# When an external service goes down

> Timeout, retry and circuit breaker: how three lines of defense stop a slow external service from locking up your whole application.

- Kind: Infographic
- Published: 2026-10-03
- Based on these articles: https://muhammetsafak.com/engineering/notes/circuit-breaker-external-service-integration/ · https://muhammetsafak.com/engineering/tools/backoff-calculator/
- Source: https://muhammetsafak.com/visuals/i/when-an-external-service-goes-down/
- Language: en-US
- Author: Muhammet Şafak

---
## Panel 1

Not down, just slow

An SMS provider slowed down. The whole application stopped.

Response time climbed to 30 seconds; within half an hour even endpoints with nothing to do with SMS were timing out.

## How slowness spreads

Cascading failure

1.   Step 1: The process locks up `worker / PHP-FPM process tied up`
2.   Step 2: Time disappears `30 s call = 30 s busy`
3.   Step 3: The pool fills `new requests wait in line`
4.   Step 4: The healthy die `unrelated endpoints time out`

## Panel 3

5 s

First defense: timeout

total timeout

Not the default 30 seconds, but 5: Http::timeout(5)->connectTimeout(2). The values are the source's suggested example; this number should be a decision.

## Three attempts, two waits

Second defense: bounded retry

wait, ms

-   Wait 1 200
-   Wait 2 400

Example values: 200 × 2ⁿ⁻¹ ms, plus random\_int(0, 100) ms of jitter. Three attempts have two waits between them; if errors persist, the problem isn't transient.

## Panel 5

~3.4 min

Put a ceiling on backoff

12th wait without a cap

delay = min(cap, base × factorⁿ⁻¹). Without a cap, base 100 ms × 2 reaches about 3.4 minutes by the 12th attempt.

## Jitter types

Thundering herd

delay = min(cap, base × factorⁿ⁻¹). Without a cap, base 100 ms × 2 reaches about 3.4 minutes by the 12th attempt.

| Type | Range | Behavior |
| --- | --- | --- |
| Full | `[0, delay]` | Widest spread; one client may retry very early |
| Equal | `[delay/2, delay]` | Keeps a floor, still spreads the herd |
| Decorrelated | `[base, previous × 3]` | Capped; follows the last wait, a strong default |
| None | `no jitter` | Fine for a single client, dangerous for a fleet |

## Stop making the call

Third defense: circuit breaker

Even a 5-second timeout is 5 seconds per process; in the open state that drops to 0.

Fail-fast

1.  01 Closed calls pass, errors are counted
2.  02 Open the external service isn't called, instant error
3.  03 Half-open a single trial: if it succeeds, closed

## What you do while the circuit is open

Fail-fast beats slow-fail

-   Queue it If the SMS doesn't have to go out right away, leave it to be processed once the circuit closes.
-   Serve stale data If the exchange-rate service is down, show the last known rate.
-   Degrade gracefully Saying "Recommendations can't load right now" beats crashing the page.
