The Runtime Theory
System DesignPlanned

System Design Intermediate: Load, Databases, and Queues

Video not available yet
#load-balancing#databases#queues#replication#intermediate

Lesson promise

By the end of this lesson, the learner should be able to: choose a load-balancing algorithm for a given traffic pattern, explain the trade-offs between B-trees and LSM trees, and describe how a database write flows through the WAL, leader, and followers to durable storage.

Narration draft

Start with load balancing: contrast round-robin, least connections, and IP hash. Show how consistent hashing distributes keys across a ring, and why virtual nodes smooth out uneven placement. Then explain health checks: active checks that probe a /health endpoint, and passive checks that observe real traffic for failure rates.

Transition to databases: the write-ahead log as the durability contract, fsync as the floor for write latency, B-trees for read-heavy workloads, LSM trees for write-heavy ones. Explain leader-follower replication: writes go to the leader, reads can go to followers, and the lag between them is the staleness guarantee.

Finish with queues: at-most-once, at-least-once, exactly-once delivery semantics. Explain visibility timeout and consumer leases, and why poison pills need a dead-letter queue. Show how consistent hashing appears here too — partitioning a queue's keyspace across consumers.

Visual sequence

  1. Animate a request flowing through a load balancer to one of three backends. Show health checks removing and re-adding backends.
  2. Show a database write flowing: app → WAL fsync → apply to page → stream to follower → ack. Contrast sync vs. async replication.
  3. Show a queue: producer publishes, consumer picks up, visibility timeout expires if no ack, message reappears.

Companion material

Use the load balancer article, database article, queues article, request trace, database write trace, and the System Design Intermediate learning path as written references. The video remains planned until media and transcript are produced.

Related articles

More in System Design

New lessons by email

Get new articles and notes on the systems behind everyday software.

One technical dispatch per week. No noise.

Not started

Sign in to save your learning progress.

Sign in to save