Synchronous and Asynchronous Processing
A distinction between waiting for work to finish in the current interaction and allowing it to complete independently later.
Download Markdown (.md)Soroush’s Product Wiki · https://wiki.soroush.uk/topic/synchronous-and-asynchronous-processing/
01What it means
Synchronous processing makes a caller wait for an operation's result before it can continue along that path. Asynchronous processing accepts or starts work and allows the caller to continue before final completion, with the outcome delivered through polling, notification, a callback, a message, or later retrieval. Asynchronous does not necessarily mean parallel.[1][2]
- Synchronous
- Request → wait → final resultBound the wait with a timeout
- Asynchronous
- Request → accepted → later resultExpose job identity, progress, failure, and cancellation
Asynchronous processing changes when completion is observed; it does not guarantee parallel execution.
02Why it matters
The choice shapes product feedback, latency, reliability, and system coupling. Synchronous flows offer immediate certainty but hold resources and propagate delays; asynchronous flows can absorb slow work and failures but require explicit pending, success, failure, and recovery states.
03When to use it
Use synchronous processing when the next user or system action requires an immediate, bounded result. Use asynchronous processing for long-running, bursty, retryable, or independently scalable work. Do not add asynchrony when its state management and operational cost exceed the latency benefit.
04How it works
- Identify whether the caller needs final completion or only durable acceptance before proceeding.
- For synchronous work, bound the wait with a timeout and return a definitive result or error.
- For asynchronous work, persist a job or message and return an identifier and pending state.
- Process the work independently with retry, idempotency, and capacity controls.
- Communicate completion, failure, progress, and cancellation through an appropriate channel.
- Measure end-to-end completion time rather than only the initial acknowledgement.
05A practical example
Account validation stays synchronous because signup cannot continue without it. Exporting a year's activity becomes asynchronous: the API returns a job ID, the interface shows progress, and a notification links to the file after a worker finishes.
06Where it breaks
Synchronous chains can suffer cascading latency and failure. Asynchronous workflows introduce eventual consistency, duplicate work, delayed feedback, and more complex testing and support. Moving work to a queue does not remove its capacity cost.
Common mistakes
- Calling work asynchronous merely because its implementation uses multiple threads.
- Returning success for asynchronous work without distinguishing acceptance from completion.
- Keeping long external calls synchronous without deadlines or cancellation.
- Adding a queue while omitting user-visible progress and terminal failure handling.
07Sources
- Synchronous and Asynchronous RequestsWeb APIs — MDN · Technical documentationSynchronous and Asynchronous Requests
- Asynchronous CommunicationAWS Prescriptive Guidance · Institutional architecture guideAsynchronous Communication