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

Reduce contention in Metrics updates #2450

Open
cijothomas opened this issue Dec 18, 2024 · 1 comment
Open

Reduce contention in Metrics updates #2450

cijothomas opened this issue Dec 18, 2024 · 1 comment
Labels
A-metrics Area: issues related to metrics performance

Comments

@cijothomas
Copy link
Member

Metrics hot path uses RWLock to sync access to HashMap. Though there is no competition to acquire Read lock in steady state, this is still a cause of contention.
This is easily visible in the stress tests, where throughput is 1/5th that of Otel .NET which uses a comparable stress test. The single thread performance between Otel Rust and .NET is comparable.

Based on couple of experiments, this can be solved via either leveraging a ConcurrentHashMap (that does not require read locks), or sharding. Otel .NET, Java solves this via ConcurrentHashMap, but as of this writing, Rust std library does not have one.

Opening an issue to track improving this. The final decision about sharding vs using external crates vs simply-wait-until-rust-std-adds-concurrenthashmap can be discussed in this issue.

@cijothomas
Copy link
Member Author

Not assigning to Metrics stable milestone, as I believe this improvement can be done with pure internal changes only.

@cijothomas cijothomas added A-metrics Area: issues related to metrics performance labels Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-metrics Area: issues related to metrics performance
Projects
None yet
Development

No branches or pull requests

1 participant