9

We are using Windows 2008 R2 and IIS 7 running on Amazon EC2. IIS is running a single .NET application written in C#.

We are having performance issues and I want to give the application more memory, but I cannot figure out how to do it. How do I control the amount of memory that the CLR gets?

I'm a total newbie with IIS, .NET and the CLR. If I were working with Java, I would just use the -Xmx flag to increase the memory available to the JVM (e.g., -Xmx3000m for 3GB). But, I cannot seem to figure out how to do this in the Windows world.

1 Answer 1

8

The CLR hosted in the application pool for the web application will grab as much memory as necessary and then based on memory demand, use garbage collection as needed to free up memory.

You can put limits on the amount of memory accessible to an application pool (in the UI, via the Advanced Settings dialog, or via PowerShell and the WebAdministration module).

You might want to check if there are caps already set for the memory on the application pool, but there really isn't a way to dedicate more memory directly to an app pool without editing the machine.config for the .NET version the app runs under.

EDIT: The default autoconfiguration for memory caps in IIS 7 is 60 percent of the machines RAM. This can be manually increased by editing the machine.config file for the .NET version that your application runs under. Details of the various configuration settings here.

4
  • Thanks Steven. As I watch the Performance Monitor, however, it seems that each worker process in the Application Pool is limited to 1 GB of memory. Is that correct? Oct 3, 2012 at 14:46
  • That depends on the settings in the app pool, the amount of RAM on the server, and/or the memory pressure from other applications. By default there are not any caps on memory usage. I've had app pools using 2 or 3 gig of memory. Oct 3, 2012 at 14:59
  • How much memory is allocated to your VM? How big is your page file? Is there a lot of swapping to the page file going on? Is RAM the bottleneck for your application or might it be processor? The number of logical processors can impact the number of requests an IIS process can handle. Oct 3, 2012 at 15:04
  • I added some additional info as to where you can tweak the memory cap (by default it's 60 percent of the machine memory). But I would also make sure that is your bottleneck. Oct 3, 2012 at 15:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .