Managing IIS Server Memory Usage

In previous articles we already addressed the management of memory used by Exchange in the article “How to limit Exchange 2010 memory usage”. We also addressed the memory used by SQL server(s) in the article “How to limit SQL Server 2005/2008 memory usage”. Today’s article is a continuation to this theme of managing the memory usage on SBS 2008/2011 servers and will be talking about managing the memory used by IIS working processes.

When looking at memory used by services, in case of Exchange and SQL Server it’s fairly simple to identify the process that needs to be addressed. In the case of IIS it’s not obvious straight away. IIS creates a working process for every Application Pool setup in it. As you can see from the screenshot of Task Manager, it’s hard to tell which process belongs to which IIS Application Pool:

Task Manager - IIS Worker Services

 

To answer the question of process v. pool identification, we need to open IIS Manager, click on the root of the navigation tree (the server name) and under IIS double click the Worker Processes icon. This will open a view that lists the running working processes, their process IDs, CPU and most memory usage.

IIS Manager - Worker Processes overview

Here we can establish which worker process is using how much memory. Note the amount of memory used by each worker process as this can give you a starting point to what level limit the memory used by each individual working process.

If the amount of memory used by the processes is in the same region, you could apply the setting to all worker processes. To do so, click Application Pools on the left tree menu and click the Set Application Pool Defaults on the right in the Actions menu. Scroll down to Recycling and in the Private Memory Limit (KB) type in the desired memory limit in KB.

IIS Manager - Application Pool Defaults

When you apply this setting and any of the worker processes hits this limit, a new worker process for the same pool is created that will take over the processing of the requests. Once this initiation is finished, the original worker process is stopped.

Alternatively, you can also adjust the memory usage on a per pool basis. To achieve this, just right click the application pool you want to manage and select Recycling... You will have  different options when to recycle the worker process based on time or memory. Select the Private memory usage (in KB) option and type in the desired memory limit and click Next.

IIS Manager - Application Pool Recycling Settings

On the following screen you can amend the recycling logging options.

IIS Manager - Application Pool Recycling Log Settings

This is useful to monitor how often does the recycling occur for each worker process. You don’t want this to happen too often since it requires additional CPU cycles and disk IOs. After a short period of monitoring and memory limit adjusting you should be able to establish a state where the recycling doesn’t happen too often yet the memory is still kept under control.

 

In category: Small Business Server
Tagged with: ,