Distributed locking
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 · 7 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 operations a second can one lock key handle?

      How long can a Redlock holder trust a 10-second lock?

        How long a GC pause beats Redisson’s lock watchdog?

          Build-up · 6 steps

          Watch a fencing token stop a stale write

          One lock with a 30-second lease, two clients and a 36-second GC pause. First the failure, then the check that stops it.

          Step 1 of 6

          Client 1 takes the lease

          The lock service grants a 30-second lease with fencing token 33, larger than any token before it. Client 1 reads the file, v1, planning to change it and write it back.

          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

            “Six replicas each fire the nightly report at 02:00, and only one should run it. Which lock do you reach for?”

            Your move. Pick an approach:

          2. Deep dive 2 of 4

            Interviewer

            “A leader-only compaction job commits output to external storage. A GC pause could outlast its lease. How do you stop a stale commit?”

            Your move. Pick an approach:

          3. Deep dive 3 of 4

            Interviewer

            “Tatkal booking opens and many users race for the same berth. The seats table lives in Postgres. How do you hold a seat?”

            Your move. Pick an approach:

          4. Deep dive 4 of 4

            Interviewer

            “Your leader-only job calls a third-party payment API that can’t check fencing tokens. How do you make a paused ex-leader’s call safe?”

            Your move. Pick an approach: