Graph
Request-Response Pattern

🔁Request-Response Pattern

NEW

A synchronous communication pattern where a client sends a request to a service and waits for a response.

DESCRIPTION

The request-response pattern underpins client-server interactions, most notably HTTP and gRPC. A requester issues a request and blocks or awaits a response from the provider. It offers straightforward control flow and error handling. Drawbacks include tighter coupling, potential cascading latency, and backpressure under load. Resilience patterns like circuit breakers and retries mitigate risks. Request-response suits CRUD APIs, command operations, and interactive user flows. It complements asynchronous messaging when combined thoughtfully.

ALTERNATIVE DEFINITIONS

Wikipedia

Request–response is a message exchange pattern in which a requestor sends a request message and waits for a response message.

Emphasizes waiting for a correlated response in a messaging exchange.

Source

IETF

The Hypertext Transfer Protocol (HTTP) is a stateless request-response protocol in the client-server computing model.

Anchors the pattern within HTTP’s client-server model and statelessness.

Source

Microsoft Learn

Use an asynchronous messaging system to decouple request and response processing for systems that require a response.

Shows a variation that decouples the pattern using asynchronous messaging.

Source

REST gRPC Synchronous Communication Circuit Breaker Pattern Service Mesh Timeout Retry with Backoff Idempotency Queue

COMPETING TERMS

Event-Driven Architecture

KNOWLEDGE AREAS

Software Engineering Data Integration & Interoperability Cloud Real-time & Streaming Data

TARGET AUDIENCE

Software Developer DevOps Engineer Cloud Architect Data Engineer Data Architect

EXTERNAL SOURCES

  • Wikipedia - Request–response
  • IETF - HTTP semantics request-response
  • gRPC - gRPC request/response RPC model
  • Microsoft - Resiliency for request-response
  • NGINX - Reverse proxying request-response

TOP QUESTIONS

When should you use the Request-Response Pattern?

Use it for operations requiring immediate confirmation, such as CRUD APIs and user-initiated actions. It’s suitable when latency is low and tight coordination is needed.

Category: Advice

What are the risks of the Request-Response Pattern?

Coupling and synchronous waits can cause cascading failures under load. Timeouts and retries must be tuned. Overuse can reduce resilience in distributed systems.

Category: Risks

How is the Request-Response Pattern typically implemented?

Common implementations include HTTP/REST and gRPC. Clients send requests and await replies. Infrastructure adds load balancers, service meshes, and tracing.

Category: Management

What is a common misunderstanding about the Request-Response Pattern?

People assume it must block threads. With async I/O, clients can await non-blockingly, preserving the request-response semantics without tying up resources.

Category: Misunderstanding

What are common mistakes with the Request-Response Pattern?

Missing timeouts and circuit breakers causes cascading failures. Ignoring idempotency makes retries dangerous. Lack of backoff amplifies thundering herds.

Category: Mistakes

What competes with the Request-Response Pattern?

Event-driven architectures compete by offering asynchronous decoupling. They suit high-throughput and loosely coupled workflows.

Category: Alternatives

How do you make Request-Response resilient?

Apply timeouts, retries with backoff, circuit breakers, and bulkheads. Use observability—traces, logs, metrics—to diagnose latency and errors.

Category: Requirements

What is a good analogy for the Request-Response Pattern?

It’s like a phone call: you dial (request) and wait for the person to answer (response).

Category: Example

What is currently a hot topic around Request-Response Pattern?

Using gRPC for efficient binary request-response and integrating service meshes for retries and timeouts are popular trends.

Category: Topic