-
Notifications
You must be signed in to change notification settings - Fork 4.5k
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
Significant performance drop with Server GC #5506
Comments
Thanks for the report!
This is curious but unfortunately I can't repro this on my machine. When using Workstation GC on a program with five threads and a machine with 8 procs, I see 12 threads (1 BGC thread + 5 user threads + 1 finalizer thread + 3 ntdll threads + 2 debugger-related threads), and with server GC, I see 26 threads (8 BGC threads + 8 Server GC threads + 5 user threads + 1 finalizer thread + 3 ntdll threads + debugger-related threads). Do you mind attaching the thread stack traces of when you observe Workstation GC spawning many GC threads and Server GC not doing so? As you say, server GC should be creating as many GC threads as there are procs. |
We used WPA to get details about threads count. Will get thread stack trace as soon as possible. |
@swgillespie Can you try this on a server with more than 20 logical processors? we have seen this issue only on systems with more than 20 logical processors. |
@syalachigere Just tried this on a machine with 48 logical processors, and I see 9 threads under workstation GC and 56 threads with server GC. This is by setting server GC and workstation GC using corerun as a host. I'm going to try and run the TechEmpower benchmark + dotnet CLI on the 48-proc machine to see if this repros - it's possible some wires are getting crossed while trying to set the GC flavor in the CLI. |
@swgillespie I did not run using corerun as a host. We build and published with . |
@syalachigere, do you have NUMA enabled on your machine? |
Yes. NUMA was enabled. |
I figure there are several possible issues here:
I can reproduce (1) by running the techempower benchmark, which has the "System.GC.Server" key set to "true" but is not starting with server GC: To reproduce (2), I looked in the debugger and saw typical Workstation GC behavior when in Workstation GC and the same for Server GC - I didn't see any abnormal thread-spawning in Workstation GC or Server GC using a single thread. I'll look at this more in tandem with (1) since they may be related. To reproduce (3), I did a 1 minute test of the server with both server GC and workstation GC set and got the following data: Workstation GC
Server GC
Your load server is much more powerful than mine, so it's possible that my server isn't hammering asp.net as hard as your load server. I'm also not sure whether or not this particular benchmark spawns a bunch of threads, I'll have to double-check. I have another workload that I can run that can spawn arbitrarily many threads that I can use to try and repro this. |
@syalachigere, may please ask you to run your test with NUMA disabled and see if it will have any effect on the results. I just want to make sure this is not the same as https://github.com/dotnet/coreclr/issues/3380. You also seem to be using an old build of dotnet/cli command line tools and CoreCLR runtime (more than a month old). I could be wrong but I don't think that dotnet v1.0.0-beta-001808 (or later) enables Server GC by default (you need to do "set COREHOST_SERVER_GC=1" to make the dotnet host to pass the Server GC option to the runtime). In any case, it would be great to get thread stack traces (like @swgillespie suggested) to be 100% sure. Please also note that the COREHOST_SERVER_GC environment variable is no longer supported on recent builds of dotnet tools. Or maybe you are still using DNX (which indeed enables Server GC by default on Windows)? @swgillespie, what version of dotnet/cli do you have installed? Propagation of the runtime options (like System.GC.Server) from project.json into runtimeconfig.json has been implemented only 2 days ago (dotnet/cli#2227). |
@sergiy-k This is the latest published nightly from the CLI and built-from-the-tip CoreCLR. I'll double-check to see if it made it into the build I was using. |
"System.GC.Server" setting did not work for us either. We are using
With NUMA enabled
There is a performance drop in Server GC mode. With NUMA disabled
Again, there is a performance drop in Server GC mode. Working on getting thread stack traces. |
@sergiy-k @syalachigere I just tried again with the most recent .NET CLI build that I could find (
Running with @syalachigere - Can you try your scenario with CLI version |
I got the latest build I also want to mention here that we have seen the performance drop on our internal non-asp.net transaction-workload (a console app) |
Hi @syalachigere, you might want to delete your bin and obj folders after upgrading the version of dotnet/cli. That can be the reason for the "Could not load host policy library" error that you mentioned in your earlier message. |
We did the following.
|
@syalachigere, I just noticed that you are setting complus_gcserver to true/false. This will have no effect; the correct (supported) values are 1 and 0. |
I also wonder if there is some instability in the benchmark's results because you are running it for 5sec only. Do you get the same numbers if you run the benchmarks let's say for 30sec? |
@syalachigere (nevermind, Aditya has a better idea than I do) |
They will do the same thing. JSON configuration is new for .NET CLI, but the COMPlus_ version still works and will override the JSON version if both are set. |
@syalachigere - @sergiy-k just discovered the reason why you observed a regression in performance with So, |
We saw the performance drop when we moved to CLI from DNX. GC settings in We verified the performance by setting I am closing this issue. Thank you @swgillespie @sergiy-k |
@syalachigere Can you share the contents of your json file (or at least the runtime part)? If GC settings are not getting propagated from there to the runtime, that's an issue we should fix. |
@swgillespie From cli documentation.
|
@syalachigere I was able to reproduce this on a CLI nightly, so I filed a bug to track it: https://github.com/dotnet/cli/issues/2485 . As a workaround, it works for me if you put the |
There is a significant performance drop of up to 80% for workloads built with .Net CLI. We used TechEmpower plaintext as well as our internal workload to verify. Initial analysis indicates Server GC to be an issue as performance is as expected when choosing Workstation GC.
We also observed that for Workstation GC,
n
number of GC threads were created wheren = total logical processors
. For Server GC, there was only one gc thread created. As per design documents of CoreCLR, it should have been equal to total logical processors.We have checked performance drop on two configurations. Configuration-1 has 36 logical processors and Configuration-2 has 24 logical processors. This performance drop is significant when running on a system with many logical threads ( >20).
Used
complus_gcserver
environment variable to enable\disable Server GC and Workstation GC.Runtime Configuration
Configuration 1
Configuration 2
The text was updated successfully, but these errors were encountered: