How it works
Replication keeps extra copies of each key on other machines, so a machine failure neither loses the key nor makes it unreachable. For each key choose N distinct physical replicas, often by walking a placement ring clockwise and skipping positions that belong to a machine already chosen. A coordinator sends reads and writes to them. Distinct virtual nodes on one machine are not distinct safety copies.
A failure domain is a set of machines that can fail together: a server, a rack sharing a power feed and switch, or a data center. Place copies across the domains your availability goal names. As an example, with N = 3 on hosts in three racks, losing one rack leaves two copies. If two copies share a rack, the same event leaves one, and a write that needs two acknowledgments now fails. Cassandra’s NetworkTopologyStrategy and Kafka’s rack-aware replica assignment exist to prevent this.
Copies have a price. Three copies triple the stored bytes, every write becomes three writes, and a copy in another region adds bandwidth and, if the client waits for it, tens of milliseconds. For data you can regenerate, one copy may be the right answer. Copies can also temporarily differ. Partitioning answers where a key belongs; replication answers where additional copies belong. Neither alone defines when put() acknowledges success or which version get() returns.
Three virtual-node copies sit on one physical server. Does N = 3 protect against its failure?
No. That failure removes all copies. Select three distinct physical owners and spread them across the failure domains in the availability goal.
Use this as a guide for self review; written answers are not graded.Keep in mind
- N counts independent physical replicas.
- Failure-domain placement matters as much as copy count.