IRInterview Ready
← System Design

Replication

Storage

Keeping copies of the same data on multiple nodes so the system survives node failure and can scale read throughput.

Replication keeps multiple copies of the same data (usually across different machines, racks, or regions) so a single node failure doesn't lose data or take down reads/writes. The dominant topology is single-leader (primary-replica): one node accepts all writes and streams a change log to one or more followers, which apply it and serve reads. Multi-leader replication lets more than one node accept writes (useful across regions/datacenters) at the cost of needing conflict resolution when two leaders accept concurrent writes to the same record. Leaderless replication (Dynamo-style: Cassandra, Riak, DynamoDB) has any node accept a write and relies on quorum reads/writes (`W + R > N`) plus read-repair/anti-entropy to converge, trading strict ordering for very high availability. Replication can be synchronous (the primary waits for the replica to ack before confirming the write — zero data loss on failover, but higher write latency) or asynchronous (the primary confirms immediately and streams to replicas after — fast writes, but a crashed primary can lose the last few unreplicated writes).

How it connects

Replication as the source, with the components it typically interacts with.

Replication is the standardSingle-leader replication n…The synchronous-vs-asynchro…In a large clusterReplicationStorageDatabase Types (SQL,NoSQL & Beyond)StorageConsensus &Replication ProtocolsReliabilityCAP Theorem & PACELCReliabilitySharding &PartitioningDistribution & Partitioning
  • Database Types (SQL, NoSQL & Beyond): Replication is the standard technique for making any database's data model durable against node failure and for scaling reads.
  • Consensus & Replication Protocols: Single-leader replication needs a consensus protocol (Raft/Paxos) to elect a new primary and keep replicas agreeing during failover.
  • CAP Theorem & PACELC: The synchronous-vs-asynchronous and leader-vs-leaderless replication choice is a concrete instance of the CAP/PACELC tradeoff space.
  • Sharding & Partitioning: In a large cluster, each shard is typically replicated independently, so replication and sharding compose rather than substitute for each other.