AlgoViz

Synchronous communication

easy 24 min

In 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 hearSayBecause
The user must know nowSynchronous, with a time budgetThe next step needs the answer
Email, report, videoAccept and queueNobody needs the result in this request
Eight services for one pageParallel calls and partial resultsThe slowest path sets the wait
A dependency slowed downTimeout, bulkhead, breakerWaiting calls fill the pool
It must be atomicOne database, or a sagaHTTP 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.