Our over-the-air (OTA) update backend from the first three parts of this series looks self-contained on a diagram. It is not. To deliver one update to one car, it calls services that belong to other teams and other companies: a push service to wake the car, a key management service to sign the package, a mobile operator’s API to check the SIM, a CDN to serve the download, an SMS gateway to tell the owner. Every one of those calls crosses a network and lands in a system you do not run, cannot see into and cannot fix.
This is where real systems most often break. Not because the external service is bad, but because the calling system was written as if the call were a local function: always fast, always answered, answered exactly once. None of those three assumptions holds over a network.
This post walks through the failure patterns and the standard defences: timeouts, retries with backoff and jitter, circuit breakers, bulkheads, idempotency, rate limits, contract tests and fallbacks. The idea comes from Gaurav Sen’s system design videos on designing for failure; the examples, numbers and simulations are my own and illustrative, as before.
The System Design series
- The Building Blocks: load balancer, replication, cache, CDN, message queue.
- Where Systems Break: finding the bottleneck, latency numbers and queueing.
- Scalability Explained Simply: horizontal scaling, statelessness, sharding, consistent hashing, and why consistency is hard.
- Why Systems That Depend on External APIs Break (you are here): timeouts, retries with backoff and jitter, circuit breakers, bulkheads and idempotency.
The OTA backend and its outside world
The drawing below shows the calls one update campaign makes to systems outside our control. Each arrow is a place where the answer can be slow, wrong, missing or duplicated. Read it as a list of things that will, at some point, go wrong on a Monday morning.

Timeouts: your system is as slow as your slowest dependency
The most common way an external API takes a system down is not by failing. It is by being slow. A call that errors after 50 ms costs one thread 50 ms. A call that hangs for 30 seconds holds that thread for 30 seconds, and while it waits, new requests keep arriving.
Take our OTA backend. Each application server has a pool of 200 worker threads. A check-in normally takes 40 ms, and one in ten check-ins also asks the push service to wake a second ECU, a call that normally takes 50 ms. At 1,000 check-ins per second per server, about 45 of the 200 threads are busy at any moment. Now the push service stops answering. It does not refuse the connection; it simply never replies. With no timeout, every check-in that touches it parks a thread forever. At 100 such check-ins per second, the 155 free threads are gone in under two seconds, and the server stops answering every car, including the 90 % that never needed the push service.
This is a cascading failure: one slow dependency becomes your outage. Part 2 explained why. A pool is a queue, and a queue whose service time grows without bound is a queue that never empties.

The defence is a timeout on every remote call, without exception. Two practical rules:
- Set it from data, not from habit. The AWS Builders’ Library article on timeouts suggests choosing the false-timeout rate you can accept, for example 0.1 %, and setting the timeout at the dependency’s latency at that percentile, here p99.9. A round 30 seconds copied from a library default is almost always far too long.
- Set both a connect timeout and a request timeout. A dead host fails fast; a sick host accepts the connection and then hangs, and only the request timeout catches that.
The chart compares the busy threads on one server after the push service hangs, with no timeout and with a 200 ms timeout.

