Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[QUERY] What is an acceptable range for MaxConcurrentSessions? #47356

Open
andrewrimmer opened this issue Nov 27, 2024 · 3 comments
Open

[QUERY] What is an acceptable range for MaxConcurrentSessions? #47356

andrewrimmer opened this issue Nov 27, 2024 · 3 comments
Assignees
Labels
Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. issue-addressed Workflow: The Azure SDK team believes it to be addressed and ready to close. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Bus

Comments

@andrewrimmer
Copy link

andrewrimmer commented Nov 27, 2024

Library name and version

Azure.Messaging.ServiceBus 7.17.3

Query/Question

What is an acceptable range for MaxConcurrentSessions?

It defaults to 8 in this SDK but in the older SDK I think it is ProcessorCount * 1000, which for our server is 64,000

In our current scenario, we seem to get up to maybe 500 sessions and then we stop getting any more sessions (and messages). Our queue just continues building up. This is surprising, as I would think our server could handle a lot more open sessions if they are all just waiting for messages.

Our application ends up not doing any message processing, and just waiting for the sessions to timeout before it can process any more messages.

Is this expected behaviour?

Environment

Windows Server 2022
.net 8
2 Processors (16 cores/32 threads)
Azure Service Bus Premium

@github-actions github-actions bot added Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Bus labels Nov 27, 2024
Copy link

Thank you for your feedback. Tagging and routing to the team member best able to assist.

@jsquire jsquire assigned jsquire and unassigned JoshLove-msft Nov 27, 2024
@jsquire
Copy link
Member

jsquire commented Nov 27, 2024

Hi @andrewrimmer. Thanks for reaching out and for your inquiry. This is not a question that can be answered authoritatively in a general way. The "acceptable range" is something that will depend heavily on the application, its environment, the type of processing done, the size/structure of the data, responsiveness of any downstream systems, other activities taking place on the host during processing, and a number of other factors.

The general guidance would be to choose a conservative value and test under real-world conditions. Monitor your resources, network congestion, and application performance, using those observations to tune your concurrency until you reach the desired results.

In our current scenario, we seem to get up to maybe 500 sessions and then we stop getting any more sessions (and messages). Our queue just continues building up. This is surprising, as I would think our server could handle a lot more open sessions if they are all just waiting for messages.

Remember that CPU utilization alone is not an accurate way to measure health of the host, particularly where concurrency is concerned. In a highly concurrent async application, you can often see a convoy of async continuations queued up and waiting for their chance to run. Because there's no fairness in thread pool scheduling, this leads to some parts of the system looking "stalled" while some may continue to make forward progress and seem ok.

Our application ends up not doing any message processing, and just waiting for the sessions to timeout before it can process any more messages.

This sounds very much like you're hitting resource issues either in the network or in the .NET thread pool. I'd suggest taking some memory dumps and analyzing the async stack, thread pool, and understanding the state of actively running threads to see where there may be a bottleneck.

Some additional discussion and resources for debugging can be found in this section of the Service Bus Troubleshooting Guide.

@jsquire jsquire added the issue-addressed Workflow: The Azure SDK team believes it to be addressed and ready to close. label Nov 27, 2024
@github-actions github-actions bot removed the needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team label Nov 27, 2024
Copy link

Hi @andrewrimmer. Thank you for opening this issue and giving us the opportunity to assist. We believe that this has been addressed. If you feel that further discussion is needed, please add a comment with the text "/unresolve" to remove the "issue-addressed" label and continue the conversation.

@Azure Azure deleted a comment Nov 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. issue-addressed Workflow: The Azure SDK team believes it to be addressed and ready to close. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Bus
Projects
None yet
Development

No branches or pull requests

3 participants