As a Cloud Solutions Architect, I have the pleasure of reviewing the architecture for many SaaS businesses. One of my favourite components that I look for in an architecture design is a messaging service such as an Azure Service Bus, Azure Event Grid, or any web-queue-worker architecture pattern.
Messaging systems/queues are great because of many benefits, including:
- Availability – the system is operational
- Reliability – the system can produce the expected result
- Scalability – resources can be added or removed based on demand
- Observability – understand the health and throughput of the system
- Extensibility – for future growth
- Loose coupling – interconnected systems can work independently
- Responsiveness – reduce latency to improve the user experience
The biggest objection I hear to messaging systems is that "our system must be real-time". Perhaps a mind shift change is required since many operations, as listed below, don't have to be real-time:
- Deleting an account
- Sending an email
- Processing an online order
- Generating a PDF itinerary or invoice
- Updating an address or subscription
Instead of saying that everything across the entire system must be done in real-time with strong consistency, moving some processes to an eventual consistency model will help to unlock the benefits listed above.
Messaging and queueing systems are everywhere and always have been. Let's look at ordering a coffee. You place your order at the counter, give them your name and make a payment.
How is that available and reliable? Even if the coffee shop is busy, you will still get your coffee because it is queued. If the coffee machine runs out of beans, orders will continue to queue up as the barista adds more beans, even if the machine is temporarily unavailable.
How is that scalable? One person doesn't have to do everything. You could have two baristas making coffee, two making Frappuccinos and a cashier taking orders and payments.
How is that observable? You can see your takeaway cup in the queue to observe the number of orders in front of you, the speed of processing the queue, and you can estimate your delivery time. Or you could do something else like read the news and wait for a call back when someone shouts your name.
How is that extensible? The business can be extended to provide additional services such as a chef making food. An order can now include hot beverages, cold beverages, and food.
How is that loosely coupled? The cashier taking the payment doesn't need to know how to make a coffee, and a barista doesn't need to know how to use the point-of-sale system.
How is that responsive? After making a payment, you get a confirmation that your order was taken, compared to waiting until your coffee is ready before receiving confirmation that your order was placed.
Just like ordering a coffee that will arrive eventually, why not apply the same principles to your business and unlock the benefits of a highly scalable and reliable solution?
In the next post, we will look at a real-world example of how a messaging solution capitalised on all these benefits.
You can read more about Jay Strydom here.