[8.0] Make counting of IO completion work items more precise on Windows #112795
+78
−3
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.
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