开发者

Worker process taking high CPU%

开发者 https://www.devze.com 2023-02-24 23:16 出处:网络
All of my websites are hosted in IIS and configured with one application pool. This application pool consists 10 websites running.

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 th开发者_运维知识库ere 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?


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.


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消