Home / Programming / Quick Review of .NET Performance & Memory Tools

Quick Review of .NET Performance & Memory Tools

Evaluating the performance of any ASP.NET application is a complex beast indeed. All the standard pitfalls of web application performance apply: server configuration, caching, network issues, client-side script performance, image management… This is not meant to be a comprehensive review of all these factors. Today we’re simply looking at tools to identify one area of performance problems and answer one question – what areas of the ASP.NET code are adversely impacting performance. Specifically, I want to run a tool on my development box and identify problem areas of code before deployment. So, what are the options?

Redgate ANTS Performance Profiler
http://www.red-gate.com/products/ants_performance_profiler/
The profiler easily attaches to an existing ASP.NET application, and no changes to your source code or application are necessary. The profiler logs all method calls, and will summarize based upon the % of time spent in each method, number of times each method was called, and the total time spent for each method call.

Clicking on any method name in the performance window shows you the source code for that method, and you can open up a call tree showing all of the methods that called this method (ancestors), and all methods called by this method (descendants). This ancestor/descendant feature is extremely helpful, since you can quickly identify which methods are being called unnecessarily.

Redgate also comes with a memory profiler that shows all objects in memory, along with the memory size, gain or loss in number of objects, and a number of filters to help identify common problems.

The Redgate toolset also offers a SQL server profiler that shows all database calls and time spent in each call. However, this is only available for Windows Vista and higher, so I was not able to evaluate this firsthand.

Price: the standard version is $395, but the memory profiler brings the price to $795. This is not cheap, but you certainly get what you pay for. It’s a very polished and comprehensive tool. A 14 day trial is available.

JetBrains Profiler
http://www.jetbrains.com/profiler/
JetBrains offers a performance and memory tracking toolset that offers many of the same features of RedGate. The profiler tracks all methods called in an ASP.NET application, sorting by total time spend, number of calls, or time spent per method.

The profiler does show methods called by each method (descendants), but does not show methods calling each method (ancestors). To find ancestors you would need to do a manual search in Visual Studio.

The suite does include a memory profiler as well showing the top memory objects in use, but it does not have the filters to identify common leak problems.

The JetBrains product is $399 for a personal licence, and a trial is available. It also integrates with ReSharper and the other tools from JetBrains, so if your shop is already a ReSharper user that’s definitely a plus.
 
Equatec
http://www.eqatec.com/Profiler/
The Equatec profiler is a very cost-effective option for basic performance tracking. It shows the time spent in each method along with both ancestor and descendant methods. Results include time spent in method along with methods calling target method, and methods called by this method.

The free version allows you to track up to 10 DLLs at once, and the $99 version allows you to track 25. However, it does require you to rebuild your app so custom DLLs are used to track performance. No changes to source code are necessary, but it is an extra step before you can generate reports. Since it’s harder to do, it would probably be used less.
 
PAL (Performance Analysis of Logs)
http://pal.codeplex.com/

PAL is an open source tool that generates very detailed reports from Performance Monitor (PerfMon) logs. To generate reports you set up a custom PerfMon tracker on a server, and let PerfMon generate log files as your web application runs. PAL takes these log files and generates detailed reports highlighting areas of concern (CPU usage, SQL calls per minute, etc).

No changes to your application are necessary, and it can be run on a production server. However, it only presents an overall view of the health of the server, does not identify problem areas of code. A great tool for evaluating the health of your web servers, but not for helping clean up the code before launch.

Slimtune
http://code.google.com/p/slimtune/
Slimtune is an open source tool that offers excellent performance tracking for desktop applications, but the beta version currently available fails when trying to attach to the ASP.NET process. The developer has not announced when the next update will be available.
 
Nprof
http://code.google.com/p/nprof/
Nprof is another open source testing tool, but there has not been any serious development on updating the project for a couple years. NProf can display the percent of time spent in methods, but it is exceptionally difficult to get it working with ASP.NET applications. The data reported by NProf is very basic, only listing the namespaces and function names with no source code integration or related functions called.

Microsoft CLR Profiler
http://msdn.microsoft.com/en-us/library/ff650691.aspx
The free CLR profiler from Microsoft can be used to track memory usage, but like Nprof it requires changing ASP.NET configuration and the reports are arcane and difficult to interpret. A nice free option for searching for memory leaks if you have the time and not the budget for a professional tool.

SciTech Memory Profiler
http://memprofiler.com/
This offers many of the same features as the RedGate studio, with the addition of showing the stack trace for each object. The standard edition is $159, and a 14 day trial is available.