</> MAANG.io

Expert

Design landmark systems in depth, from Dynamo, GFS, Bigtable and Kafka to payments and ads pipelines.

0 of 232 solved 0%

Section 7: The Seventy-Two-Hour Shock Absorber - Deep Dive: Messaging Queue

Executive Summary: The front door's 202 means "durable in the queue", so the queue is where acknowledged data first lives. Each stamp runs Event Hubs Dedicated over the Kafka protocol as three priority hubs (P0 64 partitions, P1 64, P2 128), sized for 200 MB/s of compressed design ingress. Its 72-hour retention, about 8.6 TB per stamp, is the replay window. Partitions are keyed by hash(tenantId, producerId). Delivery is at-least-once: consumers checkpoint only after an idempotent downstream commit. Consumer lag is the platform's main health signal.

The interviewer taps the box between the front door and the stores. "Section 6 acked the batch here. What is this thing, really, and why is it the right thing?"

Why a Log, and Why Not a Broker Queue

Start with the job. The buffer has four. It decouples 300k req/s of producers from the health of storage. It absorbs a 3× attack-storm peak without making ADX scale in step. It fans out the same bytes to three consumer groups: the ADX writer, the lake writer and the detection hot path (detection takes only P0 and P1). And it lets any of them replay.

Interviewer: "Service Bus is also durable and also on Azure. Why not that?"
You: "Service Bus is a broker. Each message is locked, completed and then gone, which is right for commands that one worker should do once. We need the opposite: three readers each consume the stream at their own pace, and any of them can rewind to Tuesday 03:00 after a bug fix. A log does that with one stored offset per reader. Writing straight to storage fails differently: every ADX hiccup reaches the agents as a 503."

Option Replay Fan-out to 3 readers Throughput at 200 MB/s/stamp Verdict
Event Hubs Dedicated (Kafka protocol) Offset rewind within retention Consumer groups, one stored log Built for streaming at this rate Chosen
Service Bus None once completed Topic copies per subscriber Not built for streaming at this rate Rejected
Write straight to ADX and the lake n/a Producer writes twice Couples producers to storage health Rejected

Flip trigger: if someone needs replay beyond 72 hours, replay from the lake, the system of record. Don't stretch queue retention to weeks.

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.