πŸ’¬
βœ‰οΈ
πŸ“Έ
▢️

Loading…

Distributed systems: CAP, quorum, replication, and consensus

System Evolution

System Evolution

Step 1 of 14
🌐

What Are Distributed Systems?

Why one machine is never enough β€” and what happens when you split work across many.

Architecture Diagram

Monolith

Client

Single Server

All code + DB

One failure β†’ everything down

vs

Distributed

Client

Load Balancer

API A

replica

API B

replica

One node fails β†’ others continue

Every system starts as a monolith. One server, one database, one codebase. It's simple, fast to build, and easy to debug. For most early-stage products, this is exactly right.

But traffic grows. The single machine starts sweating. CPU pegs at 90%. Response times creep up. You add more RAM, upgrade the CPU β€” this is vertical scaling, and it works until it doesn't. Every machine has a ceiling.

Next, a harder failure: the entire system goes down because one component failed. A bad deploy, a disk failure, a runaway query β€” and every user sees an error page. This is the single point of failure problem.

Distributed systems exist to solve both problems. Instead of one machine doing everything, you split the work across many machines. Traffic is spread across multiple servers via a load balancer. Data is replicated across multiple databases. No single failure takes down the whole system.

But this introduces a whole new class of problems: the machines need to agree on things, communicate over a network that can fail, and coordinate without a single brain. Everything else in this module is about solving those new problems.

Tradeoffs

ResilienceIndividual node failures no longer crash the system.
ComplexityNetwork failures, distributed state, and coordination replace simple function calls.
LatencyCross-network calls add milliseconds that a function call didn't have.
ScalabilityAdd more nodes to handle more traffic β€” horizontally.

Engineering Edge Cases

β–Έ

Splitting a monolith too early is expensive. You inherit distributed complexity before you need it.

β–Έ

Distributed systems require discipline: stateless services, explicit failure handling, and careful data ownership.

What comes next

Distributed systems communicate over a network. Networks are unreliable. That's where the first problem appears.