-
Notifications
You must be signed in to change notification settings - Fork 10k
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
Using Interlocked in InputFlowControl and Http2Stream #57968
base: main
Are you sure you want to change the base?
Conversation
Thanks for your PR, @ladeak. Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
private readonly int _initialWindowSize; | ||
private struct FlowControlState | ||
{ | ||
private const long AbortedBitMask = 1L << 32; // uint MaxValue + 1 |
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.
To avoid the comment 😉.
private const long AbortedBitMask = 1L << 32; // uint MaxValue + 1 | |
private const long AbortedBitMask = uint.MaxValue + 1L; |
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 was thinking about the same, but somehow it was cleaner to my head where the 1 is. So, I would feel an urge to add a comment with the suggestion // 1L << 32;
But happy to update as the majority prefers.
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.
was cleaner to my head where the 1 is
Makes sense. Keep it as is then.
Using Interlocked in InputFlowControl and Http2Stream
Based on the comments of #57236 implementing interlocked in InputFlowControl.
Description
In
InputFlowControl
class the state is encoded byFlowControlState
. It uses a singlelong
value that can beInterlocked.CompareExchanged
.The operations of the previous
FlowControl
type are now implemented byInputFlowControl
type itself.There are two types of performance tests I executed. One in part of the PR as a standard BDN tests, and one type using the following
Tester
class, which is based on the previous discussions of this PR.In the results below:
Interlocked
.lock
.TryUpdateWindow
) was 'just' enough to not to run into this state but on different CPU adjusting these values might be necessary.Tester
class the higher the counter number, the more operations were performed.Executing the benchmarks with BDN (part of the PR):
BEFORE:
AFTER:
Fixes #56794