Skip to main content

Distributed Systems Mock Interview

1. Executive Summary​

The distributed systems mock interview simulates principal-level technical depth probes: consistency models, consensus, replication, partitioning, failure detection, and operational recovery. Unlike broad system design mocks, this format emphasizes mechanism correctness, safety and liveness properties, and partition behavior—skills tested heavily at Google, Amazon AWS, Snowflake, NVIDIA, and OpenAI infrastructure loops.

This chapter provides six full mock sessions with prompts, interviewer scripts, timing, expected signals, follow-up chains, scoring rubrics, and an 8-week preparation strategy tied to curriculum chapters.

2. Why This Topic Matters​

Principal architects must reason about partial failure as the norm (Partial Failure). Panels ask:

  • "What happens during a network partition?"
  • "Is this linearizable?"
  • "How do you detect a failed leader without split brain?"

Candidates who only know system design boxes fail distributed depth rounds. Dedicated mocks build muscle memory for formal guarantees vs. implementation choices.

3. Problems Being Solved​

GapMock session fixes
Confusing CAP slogan with designPACELC applied per prompt
Hand-waving consensusRaft/Paxos steps verbalized
Ignoring livenessLeader election timeouts discussed
No ops storyFailure detection, metrics, runbooks
Weak comparisonAlternatives table under pressure

4. Assumptions and System Model​

AssumptionImplication
Asynchronous networkMessages delay/lose; no sync link
Crash-stop faultsUnless Byzantine specified
Clock skewNo perfect global clock without hardware assist
60-minute sessionOne major topic + follow-ups
Whiteboard or virtual boardDiagrams required

Link: Distributed System Models.

5. Essential Terminology​

TermDefinition
SafetyNothing bad happens (e.g., no split brain writes)
LivenessSomething good eventually happens (e.g., election completes)
LinearizabilityStrongest single-object consistency
QuorumMinimum replicas for read/write
Fencing tokenMonotonic token preventing stale primary writes
Leader electionChoosing coordinator replica
HeartbeatsPeriodic signals for failure detection
Split brainTwo leaders believing both are primary

6. Core Mechanism​

6.1 Mock session structure​

PhaseMinutesActivity
Warm-up5Definitions check (interviewer picks 2 terms)
Main prompt35Candidate explains design/mechanism
Failure injection15Interviewer adds partition, crash, delay
Ops & wrap5Monitoring, rollout

6.2 Interviewer failure injection menu​

  • Kill leader mid-transaction.
  • Delay heartbeat messages (not loss).
  • Partition minority quorum.
  • Slow client with retries storm.
  • Clock skew on lease expiry.

Score using Mock Interview Rubric distributed systems section.

7. Step-by-Step Walkthrough​

Mock Session A: Leader election and split-brain prevention​

Prompt: "You have a primary-secondary database failover system using heartbeats. Design failover to avoid split brain."

Strong path:

  1. Define failure detection timeout > heartbeat interval.
  2. Require quorum or fencing token before promoting secondary.
  3. STONITH or revoke old primary's write access via coordinator (Fencing Tokens).
  4. Discuss safety (no dual writes) vs. liveness (availability during partition).

Follow-ups:

  • What if heartbeat link false-positive?
  • Manual failover override risks?

Rubric target: Consistency model 4, Failure 4, Mechanism 3+.


Mock Session B: Dynamo-style quorum reads/writes​

Prompt: "Explain read repair and sloppy quorum in a partitioned key-value store."

Strong path:

  • N, R, W parameters; R+W>N for strong read-your-writes variant.
  • Read repair on digest mismatch.
  • Sloppy quorum with hinted handoff—availability tradeoff.
  • Cite Amazon Dynamo; distinguish paper from DynamoDB product.

Follow-ups:

  • Merkle tree anti-entropy when?
  • Hot key impact on quorum latency?

Mock Session C: Raft leader election (verbal)​

