Section 12: Doors Left Unlocked - Follow-up Feature Evolution
Executive Summary: Product arrives with a roadmap: reactions, paid comments, replies, live translation, viewer counts and co-hosted streams. Each one comes in through a door the design already has: the Comment Log, the Channel Router, the two lanes, the fan-out tree, or a new SSE event type. For each feature we cover what changes, the new number, the rejected alternative and the flip trigger. The recurring pattern is aggregation: a count travels up the tree and back down once per second instead of once per event.
The interviewer caps the marker. "Product loves it. Here's the roadmap: hearts, paid comments, replies, translation, a viewer count, and co-hosted streams. Which of these breaks your design?"
You: "None of them, as long as each one goes through something we already built. I'll start with the one that adds the most traffic."
Reactions: Aggregate, Never Fan Out
The tempting move is to treat a heart as a tiny comment. At one reaction per viewer per 100 s, that's 50M ÷ 100 = 500K reactions/s, ten times the 50K comments/s the Comment Log was sized for. Fanning them out is worse: the mega stream's 5M ÷ 100 = 50K reactions/s, each sent to 5M viewers, is 250 billion deliveries a second.
So reactions are counts, not events, starting on the phone. They're the one write that ends at the Gateway: Maya's client batches her taps into one POST a second carrying a count. The Gateway sums hearts per video per second, each Regional Relay sums its gateways, the Channel Router sums the relays, and once a second it emits one reactions event per video down the same tree.
For v_8812, the router reads 24 relay reports a second instead of 50K raw taps, and each viewer gets one count per second, folded into a 100 ms batch the Gateway was already sending.
Interviewer: "You'll lose hearts when a gateway dies."
You: "About a second's worth from that gateway. Reactions are at-most-once, like comments to screens. If product ever needs 'who reacted', taps go to an analytics pipeline, never the Comment Log."
Key Insight: The tree built to push comments down works just as well for pulling counts up. Before asking "how do I fan this out?", ask "can this be a count?"
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