Design a Distributed Lock Service

Hard · System Design · about 45 minutes

Asked at Google, Databricks, Uber, MongoDB, Cloudflare, Two Sigma.

Design a coordination service like Chubby, ZooKeeper or etcd that other services use to acquire locks, elect leaders, store small configuration and watch for changes. Two clients must never both believe they hold the same lock, the service must survive the loss of a minority of its servers, and a client that crashes must release its locks automatically.

Related guides