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

Loading…

How systems scale, from one server to many

How Systems Are Built
requestrouteroutereadreadcache missenqueueenqueueasync write
πŸ’»CLIENT
Client
βš–οΈLB
Load Balancer
βš™οΈAPI
API Server
βš™οΈAPI
API Server 2
⚑CACHE
Cache
πŸ—„οΈDB
Database
πŸ“¬QUEUEnew
Message Queue

Step 4 of 4

Step 4: Adding a Message Queue

Why

Heavy write operations (notifications, emails, thumbnails) are slow and block the API response. Users shouldn't wait for background work to complete.

What it does

API Servers push tasks into the Queue (like Kafka or SQS) and immediately return a response. Background workers drain the queue and write to the Database asynchronously.

Impact

API response time drops to milliseconds β€” it just enqueues and returns. The DB absorbs write bursts gradually. The system can handle 10Γ— more concurrent users.

Try it in Library β†’

Message Queue

β†—