Distributed systems interview questions
CAP and consistency models, replication, quorums, consensus, partitioning, clocks, retries, timeouts, sagas and the outbox pattern.
– interview-ready · 18 questions in this topic
– of 18 tried
Saved on this device. Interview-ready means you got it right on two different days. Guesses and hints count for less.
Questions
- What CAP actually saysPick the fix
- Consistency models from strong to eventualPick the fix
- Leader-follower replication and lagOrder the steps
- Quorum reads and writesPredict
- Consensus and RaftPredict
- Leader election, leases and fencing tokensSpot the bug
- Locks in Redis: when they're safePick the fix
- Consistent hashingPredict
- Sharding: range, hash and directoryPick the fix
- Retries with exponential backoff and jitterPredict · timeline
- Timeouts and deadline propagationPredict
- Circuit breakers and bulkheadsPredict
- At-most-once, at-least-once and 'exactly once'Spot the bug
- The transactional outbox patternPick the fix
- Sagas: orchestration vs choreographyPredict
- CQRS and read modelsPick the fix
- Clocks, timestamps and ordering eventsPredict
- Detecting failures and avoiding split brainPick the fix
Practise this topic
Flashcards · 24
Flip, then say if you knew it. Needs JavaScript; every answer is also on its question page.
Quick quiz · 18 questions
One exercise per question, checked as you go. Needs JavaScript.
Mock interview · 3 sets
Timed, out loud, then tick what you covered. Needs JavaScript.
Fix this PR · 2 reviews
Review a diff like a senior: flag the lines you'd comment on. Needs JavaScript.
Quick facts
Recall the answer first, then tap Show to check.
Majority sizes
A cluster of 2f + 1 nodes keeps a majority through f failures: 3 tolerate 1, 5 tolerate 2.
Modulo resharding
In our 1,000-key simulation, going from 4 to 5 nodes moved 807 keys with modulo hashing and 176 with a 100-vnode ring.
Monotonic time
Measure durations with time.monotonic() in Python; time.time() can jump when the clock is corrected.
PACELC
If Partitioned, choose Availability or Consistency; Else, choose Latency or Consistency.
Kafka exactly-once
Covers consume-transform-produce inside Kafka; effects outside Kafka still need idempotency.
Fencing token
A number that increases with every lock grant; storage rejects writes with an older number.
Printable cheat sheet · Review your weak spots in this topic
Share your progress
Sources: Topic outline informed by System Design Primer by Donne Martin and the Zalando RESTful API Guidelines, both licensed under CC BY 4.0. Every question and answer is written by Best Latest Apps. Credits and license