An embedded engineer knows this pattern as the reason a task must never block on a resource without a deadline. A watchdog exists precisely because “wait forever” is never the right answer.
Retries: the cure that spreads the disease
Once a call can time out, the natural next step is to try again. For a rare, brief glitch, a retry is exactly right. Under real overload it is the worst thing a client can do. Marc Brooker of AWS calls retries “selfish”: each one spends more of the server’s capacity to improve one client’s chances, at the moment the server has the least to spare.
Two things make it worse.
- Retries multiply across layers. If the app server retries three times, and the service it calls retries three times, and so on down a five-layer chain, a failing database at the bottom can see 3⁵ = 243 times the original load. The AWS article uses exactly this example. Retry in one place, usually at the edge closest to the user, not at every layer.
- Retries synchronise. Ten thousand cars that failed at the same moment and wait the same fixed second will all come back at the same moment. The recovering service sees a wall of traffic, falls over again, and the cycle repeats. This is the thundering herd.
The standard fix has two parts. Exponential backoff waits longer after each failure (100 ms, 200 ms, 400 ms and so on, up to a cap), so total pressure drops while the service recovers. Jitter picks a random wait between zero and that backoff, so the clients spread out instead of arriving together. Brooker’s 2015 analysis on the AWS Architecture Blog compared several jitter variants and concluded that jittered backoff should be the standard approach for remote clients.
To see the difference, I simulated our push service recovering from a two-second outage. Ten thousand cars fail at the same moment, the service then handles 1,000 requests per second, and anything above that is rejected. With a fixed one-second retry, the waves stay synchronised and only about 1,800 cars get through in 20 seconds. Exponential backoff without jitter is even worse, about 300, because the waves get bigger as they get rarer. With backoff and full jitter the service runs at full capacity from the moment it recovers, and all 10,000 cars are served within about 16 seconds of the recovery.

The last rule follows from the first: only retry what is safe to repeat. Reading a car’s update status twice is harmless. Charging a customer twice is not. The idempotency section below returns to this.
Circuit breakers: stop calling what is already broken
Timeouts and retries still send every request to the failing service; they only limit how long each one waits. If the push service has been down for a minute, the useful thing is to stop asking for a while. That is a circuit breaker, a pattern popularised by Michael Nygard’s book Release It! and described by Martin Fowler in 2014.
A breaker wraps the remote call and has three states:
- Closed. Calls go through as normal. The breaker counts failures, for example timeouts or 5xx answers in the last ten seconds.
- Open. Once failures cross a threshold, the breaker trips. Calls now fail immediately, without touching the network, for a cool-down period. Threads are never parked and the struggling service gets room to recover.
- Half-open. After the cool-down, the breaker lets a few trial calls through. If they succeed, it closes again; if they fail, it reopens and the cool-down starts again.

Failing fast is the point. A check-in that learns in one microsecond that the push service is unavailable can still answer the car, skip the optional wake-up and carry on. A check-in that waits 200 ms for a timeout a thousand times a second cannot.
The embedded parallel is close: it is a debounced error state with a recovery test. A CAN node that goes bus-off after too many errors, stops transmitting, and rejoins only after a defined recovery sequence is behaving like a circuit breaker.
Bulkheads: keep one leak in one compartment
A ship’s hull is divided into watertight compartments, so one hole floods one compartment instead of sinking the ship. Software borrows the name. A bulkhead gives each external dependency its own limited share of resources: its own thread pool or concurrency limit, its own connection pool, sometimes its own queue and workers.
Without bulkheads, all calls share the 200 threads from the timeout example. If the SMS gateway that tells owners “your update is ready” starts to hang, it can still eat the threads that deliver the update itself, even with timeouts in place, simply by being slow and popular. With bulkheads, SMS calls get, say, 20 threads. When those 20 are busy, further SMS requests are rejected or queued immediately, and the other 180 threads keep serving check-ins.

The most effective bulkhead in our design is one we already have: the message queue from Part 1. Notifications do not need to happen inside the check-in at all. The check-in writes a “notify owner” message to the queue and returns; a separate pool of workers sends the SMS at whatever pace the gateway allows. If the gateway is down for an hour, the queue grows, owners hear an hour later, and not a single car notices.
The general rule: separate the critical path (what a car needs to get its update) from everything that is merely nice to have, and make sure nothing on the second list can borrow from the first.
Idempotency: did my request go through or not?
A timeout tells you that you did not get an answer. It does not tell you whether the other side did the work. There are three possibilities, and from the caller’s side they all look the same:
1. The request never arrived.
2. It arrived, and the server failed halfway through.
3. The server did the work, and the reply was lost.
For a read, this does not matter: ask again. For anything with a side effect, it matters a lot. Suppose an owner buys a paid feature, such as extended range or a driver-assistance package, and our backend asks a payment provider to charge the card. The call times out. If we retry and case 3 was true, the owner pays twice. If we do not retry and case 1 was true, the owner has paid nothing and gets nothing.
The answer is an idempotency key. The caller generates a unique ID for the operation, for example a UUID stored with the order, and sends it with every attempt. The server remembers which keys it has already processed. The first time it sees a key, it does the work and stores the result. Every later request with the same key gets the stored result back without doing the work again. Stripe’s 2017 article by Brandur Leach describes exactly this design with an Idempotency-Key header, and walks through the same three failure cases.

