</> 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: Pulling on Every Thread - Interviewer Deep-Dive Challenges

Executive Summary: With both deep dives done, the interviewer stops asking how the design works and starts asking what breaks it. This section runs eight escalations: the sale-day hot product, the "textbook" Count-Min Sketch, arbitrary windows, real-time ranks, a 20-minute consumer lag, two products both showing #13, a mid-hour recategorization, and per-city lists. Each is laid out as the challenge, what the interviewer is really testing, a model answer built from the numbers ledger, and the senior line to close on. The common lesson: every earlier decision came with a number and a flip trigger, and an escalation checks whether you remember both.

Each question invites you to tear something down; the best answers rarely do. They size the threat, name the decision that covers it, and say where it would flip.

Eight interviewer challenges mapped to the four decisions that answer them: exact productId partitioning, fixed 1h/4h/24h windows, the hourly rank path, and event time with a last good list

Challenge 1: The Sale-Day Hot Partition

"Sale day. The Nova X5 is 40% of all your events. You keyed by productId, so one partition is on fire. Now what?"

What they're really asking: Do you know a partition's limits, and can you handle skew without breaking the exact merge?

The model answer: Size the claim first. The Nova X5 sells 1M units in 10 minutes: 1,667 events/s, about 333 KB/s on one partition, roughly 11% of the 15,000/s design peak. Even granting 40%:

40% of 15,000 events/s  = 6,000 events/s on one partition
6,000 × 200 B           = 1.2 MB/s
Work per event          = dedup check + buyer-cap check + one map increment

One partition and one Flink subtask handle that easily. Keying by productId only becomes a problem when one product goes well past 50k events/s. Then I'd salt the key and aggregate in two stages:

Salting hot product P-10001 across 16 Kafka partitions by buyer hash, pre-aggregating per-minute partial sums in stage 1, then re-keying by productId into a stage 2 minute bucket that feeds the 1h, 4h and 24h window counters

The salt goes on the Kafka key at the outbox router, for products on a hot list only, so the load spreads across 16 partitions before anything reads it. Stage 1 pre-aggregates per (product, salt, minute); stage 2 is a keyBy on productId. It stays exact because stage 2 sums per-minute aggregates, and addition doesn't care how the work was split. The detail people miss is salting on the buyer hash rather than at random: a buyer's confirmation and cancellation land in the same shard, so the 5-unit cap and the (orderId, lineId, eventType) dedup stay local.

The senior line: "Hot keys are a throughput problem, not a correctness problem. I salt only when the numbers say so, and in a way that keeps the cap and dedup local."

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.