Lab · Reliability

Cascading failures

Checkout pages go from the web server to orders, then to stock. Home pages need the web server only. Slow the stock service down, watch the slowdown reach pages that never call it, then try the defences.

Try it

Lab time 3.0 s
checkoutsUsers, 6 checkouts a secondUsers6 checkouts a second4 home/s · wait 3 sWeb server, 40 workersWeb server40 workers3 busy · 0 waitingOrders service, 20 workersOrders service20 workers1 busy · 0 waitingStock service, answers in 50 msStock serviceanswers in 50 msHealthy
  • Users — 6 checkouts a second — healthy — 4 home/s · wait 3 s
  • Web server — 40 workers — healthy — 3 busy · 0 waiting
  • Orders service — 20 workers — healthy — 1 busy · 0 waiting
  • Stock service — answers in 50 ms — healthy — Healthy
  • Request/response
  • Request
  • Response
  • Error / rejected
  • Retry
Home pages on time
100%
Healthy: last 10 s · they never call stock
Checkouts on time
100%
Healthy: last 10 s
Web workers busy
3/ 40
0 pages waiting
Orders workers busy
1/ 20
0 calls waiting
Gave up waiting
0
timeouts are off
Refused at once
0
0 by the queue limit, 0 by the bulkhead
Calls per checkout
1.0
that reached stock, last 10 s
Wasted answers
0
work done after the caller gave up

Numbers add up:Home: 14 arrived = 13 on time + 0 failed + 0 timed out + 1 in progress · Checkout: 15 arrived = 12 on time + 0 failed + 0 timed out + 3 in progressThe lab checks this sum as it runs, so a counting mistake would show here.

Controls

Stock service

Stock answers in about 50 ms.

Traffic
6/s
Defences

The web server waits at most 2.5 s for orders, and orders at most 1 s for stock.

Orders keeps at most 12 calls waiting, and answers 503 to the rest at once.

Checkouts may hold at most 20 of the 40 web workers; the rest are kept for home pages.

The web server and orders each make up to 3 attempts. This adds load; it is not a defence.

Pages answered on time (%)
Home pagesCheckouts
0501001502001s2s3s
Show data table
TimeHome pagesCheckouts
1s100100
1s100100
2s100100
2s100100
3s100100
3s100100
Calls waiting at orders, and busy web workers
Waiting at ordersWeb workers busy
01.32.53.851s2s3s
Show data table
TimeWaiting at ordersWeb workers busy
1s04
1s03
2s03
2s04
3s00
3s03

What just happened

Nothing yet. Start traffic or run an experiment.

What this model simplifies
  • Each hop takes 100 ms, slowed so a request can be followed. Inside one data centre a hop takes well under 1 ms.
  • Each worker handles one call at a time and waits for the whole call. Servers built on async code hold memory and connections instead of threads, and run out the same way.
  • Users give up after exactly 3 s and never press reload. Real users reload, which adds more load.
  • Stock has no limit on how many calls it works on at once. A real service would slow down further under the extra calls.
  • Retries go out at once, with no backoff or jitter. The retries lab shows what those change.