Two details are easy to get wrong:
- The key belongs to the operation, not the attempt. Generate it once, before the first try, and store it. A new key per retry defeats the purpose.
- Your own APIs need the same property. Cars retry too. A car that reports “installation finished” and loses the reply will send the report again, so the backend must recognise the second report as the same event, for example by the car’s own event ID, and not count two installations.
Idempotency is what makes the rest of this post safe. Retries, queues that redeliver messages and failover that replays requests all assume that doing something twice has the same effect as doing it once.
Rate limits: when the other side says “slow down”
Every serious external API protects itself with a rate limit: so many requests per second, per minute or per day, per customer. Exceed it and the API answers with HTTP status 429 Too Many Requests, defined in RFC 6585, often with a Retry-After header that says how long to wait.
Our OTA backend will hit these limits at the worst possible time. A campaign starts at 8:00, a million cars check in, and the operator’s SIM API that allowed 500 requests per second during testing now refuses most of them. Three habits keep this from turning into an outage:
- Treat 429 as information, not as an error to retry immediately. Honour
Retry-Afterwhen it is there, and back off with jitter when it is not. Retrying a 429 instantly is the retry storm from earlier, aimed at someone else. - Limit yourself before they limit you. Put a client-side rate limiter, typically a token bucket, in front of each external API, set a little below the agreed quota. Your own limiter fails predictably and locally; theirs fails unpredictably and may block your whole account.
- Know the quota before launch. Rate limits are part of the contract. A campaign plan that needs 2,000 operator calls per second against a quota of 500 is a planning error, not an incident. The usual fixes are to batch requests, cache answers that do not change (a SIM’s status rarely changes within a minute), or spread the campaign over more hours.
The embedded equivalent is bus load. Nobody designs a CAN network by sending as many frames as possible and hoping arbitration sorts it out; you budget the bus and stay below it.
Silent breakage: when the API still answers, but differently
The failures so far are loud: timeouts, errors, 429s. The nastier ones are quiet. The API answers quickly with status 200, and the answer is wrong for you.
- A field changes meaning. The operator’s API used to return
"status": "active"; a new release returns"ACTIVE". Your code compares strings, every SIM now looks inactive, and the campaign quietly skips every car. - A field disappears or becomes optional. Your parser assumed it was always there. Now some responses crash it, but only for certain regions.
- An old version is retired. The provider announced it months ago, in an email to someone who has left the company.
- A certificate or credential expires. Nothing changed in any code, and everything stopped working at midnight.
The defences are unglamorous and effective:
- Pin the API version you call, and treat an upgrade as a change that goes through review and testing, never as something that happens to you.
- Parse defensively and loudly. Validate the fields you depend on, and when something unexpected arrives, raise an alarm instead of guessing. A wrong default is worse than an error.
- Run contract tests. A small automated test suite that calls the provider’s sandbox and checks exactly the fields and behaviours your code relies on, run every day, finds breaking changes before your cars do.
- Monitor outcomes, not just errors. “Cars offered the update per hour” dropping to zero catches the string comparison bug above; an error-rate dashboard never will.
- Track expiry dates of certificates, keys and API versions as you would track any other deadline.
Fallbacks and the safe state
All the techniques above limit the damage. The last question is a design decision, not a technique: when a dependency is unavailable, what should the system do instead? There is no general answer. It depends on what the dependency is for, and the honest way to decide is to go through the list one by one before launch, not during the outage.
| Dependency | Without it | Fallback |
|---|---|---|
| Push service (wake the car) | Cars learn about the update later | Cars find it at their next regular check-in; slower, but nothing is lost |
| CDN | Downloads are slow or fail | Second CDN, or origin servers with a strict rate limit; downloads resume where they stopped |
| SMS and e-mail gateway | Owners are not told | Queue the messages and send later; the update itself goes ahead |
| Operator SIM API | Cannot check data plan or roaming | Use the last known status if it is recent; otherwise postpone large downloads for that car |
| Payment provider | Paid features cannot be bought | Show “try again later”; never activate a feature without confirmed payment |
| Signing service (KMS/HSM) | New packages cannot be signed | No fallback. Stop. No unsigned package is ever published |
Two kinds of answer appear. For most dependencies the right answer is graceful degradation: do less, more slowly, but keep the core working. For a few, the right answer is to stop. A software package that cannot be signed must not reach a car, whatever the deadline. This is the same principle as the campaign stop in Part 3, and for an automotive engineer it will sound familiar: when the system cannot be sure, it goes to a safe state, and in an OTA backend the safe state is “do not install”.
The table also shows why the earlier patterns matter. A fallback only works if the system notices the failure quickly (timeouts, circuit breakers), keeps the rest of the system alive while it does (bulkheads, queues) and can resume safely afterwards (idempotency).
What I take away
- A remote call is not a function call. It can be slow, fail, or succeed without telling you. Design for all three from the first line of code.
- Every remote call gets a timeout, chosen from the dependency’s real latency percentiles, never a library default.
- Retry rarely, in one place, with exponential backoff and jitter, and only for operations that are safe to repeat.
- Fail fast when a dependency is down. A circuit breaker turns a slow outage into a quick, predictable error.
- Separate the critical path from the nice-to-have. Bulkheads and queues stop a broken SMS gateway from stopping software updates.
- Make every operation with a side effect idempotent, both the calls you make and the calls you receive.
- Respect rate limits before you reach them, and treat API versions, quotas and certificate expiry dates as part of the design.
- Decide the fallback for each dependency in advance. Usually degrade gracefully; for safety-relevant steps, stop.
The next part widens the view from external APIs to failure in general: what happens when our own servers, disks, databases or a whole region fail, and how to design so that the answer is “nothing the car notices”.
Further watching and reading
- Gaurav Sen, How to avoid cascading failures in a distributed system: rate limiting, queues and why one failure triggers the next.
- Marc Brooker, Timeouts, retries and backoff with jitter, Amazon Builders’ Library: the best single article on this topic.
- Marc Brooker, Exponential Backoff and Jitter, AWS Architecture Blog, 2015: the simulations behind “add jitter”.
- Martin Fowler, CircuitBreaker, 2014.
- Brandur Leach, Designing robust and predictable APIs with idempotency, Stripe, 2017.
- Michael Nygard, Release It!: the book that named circuit breakers and bulkheads for software.
Sources
- Marc Brooker, Timeouts, retries and backoff with jitter, Amazon Builders’ Library
- Marc Brooker, Exponential Backoff and Jitter, AWS Architecture Blog, 4 March 2015
- Martin Fowler, CircuitBreaker, 6 March 2014
- Brandur Leach, Designing robust and predictable APIs with idempotency, Stripe, 22 February 2017
- MDN, 429 Too Many Requests (RFC 6585, section 4)
- System Design, Part 1, Part 2 and Part 3
The OTA backend, its dependencies, the thread counts and the retry simulation are illustrative, not a description of any carmaker’s system.
Cover photo by Markus Spiske on Unsplash.
Pingback: System Design: 3 - Scalability Explained Simply - Taner Güngör
Pingback: System Design: 1 - The Building Blocks, Explained Through a Car Update Server - Taner Güngör