ConcurrentRequestQueue - Reduced SpinCount to 15, before monitor wait #5344
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.
Double performance in synthetic benchmarks, when using OverflowAction=Block
Maybe the reason is that the DotNet Task Dispatcher is very good at giving high priority to dedicated threads running at full speed, thus delaying the handling of timer-events. There was actually a bug in dotnet 6.0.000 where the DotNet Task Dispatcher would never schedule timer-events as long other thread-task was pending. This was improved a little with Dotnet ver. 6.0.400, but timer-events still seem to have lower priority.
This means that if having 2 thread spinning hard, then it will delay the scheduling of the background timer-event, thus their spinning will actually introduce an unwanted "pause". But when reducing the spinning, then it will also reduce the "pause"-effect. Seems the SpinCount upgrades to Sleep(1) after 20 iteration, which makes the "pause" even harder.
It is strange that timer-event are not scheduled when actually having more physical cores (4) than active threads (2). So maybe I'm experiencing something else.