Prompt: "Walk through Raft leader election after leader crash."

Strong path:

  • Terms, randomized election timeout, RequestVote RPC.
  • Log matching property (high level).
  • Safety: at most one leader per term (under async model assumptions).

Link: Raft.

Follow-ups:

  • Network partition with two candidates?
  • Joint consensus for membership change?

Mock Session D: Distributed transaction across two services​

Prompt: "Service A and B must commit together or not at all. Options?"

Strong path:


Mock Session E: Exactly-once processing myth​

Prompt: "Can you implement exactly-once message processing?"

Strong path:

  • End-to-end idempotency + dedup store + transactional offset commit.
  • Kafka semantics: at-least-once + idempotent consumer = effective exactly-once in scope.
  • Distinguish guarantee from marketing term.

Link: Message Delivery Semantics, Idempotency.


Mock Session F: Global clock and ordering​

Prompt: "How does Spanner achieve external consistency?"

Strong path:

  • TrueTime uncertainty interval; commit wait.
  • Contrast with Lamport Clocks logical ordering.
  • Do not claim all databases have TrueTime.

Link: Google Spanner.

8. Invariants and Guarantees​

Interviewers expect explicit classification:

PropertyExample question
SafetyCan two leaders serve writes?
LivenessWill election complete?
ConsistencyWhat can stale reader see?
DurabilityAcknowledged write after crash?

Separate formal guarantee from implementation choice per technical accuracy standards.

9. Failure Scenarios​

Practice verbal analysis for:

ScenarioKey mechanism
Split brainQuorum, fencing
Lost ackClient retry idempotency
GC pauseFalse failure detection
Cascading retryJitter, budgets
Byzantine nodeUsually out of scope unless stated

10. Performance Characteristics​

Discuss latency vs. consistency:

  • Strong quorum reads add RTT.
  • Leader-based writes serialize through coordinator.
  • Geo-distributed quorum crosses WAN.

Back-of-envelope: 3 replicas, 2ms LAN RTT → quorum read ~4ms minimum (simplified).

11. Scalability Limits​

  • Single leader throughput ceiling.
  • Coordination service (ZooKeeper/etcd) write scalability (etcd).
  • Vector clock size with replica count.

12. Operational Considerations​

Every mock should close with:

  • Metrics: election frequency, replication lag, unavailable quorum events.
  • Alerts: split brain detection, lag threshold.
  • Runbooks: forced failover, rebuild replica.
  • Game days: inject partition in staging.

Link: Chaos Engineering.

13. Security Considerations​

  • TLS between replicas; mTLS identity.
  • Prevent unauthenticated node join to quorum.
  • Audit leader promotion events.

14. Cost Considerations​

  • Cross-AZ replication bandwidth.
  • Over-provisioned replicas for read scale.
  • Coordination cluster HA cost.

15. Production Implementations​

Reference public systems for comparison (not internals):

  • etcd/ZooKeeper — coordination.
  • Cassandra/Dynamo — quorum AP.
  • Spanner — CP with TrueTime.
  • Kafka — log replication, ISR.

Curriculum chapters per system in Distributed Databases.

16. Alternatives and Tradeoffs​

NeedLean CPLean AP
Financial ledgerSpanner, etcdNot naive eventual
Social likes—Eventual + CRDT
Config serviceConsensus store—
Shopping cartSession + mergeEventual with rules

Link: CAP Theorem, PACELC.

17. Common Misconceptions​

  • "CAP means pick two forever" — PACELC extends for latency.
  • "Raft solves all distributed problems" — It's replicated log, not magic transaction layer.
  • "Heartbeats are enough" — Need quorum/fencing for safety.
  • "Linearizable everywhere" — Often too expensive globally.

18. Principal Architect Perspective​

Principal answers connect algorithm to org:

  • "We chose saga because 2PC ops burden exceeded team maturity."
  • "We invested in formal verification of failover playbook."
  • "We documented accepted inconsistency in read model with product sign-off."

