Skip to content

Proximity Service — Notes#

Functional#

  • Nearby query: list places within radius / k-NN of point.
  • Bounding box query.
  • Optional autocomplete with location bias.

Non-functional#

  • p99 < 200 ms.
  • Read-heavy.
  • 99.99% availability.

Capacity#

  • 100M+ POIs globally.
  • Millions of queries/s peak.

Schema#

  • places(id, name, lat, lng, cell_id_S2, category)
  • cell_index(cell_id → place_id list) materialized for fast fetch.

Trade-offs#

  • Static fence vs dynamic boundary: store cell IDs at multiple zoom levels for flexible queries.
  • Precompute hot cells (city centers) into cache for instant response.
  • Geohash vs S2 vs H3: pick one and stick; cross-system conversion is painful.

Refs#

  • "S2 Geometry Library" docs.
  • Uber H3 hex grid docs.
  • ByteByteGo "Design proximity service".
  • Alex Xu Vol 2.