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
💻 Issue 444 - Check Out My New CV as a Full Stack .NET Developer!
Thursday, January 9, 2025
This week's Awesome .NET Weekly Read this email on the Web The Awesome .NET Weekly Issue » 444 Release Date Jan 09, 2025 Your weekly report of the most popular .NET news, articles and projects
💎 Issue 451 - Useful things you can do with Rails console
Thursday, January 9, 2025
This week's Awesome Ruby Newsletter Read this email on the Web The Awesome Ruby Newsletter Issue » 451 Release Date Jan 09, 2025 Your weekly report of the most popular Ruby news, articles and
💻 Issue 451 - The best way to iterate over a large array without blocking the main thread
Thursday, January 9, 2025
This week's Awesome JavaScript Weekly Read this email on the Web The Awesome JavaScript Weekly Issue » 451 Release Date Jan 09, 2025 Your weekly report of the most popular JavaScript news, articles
📱 Issue 445 - 🚀 Your Go-To List of 25 Swift Tools and Libraries for Any Project
Thursday, January 9, 2025
This week's Awesome iOS Weekly Read this email on the Web The Awesome iOS Weekly Issue » 445 Release Date Jan 09, 2025 Your weekly report of the most popular iOS news, articles and projects Popular
💻 Issue 369 - 17 Tips from a Senior React Developer
Thursday, January 9, 2025
This week's Awesome React Weekly Read this email on the Web The Awesome React Weekly Issue » 369 Release Date Jan 09, 2025 Your weekly report of the most popular React news, articles and projects
💻 Issue 451 - Mastering Express.js: A Deep Dive
Thursday, January 9, 2025
This week's Awesome Node.js Weekly Read this email on the Web The Awesome Node.js Weekly Issue » 451 Release Date Jan 09, 2025 Your weekly report of the most popular Node.js news, articles and
📱 Issue 448 - The Swift Runtime: Your Silent Partner
Thursday, January 9, 2025
This week's Awesome Swift Weekly Read this email on the Web The Awesome Swift Weekly Issue » 448 Release Date Jan 09, 2025 Your weekly report of the most popular Swift news, articles and projects
💻 Issue 446 - Great things about Rust that aren't just performance
Thursday, January 9, 2025
This week's Awesome Rust Weekly Read this email on the Web The Awesome Rust Weekly Issue » 446 Release Date Jan 09, 2025 Your weekly report of the most popular Rust news, articles and projects
JSK Daily for Jan 9, 2025
Thursday, January 9, 2025
JSK Daily for Jan 9, 2025 View this email in your browser A community curated daily e-mail of JavaScript news Advanced Query Building Techniques in Angular: Queries with Different Connectors The Query
📲 Make Your iPhone Action Button Do Different Things in Each App — How Web Apps Make Switching to Linux Easier
Thursday, January 9, 2025
Also: You'll Love This Microsoft Word Repeating Trick, and More! How-To Geek Logo January 9, 2025 Did You Know Despite the tight association between sweet tea and the American South, sweet tea was