Part 2 of 8 · 2 min read
Scope and numbers
Places within a radius.
Think of a pin map on a wall. To find the cafés near a spot, you do not read every pin. You look at the part of the wall around the spot. The design question is how to make a computer look at only that part.
A proximity service finds places, such as restaurants, shops or gas stations, near a given point. It is an example of a location-based service (LBS).
Questions and the answers assumed here (from the book's sample talk).
- Does the user pick the radius? Yes, from 0.5, 1, 2, 5 or 20 km.
- Maximum radius? 20 km.
- What if there are too few results? Only places within the radius count for now. Widening the search is a follow-up.
- How do business owners change data? They add, delete or edit, and changes can take effect the next day.
- Must the page refresh as the user moves? No, movement is slow.
Features. Return places for a position and radius. Let owners add, edit or delete a place. Let customers view the details of a place.
Requirements.
- R1. Low latency.
- R2. Location is sensitive data, so privacy laws such as GDPR apply.
- R3. High availability and scale, especially at meal times in dense areas.
Numbers. Take 100 million daily active users who each search 5 times a day. That is 500,000,000 searches a day. At 86,400 seconds a day, this is about 5,800 searches per second. The book rounds a day to 100,000 seconds and gets 5,000. The write side is small, because places change rarely. The system is read-heavy.
Location-based service (LBS)
A location-based service uses the position of a user or object to decide what to return.
Example: "cafés within 1 km of me" is an LBS query.
Check yourself: 1. Why is the system read-heavy? 2. Why is location data sensitive? 3. Why does the book round a day to 100,000 seconds?