I'm unsure if I should use Azure Event Hub or Azure Event Grid

Alfonso Hernandez 20 Reputation points Microsoft Employee
2024-08-14T00:55:15.85+00:00

I've been digging into both products Azure Event Grid and Azure Event Hub to learn which tool suits better in my use case. I'll share a brief of my use case, hopefully that makes some clarity around this dilemma I have:

Use case

When user's state change, the service needs to publish an event saying that the user's state has changed, it'll include a few properties in the event payload, such as timestamp, the reason why state changed, etc. - I'm dropping below a drafted schema. There will be a few consumers of these events, each consumer has its own logic for processing the events, and ALL of them should receive the same event so they do their stuff. I expect to have around 40k of events to be published in average per day, there can be days where 80k events can be published as well... at the end of the day I'd say there will be less than 100k events to be published in a day.

Event schema

{ 
	"userId": "", 
	"reason": "", 
	"timestamp": "", 
	"creationDate": "", 
	"secondaryId": ""
} 

I've seeing that Azure Event Hub is really good at handling large amount of data (millions of events per second), though my use case doesn't sound too much data to handle in the first place. I want to keep pull delivery, so assuming I want to use Azure Event Grid, I'd create a Queue event subscription so consumers can pull at their own pace. Azure Event Hub seems to be in the market for a while whereas Azure Event Grid not (in particular this Queue event subscription), so maybe Azure Event Hub is more mature in the space - please keep me honest here, I used this blog as source: https://yourazurecoach.com/2023/12/22/azure-service-bus-vs-event-grid-pull-delivery/ . Any thoughts, guidance will be highly appreciated. I can also provide more information if needed.

Thank you in advance!

Azure Event Hubs
Azure Event Hubs
An Azure real-time data ingestion service.
627 questions
Azure Event Grid
Azure Event Grid
An Azure event routing service designed for high availability, consistent performance, and dynamic scale.
376 questions
0 comments No comments
{count} votes

Accepted answer
  1. Bhargava-MSFT 30,816 Reputation points Microsoft Employee
    2024-08-14T17:08:49.5066667+00:00

    Hello Alfonso Hernandez

    Azure Event Grid vs. Azure Event Hub

    Azure Event Grid is a fully managed event routing service that simplifies the development of event-based applications. It provides a low-latency, high-throughput infrastructure for routing events from any source to any destination. Event Grid supports both push-based and pull-based delivery mechanisms. Push-based delivery sends events to subscribers as soon as they are published, while pull-based delivery allows subscribers to pull events from a queue or storage account at their own pace

    Azure Event Hub, on the other hand, is a highly scalable data streaming platform capable of handling millions of events per second. It provides a publish-subscribe model for streaming data, where publishers send events to a hub and subscribers consume events from the hub. Event Hub supports both push-based and pull-based delivery mechanisms, making it versatile for different use cases

    Key Differences and Considerations

    1. Event Routing and Management:
      • Event Grid: Ideal for event-based architectures with a need for flexible event routing. It supports various event sources and handlers, making it a versatile option for event-driven applications
      • Event Hub: Designed for high-throughput data streaming and real-time processing. It is well-suited for scenarios requiring ingestion and processing of large volumes of data
    2. Delivery Mechanisms:
      • Event Grid: Supports both push-based and pull-based delivery. The Queue event subscription feature allows consumers to pull events at their own pace, which can be beneficial for maintaining control over the event processing rate
      • Event Hub: Also supports both push-based and pull-based delivery, providing flexibility in how events are consumed
    3. Scalability and Performance:
      • Event Grid: Provides a low-latency, high-throughput infrastructure suitable for routing events efficiently. It is designed to handle a moderate volume of events
      • Event Hub: Capable of handling millions of events per second, making it suitable for high-throughput scenarios
    4. Maturity and Features:
      • Event Grid: A newer service that is rapidly evolving and adding new features. It is designed to integrate seamlessly with other Azure services
      • Event Hub: A more mature service with a longer presence in the market. It offers a robust set of features and integrations

    Recommendations

    Based on your use case, where you expect to publish up to 100k events per day and prefer pull delivery, Azure Event Grid with a Queue event subscription could be a good fit. This will allow your consumers to pull events at their own pace, and the low volume of events should be easily handled by Event Grid

    However, if you anticipate a need for higher throughput or real-time processing in the future, Azure Event Hub might be a more scalable option. It provides the flexibility to handle larger volumes of data and offers a mature set of features for data streaming

    reference documents:
    https://azure.microsoft.com/en-us/blog/events-data-points-and-messages-choosing-the-right-azure-messaging-service-for-your-data/ https://video2.skills-academy.com/en-us/azure/service-bus-messaging/compare-messaging-services https://yourazurecoach.com/2023/12/22/azure-service-bus-vs-event-grid-pull-delivery/

    https://video2.skills-academy.com/en-us/azure/service-bus-messaging/compare-messaging-services

    I hope this answers your question.

    If this answers your question, please consider accepting the answer by hitting the Accept answer and up-vote as it helps the community look for answers to similar questions.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.