Skip to content

Handle ASB queue-length management throttling (disable retries) - #5605

Closed
ramonsmits wants to merge 1 commit into
masterfrom
asb-queue-length-disable-retries
Closed

Handle ASB queue-length management throttling (disable retries)#5605
ramonsmits wants to merge 1 commit into
masterfrom
asb-queue-length-disable-retries

Conversation

@ramonsmits

@ramonsmits ramonsmits commented Jul 15, 2026

Copy link
Copy Markdown
Member

Disables the management client's internal retries so throttling (429) surfaces as a ServiceBusException instead of being silently retried away, then reactively backs off the queue-length query interval, logging a warning once per throttling episode.

One of two alternative approaches for the same issue; the other (#5604) detects throttling via an HTTP pipeline policy.

…tling

Azure Service Bus throttles management operations (GetQueuesRuntimeProperties)
used to read queue lengths. By default the client retries the HTTP 429 responses
internally and usually succeeds, so the throttling never surfaced as an exception
and was invisible in the logs while still showing on the namespace dashboard.

Disable the internal retries for the queue-length management client so a throttled
query fails fast and throws ServiceBusException(ServiceBusy). The polling loop
catches that and reactively backs off the query interval (exponential up to 1 min,
recovering gradually) and logs a warning once per throttling episode, until the
throttling clears. Disabling retries also removes the per-request retry
amplification (each 429 retried up to 3x).

@mauroservienti mauroservienti left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor log message tweak

if (!throttled)
{
throttled = true;
logger.LogWarning("Azure Service Bus is throttling the management operations used to read queue lengths. Backing off to a {CurrentDelay} query interval. This is expected on busy or large namespaces; increase the 'QueueLengthQueryDelayInterval' connection string setting to reduce it. Queue length metrics may be delayed until the throttling clears.", currentDelay);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
logger.LogWarning("Azure Service Bus is throttling the management operations used to read queue lengths. Backing off to a {CurrentDelay} query interval. This is expected on busy or large namespaces; increase the 'QueueLengthQueryDelayInterval' connection string setting to reduce it. Queue length metrics may be delayed until the throttling clears.", currentDelay);
logger.LogWarning("Azure Service Bus is throttling the management operations used to read queue lengths. Backing off to a {CurrentDelay} query interval. This is expected on busy or large namespaces; increase the 'QueueLengthQueryDelayInterval' connection string setting to reduce pressure on the broker. Queue length metrics may be delayed until the throttling clears.", currentDelay);

@johnsimons

Copy link
Copy Markdown
Member

This PR was opened based on a support case.
The solution for the support case was to control the queue length cycle delays.
This is not necessary.

@johnsimons johnsimons closed this Jul 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Monitoring queue length checks can throttle the Azure Service Bus namespace with no log evidence

3 participants