@Jona - Thanks for the question and using MS Q&A platform.
Yes, you are correct. The billing for Event Hubs is done on an hourly basis, and you will be billed for the highest throughput units (TU) that the system scaled to in that hour. In both of the scenarios you provided, the total billed TU is the same, which is 14 TU.
In order to optimize your cost, you should ensure that the capacity is set to the minimum required for your workload. If you are using auto-inflate to scale up, you should also consider using the REST API to scale down when the workload decreases.
To ensure that you are billed correctly, you should scale up before the start of the hour and scale down after the end of the hour. This will ensure that you are billed for the highest TU used in that hour.
Do you know what the SLA is for Event Hub REST API to respond? I'll let auto inflate to increase TU's. To decrease the compute before starting the next hour, I need to know how much it takes to Event Hub to scale down. Let's suppose I want to scale down and make and REST API call to Event Hub. If the API call accurs at certain hour in the minute 55, and it takes to Event Hub to scale down 7 minutes, that means the next hour will have its first two minutes with higher TU's before scale down at minute 2. This scenario impact negatively in the billing on that specific hour (since the max capacity ocurrs the first two minutes, and Azure will take this into account to charge that hour)??
The SLA for the Event Hubs REST API to respond is not explicitly mentioned in the documentation. However, the response time for the REST API will depend on various factors such as the current load on the system, the size of the Event Hub, and the number of partitions.
To ensure that you are not billed for higher TU's in the next hour, you should make sure that the scaling down process is completed before the start of the next hour. You can use the Azure Monitor metrics to monitor the scaling down process and ensure that it is completed before the start of the next hour.
You can also consider using the Azure Event Hubs SDK to programmatically manage the scaling of your Event Hub. The SDK provides a more efficient way to manage the scaling of your Event Hub and can help you avoid any potential issues with the REST API.
Hope this helps. Do let us know if you any further queries.
If this answers your query, do click Accept Answer
and Yes
for was this answer helpful. And, if you have any further query do let us know.