Systems Architecture
Distributed Systems
Systems spread across many machines and how they stay consistent.
- 7 notes
- 59 minutes of reading
Systems that run on many computers at once
A distributed system is a group of computers that work together and appear to users as one service: a bank's payment platform, a social network or a cloud database. Spreading work across machines brings scale and resilience, but it also brings problems a single computer never has. Messages get delayed or lost, clocks disagree, and parts of the system fail while others keep running.
The key ideas
- Trade-offs: the CAP theorem says that during a network partition you must choose between consistency and availability; PACELC adds the everyday trade-off between latency and consistency.
- Consistency models: strong, eventual and causal consistency decide what users see after a change.
- Replication and sharding: copies of data for resilience, and splitting data so it can grow.
- Consensus: algorithms such as Raft and Paxos let machines agree even when some fail.
- Communication: queues, event streams, REST and gRPC connect the parts.
Where to start
Read the notes below in order; each builds on the last. They also explain much of how the cloud services in our cloud architecture notes work behind the scenes.
- What distributed systems are and why they are hardAn introduction to distributed systems: what they are, why organisations build them, and the core problems of unreliable networks, partial failure and unsynchronised clocks. 8 min · Beginner
- The CAP theorem and PACELCWhat the CAP theorem really says about consistency, availability and partition tolerance, common misreadings of it, and how PACELC adds the latency trade-off. 8 min · Intermediate
- Consistency models: strong, eventual and causalA plain guide to consistency models in distributed systems, from linearisability through causal and session guarantees to eventual consistency, with examples of when each fits. 8 min · Intermediate
- Replication and shardingHow distributed databases copy data with replication and split it with sharding, the main topologies and partitioning strategies, and the pitfalls of each. 9 min · Intermediate
- Consensus: Raft and Paxos simply explainedHow distributed nodes agree on one value or one ordered log despite failures, explained through Raft leader election and log replication, with a short look at Paxos and quorum sizing. 9 min · Advanced
- Message queues and event streamingHow message queues and event streams decouple services, the difference between them, delivery guarantees, ordering, idempotency and dead-letter queues. 8 min · Intermediate
- Microservice communication: REST, gRPC and service meshHow microservices talk to each other: REST, gRPC and asynchronous events compared, resilience patterns such as timeouts and circuit breakers, and what an API gateway and service mesh add. 9 min · Intermediate