Link: Architecture Decision Records.

19. Architecture Review Exercise​

Given: active-active MySQL in two regions with async replication and DNS failover. List safety violations and redesign one region active-passive with explicit RPO.

20. Whiteboard Explanation​

Draw Raft election timeline: follower timeout → candidate → majority votes → leader append entries. Mark safety invariant.

21. Interview Questions​

Q1: What happens to an in-flight write when leader dies before replication?​

Expected signals: Client timeout; retry idempotency; uncommitted loss unless sync replicate ack policy.

Follow-ups: Durability vs. latency tradeoff?

Scoring rubric:

LevelCriteria
ExcellentReplication state machine, client behavior, ops
GoodUncommitted may lose
Adequate"It fails"
WeakSilent data loss claim without mechanism

Q2: Compare etcd and application-level leader election​

Expected signals: etcd gives proven consensus; app election risks bugs; coordination service as dependency.


Q3: Design idempotent consumer for payment events​

Expected signals: Dedup key store; exactly-once within consumer boundary; link to sagas.


Q4: Network partition — can system remain available and consistent?​

Expected signals: CAP/PACELC; choose; explicit sacrifice.


Q5: How detect silent replica lag?​

Expected signals: Heartbeat + lag metric; read from leader for critical reads; automatic demotion.

22. Interview Follow-Ups​

Interviewer escalation path:

  1. Mechanism correct?
  2. Failure injected?
  3. Ops metrics?
  4. Alternative rejected why?
  5. Business impact of chosen consistency?

23. Strong Answer Example (quorum excerpt)​

"With N=3, W=2, R=2, a write is durable if two replicas acknowledge before client success. During partition isolating one replica, we can still commit if the majority side has two nodes. Reads from minority may be stale—clients needing read-your-writes must contact coordinator or use session tokens tracking write replica. If R+W≤N, we risk reading pre-write value without repair; I'd use read repair on mismatch detection during quorum read."

24. Weak Answer Example​

"We use a load balancer and three databases; if one fails it fails over automatically."

No quorum, no split-brain analysis.

25. Hands-On Exercise​

  1. Pick Mock Session A–F; set 60-min timer.
  2. Record whiteboard explanation.
  3. Score with distributed rubric.
  4. Re-study weakest chapter (Consensus hub).
  5. Repeat session in 5 days.

26. Knowledge Check​

  1. State safety and liveness for leader election.
  2. When does R+W>N matter?
  3. What problem do fencing tokens solve?
  4. Difference between at-least-once and effectively-once?
  5. Why is commit wait needed in Spanner-style designs?

27. Flashcards​

FrontBack
Split brain preventionQuorum + fencing
Raft safetyOne leader per term
Read repairFix stale during read
Saga vs 2PCLiveness vs simplicity tradeoff
Idempotency keyDedup client retries

28. Cheat Sheet​

  • Classify safety vs liveness first.
  • Draw timeline for failures.
  • Cite N, R, W or Raft terms.
  • Close with metrics + runbook.
  • Use Mock Interview Rubric.

Mock Session G: Kafka consumer lag storm​

Prompt: "Consumer group lag growing 1M messages/hour. Diagnose and architect fixes."

Strong path:

  • Partition count vs consumer count.
  • Slow handler profiling.
  • Backpressure to producers if needed.
  • DLQ for poison messages.
  • Rebalance storm detection.

Link: Kafka Architecture.


Mock Session H: Linearizability litmus test​

Prompt: "Is this register linearizable?" — interviewer draws concurrent operations timeline.

Strong path:

  • Draw history; check for real-time order violation.
  • Distinguish sequential consistency vs linearizability.

Link: Linearizability.

Timed Drill Cards​

Print or flashcard these 5-minute drills:

CardTask
1Explain 2PC failure modes aloud
2Draw Raft election
3Compute quorum for N=5, W=3, R=3
4List saga compensations for order flow
5Explain fencing token scenario

