Replication, Sharding & Consistent Hashing · Key takeaways

1 min read
Senior12 min read
Rapid overview

Key takeaways

  • Replication scales reads and provides failover; only sharding scales writes.
  • Async replication means read-your-own-writes anomalies. Route post-write reads to the primary or track the log position.
  • The shard key is effectively permanent. Derive it from access patterns and atomicity needs, not from even distribution alone.
  • hash % N remaps almost everything when N changes; consistent hashing limits it to 1/N.
  • Virtual nodes are what make consistent hashing distribute evenly and allow weighting.
  • Even row counts do not imply even load. Measure operations per shard.
  • Prefer choosing a key that avoids cross-shard transactions over implementing them.

See also