A distributed system is a set of programs on different machines that work together as one: a website behind a load balancer, services that talk through a message broker, a database split across servers. These guides explain the parts such systems are built from and the trade-offs between them, one idea at a time, each with a diagram.
Where to start
The CAP theorem in plain terms: consistency, availability and partition tolerance, why a network partition forces a CP vs AP choice, real database examples, PACELC, and FAQs.
The parts most systems are built from: what each one does and when you need it.
How a load balancer distributes traffic across servers: algorithms (round robin, least connections, hashing), active health checks, Layer 4 vs Layer 7, TLS termination, and FAQs.
What a Content Delivery Network (CDN) is, how edge caching cuts latency, push vs pull CDNs, Cache-Control headers, origin offload, and how to set one up.
How caching works in distributed systems: cache-aside, write-through and write-behind patterns, TTL and event-driven invalidation, LRU/LFU eviction, and common failure modes.
What an API Gateway is in distributed systems, how it handles routing, authentication, rate limiting and protocol translation, API Gateway vs Load Balancer, BFF pattern, and FAQs.
What a rate limiter is, how Token Bucket, Leaky Bucket, Fixed Window, and Sliding Window algorithms work, distributed rate limiting with Redis, HTTP 429 headers, and FAQs.
How DNS resolves domain names to IP addresses, recursive vs authoritative servers, DNS record types (A, AAAA, CNAME, NS, TXT), TTL caching, GeoDNS, and failover trade-offs.
How message queues and brokers decouple microservices: point-to-point queues vs pub/sub event logs, Kafka vs RabbitMQ vs SQS, delivery guarantees, backpressure, and dead-letter queues.
What object storage is (Amazon S3, GCS, Cloudflare R2), how it differs from block and file storage, presigned URL direct uploads, erasure coding durability, multipart uploads, and FAQs.
What service discovery is in microservices, client-side vs server-side discovery patterns, service registries (Consul, etcd, Eureka, Kubernetes CoreDNS), heartbeats, and FAQs.
How data is split, copied and kept consistent across machines.
What consistent hashing is, why modulo hashing (hash % N) causes massive cache misses when nodes change, how the hash ring and virtual nodes work, and real-world uses.
How database replication and sharding scale distributed systems: primary-replica vs multi-primary, hash vs range sharding, hot partitions, cross-shard joins, and FAQs.
How database indexes speed up queries: B-Trees vs LSM-Trees (MemTable, WAL, SSTables, Bloom filters), composite and covering indexes, inverted indexes, write amplification, and FAQs.
Deep dive into data partitioning strategies: range vs hash vs composite partitioning, hot-key salting, fixed vs dynamic rebalancing, and local vs global secondary indexes.
What distributed consensus is, how the Raft algorithm solves leader election and log replication using majority quorums, split-brain prevention, Raft vs Paxos, and FAQs.
How distributed transactions work across microservices and sharded databases: Two-Phase Commit (2PC) vs Saga pattern (choreography vs orchestration), transactional outbox, and FAQs.
How services come to depend on each other, and how to loosen the ties.
Tight vs loose coupling in distributed systems, and the five types of coupling between services (domain, temporal, pass-through, common, content) with examples.
What domain coupling is in microservices, why it is the loosest form of inter-service coupling, an order-management example, and how bounded contexts and domain events keep it under control.
What temporal coupling is in microservices, why synchronous call chains hurt availability and latency, an order-creation example, and how queues, events, outbox, and circuit breakers fix it.
What pass-through coupling is in microservices, why forwarding unused data through an intermediary service causes coupled deployments, an order-inventory-delivery example, and how to fix it.
Explore common coupling in distributed systems, its challenges, and strategies to mitigate risks. Learn how to improve system architecture and maintain data integrity.
Explore content coupling in distributed systems, its challenges, and strategies to mitigate risks. Learn how to improve system architecture and maintain service independence.
How services exchange messages through a broker, and the kinds of message they send.
How asynchronous messaging works between microservices: sender, message broker, receiver, point-to-point queues vs pub/sub topics, delivery guarantees, and how it removes temporal coupling.
Anatomy of a message in distributed messaging systems: header metadata (message ID, correlation ID, group ID, sequence number, expiry) and the three payload types (command, event, document).
What a command message is in distributed messaging, write vs query commands, fire-and-forget vs request-reply messaging, orchestration sagas, and command vs event messages.
What an event message is in microservices: Event with Detail (Event-Carried State Transfer) vs Event with Identifier (notification event), pros, cons, JSON examples, and choreography sagas.
What a document message is in distributed messaging: transferring entity snapshots in Change Data Capture (CDC) pipelines, request-reply responses, and event payloads, with JSON examples.