Advertisement
Intermediate .NET, CLR & Runtime

What is the difference between the CLR's Server GC and Workstation GC modes, and how do you choose between them?

Short answer

Workstation GC is optimized for low-latency, interactive client applications with typically one core dedicated to GC work at a time, minimizing pause impact on UI responsiveness.

Save .NET mock interview
Advertisement
AModel answer
Workstation GC is optimized for low-latency, interactive client applications with typically one core dedicated to GC work at a time, minimizing pause impact on UI responsiveness. Server GC is optimized for throughput on multi-core server applications, using one GC heap and thread per core to parallelize collection work, generally providing better overall throughput for server workloads at the cost of higher memory usage and potentially longer individual pause times -- ASP.NET Core apps default to Server GC.
<PropertyGroup>
  <ServerGarbageCollection>true</ServerGarbageCollection>   <!-- default for ASP.NET Core -->
  <ConcurrentGarbageCollection>true</ConcurrentGarbageCollection>
</PropertyGroup>
Real-world example
A high-throughput API server explicitly confirms Server GC is enabled (the ASP.NET Core default) to maximize request-handling throughput on its 16-core machine, while a desktop application explicitly uses Workstation GC to minimize UI-thread pause impact.
Likely follow-ups
  • How does memory usage differ between Server and Workstation GC on the same workload?
  • When would a server application actually want Workstation GC instead?
Related topics