Distributed caching
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 · 9 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 many shards does a dinner-peak menu cache need?

      What happens to the database when you add a 21st cache node?

        How hard does one dead node hit the database?

          How long does Redis Cluster take to fill a new 21st node?

            Build-up · 5 steps

            Route, redirect and move a key

            How Redis Cluster finds the owner of menu:7781, recovers from a stale map, moves a slot and copies writes.

            Step 1 of 5

            Key to slot

            Every key maps to one of 16,384 slots, CRC16(key) mod 16384. menu:7781 lands in slot 14816, and clients cache the slot map.

            4 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 4

              Interviewer

              “Dozens of services in four languages share one memcached fleet. How should they find the node that owns a key?”

              Your move. Pick an approach:

            2. Deep dive 2 of 4

              Interviewer

              “One of 20 cache nodes dies at dinner peak, and the database handles 100,000 reads a second. What absorbs that node’s traffic?”

              Your move. Pick an approach:

            3. Deep dive 3 of 4

              Interviewer

              “Your Redis now holds sessions and rate-limit counters, not just cached rows. Is asynchronous replication still fine?”

              Your move. Pick an approach:

            4. Deep dive 4 of 4

              Interviewer

              “To use multi-key commands in Redis Cluster, a teammate tags every key by city, like {mumbai}. What do you say?”

              Your move. Pick an approach: