Synchronous communication
easy 24 minIn synchronous communication the caller sends a request and needs the response before that piece of work can go on.
When it comes up
The moments this idea belongs in a design interview, and the moments it does not.
Signals
When to bring it up
| You hear | Say | Because |
|---|---|---|
| The user must know now | Synchronous, with a time budget | The next step needs the answer |
| Email, report, video | Accept and queue | Nobody needs the result in this request |
| Eight services for one page | Parallel calls and partial results | The slowest path sets the wait |
| A dependency slowed down | Timeout, bulkhead, breaker | Waiting calls fill the pool |
| It must be atomic | One database, or a saga | HTTP calls are not a transaction |
Options
Compare your moves
A product page needs price, stock, reviews and recommendations from four services. How do you call them?
BreaksOne after another
- How
- Call price, then stock, then reviews, then recommendations, with no timeout.
- Limit
- The delays add up, and slow recommendations block the whole page.
- Choose when
- Never on a page people wait for.
WorksAll in parallel
- How
- Start the four calls together and wait for all.
- Limit
- The slowest sets the time, and one failure can still fail the page.
- Choose when
- All four are required.
StrongParallel with budgets and fallbacks
- How
- Price and stock are required. Reviews and recommendations have a short limit and are left out when late.
- Limit
- The page may be incomplete, so the product must agree to that.
- Choose when
- Some parts are optional, as on most pages.