-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
[9.0] Make counting of IO completion work items more precise on Windows #112794
base: release/9.0-staging
Are you sure you want to change the base?
Conversation
…Pool.CompletedWorkItemCount (dotnet#106854) * Stop counting work items from ThreadPoolTypedWorkItemQueue as completed work items * Fix CompletedWorkItemCount * Update src/libraries/System.Threading.ThreadPool/tests/ThreadPoolTests.cs Co-authored-by: Koundinya Veluri <kouvel@users.noreply.github.com> * Run CompletedWorkItemCountTest on Windows only --------- Co-authored-by: Eduardo Manuel Velarde Polar <evelardepola@microsoft.com> Co-authored-by: Koundinya Veluri <kouvel@users.noreply.github.com>
- Follow-up to dotnet#106854. Issue: dotnet#104284. - Before the change, the modified test case often yields 5 or 6 completed work items, due to queue-processing work items that happen to not process any user work items. After the change, it always yields 4. - Looks like it doesn't hurt to have more-precise counting, and there was a request to backport a fix to .NET 8, where it's more necessary to fix the issue
Tagging subscribers to this area: @mangod9 |
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.
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
Comments suppressed due to low confidence (1)
src/libraries/System.Threading.ThreadPool/tests/ThreadPoolTests.cs:1467
- The test case ThreadPoolCompletedWorkItemCountTest should include scenarios where the counter is decremented to ensure the Decrement method is tested.
[PlatformSpecific(TestPlatforms.Windows)]
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. we will take for consideration in 9.0.x
Customer Impact
While upgrading a service from .NET 6 to 8, a 1p customer noticed that on Windows, the "Thread Pool Completed Work Item Count" counter values roughly doubled for the service. This is due to .NET 8 also counting queue-processing work items that were introduced in .NET 7. So, for each IO completion callback run to completion, the completed work item count may change by 1-3 or more depending on the situation. Especially in services that take small amounts of periodic traffic, the completed work item count can appear to double or triple per IO completion callback run to completion. The metric is monitored closely by the customer to monitor service health, and they would like to be able to use a more representative count that reflects actual user work items that are completed, for that purpose.
Regression?
Yes, in .NET 7 on Windows
Testing
Validated in a small test case that for IO completion handling, the count reflects the actual number of IO completion callbacks run to completion.
Risk
Low, the count after the change is similar to what it used to be in .NET 6