Alex Xu V2 - 1 Proximity Service


It’s like Yelp / Google Maps

Clarify questions


Back of Envelope Estimations for 100M Daily Users and 200M Businesses

Obvious heavy read application with low writes We’ll have an API that has a GET for search/nearby And API that handles CRUD for add,update,delete businesses GET -> /v1/business POST -> /v1/business PUT -> /v1/business

How do we split the earth to get all of these businsesses

Step 3 - Deep Dive

Scale the DB


But how does it handle adding, removing, and updating nodes?

Geohashing vs Quadtree

Geohashing is easy to update and easy to implement

Quadtree requires traversing tree to delete nodes

Google S2

Google S2 Geometry Library is also used in apps like Google Maps / Tinder In-Memory solution Maps a sphere to a 1D index on the “Hilbert curve”

![[Pasted image 20240503110054.png]] Because it approximately maps phyiscal locations, can be used ot make geofences

Xu’s Recommendation

He recommends to talk about Geohash or Quadtree in interview S2 is too complicated to explain clearly in interview

Deep Dive

How to Scale the Database



Region and Availability Zones

Followup -> How to filter by time

Can filter post because we’ll only have like 100 businesses that we show near them

![[Pasted image 20240503123227.png]]