Company Overlay Sessions​

After completing Sessions A–H, add one company-specific distributed probe:

CompanyExtra probe
AmazonDynamo quorum + anti-entropy
GoogleSpanner commit wait
SnowflakeMetadata service HA
NVIDIANCCL collective failure
OpenAIInference request timeout cascade

Link: Company-Specific Preparation.

Safety and Liveness Quick Reference Card​

SystemSafety propertyLiveness risk
Leader election≤1 leader per termSplit vote delay
2PCAtomic commitCoordinator blocking
Raft logLog matchingElection timeout
Quorum KVNo stale write ackUnavailable minority
SagaCompensating consistencyPartial completion visible

Memorize for rapid interview classification.

Mock Facilitator Guide​

If you are the interviewer:

  1. Do not help too early—wait 2 minutes of silence before hint.
  2. Hints escalate: clarify requirement → suggest dimension → partial answer.
  3. Record which hints were needed—counts against depth score.
  4. End with written scores within 5 minutes while memory fresh.

Appendix: Full Mock Session I (Read Path)​

Prompt: "Design a distributed configuration service like etcd-lite."

45-minute candidate path:

  1. Clarify: strong consistency required; watch API; max 10K keys; 1 KB values; 1K QPS reads, 100 writes.
  2. Single Raft cluster per environment; linearizable reads from leader or quorum reads with tradeoff explanation.
  3. Watch long-poll or gRPC stream for changes.
  4. Failure: leader dies—election in <5s; clients retry with backoff.
  5. Ops: metrics on proposal latency, election count, fsync duration.

Scoring expectation: Mechanism 4 if Raft articulated; Failure 3+ if election covered.

Appendix: Full Mock Session J (Write Path)​

Prompt: "Implement distributed lock for cron leader election."

Compare etcd lease lock vs database advisory lock vs Redis Redlock (and known Redlock controversies—cite Martin Kleppmann critique conceptually). Principal answer: prefer consensus-backed lease with fencing token for writers touching external systems.

Link: Distributed Leases, Fencing Tokens.

Appendix: PACELC verbal drill​

For each system below, state PACELC classification aloud in 30 seconds:

  1. Cassandra write path
  2. etcd key-value
  3. Redis primary-replica async
  4. Spanner global row
  5. Kafka consumer lag commit

Answer key in PACELC chapter—self-check after drill.

Interview + Game Day readiness​

Score mocks against Production LLD and Game Day Standard—LLD depth and game-day verbal are explicit rubric dimensions. Targets the Production LLD and Game Day Standard at interview depth—connect leadership and prep chapters to production reasoning and tabletop game days.

Game Day tabletop drills​

DrillInjectDetectMitigateVerify
GD-MK-1Mid-mock failure injectCandidate SLI answerMitigate + verifyResilience score ≥4/5
GD-MK-2Omit observabilityInterviewer redirectsGolden signals addedOps score improves

30. References​

  • Kleppmann, Designing Data-Intensive Applications.
  • Ongaro & Ousterhout, "In Search of an Understandable Consensus Algorithm" (Raft).
  • Gilbert & Lynch, CAP paper.
  • Corbett et al., Spanner paper (OSDI 2012).
  • DeCandia et al., Dynamo paper (SOSP 2007).

Preparation Strategy (8 Weeks)​

WeekStudyMock
1Partial Failure, Safety and LivenessSession E
2CAP, PACELCSession B
3Raft, Leader ElectionSession C
4Fencing Tokens, Distributed LeasesSession A
5Sagas, 2PCSession D
6Kafka ArchitectureSession E repeat
7SpannerSession F
8Full distributed + system design combo mockBoth rubrics

Daily (45 min): one flashcard deck + one 10-min whiteboard mechanism from memory.

Pair with System Design Mock for full loops.

Diagram​

Figure: Distributed systems mock interview depth progression.