Skip to content

Workstation GC vs Server GC

Context: .NET offers two GC modes optimized for different application types. Workstation GC is designed for client applications (WPF, WinForms, Console) where UI responsiveness is critical; it uses a single GC thread and prefers lower latency. Server GC is for server applications (ASP.NET, services) that need high throughput and scalability; it creates one GC thread per CPU core and collects heaps in parallel.

ModeUsageCharacteristics
Workstation GCClient appsSingle GC thread, optimized for low latency
Server GCServer appsMultiple GC threads, optimized for throughput
<!-- Configuration in .csproj or runtimeconfig.json -->
<PropertyGroup>
<ServerGarbageCollection>true</ServerGarbageCollection>
</PropertyGroup>
// Check current mode
using System;
using System.Runtime;
Console.WriteLine($"GC mode: {(GCSettings.IsServerGC ? "Server" : "Workstation")}");
Terminal window
dotnet run
GC mode: Workstation
  • Workstation is the default for client applications.
  • Server is recommended for backend applications with many threads and high memory allocation.

ASP.NET Core web API – By default, it runs on Server GC to handle many concurrent requests efficiently. You can override this in the project file.
See .NET docs on GC modes.