The problem with tight runtime coupling and how to avoid it
You are receiving this email because you subscribed to microservices.io
On Wednesday, January 22, 2025 at 6pm, I'll be giving a talk in Melbourne Australia.The talk is: Enabling DevOps and Team Topologies: Architecting for Fast Flow. I hope to see you there.
Learn about the service collaboration patterns (Saga, API composition, etc) in my online, self-paced bootcamp. It's available for USD $95 - limited time early. Find out more and enroll.
I'm available for consulting and workshops at your organization. Learn more
A phone company's customer experience: a great example of undesirable tight runtime coupling
There are various types of undesirable coupling that can occur in a microservice architecture. Recently I wrote about how the The launch status check: a great example of loose design-time coupling. Another type of coupling that can occur is runtime coupling, which affects the runtime behavior of an application.
What is runtime coupling?
Runtime coupling is one of the reasons that the famous computer scientist Leslie Lamport once wrote:
A distributed system is one in which the failure of a computer you didn’t even know existed can render your own computer unusable.
It occurs in a microservice architecture when service X (e.g. the Order Service
) cannot respond to a request (e.g. POST /orders
) until another service Y (e.g. Customer Service
) has responded to it.
Tight runtime coupling increases latency and reduces availability. In the worst case, you can create an architecture that behaves like a string of Christmas tree lights: if one light goes out, they all go out. While tight runtime coupling is sometimes a worthwhile trade-off, such as in the API Composition pattern, the goal when designing a microservice architecture should usually be to minimize runtime coupling.
A real-world example of tight runtime coupling
A recent experience with my phone company illustrates the problem of tight runtime coupling. I wanted to change some features of my phone plan but was unable to do it online and so had to call ‘customer service’. I finally got through to a human who eventually put me on hold while talking with “other departments” who could make the changes.
After an hour on the phone, the customer service representative told me that they couldn’t make the changes because of an internal system problem and that the folks who could fix it didn’t work weekends and that I needed to call back on Monday. Essentially, the end-to-end flow ‘me -> customer service rep -> other departments’ is an example of tight runtime coupling. We all needed to be available at the same time in order to make the changes.
What’s even worse is that this was not the first time I requested these changes. After what I thought was a successful call, the changes were simply not made. The VP of Customer Service is certainly doing “a heckuva of job”.
A less runtime coupled customer experience
Ignoring the fact that I should have been able to make the changes online, what should a less runtime coupled customer experience look like? It’s actually quite simple. I should have been able to hang up after the customer service representative captured my request. The changes should have been made in the background, presumably by routing tickets to the various departments. They could have even phoned to notify me that the work was done.
Service collaboration patterns
Let’s now look at a version of the customer and order example that is less runtime coupled.
There are two service collaboration patterns that can reduce runtime coupling when implementing commands: the saga pattern and the command-side replica pattern.
The customer and order example needs implement the POST /orders
request using the saga pattern since it updates both the Customer Service
and the Order Service
.
The saga-based implementation of POST /orders
works as follows:
- Client makes a
POST /orders
request to theOrder Service
- The
Order Service
creates theOrder
inPENDING
state and responds to the with a 200 (or 202) response containing theOrder
ID - The
Order Service
andCustomer Service
exchange messages to complete the creation of theOrder
, which ends up in theACCEPTED
orREJECTED
state
Since the initial response no longer contains the operation’s ultimate outcome, the client can either periodically poll the Order Service
for the status of the Order
or the Order Service
can send a message to the client when the Order
is complete.
See the Saga pattern for the two different ways of implementing the Create Order Saga
.
Need help with accelerating software delivery?
I’m available to help your organization improve agility and competitiveness through better software architecture: training workshops, architecture reviews, etc.
Learn more about how I can help
Older messages
Reminder: Loose design-time coupling: part of the wiring of a winning organization
Friday, November 15, 2024
You are receiving this email because you subscribed to microservices.io Next week, I'll be teaching a public workshop in Milan. I hope you will enroll. Loose design-time coupling: part of the
Loose design-time coupling: part of the wiring of a winning organization
Tuesday, November 12, 2024
You are receiving this email because you subscribed to microservices.io Next week, I'll be teaching a public workshop in Milan. I hope you will enroll. Loose design-time coupling: part of the
Reducing insider trading in a microservice architecture
Wednesday, November 6, 2024
You are receiving this email because you subscribed to microservices.io In November, I'll be teaching public workshops in Berlin and Milan. I hope you will enroll. My service collaboration patterns
Reminder: The evolution of the Microservice Architecture pattern language
Thursday, October 31, 2024
You are receiving this email because you subscribed to microservices.io In November, I'll be teaching public workshops in Berlin and Milan. I hope you will enroll. My service collaboration patterns
The evolution of the Microservice Architecture pattern language
Tuesday, October 29, 2024
You are receiving this email because you subscribed to microservices.io In November, I'll be teaching public workshops in Berlin and Milan. I hope you will enroll. My service collaboration patterns
You Might Also Like
Say Goodbye to Type Erasure
Thursday, February 27, 2025
View in browser 🔖 Articles Practical Kotlin: When and How to Use inline reified, noinline, and crossinline Master Kotlin's inline reified functions to tackle type erasure and boost performance!
SRE Weekly Issue #464
Thursday, February 27, 2025
View on sreweekly.com A message from our sponsor, incident.io: For years, on-call has felt more like a burden than a solution. But modern teams are making a change. On Feb 26 at 1 PM EST, hear why—and
Hands On: New VS Code Insiders Build Creates Web Page from Image in Seconds, More
Thursday, February 27, 2025
Home | News | How To | Webcasts | Whitepapers | Advertise .NET Insight February 27, 2025 THIS ISSUE SPONSORED BY: ■ Visual Studio Live! Las Vegas: .NET Developer Training Conference ■ VSLive! 4-Day
Re: Tomorrow's Password Class: How to sign up!
Thursday, February 27, 2025
Hi there, Do you reuse passwords? Do you struggle to remember unique passwords across accounts? Have you tried setting up a password manager but found it to be a hassle? You might not realize how
Documenting Event-Driven Architecture with EventCatalog and David Boyne
Thursday, February 27, 2025
If you're wondering on how to document Event-Driven Architecture, or you don't know that you should, I have something for you. We discussed with David Boyne, why data governance practices and
wpmail.me issue#708
Thursday, February 27, 2025
wpMail.me wpmail.me issue#708 - The weekly WordPress newsletter. No spam, no nonsense. - February 27, 2025 Is this email not displaying correctly? View it in your browser. News & Articles Shaping
Hackers stole 1Password logins - here's how
Thursday, February 27, 2025
Amazon AI races ahead; Research agents; Smartwatch trade-in -- ZDNET ZDNET Tech Today - US February 27, 2025 thief stealing passwords Hackers stole this engineer's 1Password database. Could it
New Golang-Based Backdoor Uses Telegram Bot API for Evasive C2 Operations
Thursday, February 27, 2025
THN Daily Updates Newsletter cover ⚡ LIVE WEBINAR ➟ Building Resilient Identity: Reducing Security Debt in 2025 Attacks Evolve, So Can Your Defenses--Learn How to Mitigate Risk and Optimize Identity
Reminder: What developer productivity metrics actually measure
Thursday, February 27, 2025
You are receiving this email because you subscribed to microservices.io. Considering migrating a monolith to microservices? Struggling with the microservice architecture? I can help: architecture
⚡ THN Weekly Recap: Google Secrets Stolen, Windows Hack, New Crypto Scams & More
Thursday, February 27, 2025
From Google espionage to crypto scams, this week's Cyber Recap uncovers it all—read more now ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