Reputation: 44605
I am currently running an asp.net mvc application and under high load I am seeing the site maxing out at 100%. This should not be the case and I believe there may be an issue with the application that is degrading performance. This application communicates directly to wcf services layer which communicates to a sql server database. Neither the wcf layer or database layer have any performance issues as the 100% CPU can be directly apportioned to the MVC app.
Therefore I am looking at profiling where the issue may be in the MVC app - preferably without changing any code. The server is a windows server 2008 R2 with IIS 7.5.
What tools are available to be to assist with this? For starters I have been looking setting some performance counters.
Upvotes: 0
Views: 1846
Reputation: 40669
If a program takes 100% of the core it's running on, that means its ratio of CPU time to I/O (or sleep) time is very high. If that is normal, then you could reduce the CPU time by an order of magnitude and it could still be showing almost 100% CPU, even though it is getting ten times as much work done. All that means is there are better performance diagnostics than CPU percent.
A good one is: how many transactions per second or minute does it handle? If that number goes down, you know you have a problem to solve.
The method I use is to get stackshot samples during the slowness and examine them. If there's something suspect going on 50% of the time, for example, then it will be seen, in precise detail, on roughly 50% of the samples. You don't need a lot of samples to see this, but you do need to examine each one. Measurements are not very good at telling you what's going on.
Upvotes: 0
Reputation: 5197
I know it seems like a daunting task getting started, but start slow and try to develop a hypothesis for why your application is experiencing such degraded performance. A good place to start is with basic perfmon counters and debugdiag, as per this article:
Troubleshooting High CPU in an IIS 7.x Application Pool
There are tons of SO posts on this topic, so definitely do your research. A good profiler can definitely help here, for ASP.NET MVC apps I'd recommend Red Gate ANTS, because it can show you where and how long calls to DBs and other downstream systems are taking.
Upvotes: 3