3

All of my websites are hosted in IIS and configured with one application pool. This application pool consists 10 websites running.

It is working fine till today, but all of sudden I am observing that there is sudden up and down % in CPU usage. I am unable to trace out the problem.

Is there anyway to check which website is taking much load among all in the application pool?

max
  • 31
  • 1
  • 2
  • 1
    The whole point of having application pools is so you can isolate applications from each other and not have one application dominate the resources. Sure you could do some application level tracing to figure out what's going on, but you'd be better off breaking things up into their own pools anyway. – Brook Apr 15 '11 at 17:37
  • Most of the websites are static except one. That is the reason, all were configured with single application pool. – max Apr 15 '11 at 17:57
  • 1
    What do you mean by "up and down % CPU".. generally normal behavior on an asp.net site will consist of a lot of spikes.. I wouldn't worry unless you know your sites should be idle most of the time or the CPU is "pegged" for an unusually long period.. – Bobby D Apr 15 '11 at 20:30

3 Answers3

1

Performance counters, task manager and native code analysis tools only tell part of the story. To gain a deeper understanding of what is happening inside your ASP.NET application you need to use WinDBG, SOS and ADPlus.

Tess Ferrandez has a great series of articles on tracking down what is to blame here:

.NET Debugging Demos Lab 4: High CPU hang
.NET Debugging Demos Lab 4: High CPU Hang - Review

This is a real world example:

High CPU in .NET app using a static Generic.Dictionary

You will probably want to separate your sites into individual application pools so you can identify and isolate the site that is causing the high CPU (but it already looks like you have a suspect so I'd isolate that one). From then you can follow Tess's advice and guidance to track down the cause.

You should also take a look at the logs to see if you're experiencing an unexpected spike or increase in traffic. Perhaps there's a badly behaved search engine site indexer nailing the site. If that's the case then maybe you need to (if you haven't already done so) create a robots.txt to prevent crawlers from indexing parts of the site that don't need to be indexed. On top of that if certain crawlers are being overly promiscious then just ban them. Perhaps consider a sitemap for google to tame and tune its activities.

Kev
  • 118,037
  • 53
  • 300
  • 385
  • All links are broken (404) - e.g. *"Oops, 404 Error! That page can’t be found."*. – Peter Mortensen Sep 09 '20 at 19:17
  • This isn't broken (6 pages of annotated links), but the .NET Debugging Demos Labs do no seem to be among them: https://learn.microsoft.com/en-us/archive/blogs/Tess/ – Peter Mortensen Sep 09 '20 at 19:42
  • @PeterMortensen archive.org is your friend. I've updated the links to point there. That's now two iterations of msdn blogs that have been fsck'd over by Microsoft....grrr. – Kev Sep 11 '20 at 12:56
0

If your server has reached it's max capacity, you will see CPU go up and down erratically because the GC will start trying to recover resources(cache..etc), which in turn causes your sites to work even harder. It's an endless cycle.

Have you been monitoring your performance counters? Do you have any idea what normal capacity is for your site? If you cannot answer these questions, I suggest you gather some perf numbers as soon as possible.

My rule of thumb is to always measure first, then make necessary changes.

Most of the time performance bottlenecks aren't where you think they would be.

rick schott
  • 21,012
  • 5
  • 52
  • 81
0

There is really no performance counter way to tell, because the CPU counters are at the process level. Your best bet would be to do a time corelation with other events in the event log and .NET/ASP.NET counters for garbage collection, requests etc.

If you really want to go hardcore, you could use the SysInternals toolset to take snapshots of your app pool over time and then do a post-analysis to figure out what code was executed when the spike happened. Here is a related example from Mark Russinovich's blog - http://blogs.technet.com/b/markrussinovich/archive/2008/04/07/3031251.aspx.

Naraen
  • 3,240
  • 2
  • 22
  • 20