Scuba (Real-time Analytics)
maang.io System Design Series
Scuba is Facebook's in-memory database for real-time, ad-hoc analytics β the tool engineers reach for to debug a live incident. It holds recent data fully in RAM, sharded across many leaf servers, and answers arbitrary aggregations in sub-seconds via a scatter-gather tree, using sampling to bound cost. It trades exactness and history for speed and freshness β the opposite bargain from a warehouse.
This deep dive comes in three parts:
- Foundations & Core Concepts β in-memory columnar storage and the fresh-vs-exact trade.
- Internals β the scatter-gather aggregator tree, sampling, and sizing, with worked numbers.
- Interview β Staff/Principal Q&A: real-time analytics design and sampling trade-offs.
Scuba β Part 3: System-Design Usage & Interview Mastery
maang.io System Design Series
What is this?
You now know Scuba from the anchor's chair down to the compressed columns on a single leaf. This chapter is where that knowledge earns you the offer. An interviewer doesn't want you to recite "Scuba is in-memory and sampled" β they want to watch you reach for a real-time analytics store at the right moment, size it honestly, and defend the trade-offs when they push on exactness, history, and failure. That's the difference between a senior signal and a memorized fact.
We'll do two things: first see where a Scuba-shaped store fits in real designs (with a diagram), then run a mock interview β for each question, what they're really asking, a model answer, and the senior line that signals you've done this for real.
Keep the election-night tally room in your head the whole way: hundreds of clerks each holding a random shuffle of the ballots, a question rippling out to all of them, partial tallies flowing back up to a floor manager, and β when air-time hits β taking whatever's counted and scaling it up. Every answer below is that room.
The one-line idea: interviewers use Scuba to test whether you can match a datastore's shape to a workload's shape β ad-hoc, recent, human-speed observability β and then live honestly with the costs it buys that speed with: approximate numbers, a short window, and RAM.
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