Distributed Data Systems

Replicationdistributed systemsleader-follower, multi-leader and leaderless replication, quorums and replication lag. Partitioning and Shardingdistributed systemssplitting data across nodes by hash or range, hot spots and rebalancing. Consistency Modelsdistributed systemslinearizability, sequential, causal and eventual consistency, and session guarantees. CAP and PACELCdistributed systemsthe consistency, availability and latency trade-offs every distributed database makes. Consensus: Raft and Paxosdistributed systemshow a cluster agrees on a leader and a log despite failures.

Almost every modern data platform, from Kafka and Cassandra to Snowflake and Spanner, is a distributed system. This section explains the core ideas they all share: how data is split, copied, agreed upon and read consistently when machines and networks fail.


1. Overview

A distributed data system stores and processes data on several machines that communicate over a network. We distribute for three reasons: the data or load is too big for one machine (scale), one machine failing must not stop the service (fault tolerance), and users are spread across the world (latency). The price is that networks delay, reorder and drop messages, clocks disagree, and machines fail partially, so problems that are trivial on one computer, such as "what is the latest value?", become hard.

Partitioning and Replication Together Node 1 Partition A leader Partition B follower Partition C follower Node 2 Partition A follower Partition B leader Partition C follower Node 3 Partition A follower Partition B follower Partition C leader Partitioning spreads data for scale; replication copies each partition for fault tolerance. Consensus elects each partition's leader; consistency models define what readers may see.

Four ideas fit together. Partitioning (sharding) splits the data so each node owns a subset. Replication keeps copies of each partition on several nodes. Consensus lets nodes agree on a single value or order, such as which replica is leader, even when some fail. Consistency models state precisely what a read may return given concurrent writes and replication lag, and the CAP and PACELC results describe the unavoidable trade-offs between consistency, availability and latency.

2. How to Read This Section

A good reading order is: partitioning and replication first, since they are the mechanisms you configure every day; then consistency models, which give the vocabulary for what those mechanisms guarantee; then CAP and PACELC, which explain why no system gets everything; and finally consensus, the algorithmic core that makes strong guarantees possible. Each page includes diagrams and runnable code.

3. Which Concept Answers Which Question

Question you are askingConceptTypical knobs
My table no longer fits on one node or one node is too slowPartitioning and shardingPartition key, hash vs range, number of partitions
A node failure must not lose data or stop readsReplicationReplication factor, sync vs async, W and R quorums
Which node is the leader? Did this write commit?Consensus (Raft, Paxos)Cluster size (odd numbers), election timeouts
Can a user see stale or out-of-order data?Consistency modelsLinearizable, causal, eventual; read-your-writes
What happens during a network partition, and what does consistency cost in latency?CAP and PACELCConsistency level per query, region placement

In practice these are configured together. A Kafka topic, for instance, chooses a number of partitions (partitioning), a replication factor and min.insync.replicas (replication), relies on a controller quorum (consensus), and its producer acks setting determines the durability guarantee a write receives.

Data EngineeringSectionparent section Cassandrawide columna partitioned, leaderless database Kafka Producer and Consumerpipelinesa partitioned, replicated log Stream ProcessingSectiondistributed computation over streams

5. Further Reading