Key-value store
0-day streakReview

Your progress

Level 1

0 XP100 XP to level 2
0day streak
0best streak
0topics started
0cards reviewed
    Review cards

    Progress is stored only in this browser. No account is required.

    Layer 3 · Go deeper · 11 min

    Go deeper

    Size it, build it, then make the calls an interviewer will push you on.

    Back of the envelope

    Size it up

    Tap through each step of the arithmetic.

    How much disk does 100 TB of data really take?

      How many nodes do you need if a whole zone can fail?

        How hard does compaction work each node’s disk at peak?

          A node restarts for 10 minutes. How many hints pile up?

            Build-up · 5 steps

            Build the high-level design

            One functional requirement at a time, ending with a store that works in one region at moderate load.

            Step 1 of 5

            Put, get and delete by key

            Hash the key onto a ring and walk clockwise to three distinct machines in three zones. The client caches that map, so the request reaches B, the coordinator, in one hop.

            6 interview moments

            You’re the candidate

            The interviewer pushes on the hard parts. Pick an approach and see how it holds up.

            1. Deep dive 1 of 6

              Interviewer

              “Mid-sale, you must add node 121 to a 120-node store holding 345 TB on disk. How do you spread keys so that’s cheap?”

              Your move. Pick an approach:

            2. Deep dive 2 of 6

              Interviewer

              “Carts must stay writable with a replica down, and reads should see the last write. With N = 3, which R and W?”

              Your move. Pick an approach:

            3. Deep dive 3 of 6

              Interviewer

              “Your phone and laptop edit the same cart at once, through different coordinators. Whose edit survives?”

              Your move. Pick an approach:

            4. Deep dive 4 of 6

              Interviewer

              “Replica C goes down for a 10-minute restart at peak, and writes for its partitions keep arriving. What do you do?”

              Your move. Pick an approach:

            5. Deep dive 5 of 6

              Interviewer

              “Each node takes 7,500 replica writes and about 16,700 reads a second over 1.25 billion keys. How does it store them?”

              Your move. Pick an approach:

            6. Deep dive 6 of 6

              Interviewer

              “Mid-sale, node 121 must take about 2.9 TB without quorums ever ceasing to overlap. How do you bring it in?”

              Your move. Pick an approach:

            Build-up · 8 steps

            Follow one cart update through it

            Steps 1 to 4 are the only ones on the request path. Hints, gossip, repair and streaming run in the background on budgets.

            Step 1 of 8

            Route

            The client library hashes carts/user:98231 and finds its replicas in a cached partition map, refreshed every 10 seconds and on redirects. B is in zone a, D in zone b, C in zone c.