Throughput Units (TUs) in Azure Event Hubs
Last Updated: October 26, 2023
Throughput Units (TUs) are the primary unit of compute provisioned for an Azure Event Hubs namespace. TUs provide a fixed amount of ingress and egress throughput for Event Hubs. They are the basis for billing and determine the capacity of your Event Hubs namespace.
Understanding and configuring TUs is crucial for managing the performance and cost of your Event Hubs. Event Hubs offers two tiers: the Basic tier and the Standard tier, each with different capabilities and pricing for TUs.
Standard Tier vs. Basic Tier TUs
The primary difference in how TUs are handled lies between the Standard and Basic tiers:
- Standard Tier: In the Standard tier, you explicitly purchase and provision TUs for your Event Hubs namespace. You can scale the number of TUs up or down as your needs change. Each TU provides a specific amount of dedicated ingress and egress capacity.
- Basic Tier: The Basic tier offers a simpler model where TUs are not directly provisioned. Instead, you pay for the number of ingress and egress events. The Basic tier has a lower ingress throughput limit compared to the Standard tier.
For scenarios requiring higher throughput, predictable performance, and more advanced features like Event Hubs Capture, the Standard tier with provisioned TUs is recommended.
Provisioning and Scaling TUs (Standard Tier)
When you create an Event Hubs namespace in the Standard tier, you must select the initial number of TUs. The minimum is typically 1 TU.
You can scale the number of TUs at any time through the Azure portal, Azure CLI, or Azure PowerShell. This allows you to adapt to fluctuating event volumes.
Scaling Process:
- Navigate to your Event Hubs namespace in the Azure portal.
- Under "Settings", select "Scale".
- Adjust the slider or enter the desired number of Throughput Units.
- Save the changes.
Scaling operations typically take a few minutes to complete. During scaling, your namespace remains available, though there might be a brief period of reduced performance.
TU Capacity and Limits
Each provisioned Throughput Unit in the Standard tier provides the following capacity:
- Ingress: 1 MB/sec or 1000 events/sec (whichever comes first)
- Egress: 2 MB/sec
These are the guarantees per TU. The total capacity of your namespace is the sum of the capacities of all provisioned TUs.
Monitoring TU Usage
It's essential to monitor your TU usage to ensure you have adequate capacity and to optimize costs. Azure Monitor provides metrics for Event Hubs, including:
- Ingress and Egress Throughput: Track the actual data transfer rates.
- Incoming and Outgoing Messages: Monitor the number of events processed.
- Throttled Requests: Identify if your TUs are saturated.
By setting up alerts based on these metrics, you can be proactively notified when your namespace is approaching its limits.
(Illustrative placeholder image of Azure Monitor metrics dashboard for Event Hubs)
Choosing the Right Number of TUs
The number of TUs you need depends on several factors:
- Expected Peak Ingress Rate: The maximum rate at which you expect to send events.
- Expected Peak Egress Rate: The maximum rate at which consumers will read events.
- Number of Partitions: While TUs are namespace-level, partition count can influence how load is distributed.
- Concurrency Requirements: High concurrency of publishers and consumers.
- Latency Sensitivity: Critical applications might require higher TUs for lower latency.
A common strategy is to provision TUs based on your expected peak load and then monitor usage. You can then scale up if consistently hitting limits or scale down if consistently underutilizing capacity.
Cost Implications
Throughput Units are a significant factor in the cost of an Azure Event Hubs Standard tier namespace. The cost is typically calculated per hour based on the number of TUs provisioned.
Ensure you consult the Azure Event Hubs pricing page for the most up-to-date pricing information for your region.
Summary
Throughput Units are the fundamental scaling and capacity metric for Azure Event Hubs, particularly in the Standard tier. By understanding their capacity, provisioning, scaling, and monitoring their usage, you can effectively manage the performance and cost of your event streaming solutions.