Blog Post

Messaging on Azure Blog
2 MIN READ

How exactly does Event Hubs Throttling Work?

AshishChhabria's avatar
Mar 15, 2019
First published on on Jul 16, 2015

This is a good question and it comes up fairly often. Event Hubs provides capacity through a concept called a Throughput Unit (TU). A TU entitles you to a maximum of 1000 events per second or 1 MB per second of ingress (traffic to Event Hubs) and double that amount in egress - traffic out of Event Hubs. This number is global for the namespace and shared across all Event Hubs in that namespace. You can change your TU setting in the Azure portal and select a value between 1 and 20. TUs are charged per hour, but the increase is effective almost immediately. If you need more than 20 TUs you can issue a support ticket in the Azure portal.



So what happens when you hit this limit, which by default is 1 TU? We throttle you. Throttling means we will deny request. We do this with a fairness based approach so that all of your senders or readers should get an even amount of throttling based on the traffic they send. How we do this is we keep a short window running total of your traffic. When it exceeds your purchased TU limit we will throttle. For .NET clients this means a ServerBusyException. This will happen both on senders (producers) and readers (consumers).



When you receive the ServerBusyException take a look at the Detail property to see more information. It will have a more detailed message and an error code. An error code of 50002 means you are being throttled.



You should log these so you can know when you need to increase your TUs.



For a complete list of messaging exceptions that Service Bus may throw see: Appendix: Messaging Exceptions on MSDN.

Updated Mar 15, 2019
Version 2.0
  • Michael_Olsson's avatar
    Michael_Olsson
    Copper Contributor

    Does somebody know what happens when Logic Apps have a very high load and these all Log using the Diagnostics feature to the same Event Hub?

     

    I'm missing Records from the Event Hub, and my concern is that Logic Apps does not bother if the Event Hub actually receives the logging, or not in order not to disturb the processing, maybe the ServerBusyException is simply ignored thus losing data.

     

    Does anyone know how Logic Apps behave under these conditions?  Logging in to Storage may overcome this problem, but that is out of topic.