Azure Service Bus billing, vs metrics, vs current monthly cost

Recently we got a few questions on how Azure Service Bus billing works, hence a short summary. First of all a disclaimer though: This blog is just a high level summary. The actual information about billing is on the regarding official documentation pages. The questions may come in three different categories:

  1. Understand how you are billed.
  2. Predict your bill.
  3. See your current monthly cost.

Understand how you are billed

For our Standard Tier you are in general billed:

  1. A base charge per month
  2. By the number of operations you do
  3. The amount of brokered connections.

For our Premium tier you only pay a daily fixed rate. You can find most of the details here:

https://azure.microsoft.com/en-us/pricing/details/service-bus/ https://docs.microsoft.com/en-us/azure/service-bus-messaging/service-bus-pricing-billing

To measure your operations and also you connections we are using meters. Please follow the below link to learn more about meters in general.

https://msdn.microsoft.com/en-us/library/dn589796.aspx

Please note that Azure monitoring usage only and are not connected to the azure meters. For that reason you cannot use those to predict your bill: https://blogs.msdn.microsoft.com/servicebus/2017/10/21/metrics-in-azure-monitor-preview-released/ https://blogs.msdn.microsoft.com/servicebus/2018/01/30/how-to-setup-alerts-on-the-new-metrics-for-azure-service-bus/

Predict your bill

The above mentioned operations and also connections can be significantly influenced by the code you are running. For mapping how your code will transfer into you bill assume the following:

  1. Any method call like send, receive, complete counts as operation.
  2. GetQueue and Management operations count as operations.
  3. Any connection you open counts.
  4. In general any API call counts at least as one operation.
  5. Factor in the message size.

The exact data on how the operations meter works can be found here:

https://azure.microsoft.com/en-us/pricing/details/service-bus/ - in the FAQ under:

  1. "How is the operations meter calculated for queues and topics?" 
  2. "What is a brokered connection and how do I get charged for them?"
  3. "Do brokered connection charges apply to queues and topics/subscriptions?"

Very often we see code which is for example receiving in a tight loop (A while loop calling receive every second) versus using long polling (Doing only 1 call per minute per default timeout specified in the client, unless messages arrive which will cause the Server to respond the message back to the client immediately and then the client issuing another request). That is often done in parallel from multiple receivers. This may then transfer into a bigger bill. So thinking about how many receive calls you do and how many connections you open in what time frame is the key driver. If you can roughly estimate the amount of operations your code does, you can also roughly estimate your bill using the following calculator (Click on the tile “Enterprise Integration” and then on the right on “Service Bus”):

https://azure.microsoft.com/en-us/pricing/calculator/

See your current monthly cost

In the portal select "Cost Management + Billing" to get an idea on how much you are currently spending and how much of it is attributed to Service Bus. In the "Overview" first select your subscription:

Then click on the pie chart costs by resource:

Then expand "Other classic resources":