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 votes a second, and how many listing updates?
How much memory do every community’s precomputed listings need?
How much does one viral match thread cost the origin?
Build-up · 6 steps
Build the high-level design
One functional requirement at a time, ending with a Reddit that works at moderate traffic before any scaling.
Step 1 of 6
Submit a post
The post service checks the community, assigns a time-ordered ID, writes the row sharded by ID and publishes post_created, so a slow consumer never slows a submission. Image bytes go straight to object storage.
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
“Every page is a sorted list, served 90k times a second. Which ranking formula do you use for hot?”
Your move. Pick an approach:
Deep dive 2 of 6
Interviewer
“At peak, 2,100 post votes a second each move a post in six listings, mostly in a few hundred communities. How do listings stay fresh?”
Your move. Pick an approach:
Deep dive 3 of 6
Interviewer
“The site takes 7,000 votes a second, and a viral post 100 of them. How do votes become scores?”
Your move. Pick an approach:
Deep dive 4 of 6
Interviewer
“A thread has comments scored 1–0, 10–1, 40–20 and 600–400. How do you sort them by best?”
Your move. Pick an approach:
Deep dive 5 of 6
Interviewer
“A user joined 50 communities, one with 40 million members. How do you build their home feed?”
Your move. Pick an approach:
Deep dive 6 of 6
Interviewer
“Last over of an IPL final: 200,000 people on one match thread, 6,700 requests a second. How do you serve it?”
Your move. Pick an approach:
Build-up · 6 steps
Follow a page view, then a vote
Reads come from precomputed, shared structures. Writes are small rows plus events, and workers derive everything sorted or counted off the request path.
Step 1 of 6
Logged-out read
The CDN serves listing and thread pages from a 5-second cache with stale-while-revalidate. A viral thread costs origin about one request per edge location per 5 seconds.