Azure Storage Queues, Azure Event Hubs, Azure Event Grids, and Azure Service Bus have many similar traits and functionality, but their differences make them unique to specific use cases. I find that I have to familiarize myself often with their respective functionalities and how we can use these services.
Azure Messaging services are popular architecture choices with use cases such as Microservice Communications, Event-Driven Architectures, and Real-Time Telemetry based applications. This blog post depicts some of the areas I will analyze when making an architecture decision around messaging or events in Azure.
The table below from Microsoft Learn is a very general depiction of when to use a specific messaging service in Azure. Microsoft Learn is always my first stop when looking for documentation around Azure and resources within.
Unfortunately, it never can be this simple and the "devil is in the details" There are always other technical and business factors to ensure the solution aligns with your application's requirements. Below are some other considerations I factor in my architecture decisions.
Throughput refers to the number of messages or events being processes. Applications with higher message volumes require a services with no bottlenecks.
- Azure Storage Queue supports moderate throughput for simple workloads
- Azure Service Bus is for medium to high throughput
- Azure Event Hubs is designed for high-throughput workloads (i.e. millions of events per second)
Latency refers to the time taken for a message to travel from sender to receiver. This metric is critical for real-time applications (i.e. chat systems, live dashboard, or streaming analytics).
- Azure Event Grid is very low latency (i.e. milliseconds)
- Azure Service Bus has moderate latency
- Azure Storage Queue has higher levels of latency
Message Size refers to the maximum payload size of service. This characteristic has determined my architectural decision multiple times.
- Azure Storage Queue support up to 64Kb
- Azure Service Bus support 256Kb or 1Mb Premium Tier
- Azure Event Hub support 1Mb per event
Scalability is the services capacity to handle increasing workloads and ensures that your application is responsive under heavy loads.
- Azure Event Hubs scale horizontally with "partitions"
- Azure Event Grid automatically scales
- Azure Service Bus can scale with using the Premiums tiers and partitioned entries
Reliability metric is how we ensure that messages are delivered without being lost. This metric is critical for application.
- Azure Service Bus has "at-least-once" delivery, deduplication, and dead-lettering for guaranteed delivery.
- Azure Event Grid ensures "at-lead-once" delivery with retries
- Azure Queue Storage offers "at-least-once" delivery without deduplication functionality.