-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Optimize calling GetTotalWorkerThreadPoolCompletionCount #1079
Comments
Yes these could be moved, but the method called here ( |
Ah, interesting. The .NET Framework code is slightly different and I didn't pay close attention when I was linking the source from this repo. Thanks for calling it out. It does look like it has changed here: dotnet/coreclr/pull/24113. As this isn't a .NET Core scenario in the customer case I don't have a great barometer for how the new implementation will fare. Looking through the old and new code I suspect the real cost was ::FlushProcessWriteBuffers, which we don't seem to do now. The new code path does still do a fair bit of work which we should avoid if we aren't going to use the answer. I'll send a PR. |
I got updated data which shows the actual cost under |
I see, makes sense, thanks |
@ninedan reported this function as expensive in one of the server scenarios he monitors. The actual time is spent in `ThreadStore::GetAllThreadList`. Moving the call to `GetTotalWorkerThreadPoolCompletionCount` should reduce this cost. Fixes dotnet#1079
@ninedan reported that calling GetTotalThreadPoolCompletionCount is costing ~0.62% of all CPU usage in a large server scenario. It looks like we can easily move the following lines inside the check to for the thread adjustment interval, only paying this cost when we might use the answer.
@kouvel what do you think?
runtime/src/coreclr/src/vm/win32threadpool.cpp
Lines 922 to 924 in 2cc926e
The text was updated successfully, but these errors were encountered: