-
Notifications
You must be signed in to change notification settings - Fork 15
feat(span_concentrator): replace std map with hashbrown for better perf #1234
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
feat(span_concentrator): replace std map with hashbrown for better perf #1234
Conversation
…rformances # Motivations Creating and checking for the existence of the aggregation key is the most expensive operation performed by data-pipeline if there is a high drop rate. Currently this operation is not optimal as equality has to go through virtual dispatch because of limitations on the std hashmap. Changing to hashbrown gives us: * A more efficient hashing function * We can implement the Equivalent trait instead of the borrow trait to compare owned and borrowed key, which performs better * We can drop the Cow and just use either String or &str * We can use the entry API on the hashmap so we don't have to potentially access the hashmap twice These changes bring a 25% perf improvement on the span concentrators benchmarks # Changes * Use hashbrown::HashMap instead of std::HashMap in the stats collector * Replace AggregationKey<'static> with OwnedAggregationKey * implement hashbrown::Equivalent instead of Borrow
BenchmarksComparisonBenchmark execution time: 2025-09-25 16:00:21 Comparing candidate commit dc2c080 in PR branch Found 1 performance improvements and 0 performance regressions! Performance is the same for 52 metrics, 2 unstable metrics. scenario:concentrator/add_spans_to_concentrator
CandidateCandidate benchmark detailsGroup 1
Group 2
Group 3
Group 4
Group 5
Group 6
Group 7
Group 8
Group 9
Group 10
Group 11
Group 12
Group 13
Group 14
Group 15
BaselineOmitted due to size. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1234 +/- ##
==========================================
- Coverage 71.65% 71.60% -0.06%
==========================================
Files 355 355
Lines 56317 56309 -8
==========================================
- Hits 40354 40320 -34
- Misses 15963 15989 +26
🚀 New features to boost your workflow:
|
VianneyRuhlmann
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
| .into_iter() | ||
| .map(|(key, value)| (Cow::from(key.into_owned()), Cow::from(value.into_owned()))) | ||
| .collect(), | ||
| peer_tags, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
very nit: this should be:
peer_tags,
is_trace_root: span.parent_id == 0,
to match field order in the struct
f96a538 to
dc2c080
Compare
|
/merge |
|
View all feedbacks in Devflow UI.
This merge request is not mergeable yet, because of pending checks/missing approvals. It will be added to the queue as soon as checks pass and/or get approvals.
The expected merge time in
|
Motivations
Creating and checking for the existence of the aggregation key is the most expensive operation performed by data-pipeline if there is a high drop rate.
Currently this operation is not optimal as equality has to go through virtual dispatch because of limitations on the std hashmap.
Changing to hashbrown gives us:
These changes bring a 25% perf improvement on the span concentrators benchmarks locally (only 10% in CI??)
Changes