</> MAANG.io
system design · 301

Advanced

Master system design interviews with scalable architecture patterns, distributed systems, and real-world design challenges.

0/480 solved 0% complete

Section 12: Growing Without a Rebuild - Follow-up Feature Evolution

Executive Summary: The product team asks for five things: a live "new answers" banner, Reddit-style communities, a Quora-style personalized feed, AI-assisted answers, and faster pages far from the home region. Each one lands as an addition: a new consumer on the event stream, a new column, a new page served from the origin, or a flip trigger we named earlier finally firing. Three things never move: the question page is the same HTML for everyone, a question and everything under it live on one shard, and writes go to one home region.

The interviewer leans back. "It works. Now product wants live updates, communities, a home feed, an AI answer box and a faster site in Asia. Which of these break your design?"

You: "I'd like the answer to be none. For each one I'll say what changes, what stays, and which earlier decision made it an addition."

Key Insight: The cached question page is the most valuable thing we own. It is why 85% of 10,500 page views a second never reach the origin. Any feature that needs personal or live data gets its own call or its own page next to it, and never goes into it.

Live Updates: "2 New Answers"

Priya has their question open when Daniel answers. Today they'd see it only on reload. Product wants a banner.

You: "This is a new consumer of post-events from Section 6's outbox. Open tabs hold a Server-Sent Events stream to a fleet of SSE gateways. Each gateway subscribes to a pub/sub channel per question, q:{question_id}, when its first tab for that question connects. The publisher sits behind the cache purger. It announces a change only after the page has been purged, so a click on the banner fetches a fresh page from the CDN instead of the copy it just replaced."

Live updates flow: outbox post-events (~56/s peak) go to the cache purger, then after purge (max 1 per question per 5 s) to a pub/sub channel per question, fanned out to SSE gateways A and B that push a new-answers banner to signed-in tabs; clicking reloads a fresh page from the CDN

The sizing comes from Little's law with the 120-second average dwell time. At peak, 10,500 views a second × 120 s ≈ 1.26M concurrent open pages. Signed-in viewers alone are 2,100 × 120 ≈ 252K. So launch for signed-in users first. The event rate is small: questions, answers, comments and edits peak at about 56 a second. The connection count is the real cost.

Interviewer: "Why not just poll?"

You: "Polling a tiny cacheable version endpoint every 10 seconds is honestly viable. With s-maxage=5 the edge absorbs it, so the origin sees about one request per question per 5 seconds. But 1.26M tabs is still 126,000 CDN requests a second, about twelve times our page-view peak, and it adds up to 10 seconds of latency. SSE sends a message only when something happens. I'd pick SSE over WebSockets because the stream flows one way and it's plain HTTP through our existing gateway. Cached polling is my fallback for anonymous readers."

Votes don't go on the stream, for the same reason they don't purge: 350 a second of score changes would be noise, and counts that are 60 seconds old are fine. The cached page doesn't change at all; the banner is added on top by a small script. Flip trigger: once the signed-in launch shows what a connection costs, extend to anonymous readers on hot questions. Priya's viral hour alone is 280 × 120 ≈ 33,600 open tabs, about 80% of them anonymous, like the site as a whole.

Quick check before moving on:

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

Sign in to MAANG.io

Use your Google or Microsoft account — no password to remember.

Continue with Google Continue with Microsoft

Please accept the terms above to continue.