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 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.
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:
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:
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:
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: