-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
[chore] processor/deltatocumulative: remove global mutex #37682
Conversation
cc @ArthurSens |
d9b2c75
to
bc276be
Compare
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.
I did a first pass today, focused only on the first benchmark 😬
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.
Did another pass here. I wonder if we could relax usage of generics, it feels like it's getting out of hand.
Why do we need Limited
, Count
and Sized
implementations if we're never using them alone? There's one single usage of those maps and we're chaining them all together. Wouldn't it be more readable if we have one single generic implementation of this map?
be191cc
to
554eb31
Compare
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.
Sorry for taking so long to review this PR. I'm struggling a bit to follow everything 😬
It would be nice to add code comments to the benchmark as well!
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.
Let me remove the approval, apparently there was a mistake in the last commits that messed up the module...?
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.
.
abf6d30
to
ba6f401
Compare
This PR was marked stale due to lack of activity. It will be closed in 14 days. |
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.
Thanks
Description
Before, deltatocumulative acquired a
sync.Mutex
on eachConsumeMetrics
invocation. This inherently does not scale well.To fix, I ran microbenchmarks of different threadsafe hashmap approaches and value types (see
internal/research/tracking
).This implements the first finding, switching to
xsync.MapOf
for stream tracking and wrapping the individual datapoints into mutexes, to allow for higher parallelism.Link to tracking issue
none
Testing
Existing test continue to pass.
A new
TestStaleness
was added using experimental Go 1.24testing/synctest
, which for now can only be run manually: