About Event Hub Billing Method

Jona 375 Reputation points
2024-04-27T04:51:38.29+00:00

Hi Everyone

According to the pricing page on Event Hub, one of the fact questions expresses the following:

User's image

To understand this well, I want you to help me understand this based on the next scenarios. Both scenarios tell us about changing the capactity of an Event Hub Standard (Auto Inflate and REST API). You can see a timeline from 0 hour to 5 hour, and also you can see when the capacity is changed (before ending certain hour or after begining the next)

Case 1

User's image

Billing per hour.

  • Hour 0: It started with 2 TU. 3 TU billed, since the capacity scaled up before finishing the hour.
  • Hour 1: It started with 3 TU. 3 TU billed, since the capacity scaled down before finishing the hour.
  • Hour 2: It started with 1 TU. 3 TU billed, since the capacity scaled up before finishing the hour.
  • Hour 3: It started with 3 TU. 3 TU billed, since the capacity scaled down before finishing the hour.
  • Hour 4: It started with 2 TU. 2 TU billed, since the capacity scaled down before finishing the hour.

14 TU billed at the end

Case 2

User's image

Billing per hour.

  • Hour 0: It started with 2 TU. 2 TU billed, since the capacity scaled up after starting the next hour.
  • Hour 1: It started with 3 TU. 3 TU billed, since the capacity scaled down before finishing the hour.
  • Hour 2: It started with 1 TU. 3 TU billed, since the capacity scaled up before finishing the hour.
  • Hour 3: It started with 3 TU. 3 TU billed, since the capacity scaled down after starting the next hour.
  • Hour 4: It started with 3 TU. 3 TU billed, since the capacity scaled down before finishing the hour.

14 TU billed at the end, as well.

I'm trying to understand the billing method, since I want to implement a mechanism of autoscaling on Event Hub. I'll enable auto inflate to scale up, however, y need to perform the scaling down action (REST API).

As far I understand, if I need certain hour to be billed with certain TU capacity, that capacity needs to be highest capacity inside that hour. That implies to scale before starting the mentioned hour and not to have a higher TU capacity in the same hour.

Regards

Jona

Azure Event Hubs
Azure Event Hubs
An Azure real-time data ingestion service.
560 questions
0 comments No comments
{count} votes

Accepted answer
  1. PRADEEPCHEEKATLA-MSFT 77,901 Reputation points Microsoft Employee
    2024-05-01T08:59:41.96+00:00

    @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.

    1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. SaravananGanesan-3177 1,665 Reputation points
    2024-04-28T17:40:08.61+00:00

    Hi Jona ,

    Let's analyze how scaling Event Hub capacity impacts billing, considering both increasing and decreasing throughput units (TUs) within hourly increments.

    Scenarios and Billing Implications:

    Scenario 1: This scenario demonstrates how the timing of scaling events affects hourly billing. Even with adjustments throughout the hour, you're billed for the highest capacity used within that timeframe.

    Scenario 2: Similar to scenario 1, the total billed TUs remain the same (14), but adjustments within the hour impact the specific cost for each hour.

    Key Takeaways:

    Billing Based on Peak Usage: To guarantee a specific hourly billing amount for TUs, ensure the highest capacity needed for that hour is set before the hour starts.

    Impact of Intra-hour Scaling: Scaling TUs up or down within an hour influences the billing for that specific hour.

    Optimizing Autoscaling:

    By considering these points, you can fine-tune your autoscaling mechanism's triggers and timing. This will help achieve a balance between optimal performance and cost-effectiveness.

    In essence:

    Hourly billing is based on the peak capacity used within that hour.

    Intra-hour scaling adjustments affect the specific cost for each hour.

    Strategize your autoscaling triggers and timing for optimal performance and cost efficiency.

    if you find my answer useful , upvote and accept my answer .

    Regards,

    Saravanan Ganesan