Service bus & azure functions billing

Ilminsky, Mykola-ext 6 Reputation points
2022-12-01T13:21:02.347+00:00

Let's say I have a service bus billed with Standard tier. And let's say I have an azure function which is triggered by that service bus
According to service bus pricing documentation https://azure.microsoft.com/en-us/pricing/details/service-bus/
the first 1000 connections to the brokers are free of charge, and further connections cost $0.03 per connection per month.
It's not clear to me, if every invocation of my azure function (both cold and hot?) will create a new connection to the service bus broker every time. Won't it?

Azure Service Bus
Azure Service Bus
An Azure service that provides cloud messaging as a service and hybrid integration.
620 questions
Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,944 questions
Azure Cost Management
Azure Cost Management
A Microsoft offering that enables tracking of cloud usage and expenditures for Azure and other cloud providers.
2,536 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. msrini-MSFT 9,281 Reputation points Microsoft Employee
    2022-12-04T14:48:02.757+00:00

    Hi,

    You can consider a connection as 5 tuple. Source IP, destination IP, source port, destination port and protocol.

    When a function app invokes a call to service bus broker, if it used different source port for each call, then it will be accounted as seperate connection.

    Regards,
    Karthik Srinivas

    0 comments No comments

  2. MayankBargali-MSFT 70,396 Reputation points
    2022-12-05T03:43:20.977+00:00

    @Ilminsky, Mykola-ext Thanks for reaching out. It depends upon how you have configured the concurrency in your function if you are leverage the service bus bindings and for more you can refer to this document. If your function is executing concurrently then it will be creating multiple connections to the service bus and as Karthik has mentioned the connection would be consider as 5 tuple (Source IP, destination IP, source port, destination port and protocol).

    In case you are not leveraging the service bus trigger and using the service bus SDK to send/receive the messages from function app then the outbound connection to service bus would depend how you are creating the connection in your code. If you have defined the static client and reusing it then it will create only once connection to service bus. For more details on managing the connection please refer to this document.

    Regarding your concern of broker connection charge's function will just be client and FAQ section covers on the charges.

    A brokered connection is defined as one of the following:

    An AMQP connection from a client into a Service Bus topic, subscription, queue, or event hub.
    An HTTP call to receive a message from a Service Bus topic or queue that has a receive timeout value greater than zero.
    Microsoft charges for the peak number of concurrent brokered connections that exceed the included quantity (1,000 in the standard and premium tier). Peaks are measured on an hourly basis, prorated by dividing by 730 hours in a month, and added up over the monthly billing period. The included quantity (1,000 brokered connections per month) is applied at the end of the billing period against the sum of the prorated hourly peaks.

    Examples:

    5,000 clients connect via a single AMQP connection each, and receive commands from a Service Bus topic and send events to queues. If all clients connect for 12 hours every day, you will see the following connection charges (in addition to any other Service Bus charges)—5,000 connections * 12 hours * 30.5 days / 730 = 2,500 brokered connections. After the monthly allowance of 1,000 brokered connections, you would be charged for 1,500 brokered connections.
    5,000 clients receive messages from a Service Bus queue via HTTP, specifying a non-zero timeout. If all devices connect for 12 hours every day, you will see the following connection charges (in addition to any other Service Bus charges)—5,000 HTTP receive connections * 12 hours per day * 30.5 days / 730 hours = 2,500 brokered connections.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.