Layer 3 · Go deeper · 11 min
Go deeper
Size it, build it, then make the calls an interviewer will push you on.
Back of the envelope
Size it up
Tap through each step of the arithmetic.
How many likes, matches and match notifications a day?
How hard do decks hit the search cluster at peak?
How many WebSockets, and gateway nodes, at the peak?
Build-up · 5 steps
Build the high-level design
One functional requirement at a time, ending with an app that works for one city, with no sharding and no cleverness.
Step 1 of 5
Create a profile
Profile fields go to a key-value database partitioned by user ID, because every read is “give me user X”. Photo bytes skip the servers: a signed URL up to object storage, a CDN down.
6 interview moments
You’re the candidate
The interviewer pushes on the hard parts. Pick an approach and see how it holds up.
Deep dive 1 of 6
Interviewer
“Asha wants people within 25 km of Andheri. How do you index locations so “near me” is fast?”
Your move. Pick an approach:
Deep dive 2 of 6
Interviewer
“One Elasticsearch index with the default five shards serves the world, and CPU stays high. How do you split it by geography?”
Load tests showed performance improving roughly linearly as the index shrank.
Your move. Pick an approach:
Deep dive 3 of 6
Interviewer
“A fetch must return 25 good cards in under 200 ms at p99. How do you serve the deck?”
Each card needs a geo query, two-way preference checks, a seen-set check and a ranking model.
Your move. Pick an approach:
Deep dive 4 of 6
Interviewer
“An active user has 10,000 swipes behind them. How does the deck builder skip everyone they’ve already seen?”
Your move. Pick an approach:
Deep dive 5 of 6
Interviewer
“21k likes a second at peak, and two people can like each other in the same instant. How do you detect a match?”
Your move. Pick an approach:
Deep dive 6 of 6
Interviewer
“Asha hears about the match in her swipe response. How does Rohan hear within 2 seconds, with 10M apps open?”
Your move. Pick an approach:
Build-up · 8 steps
Follow Asha and Rohan through it
The request path is short: a service and one in-memory or single-row store. Indexing, geosharded search, ranking and notifications all run in the background.
Step 1 of 8
Profile and location
Edits and location changes go through the gateway to the profile service and the profile database, the source of truth. Photos go straight from the phone to object storage.