Safe Parallel Calls
In this article
- Read a task graph and say which steps can run at the same time and which must wait.
- Calculate the time a parallel version saves, as the sum of all steps minus the critical path.
- Write a failure rule for each parallel branch, so no failed call is ever dropped silently.
- Predict how long a large fan-out takes when a limit allows only a few calls in flight.
- Terms defined here: error aggregation.
Overview
A customer was charged twice this month and asks for money back. To answer, a support assistant must fetch two bills, find the refund page and issue the refund. Done one after another, that work takes 5.5 seconds, and most of that time the assistant is only waiting. Which of those calls could run at the same time, and what happens when one of them fails?
Brightline, a made-up home-internet provider, runs a support assistant on its website that answers customers and can look up an order, issue a refund of at most $50 and hand a conversation to a person. By the end you can split a task like this into steps that run together and steps that must wait, compute the time saved, write what happens when one step fails, and predict how long forty calls take when only ten may run at once.
Sign in to keep reading
The rest of this article opens with an account. An account also keeps your progress and quiz results on every device, and lets you follow news for up to five topics.
Still to read in this article
- Which steps must wait
- Timing the two versions
- Why the refund waits
- When one branch fails
- Collecting every result
- When fan-out meets a limit
- Putting it to work
- Common mistakes
- In production
- Sources
- Check yourself, 13 questions