Code Room
System designHardsd-g642
Subject Distributed lockLevel Senior–Staff~45 minCommon in Concurrency · Distributed systems interviewsIndustries Technology, Software development

Question

Your team currently uses single-instance Redis SETNX-with-TTL as a distributed lock and has hit incidents where two workers both believed they held the lock. Design a safer locking scheme for the same use case — serializing ~2k/sec short critical sections — and decide whether a quorum scheme (Redlock across 5 independent nodes) actually fixes the root cause. Constraints: low latency, tolerate single-node Redis failure, and provably prevent two simultaneous holders for the protected operation. Describe the mechanism and justify your choice.

What a strong answer looks like

Clarify scale and constraints first. Propose a clean component breakdown, then go deep on the hard parts — data model, bottlenecks, consistency, failure modes — and name the trade-offs you are making.

Narrate your design
Loading whiteboard…
Run or narrate your approach, then ask the coach.