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

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 Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

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

%d bloggers like this: