Distributed Systems & Concurrency: Overview
Published: Sun Feb 15 2026 | Modified: Sat Feb 07 2026 , 2 minutes reading.
Distributed Systems & Concurrency: Overview
Introduction: The āMultiple Brainā Problem
In a single-machine world, the CPU knows everything. In a Distributed System, you have hundreds of ābrainsā (servers) that must work together.
- What if the network splits and Server A canāt talk to Server B?
- What if 10,000 users buy the last iPhone at the exact same millisecond?
This chapter covers the algorithms that keep the internet running reliably, even when things fail.
Typical Business Scenarios
- Financial Transactions: Ensuring money is never ācreatedā or ālostā during a transfer between two different database shards (2PC, Paxos).
- Cloud Coordination: Ensuring all nodes in a cluster agree on who the āLeaderā is (Raft).
- API Protection: Preventing a single user from crashing your system with 1M requests (Rate Limiting).
- System Stability: Automatically cutting off traffic to a failing microservice to prevent a total meltdown (Circuit Breaker).
Core Concepts: The CAP Theorem
You cannot have all three:
- Consistency (C): Every node sees the same data at the same time.
- Availability (A): Every request receives a response (even if itās old data).
- Partition Tolerance (P): The system continues to work even if the network fails.
The Reality: In the cloud, network failure (P) is inevitable. You must choose between Consistency (Raft/Paxos) or Availability (Gossip/Eventual Consistency).
Quick Look at Common Algorithms
- 5.1 Raft: The āUnderstandableā consensus algorithm used by etcd and Kubernetes.
- 5.3 2PC (Two-Phase Commit): The classic way to handle atomic transactions across databases.
- 5.5 Rate Limiting: Token Bucket and Leaky Bucket algorithms for traffic control.
- 5.6 Circuit Breaker: The āSafety Fuseā for microservices.
- 5.8 Vector Clocks: Tracking the order of events when there is no global clock.
Selection Cheat Sheet
| Requirement | Algorithm / Pattern | Goal |
|---|---|---|
| Cluster Leader Election | Raft | High Consistency & Fault Tolerance. |
| Distributed Transaction | 2PC / TCC | Atomicity across multiple services. |
| Load Balancing | Weighted Round Robin | Evenly distribute traffic. |
| DDoS / Spam Prevention | Token Bucket | Smoothing out traffic spikes. |
| Data Synchronization | Gossip Protocol | High availability & eventual consistency. |
The āOne-Sentence Mindsetā
āDistributed algorithms turn a chaotic network of failing machines into a single, reliable virtual computer.ā
