Code Room
System designHardsd-g400
Subject GeofencingLevel Senior–Staff~50 minCommon in Databases & SQL interviewsIndustries Technology

Question

Design a geofence breach-detection service for 10 million devices, each reporting location every few seconds, evaluated against up to 50 million user-defined geofences (circles and polygons) that can be created or deleted at any time. When a device crosses into or out of any fence it subscribes to, you must fire an enter/exit event within ~5 seconds, exactly once per real crossing — no duplicate alerts on jittery GPS. Describe the spatial indexing, how you evaluate a location against only the relevant fences, debouncing, and exactly-once event semantics.

What a strong answer looks like

Clarify scale and constraints first. Propose a clean component breakdown, then go deep on the hard parts — data model, bottlenecks, consistency, failure modes — and name the trade-offs you are making.

Narrate your design
Loading whiteboard…
Run or narrate your approach, then ask the coach.