System design interview questionHardBasic System Component

Design a Distributed Lock Service

Design a distributed lock: many app servers coordinate so only one holder runs a critical section at a time.

Interview scope

Client → LB/Gateway → App → Cache (and/or DB) for lock state. No Client → Cache/DB.

Functional requirements

  • Acquire a lock by name/key.
  • Release a lock when done.
  • Expire locks if a holder dies (high level).

Scale and quality goals

  • Acquire/release must be fast.
  • Lock state must be shared across app instances — not only local memory.
  • Avoid Client talking directly to the lock store.

Capacity assumption

Design for this scale

Assume ~20M lock operations/day (~230 RPS average) across many app servers.

Practice more than a diagram

Place components on the Froquiz canvas, connect the data flow, and see which decisions the scenario-specific review finds missing. The full exercise and review unlock with Premium.

Explore Premium