views:

555

answers:

3

I have a IIS server running on Windows Server 2003. The server hosts multiple websites.

Occasionally the CPU load peaks in long durations of time, such that the server stops responding or responds with lag.

The problem is that we don't know which of the multiple websites is creating the high load - I have tried looking around in Performance Monitor for counters which could be used, but I don't see anything about CPU load for specific IIS instances.

This makes it quite hard to find the root of the problem.

+1  A: 

Have you tried checking the Performance counters for Garbage Collection 2 spikes (# Gen 2 Collections)?

Periods of very high CPU load are often attributable to this.

EDIT: This SO answer might be useful: http://stackoverflow.com/questions/161737/what-are-the-best-asp-net-performance-counters-to-monitor

This blog post describes collecting and interpreting GC Performance Counters: http://blogs.msdn.com/maoni/archive/2004/06/03/148029.aspx

Mitch Wheat
I monitor them now, but how do I interpret the numbers? What should be expected?
mbp
I've assumed you are runing ASP.NET (which may not be the case?) A large Gen 2 Heap and a large number of Gen 2 collections can mean that too many objects are being retained in memory.
Mitch Wheat
What is a large number? :-)I see values ranging from 2 to 40, I assume this is not a large number.
mbp
+3  A: 

For each application pool there is w3wp.exe process. So try to set each web application in a different application pool. By the way this is always a good practice.

Then run the following script.

Then you can see which web application is creating the high CPU load via the Task Manager or the Performance Monitor.

Michael
+1. I took the liberty of editing so that the URL wasn't running off the side of the page.
Mitch Wheat
A: 

Using WMI try :

To get process usage (W2K3/2K8) :
"SELECT IDProcess, PercentPrivilegedTime, PercentProcessorTime, PercentUserTime FROM Win32_PerfFormattedData_PerfProc_Process where Name='w3wp'"

To identify your site use this :
"SELECT ProcessId, CommandLine, WorkingSetSize, ThreadCount, PrivatePageCount, PageFileUsage, PageFaults, HandleCount, CreationDate, Caption FROM Win32_Process where Caption='w3wp.exe'"

Use this tool for test sql : http://code.msdn.microsoft.com/NitoWMI

Good luck.

lsalamon