Synchronous vs asynchronous communication
What it costs to make the caller wait, and what you give up when you stop making it wait.
15 min readThe cost of waiting
In a synchronous call the caller blocks until the callee answers. That is simple to reason about, but the costs compound along a chain. Latencies add: an API that calls three services in sequence, each with a 40 ms median, cannot answer in less than 120 ms. Availabilities multiply: four dependencies at 99.9% each leave the whole request at about 99.6%. Tails get worse with fan-out: if a request touches ten services and each is slow 1% of the time, about 10% of requests (1 - 0.99^10) hit at least one slow response. Every synchronous dependency you add makes your own latency and availability worse.
What asynchronous buys
Asynchronous communication puts a durable buffer (a queue or a log) between the caller and the work. The caller hands off the message, gets an acknowledgement in a few milliseconds, and moves on.
- Temporal decoupling: the consumer can be down for an hour and nothing is lost; it catches up when it returns
- Load levelling: a burst of 5 000 jobs per second against workers that handle 1 000 becomes a backlog drained over minutes, not a wall of errors
- Independent scaling: add workers without touching the API
- Failure isolation: a slow email provider slows email, not checkout
What it costs
Nothing is free. The user no longer sees the result immediately, so the system is eventually consistent and the UI must say 'processing' honestly. Messages can be duplicated, delayed or reordered, and the consumer must cope with all three. Debugging gets harder because one user action becomes several hops with gaps between them, so you need correlation IDs and tracing across the queue. And you now operate more infrastructure: a broker to run, backlogs to monitor and messages that fail to park somewhere.
Choosing per interaction
The decision is per edge, not per system. Ask one question: does the caller need the result to continue? If yes (an authorisation check, a price lookup, reading a profile) keep it synchronous, with a timeout. If no (sending an email, generating a thumbnail, updating a search index, counting a click) make it asynchronous. For long jobs the user started, return 202 Accepted with a job ID, then let the client poll a status endpoint or receive a push. On the SystCode canvas, drawing a queue between the API and a slow component ends the synchronous path at the queue's acknowledgement.
Key takeaways
- Synchronous chains add latency and multiply failure probability
- Asynchronous hand-offs buy decoupling, load levelling and isolation at the price of eventual consistency
- Decide per interaction: keep it synchronous only if the caller needs the answer to continue
- Long user-initiated jobs return 202 Accepted with a job ID and report progress separately
Sign in to track lessons and earn badges.