</> 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: Six Ways to Push on a Pipeline - Interviewer Deep-Dive Challenges

Executive Summary: The design is on the board and the partner outage drained in 13 minutes. Now the interviewer pushes on it: exactly-once delivery, a broadcast once a second, a leak after unsubscribe, out-of-order events, "just use Kafka", and a crash halfway through a page. For each one you get what's really being tested, a model answer tied to the numbers ledger and the decisions behind it, and one sentence worth saying out loud.

Each challenge has a cheap answer and a priced one. Give the priced one. Here's where each answer lives:

Six interviewer challenges mapped to mechanisms: exactly-once to MessageId plus subscriber dedup (D4), an 8M-subscriber topic once a second to fan-out quota and cost-based admission (D14), messages after unsubscribe to push invalidation plus a delivery-time status check (D12), Cancelled before Placed to version in payload and FIFO topics (D3 flip), why not Kafka plus pull to log inside and push product outside (D2, D8-D10), crash mid-page to enqueue before ack with bounded duplicates (D6)

Challenge One: "Give Me Exactly-Once"

"The fraud team says duplicates cause double holds on cards. Guarantee exactly-once."

What they're really asking: do you know why it's impossible over HTTP, and where the real fix lives?

We can't know whether a third party processed a request whose response never came back. That's the two generals problem:

Sequence diagram: the Delivery Worker POSTs the notification for order 84721 (attempt 1), the fraud webhook places a card hold but its 200 OK is lost on the network, the worker hits its 5 s timeout with the outcome unknown and POSTs the same messageId (attempt 2), and the webhook recognises the messageId, skips it and returns 200 OK

Duplicates have three sources: a publisher retry, a fan-out re-expansion, and a delivery retry. We stay at-least-once (D4) and stamp the messageId in the envelope and in X-Notify-Message-Id. The fraud service records that messageId under a unique constraint in the same transaction as the card hold, so a second copy becomes a no-op. A publish-side dedup store would cost writes at 150,000/s and only remove one source of the three. The FIFO tier (Section 12) adds a 5-minute dedup window, and even that only narrows the publish side.

The senior line: "Exactly-once isn't a delivery property, it's a processing property. We deliver at least once with a stable ID, and the subscriber makes processing idempotent."

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.