</> 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 9: The Gauntlet - Interviewer Deep-Dive Challenges

Executive Summary: Here the interviewer stops following your design and starts pushing on it: replace the log with Redis Pub/Sub, a viewer on weak 3G, a broadcaster who wants every comment, a 10× goal spike, a viewer posting from another continent, and a demand for exactly-once delivery. Each gets what's really being tested, a model answer with a number and a flip trigger, and one sentence worth saying out loud.

The fan-out tree is on the whiteboard and Maya's comment has made it from São Paulo to Tomás's screen in Lisbon in about 435 ms. The interviewer caps the marker. "Okay. Let me poke at it." Each question has a confident cheap answer and one with a number attached. Give the second.

Challenge One: "Why Not Just Redis Pub/Sub?"

"All this log and router machinery. Redis Pub/Sub does fan-out in one line. Why not use it?"

What they're really asking: do you know what the Comment Log buys you, or did you draw Kafka out of habit?

Pub/Sub is fire-and-forget: a message published while a subscriber is away is gone, and a subscriber that falls behind is cut off. The spine needs three things it can't give. The 201 must be durable (here, an append with acks=all, RF 3, min ISR 2; on Pub/Sub, a promise nothing backs). A crashed Channel Router's successor must resume from the last committed offset. And the Store Writer must be able to lag: 3-day retention (~6.5 TB) absorbs a store outage, where Pub/Sub would lose the comment.

The obvious patch, "write to the database, then publish", is a dual write. Crash between the steps and you lose one of the two. Redis is fine as a building block inside a region, where a lost message is a gap the Gateway detects by offset and refills from the log, but not as the system of record. Flip trigger: if the end-to-end SLO tightened below ~100 ms, I'd put in-memory pub/sub on the hot path and demote the log to asynchronous durability.

The senior line: "Redis Pub/Sub is a fine loudspeaker and a terrible ledger. The log is the ledger, and everything downstream can replay from it."

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.