ASP.NET Garbage Collection


 

You can improve performance by switching garbage collector modes under certain scenarios.  There are two modes, Server and Workstation.  The Server GC is optimized for scalable throughput on multiprocessor machines, the WorkStation GC is optimized to reduce collection pause times for interactive applications.

The Server GC creates a heap per processor, while the WorkStation GC creates only one heap.  When hosting multiple ASP.NET worker processes, the Server GC can consume more memory than desired, if the Workstation GC is used instead the number of hostable worker processes may increase substantially with only a small decrease in throughput.

To use the WorkStation GC:

Open the aspnet.config
(C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet.config)

Add the following within the <runtime> element:
<gcServer enabled="false"/>

This is not specific to ASP.NET 2.0, it also applies to ASP.NET 1.1

Wes MacDonald's avatar

About Wes MacDonald

Wes MacDonald is a DevOps Consultant for LIKE 10 INC., a DevOps consulting firm providing premium support, guidance and services for Azure, Microsoft 365 and Azure DevOps.

No comments yet... Be the first to leave a reply!

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.