Runtime coupling occurs when one component’s failure causes another component to fail. For example, a service is runtime coupled to another when it cannot complete a request until the other service responds. The operation’s availability then depends on both services. section 4.4
Synchronous calls across service boundaries can reduce availability and increase latency. Long chains amplify the risk: a failure in one service can cause the entire request to fail. Runtime coupling differs from design-time and build-time coupling, which affect development, and infrastructure coupling, which arises from shared resources. section 1.3.4 section 4.1.1
Creating an order
The Order Service handles POST /orders by calling the Customer Service to validate the customer and reserve credit. It cannot respond until the Customer Service responds. If each service is 99.9% available, the example endpoint is approximately 99.8% available; its response time also includes both services’ response times. section 4.4.1
Figure 4.12 The Order Service cannot respond to the POST /orders request until the Customer Service has responded to the PUT /customers/{id} request. As a result, the availability of the POST /orders request is the product of the availability of the Order Service and the Customer Service
Follow the synchronous request path and its availability dependency. section 4.4.1
Trace requests end to end, including calls owned by other teams. A request that appears to depend on only a few services may depend on a larger cluster behind them, putting its availability target at risk. section 4.4.2
Choose a way to reduce coupling for the operation that matters:
- Merge subdomains into one service so the operation is local. This suits frequent operations needing high availability and low latency, but can produce oversized services or a monolith. section 4.4.3
- Move responsibilities between services. Moving credit management to the Order Service removes its credit-validation call, but makes customer creation span two services. section 4.4.3
- Use asynchronous messaging. The Order Service can send a validation message and return an HTTP response immediately; a later response lets it approve or reject the order. section 4.4.3
Minimize coupling where its operational cost matters, rather than eliminating it at any price. Some coupling is inevitable, and reducing it can shift complexity or dependencies to other operations. section 4.6 section 4.4.3
