Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have a suspicion that a website on my server has a memory leak as the w3wp.exe process seems to be growing quicker than normal and I've had a couple OutOfMemoryExceptions.

Is there an easy way to determine how much RAM each website/app pool in IIS is using?

share|improve this question

3 Answers 3

up vote 2 down vote accepted

I realize that other people have given the answer "move each site into it's own App Pool" so I don't mean to be redundant but I want to give a more thorough answer. Start by moving each website into it's own App pool - if you have a "lot" you could at least start by breaking them up into groups. There really isn't a good reason to assign each app pool to a different account, there is an easier way to see which app pool is causing the problem.

Next you use iisapp.vbs: http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/b8721f32-696b-4439-9140-7061933afa4b.mspx?mfr=true which is a simple command line utility.

Open up task manager, and add the column PID (Process Identifier). Run iisapp.vbs form the command line and it will tell you which w3wp.exe service belongs to which app pool (by PID) and you can narrow it down from there.

Once you have the web with the problem isolated in an app pool, and if you need help diagnosing what is causing the leak you can grab the microsoft IIS debugging tool: http://www.microsoft.com/downloads/details.aspx?FamilyID=28bd5941-c458-46f1-b24d-f60151d875a3&DisplayLang=en

Then:

The IIS Debug Diagnostics Tool can help track down CPU and memory issues from a worker process. Microsoft has a nice kb article that goes over the basics as well: http://support.microsoft.com/kb/919791.

  1. Install the IIS Debug Diagnostics locally on the system.

  2. Open the Debug Diagnostics Tool under Start > Programs > IIS Diagnostics > Debug Diagnostics Tool > Debug Diagnostics Tool.

  3. Click Tools > Options And Settings > Performance Log tab. Select the Enable Performance Counter Data Logging option. Click OK.

  4. Use task manager to find the PID of the worker process.

  5. Select the Processes tab and find the process in the list.

  6. Right-click on the process and select Create Full Userdump. This will take a few minutes and a box will pop-up giving you the path to the dump file.

  7. Select the Advanced Analysis tab and click the Add Data Files button. Browse to the dump file that was jump created and click OK.

  8. Select Crash/Hang Analyzers from the Available Analysis Scripts box for CPU Performance and crash analysis. Click Start Analysis.

After a few minutes, a report should be generated containing stack trace information as well as information about any requests executing for longer than 90 seconds. Note that the memory dump with use a few hundred megabytes of space, so be sure to install the tool on a drive with sufficient debugging space. Also, if the box is under heavy load, you can create the user dump on the system, copy the file to your workstation, and perform the analysis locally.

share|improve this answer

If you want to know which site is consume more memory than you need to assign dedicated application pool with help of which you can diagnose your issue via Task manager.

share|improve this answer

Each app pool should have it's own process in the task manager.

If you spam a few local accounts, you could assign each app-pool to a different account, and thereby determine which App pool is causing the problems.

You should also go have a look at: http://stackoverflow.com/questions/363680/stringbuilder-for-string-concatenation-throws-outofmemoryexception Since that may be the cause of your memory issues.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.