liveBook · Manning

Synchronous call

As explained in Grokking Software Architecture

A synchronous operation blocks the initiating participant until the requested processing completes and a result is available.

Imagine ordering a latte and waiting at the counter while the cashier makes it before taking the next order. A synchronous call works similarly: the caller waits until the requested operation completes and a response is available. section 7.3.2 section 6.2.3

In a client-server exchange, the client sends a request, the server processes it and returns a response, and the client can then use the result. For example, GET /user/123 might return 200 OK with a user’s name, ready for the client to display. section 6.2.3

The handshake and the work are not necessarily the same thing. A synchronous request can return a receipt such as 202 Accepted while the actual work continues asynchronously. The caller stops waiting for that request; the eventual result can arrive through a callback or polling. section 6.2.3

An order with a slow shipping label

Suppose an Order API checks inventory, charges a card, and prints a shipping label in sequence. If each call takes 200 ms, the customer waits 600 ms plus network time. If shipping is down, the order cannot finish even when stock and payment are fine. One alternative is to check stock and charge synchronously, then queue the label for later. section 6.8.4

Figure 6.14 Avoiding the Distributed Monolith: Breaking a fragile synchronous chain with an asynchronous queue ensures critical tasks succeed even if non-critical services fail.

The diagram contrasts a fragile synchronous chain with a queue for later shipping work. section 6.8.4

Keep work synchronous when the caller needs its result before proceeding; consider deferring work that can finish later. Deferral introduces a gap before the result is available, so decide where eventual consistency is acceptable. For network calls that remain, plan for failures with timeouts, retries, and circuit breakers. section 7.3.2 section 12.6.1

How Grokking Software Architecture covers it

How deep it goes
Explains the request-response cycle and illustrates latency and availability consequences of sequential service calls.
Examples
Uses a coffee-shop queue and an order workflow involving inventory, payment, and shipping.
What you can do after
Evaluate which work needs an immediate result and which can be queued for later processing.
How it connects
Connects asynchronous communication, queues, eventual consistency, temporal coupling, and distributed monoliths.

Also explained in

Compare how 12 books explain synchronous call →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Grokking Software Architecture. The section links point to the parts of the book it draws on.