Section 10: The Gauntlet - Interviewer Deep-Dive Challenges
Executive Summary: The design is on the board: one cached page for everyone, a sharded Postgres where a whole question lives together, a vote transaction that counts each person once, and search fed from the outbox. Now the interviewer tries to break it. Seven challenges follow, and none of them adds a new core box. Each one gets the probe, what it really tests, a model answer with numbers from the ledger, and the senior line. Most answers point back at a decision already made.
Challenge 1: The Viral Question
"A newsletter links Priya's question. One million views in an hour. What happens to your origin?"
What they're really asking: does your cache survive a hot key while the page is still changing?
Model answer: One million views in an hour is ≈280/s on one URL. With s-maxage=60 and an origin shield, the origin renders it about once a minute. The hard part is that comments keep arriving, and each one purges the page. Section 7's coalescing caps that at one purge per question per 5 s, so at most 12 extra renders a minute. Each is a soft purge: stale copies keep serving, the shield collapses misses into one origin request, and the bundle lock lets one pod rebuild. Worst case, about 13 renders a minute against 16,800 with no caches.
The votes don't move the page at all. Daniel's answer takes ≈5.6 votes/s, one row lock each, against a buffered-counter flip at 500/s, and votes never purge.
The senior line: "A viral page is the cheapest page on the site. The danger is purges, so I cap purges, not readers."
Sign in to continue reading
The rest of this lesson is available with a free account. Signing in with Google or Microsoft is free.
Sign in to read the full lesson