</> 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 3: Sixty-Four Bits, Spent One Question at a Time - Scale Estimation & the Bit Budget

Executive Summary: This section turns the interviewer's numbers (20 billion IDs a day, 5 regions, a 4× peak, 10× growth) into the figures the rest of the design is judged against: about 231 K IDs per second on average, a design peak of 1 M/s, 10 M/s after growth, and 400 K/s in the largest region. Then it spends the 64 bits. Every field gets its width by answering one question: 41 bits of milliseconds last 69.7 years from a custom 2026 epoch, 3 region bits allow 8 regions, 7 worker bits allow 128 generators per region, and 12 sequence bits allow 4,096 IDs per millisecond per worker. The fleet comes to 50 nodes, the sequence space runs at 0.6 % utilization, and 64 bits instead of 128 saves 58.4 TB of primary keys a year. Finally the arithmetic finds the design's first ceiling: at 10× growth the largest region needs 160 nodes and only has 128 worker slots.

The interviewer caps the marker and slides it across. "You've said 64 bits, roughly time-ordered, 20 billion a day. Show me it fits." This is the moment a memorized Snowflake answer gives itself away. A memorized answer writes "41 / 10 / 12" because that's the famous layout. The Staff version derives each width from a requirement, says what it costs, and names the number that would change it.

Step 1: Rates, from Days to Seconds

Start with the interviewer's figure from Section 1 and divide by the seconds in a day:

Average:   20,000,000,000 ÷ 86,400 s     ≈ 231,481 IDs/s   (~231 K/s)
Peak:      × 4 peak-to-average           ≈ 925,926 IDs/s   → design for 1 M/s
Growth:    × 10                          = 10 M IDs/s peak

Regional split at today's 1 M/s peak:
  largest region   40 %  → 400 K/s
  next             25 %  → 250 K/s
  next             15 %  → 150 K/s
  two smallest     10 %  → 100 K/s each

Round 925,926 up to 1 million and say why: the peak factor is itself a guess, and a round number survives the next three steps of arithmetic without decimals.

You: "The global number is a vanity figure. Nothing in this design is global per ID; Section 2 ruled out cross-region coordination. The number that sizes hardware is the largest region: 400,000 IDs a second at peak."
Interviewer: "So you'll size five separate systems?"
You: "Five copies of one system, each sized to its own traffic. The largest one decides whether the bit layout works, so I'll keep checking against 400 K."

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.