Design a Distributed Lock and Coordination Service Like Chubby
Last updated: November 29, 2026
Quick Overview
Design a highly available coordination service that offers locks, leader election, and small configuration files to thousands of internal Google services.
0
0
0 solved
Design a highly available coordination service that offers locks, leader election, and small configuration files to thousands of internal Google services.
Coordination services sit under many Google systems, and this question checks understanding of consensus, leases, and the subtle problem of clients acting on expired locks. It is a favorite for senior candidates.
What the Interviewer Expects
- Uses a consensus protocol for a replicated state machine
- Explains sessions, leases, and keepalives
- Introduces fencing tokens for safety
- Designs client caching with invalidation
- Plans for scale via proxies and read patterns
Key Topics to Cover
How to Approach This
- Start by clarifying functional and non-functional requirements with the interviewer.
- Estimate the scale: QPS, storage, bandwidth. This drives your design decisions.
- Draw a high-level architecture first, then deep dive into 1-2 critical components.
- Discuss trade-offs explicitly (e.g., consistency vs availability, SQL vs NoSQL).
- Address failure scenarios, monitoring, and how the system handles 10x traffic spikes.
Possible Follow-up Questions
- What happens if a client pauses for 30 seconds while holding a lock?
- How does a new master avoid violating existing leases?
- Why offer coarse-grained locks instead of fine-grained ones?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice System Design ProblemsSample Answer
Requirements
Functional: a small hierarchical namespace of files; acquire and release exclusive or shared locks on files; watch for changes; sessions that release locks when a client dies; leader election via ...
High-Level Design
- A cell of five replicas runs a consensus protocol (Paxos or Raft) to replicate a log of operations; one replica is master and serves all reads and writes.
- Clients open a session with the...