How do you profile an ASP.NET application for production?

We have some performance issues in one of our applications. I was thinking of using something like dotTrace to find out where the problems are, but dotTrace is likely to degrade performance even more.

What is the best way to profile an application that in prod does not affect performance too much?

+4
source share
6 answers

General answer: "Do not do this."

Other than that, you can get a lot using performance counters. If the built-in counters do not help, you can create your own.

Among other things, performance counters can give you an idea of ​​how to reproduce performance problems through load testing.

The next idea is to narrow down the area in which you are interested. It makes no sense to affect performance for the entire application if it is slow access to your web service.

Then make sure you apply the application, preferably using the configuration. The Enterprise Journal Logging application block is great for this, as it allows you to add a journal to the application, but it is configured. Then you can configure what information to write to the log, and where to write it.

This gives you a choice regarding how expensive the log should be: from entering the event log to entering the XML file. And you can solve all this at runtime.

Finally, you won’t be able to use dotTrace or anything else that requires restarting IIS by adding code to your running application. Not in production. The above ideas are not intended for this.

+3
source

Memory profiling or processor ?

Memory: the best way is to create a memory dump of the w3wp process (start the task manager, right-click the process, then create a dump), and then copy the dump to the local machine and analyze it using WinDbg. And look at which classes consume the most memory. There are many questions / answers on Stackoverflow on how to do this (how to use WinDbg and parse a bunch of .NET).

CPU: we use short command line profiler Sam Shaffron (woohoo, one of the creators of Stackoverflow!). His project was abandoned, but we forked it and saved it here. https://github.com/jitbit/cpu-analyzer Everyone can contribute. It joins your threads using Microsoft DbgManager and finds calls that take a long time to complete.

+1
source

You can use the ant profiler

http://www.red-gate.com/products/ants_performance_profiler/index2.htm

They claim that "the overhead was barely noticeable."

There is a 14-day free trial, so you can try it.

Edit: I agree with John's comment, he will violate, it will take some downtime to start / stop it. It is best used in a test environment to identify the neck of a bottle.

0
source

Did the application load with a load of several sessions, somewhere close to the actual loading of the working environment?

The first thing that comes to mind is that your application does not scale well under load or that your db does not scale with increasing size (which causes problems even with a very limited number of concurrent sessions), but it may be something really.

My suggestion is to replicate the production environment and run proper load testing and then look at the data and this will give you some idea.

You don’t want to play games with your production environment, but if you don’t have one, you can use the logbook to track the sequence and time intervals of key events and take them from there.

0
source

You can use an ant profile as well as a system performance counter. This will help you determine what the problem is.

The following are some performance counter information.

http://msdn.microsoft.com/en-us/library/fxk122b4.aspx

http://msdn.microsoft.com/en-us/library/ms979204.aspx

http://www.codeproject.com/KB/dotnet/perfcounter.aspx

0
source

I would recommend taking a few memory dumps of the process in Production, looking at all the stack traces, and seeing if the template was found.

0
source

All Articles