Share via

How to address the latency issues when pushing messages to Azure Service Bus queue

Vijay Myadam (myadam) 0 Reputation points
2026-05-16T19:42:12.7733333+00:00

We have recently integrated to process messages using Azure service bus. We are using Azure Service Bus premium tier, pushing messages from Legacy (.NET FRAME WORK 4.8) SOAP API. Few messages pushed to queue quickly but when load is increased requests get more time to push the messages. On some occasions it took more than 110 seconds and getting timedout.

Application : Legacy SOAP API
Running : .NET framework 4.8
Azure Service bus premium tier
Using User Managed identity to connect.

Azure Service Bus
Azure Service Bus

An Azure service that provides cloud messaging as a service and hybrid integration.


3 answers

Sort by: Most helpful
  1. Vijay Myadam (myadam) 0 Reputation points
    2026-05-19T12:31:14.13+00:00

    Thank you for your suggestions regarding our Service Bus latency issues. We have thoroughly reviewed those recommendations; however, we have not yet identified the root cause of the delay.

    Through our investigation, we have isolated a significant latency bottleneck during the initialization phase. We observed that creating the ServiceBusClient and ServiceBusSender objects occasionally takes more than 20 seconds.

    Once the client and sender are successfully established, the subsequent operation of pushing a message to the Service Bus queue is very efficient, typically completing within 100 milliseconds.

    Our Questions:

    1. Is this initialization latency expected? Is a 20-second delay during the creation of the ServiceBusClient and ServiceBusSender considered within normal operating parameters for this SDK?
    2. What is the "ideal" latency? What is the typical expected time for establishing a connection and initializing these objects?
    3. Troubleshooting Guidance: Are there specific network or configuration factors (e.g., DNS resolution, authentication handshake, or connection pooling settings) that we should investigate to reduce this 20-second initialization time?

    We are concerned that this connection-creation delay is the primary driver behind the message processing latency we are experiencing. Any guidance you can provide on optimizing this initialization process would be greatly appreciated.

    Was this answer helpful?

    0 comments No comments

  2. Sina Salam 29,101 Reputation points Volunteer Moderator
    2026-05-17T13:47:24.98+00:00

    Hello Vijay Myadam (myadam),

    Welcome to the Microsoft Q&A and thank you for posting your questions here.

    I understand that you need how to address the latency issues when pushing messages to Azure Service Bus queue.

    In practice, this pattern is almost always caused by either (1) Premium namespace throttling/capacity pressure (Messaging Units CPU/memory) or (2) producer-side inefficiencies that most commonly recreating Service Bus clients/senders and/or managed identity credentials per request, which triggers connection churn and token acquisition overhead, amplified by the SDK’s retry/try-timeout behavior (default TryTimeout = 60 seconds per attempt). https://learn.microsoft.com/en-us/azure/service-bus-messaging/monitor-service-bus-reference, https://learn.microsoft.com/en-us/azure/service-bus-messaging/service-bus-throttling, https://learn.microsoft.com/en-us/dotnet/api/azure.messaging.servicebus.servicebusretryoptions.trytimeout?view=azure-dotnet, https://learn.microsoft.com/en-us/dotnet/api/azure.identity.managedidentitycredential?view=azure-dotnet

    Follow the below steps to resolve it:

    After confirming broker health and applying the producer fix (client/credential reuse + batching + correct transport + SLA-aligned retry), send latency stabilizes under load and timeouts stop occurring in the SOAP request path. Use the associated links for steps, more reading and references.

    I hope this is helpful! Do not hesitate to let me know if you have any other questions, steps or clarifications.


    Please don't forget to close up the thread here by upvoting and accept it as an answer if it is helpful.

    Was this answer helpful?

    0 comments No comments

  3. AI answer

    2026-05-16T19:42:35.0733333+00:00

    Use the Premium tier features and client-side optimizations to remove the send latency bottleneck and avoid timeouts when load increases.

    1. Validate capacity and tier usage
    • Premium provides dedicated messaging units (MUs). Each MU delivers about 4 MB/s of ingress and 4 MB/s of egress in benchmark tests.
    • If message size × send rate under load approaches or exceeds this per-MU throughput, increase the number of MUs or enable auto-scaling so the namespace can handle spikes without throttling.
    • Ensure the workload is actually using the Premium namespace (not a Standard one) and that auto-scaling is configured with appropriate minimum and maximum MUs.
    1. Optimize client concurrency and async usage
    • High send latency often comes from serial, synchronous operations on the client side rather than the Service Bus itself.
    • Use asynchronous send APIs from the .NET client and schedule multiple concurrent send operations so that the next send starts before the previous one completes.
    • Run multiple concurrent senders (threads or tasks) instead of a single sender under load. This increases the number of operations per unit time and hides network latency.
    1. Use batching for sends
    • Instead of sending one message per call, batch messages using the batch send APIs (for example, SendMessages() equivalents in the SDK).
    • Batching reduces network round trips and connection overhead, which significantly improves throughput and reduces per-message latency when load increases.
    1. Tune connection and network behavior
    • Ensure connection pooling is enabled and reuse MessagingFactory/ServiceBusClient instances instead of creating them per request.
    • Co-locate the SOAP API compute (App Service, VM, etc.) in the same Azure region as the Service Bus Premium namespace to minimize network latency.
    • Verify there is no network bottleneck (firewall, proxy, or VPN) adding latency when many concurrent connections are opened.
    1. Configure prefetch and receive patterns on consumers
    • If the queue is backing up because consumers are slow, send operations can be indirectly impacted by throttling or resource contention.
    • Use prefetch on receivers and multiple concurrent receivers to keep the queue depth under control and maintain steady throughput.
    1. Monitor and detect throttling or bottlenecks
    • Use Azure Monitor metrics for the namespace to track:
      • Message throughput (ingress/egress)
      • Queue depth trends
      • Throttling events and server errors
      • Processing latency
    • If throttling is observed, increase MUs, enable/adjust auto-scaling, or distribute load across additional queues/namespaces.
    1. Adjust timeout and retry behavior
    • Ensure the client uses the default retry policy for Service Bus so transient throttling or network delays do not immediately cause failures.
    • Set reasonable operation timeouts in the client; combine this with retries rather than a single long operation that times out at 110 seconds.
    1. Capacity planning and load testing
    • Perform capacity planning based on expected peak message volume, size, and concurrency.
    • Use Azure Load Testing or similar tools to simulate realistic workloads and validate that the configured MUs, batching, and concurrency levels sustain the required throughput without hitting timeouts.

    Applying these changes—Premium MU sizing/auto-scaling, async and concurrent sends, batching, regional co-location, and proper monitoring—will address the latency spikes when pushing messages under load.


    References:

    AI-generated content may be incorrect. Read our transparency notes for more information.

    Was this answer helpful?

Your answer

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