liveBook · Manning

Distributed operation

As explained in Microservices Patterns, Second Edition

A distributed operation is an application operation whose execution spans multiple services and requires inter-service communication.

A distributed operation is an application operation that spans multiple services and requires them to communicate. Unlike a local operation that can call classes within one transaction, it crosses process and transaction boundaries. Some operations will span services even when the most important ones are kept local. section 7.5.1

Designing across those boundaries introduces three recurring challenges:

  • Network communication costs time and bandwidth. Assess its impact against the operation’s service level objective, rather than assuming that every network call is unacceptable. section 7.5.1
  • Synchronous calls create runtime coupling. An unavailable service can affect its callers, increasing latency or causing failures to cascade. section 1.3.4
  • Transaction boundaries complicate consistency across services. Distributed operations may need to use eventual consistency instead of a single local transaction. section 1.3.4 section 7.5.1

Creating an order

A createOrder() operation can span an Order Service and a Customer Service. Its design must account for the Customer Service being unavailable and for the cost and failure modes of communication between services. section 1.3.4

Figure 7.9 Distributed transactions are replaced with a sequence of local transactions coordinated by asynchronous messaging
2PC BASE

A sequence of local transactions coordinated by asynchronous messaging is one way to structure work across transaction boundaries. section 7.5.1

Use operation requirements when drawing service boundaries. Keeping an operation local can avoid distribution costs, but may trade away benefits such as team autonomy. Conversely, splitting services without managing their coupling risks a distributed monolith. section 7.2 section 7.5.1 section 7.7

How Microservices Patterns, Second Edition covers it

How deep it goes
Explains network costs, runtime coupling and eventual consistency, and illustrates coordination through local transactions and asynchronous messaging.
Examples
Uses createOrder() across Order and Customer services to illustrate communication and service unavailability.
What you can do after
Evaluate service boundaries against operation latency objectives, failure risks and the benefits of distribution.
How it connects
Connects microservices with service boundaries, runtime coupling, eventual consistency and asynchronous messaging.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Microservices Patterns, Second Edition. The section links point to the parts of the book it draws on.