CLOUD CONCEPT

Asynchronous Communication

Asynchronous communication lets a sender submit work or information without waiting for the receiver to finish processing it.

Cloud Concepts Hub →

What is Asynchronous Communication

Applications exchange messages, events, or job requests and obtain results separately through polling, callbacks, or notifications. This decouples components and helps absorb traffic bursts, but requires explicit handling of delivery failures, duplicate processing, and delayed results.

Asynchronous communication separates submitting work from completing it. In a synchronous interaction, the caller waits for a response containing the outcome before continuing the dependent operation. In an asynchronous interaction, the caller can receive an acknowledgment or job identifier and continue other work while processing happens independently. An acknowledgment of acceptance is not confirmation that the business operation succeeded.

Cloud applications commonly implement this pattern with queues, event buses, background workers, and job-oriented APIs. For example, a document-summarization API can store an uploaded document, enqueue its storage reference, and return an HTTP 202 Accepted response with a job identifier and status URL. A worker retrieves the document, invokes a foundation model, stores the summary, and updates the job status. The client later retrieves the result or receives a completion notification. Large documents and sensitive prompts generally belong in access-controlled storage rather than directly in messages.

For generative AI workloads, asynchronous communication is useful when model inference, document ingestion, embedding generation, or evaluation takes longer than an interactive request should remain open. A queue absorbs bursts while worker concurrency is limited to respect model request quotas, token quotas, and vector database capacity. This improves resource utilization and reduces failures caused by overloaded downstream systems. It does not make an individual model generate tokens faster, and queueing can increase end-to-end completion time.

Dependency analysis determines where concurrency helps. Independent retrieval queries or independent model evaluations can run concurrently, subject to resource limits. However, a retrieval-augmented generation workflow usually must obtain relevant context before constructing the final grounded prompt. Making those dependent stages asynchronous does not remove that dependency. Optimize vector queries separately through appropriate metadata filters, retrieval counts, index configuration, and connection reuse. For interactive answers, response streaming can improve time to first visible output; streaming is not equivalent to submitting a durable background job.

Profile the complete workflow before changing communication patterns. Propagate correlation identifiers across the submission API, message transport, worker, retrieval calls, and inference calls. Measure acceptance latency, queue age, retrieval latency, model time to first token where applicable, generation duration, and total job completion latency. Compare prompt and completion token counts with inference duration, and examine percentile latencies rather than averages alone. A fast submission endpoint can conceal a growing backlog, so acceptance latency is not a sufficient performance measure.

Reliability requires explicit delivery and processing semantics. Many messaging systems deliver at least once, so workers must tolerate duplicate messages through idempotency keys, conditional writes, or durable job-state checks. Set processing leases or visibility timeouts to accommodate expected work, extend them when supported, and acknowledge messages only after required results are durably recorded. Use bounded retries with exponential backoff and jitter, and isolate repeatedly failing messages in a dead-letter queue. Model calls can incur duplicate charges after ambiguous failures even when result storage is idempotent.

The main trade-offs are operational complexity, eventual consistency, and delayed failure visibility. Define job states, expiration, cancellation behavior, and result retention explicitly. Apply backpressure through bounded concurrency and admission controls rather than allowing an unlimited backlog. A nonblocking SDK call alone does not provide durable delivery, and a queue does not guarantee global ordering or exactly-once business effects. Choose asynchronous communication when deferred completion is acceptable, not simply because it is assumed to be faster.

Key aspects of Asynchronous Communication

Effective asynchronous communication combines decoupled execution with explicit completion tracking, bounded concurrency, safe retries, and end-to-end latency measurement.

Separate acceptance from completion

Return an acknowledgment or job identifier after work is accepted, and expose completion through a status endpoint, callback, or notification. Keep accepted, running, succeeded, and failed states distinct.

Decoupled producers and consumers

Producers submit work without requiring consumers to finish immediately. Durable messaging can allow processing to resume after consumer outages, subject to retention limits.

Controlled concurrency and backpressure

Bound worker concurrency according to model quotas, token throughput, and retrieval-system capacity. Monitor backlog age and reject or defer new submissions when completion objectives cannot be met.

Idempotent processing and bounded retries

Assume duplicate delivery or ambiguous outcomes are possible and make repeated processing safe. Combine durable job-state checks with bounded retries and dead-letter handling.

Dependency-aware parallelism

Overlap independent retrieval or inference operations, but preserve dependencies such as retrieving context before generating a grounded answer. Additional concurrency can worsen throttling and tail latency if downstream capacity is fixed.

End-to-end observability

Trace each job across submission, transport, retrieval, inference, and result delivery. Measure queue delay and total completion latency separately from API acceptance time.

Cloud services for Asynchronous Communication

An application can enqueue a document-processing job in Amazon SQS, use AWS Lambda for bounded background processing within its execution limits, and invoke Amazon Bedrock for generation. AWS Step Functions can coordinate retrieval, inference, and result persistence when the workflow needs explicit state and recovery. Amazon EventBridge can route completion events to downstream consumers. These services address different responsibilities: buffering, execution, orchestration, inference, and event routing. Configure each integration's delivery and retry behavior, propagate job identifiers throughout the workflow, and measure queue delay alongside retrieval and model latency.

Amazon EventBridge image Amazon EventBridge

Routes events to interested targets, allowing producers to announce changes without directly coordinating every consumer. It suits document-ingestion triggers and job-completion events, while target retry policies and dead-letter queues help handle delivery failures.

Open Amazon EventBridge →
AWS Lambda image AWS Lambda

Runs background handlers through asynchronous invocation or event source integrations such as SQS. SQS-triggered execution uses a polling integration rather than Lambda's asynchronous invocation queue, so retry and failure behavior must be configured for the actual integration.

Open AWS Lambda →
AWS Step Functions image AWS Step Functions

Coordinates multi-stage workflows with explicit state, retries, parallel branches, and error handling. Supported job-run and callback integration patterns let workflows coordinate longer-running work without requiring the original client connection to remain open.

Open AWS Step Functions →
Amazon Bedrock

Workers can invoke foundation models through Amazon Bedrock as part of an asynchronous application workflow. For supported models, its asynchronous inference API accepts jobs whose status can be checked later and writes output to Amazon S3; availability and request formats depend on the model.

Open Amazon Bedrock →