FDE Times dataFDE jobs open 932▼14 Change in open roles over 7 days, like-for-like: roles from companies we started tracking this week are left outNew in 7 days 62Companies hiring 202Remote-friendly 24%Median US pay $201kTop hirer Databricks 92
中文VI

The newspaper of the Forward Deployed Engineer

Books & courses

Read these two free chapters before calling a client's API

Roberto Vitillo's chapters on resiliency in Understanding Distributed Systems are free to read, and they set out the timeout and retry rules integrations need.

ShareLinkedInFacebookX

In brief

  • Buy the second edition (2022, 344 pages); the first edition on Leanpub is no longer sold.
  • Start with chapters 27 and 28 on resiliency, which The Pragmatic Engineer republished free.
  • The book warns that retrying at several layers amplifies load; count the attempts across your own call chain.
Big-number graphic: one user request passes through three layers, each retrying up to 3 times, becoming 3 × 3 × 3 = 27 requests hitting the weakest service. The image shows 27 orange dots arranged in three rows. Conclusion: retry at one layer only.
When all three layers retry up to 3 times, one request can multiply into 27 requests hitting the final service. Source: illustrative example in the article, based on two resiliency chapters of Understanding Distributed Systems (Roberto Vitillo).

The second edition of Understanding Distributed Systems runs to 344 pages. An FDE about to connect a system to a client’s API should start with just two of its chapters, 27 and 28, on resiliency. Gergely Orosz republished both on The Pragmatic Engineer with the author’s permission, so you can read them before you decide to buy.

The reason to read them is practical. In a client integration, the other end of the API call is usually outside your control. That leaves the decisions on your side: how long the timeout should be, how many retries to allow, and whether one failing service can slow down the others.

The book the author wished he had

On the book’s website, Roberto Vitillo is blunt: learning to build distributed systems is hard, especially when the systems are large. That is why he decided to write a book covering the fundamentals.

He describes it as the guide he wishes he had had when he started out. The second edition’s subtitle names its audience: what every developer should know about large distributed applications. An FDE writing an integration belongs squarely in that group.

Which edition should you buy?

Buy the second edition. The first came out in 2021 at 253 pages; its Leanpub page was last updated on November 8, 2021, and it is no longer on sale.

The second edition was published on February 23, 2022, at 344 pages, ISBN 9781838430214. That makes it 91 pages longer than the first.

What to read first before a client integration

You do not need to read the book in order. Start with chapters 27 and 28 on The Pragmatic Engineer, because they deal most directly with calling a system you do not control. If the writing suits you, buy the book and read the rest.

The other foundational sections can wait until you start designing systems of your own, not just plugging into a client’s.

Three ideas to take to the client site

The first is the rule that opens the section on timeouts: always set a timeout when making a network call. At a client, every outbound call needs a number you chose deliberately. Do not leave the decision to your HTTP library’s defaults.

The second is retries. The book is clear that a call being retryable does not mean it should be retried. It also warns that retrying at several layers of a dependency chain amplifies the total number of attempts.

To see how fast that adds up, take a hypothetical request that passes through three layers, each of which tries up to 3 times. When the last service slows down, a single user request can become 3 × 3 × 3 = 27 requests landing on the service that is already weakest.

The AWS Builders’ Library gives a similar calculation: if every layer retries independently, load on the database rises 243-fold. The same piece notes that when an overloaded system causes calls to time out, retrying can make the overload worse.

Retries therefore have to be designed for the whole call chain. Usually only one layer should retry, while the others fail fast, and the backoff should include jitter, a small random delay, so that clients do not all retry at the same moment.

The third is the circuit breaker. According to the book, its purpose is to let a subsystem fail without slowing down its callers. When the client’s API goes down, your service should trip the circuit and return an error immediately, rather than leaving every request hanging until it times out.

What those three ideas look like in a config file

Go back to the three-layer chain above, and say the last layer calls the client’s order-lookup API. The numbers below are a starting point for discussion with the client, not a universal standard; adjust them to the latency you actually measure.

Component Sample value Reason
Timeout 2 seconds per call An explicit number instead of the library default
Retry Only at the layer calling the client API, at most 2 retries, only on timeouts or 503 A 400 or 401 will still fail on retry
Backoff Wait 200 ms, then 400 ms, plus 0–100 ms of random delay Jitter so clients do not pile in at once
Circuit breaker Opens after 5 consecutive failures, tries again after 30 seconds If the client API is down, fail immediately
Layers 1 and 2 No retries; pass the error up Avoids multiplying attempts

Now redo the arithmetic. One user request produces at most 3 calls to the client’s API, not 27. In the worst case the user waits about 3 × 2 seconds + 0.6 seconds of backoff + up to 0.2 seconds of jitter, or roughly 6.8 seconds.

Once the circuit breaker is open, that request is rejected almost instantly instead of holding a connection for up to 6.8 seconds. If the call is a write, such as creating an order, ask the client whether the API guards against duplicates before you turn on retries, because a single retry could create two orders.

Turning the reading into evidence on your CV

If a job posting mentions integrating with client systems or running production services, that is where this reading is worth mentioning. On your CV, do not just write “API integration”. Say what timeout you set, which layer retries, and why you made those choices.

If you have no real project yet, write a small client wrapper around a public API, use the configuration in the table above, and log every failure. Add a README that explains each number, so an interviewer who opens the code can see how you think.

Clients will not remember which HTTP library you picked. They will remember that their system kept running on the day their own API went down.

Was this article useful?

Use with your AI assistantAsk Claude ↗Ask ChatGPT ↗
5 sources
Read next on the roadmap · Stage 1: FoundationsAndrew Ng's course for non-engineers is an FDE's client-training kitA deployment can be technically sound and still fail when client staff prompt AI as they did in 2022; this seven-hour course supplies the syllabus.