DEV Community

Odumosu Matthew
Odumosu Matthew

Posted on Edited on

Backpressure in System Design: How to Handle Traffic Spikes Without Crashing

๐ˆ๐ญโ€™๐ฌ ๐ญ๐ก๐ž ๐Ÿ๐ข๐ซ๐ฌ๐ญ ๐Œ๐จ๐ง๐๐š๐ฒ ๐จ๐Ÿ ๐ญ๐ก๐ž ๐ก๐จ๐ฅ๐ข๐๐š๐ฒ๐ฌ. ๐„๐ฏ๐ž๐ซ๐ฒ ๐Ÿ๐ฅ๐ข๐ ๐ก๐ญ ๐ฅ๐ž๐š๐ฏ๐ž๐ฌ ๐›๐ž๐Ÿ๐จ๐ซ๐ž 9๐š๐ฆ.

Thousands of passengers reach airport security at once.

Imagine the airport let everyone through the entrance together. People crowd the scanners. Bags pile up. Staff canโ€™t move. Nobody gets through, and everyone misses their flight.

Real airports donโ€™t do that. They control the flow at the door: a rope queue, a gate that opens in batches, a fast-track lane for anyone about to miss a flight. The scanners keep a steady pace, and the queue absorbs the rush.

Software faces the same rush on payday, during a flash sale, or when something goes viral. A system that accepts everything eventually serves no one.

Engineers call the fix ๐›๐š๐œ๐ค๐ฉ๐ซ๐ž๐ฌ๐ฌ๐ฎ๐ซ๐ž. I sketched how it works, from the API gateway down to the database.

Whatโ€™s the biggest traffic spike your system has had to survive?

back-pressure

Top comments (2)

Collapse
 
arslan_ah profile image
Arslan Ahmad •

Nice analogy. The airport rope queue is bounded, and that's the detail worth emphasizing. An unbounded queue just moves the crash from the scanners to the hallway. Real backpressure means someone gets told "not now": rate limits at the gateway, bounded queues in between, load shedding when even the queue is full. And the other half of the fix is client behavior: retries with exponential backoff and jitter, so a thousand clients don't come back in sync and recreate the spike you just shed.

Collapse
 
robertpaschal profile image
Odinaka Robert Nnamani •

The airport door analogy works well here. Letting everyone in at once just moves the crash to the scanners.

⌂ ๆข็ฝ‘ๅ€