Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Distributed Systems Overview

Overview

A distributed system is a collection of independent computers that appears to its users as a single coherent system. These computers communicate and coordinate their actions by passing messages over a network. Distributed systems enable scalability, fault tolerance, and geographic distribution, but introduce fundamental challenges around consistency, coordination, and failure handling.

Why Distributed Systems?

graph TB
    REASONS[Why Distribute?] --> SCALE[Scalability<br/>Handle more load]
    REASONS --> FAULT[Fault Tolerance<br/>No single point of failure]
    REASONS --> LATENCY[Low Latency<br/>Servers closer to users]
    REASONS --> AVAIL[Availability<br/>24/7 service]
NeedSingle MachineDistributed System
ScaleVertical (bigger machine)Horizontal (more machines)
Fault ToleranceSingle point of failureRedundancy across machines
LatencyOne locationEdge servers worldwide
AvailabilityLimited by one machineSurvives individual failures

Fundamental Challenges

graph TB
    CHALLENGES[Distributed System Challenges] --> TIME[Time & Ordering<br/>No global clock]
    CHALLENGES --> CONSENSUS[Agreement<br/>Getting nodes to agree]
    CHALLENGES --> FAILURE[Failure Detection<br/>Is it slow or dead?]
    CHALLENGES --> CONSISTENCY[Consistency<br/>Keeping data in sync]
    CHALLENGES --> PARTITION[Network Partitions<br/>Messages can be lost/delayed]

The Eight Fallacies of Distributed Computing

Peter Deutsch’s fallacies (1994):

  1. The network is reliable — It isn’t. Messages get lost, connections drop.
  2. Latency is zero — It isn’t. Cross-datacenter communication takes milliseconds.
  3. Bandwidth is infinite — It isn’t. Network congestion is real.
  4. The network is secure — It isn’t. Every communication can be intercepted.
  5. Topology doesn’t change — It does. Nodes join and leave constantly.
  6. There is one administrator — There isn’t. Multiple teams manage different parts.
  7. Transport cost is zero — It isn’t. Serialization, encryption, and routing cost CPU and time.
  8. The network is homogeneous — It isn’t. Different hardware, protocols, and configurations.

Topics in This Section

TopicDescription
CAP TheoremConsistency, Availability, Partition Tolerance — pick two
FLP ImpossibilityWhy deterministic consensus is impossible in asynchronous systems
Consistency ModelsStrong, eventual, causal, and more
Time and OrderingPhysical clocks, logical clocks, happens-before
Lamport ClocksLogical clocks for event ordering
Vector ClocksCapturing causal relationships

Real-World Distributed Systems

SystemTypeScale
Google SearchWeb serviceBillions of queries/day
Amazon DynamoDBDistributed databaseTrillions of requests/day
Apache KafkaMessage streamingTrillions of events/day
NetflixContent delivery200+ million subscribers
BitcoinBlockchain~15,000 nodes worldwide

Interview Focus

  • Explain the CAP theorem and its real-world implications
  • Describe the difference between consistency models
  • Explain why distributed consensus is hard
  • Describe how vector clocks capture causality
  • Give examples of distributed systems you use daily

Cross References