Skip to content

High CPU Utilization from Gossip Fix #1315

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

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft

Conversation

vazois
Copy link
Collaborator

@vazois vazois commented Jul 25, 2025

WIP

{
conn = null;
if (_disposed) return false;
for (var i = 0; i < numConnection; i++)
Copy link
Contributor

Choose a reason for hiding this comment

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

Understanding the reason behind the connections being an array instead of something like a ConcurrentDictionary. Is it because the number of connections is expected to be significantly low to impact the search?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I feel that access should be pretty fast if the number of items is in the order of 100s - 1000s. The other issue is empirically we found that ConcurrentDictionary not being that performant. I guess since gossip is not on the critical path it should be fine. Last thing using our own lock gives us the ability to favor Readers (accessing connection stats) over Writers (adding a new connection). We can probably get away with that if we use regular Dictionary with our lock.

Is it possible to provide a repro that demonstrates high CPU utilization so we can profile somehow the different options?

Copy link
Contributor

@Xizt Xizt Jul 28, 2025

Choose a reason for hiding this comment

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

I see that paddy has already mentioned similar concern on the issue. #1299 (comment)

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.

2 participants