Configure .NET garbage collection
For good performance, it’s important to configure .NET garbage collection correctly for the silo process. Based on the team’s findings, the best combination of settings is gcServer=true and gcConcurrent=true. You can configure these values in your C# project (.csproj) or an app.config file. For more information, see Flavors of garbage collection.
.NET Core and .NET 5+
Section titled “.NET Core and .NET 5+”This method isn’t supported for SDK-style projects compiling against the full .NET Framework.
<PropertyGroup> <ServerGarbageCollection>true</ServerGarbageCollection> <ConcurrentGarbageCollection>true</ConcurrentGarbageCollection></PropertyGroup>.NET Framework
Section titled “.NET Framework”SDK-style projects compiling against the full .NET Framework should still use this configuration style. Consider an example app.config XML file:
<configuration> <runtime> <gcServer enabled="true"/> <gcConcurrent enabled="true"/> </runtime></configuration>However, this isn’t as easy if a silo runs as part of an Azure Worker Role, which defaults to using workstation GC. A relevant blog post discusses how to set the same configuration for an Azure Worker Role; see Server garbage collection mode in Azure.
