Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
[SDK] Circular buffer tweaks + cpu pressure test #3349
[SDK] Circular buffer tweaks + cpu pressure test #3349
Changes from 2 commits
12d1612
673ea1d
7bda54c
dd0a640
248d559
223e255
fe3a40f
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Would it be useful to add
Spinwait.SpinOnce()
here beforecontinue
?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.
Defer to @reyang on this one, but I don't think so. This thread isn't so much waiting on another thread to finish as it is learning that some other thread took the head. It should retry immediately and just take the next head/index available.
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.
SpinOnce might be more smart yielding if singlecore etc?
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 think a yield here would be even worse than a spin 😄 Because it doesn't need to wait on anything. If there is only 1 core this thread should just loop around, take the next index, and continue on doing its thing. Same as if there were many cores, really.
There should probably be a SpinOnce here though:
opentelemetry-dotnet/src/OpenTelemetry/Internal/CircularBuffer.cs
Line 171 in 91d7e83
Because that logic is actually waiting on the writer thread to finish. On single core, it should yield immediately because a spin won't accomplish anything other than delay letting the writer get the CPU back to finish its job 🤣
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.
+1