Data Consistency and Distributed Transactions Questions

Maintaining correctness of state across services and replicas: eventual consistency, conflict resolution (last-write-wins, CRDTs, vector clocks), the saga pattern, two-phase commit, and idempotency keys for exactly-once effects. Covers when to trade strict consistency for availability and how to reason about read-your-writes and monotonic guarantees. Focuses on the application/service layer rather than storage-engine internals.

HardTechnical
32 practiced

Implement a PN-Counter (Positive-Negative counter) CRDT in Python with methods: increment(amount), decrement(amount), merge(other), and value(). Provide the data structure and explain why merge is commutative, associative, and idempotent.

HardSystem Design
29 practiced

Design a multi-region user profile service that must support 100M users, 50k profile updates per second globally, and 1M reads per second. Requirements: users see their own updates immediately (read-your-writes) within a region, other users see updates eventually (within a bounded window), and 99th-percentile read latency stays low per region. Sketch the high-level architecture, replication strategy, and how you provide the read-your-writes guarantee without strong global coordination.

MediumSystem Design
35 practiced

Design a scalable approach to support atomic increments for a counter that's sharded across many keys (for example, a global 'likes' count). Compare a few approaches (per-shard counters with periodic aggregation, CRDT counters, a central counter service, optimistic CAS-based increments) on accuracy, throughput, read latency, and reconciliation cost.

HardTechnical
38 practiced

Design an algorithm to compact vector clocks or CRDT deltas in a long-running distributed system so their metadata doesn't grow unbounded, while preserving eventual convergence. What heuristics would you use, what trade-offs do they introduce in causality precision, and how would you recover or reconcile after a compaction?

HardTechnical
32 practiced

Compare implementing a global transaction coordinator using distributed consensus (Raft/Paxos) versus relying on a centralized ACID database for coordinating cross-shard transactions. Analyze latency, throughput, operational complexity, availability, and developer ergonomics, and give recommendations for systems of different scale and reliability requirements.

Unlock Full Question Bank

Get access to all Data Consistency and Distributed Transactions interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.