Architecture

Choose Between Synchronous and Asynchronous Workflows

Decide which operations should complete in the request and which should move to background processing.

Synchronous processing is easier to reason about because the caller receives a direct result. Asynchronous processing can improve responsiveness and isolate slow work, but it introduces queues, retries, monitoring, and eventual consistency.

Keep immediate decisions synchronous

Validation, authorization, and decisions needed to respond to the user generally belong in the request path. A user should receive a clear result when an operation cannot be accepted.

Move suitable work to background jobs

Email delivery, large exports, media processing, bulk imports, and expensive report generation are common candidates. Return a job identifier and a status endpoint when users need to track progress.

Design the user experience

Asynchronous does not mean invisible. Show queued, running, completed, and failed states. Provide safe retry behavior and explain whether a job can be cancelled.

Account for consistency

A background job may finish later than expected. Consumers must tolerate delayed results and repeated delivery. Do not move a critical authorization decision into a job that runs after the request without revalidating the relevant permissions and state.

Checklist

  • Keep request-critical validation synchronous.
  • Move long-running work to durable jobs.
  • Expose job status and failure outcomes.
  • Make retries safe and idempotent.
  • Monitor queue age and worker health.
Share this page Help other developers discover this resource.