One of the best things about being a .NET developer is all the amazing ASP.NET performance tools that can make your life easier. This blog post is a list of the various types of ASP.NET performance tools at your disposal for finding and optimizing...
One of the best things about being a .NET developer is all the amazing ASP.NET performance tools that can make your life easier. This blog post is a list of the various types of ASP.NET performance tools at your disposal for finding and optimizing ASP.NET performance problems. Depending on the task, some of these tools will be much better than the others.
New call-to-action Performance Tools for .NET and ASP.NET
Pros: Very deep analysis down to the method and code level. .NET code profilers can be used on your local machine and some support remote profiling and debugging. They can be helpful to track down performance problems. Cons: Method and code level profiling can really slow down your app while the profiler is running. Not preferable in production environments. Not designed to run non-stop for monitoring ongoing performance. Popular Tools: Visual Studio Performance Analyzer & Intellitrace Red Gate ANTS JetBrains dotTrace 2. ASP.NET Performance Profilers & Transaction Traces I’m not sure how to categorize these, but there are a couple of great options for analyzing the performance of your ASP.NET apps without doing full code profiling. These solutions all capture detailed transaction traces about each ASP.NET web request.
Glimpse and the Miniprofiler work differently than each other but both basically allow you to understand some details about the performance of your app while in development or production. But only for the performance of the current request you are executing, a la, ASP.NET profiling.
Pros: These tools are great for basic ASP.NET performance troubleshooting during development and QA-type scenarios. Can be useful in production as well with minimal performance overhead. Cons: They only show details about your current request that you are executing. So you can’t really troubleshoot ASP.NET performance problems your users are seeing unless you reproduce the same exact steps. They aren’t used for monitoring the ongoing performance of your entire application like an APM solution does. Popular Tools: Glimpse can show you a lot of details about a single web request and the configuration of your server. Miniprofiler tracks database queries and can provide more details if you add some code in your app for the steps that you want to track. Prefix provides deep-level performance details about your app. Including all SQL statements, errors, logs, HTTP calls, and details from dozens of other frameworks. Prefix code profiler lets you test and profile your code while writing it. Review of Prefix: A lightweight ASP.NET profiler helping you write better software
Tools like Prefix can provide very detailed traces of what your code is doing:
Pros: Monitor the ongoing performance of your production applications. Quickly identify slow web requests, database queries, web services, and much more. Can typically be used on any app without code or configuration changes. Can be useful in QA-type environments to identify performance problems before they make it to prod. Cons: Can be very expensive. Most do not support newer async/await coding patterns. Some vendor products do not work with Azure Web Apps or other cloud-type hosting scenarios. Many tools can provide an overwhelming amount of information and be difficult to use. Popular Tools: Monitoring .NET applications is much easier with a good APM solution like Stackify Retrace. Retraces lets you integrate code profiling, error tracking, and application logs into your program. But that’s not all. You can improve your code as you write since Retrace can quickly troubleshoot problems and commend ways to optimize your code. APM tools in the market are New Relic, AppDynamics, Dynatrace, and others. Note: Some providers, including Stackify, provide free trials that can be used to help identify immediate problems.
Compare: Stackify Retrace vs New Relic, Stackify Retrace vs App Insights
Read More: Azure Service Profiler review – How does it fit in your toolbox?
How to Monitor IIS Performance
Most APM providers also provide real user monitoring. There are also numerous providers of only real user monitoring, including load balancer providers.
Stackify Retrace provides real user monitoring as part of its performance management solutions. With Retrace’s RUM, you will be alerted when your customers are having poor experiences. Then, it automatically points your UI engineers to how and where it can be fixed.
Read More: Stackify Retrace Real User Monitoring Getting Started
Pros: Pre-installed on every Windows Server. Most server & app monitoring tools designed to collect them for reporting. Cons: Can be hard to match up constantly changing process IDs and names to your app. Not available on Azure Web Apps. For apps on multiple servers, you need to collect them from each server to compare or aggregate which can be difficult. Read more: Performance Counters for ASP.NET on MSDN
As an example of how you can use custom metrics, at Stackify we use a lot of them to track things like how many metrics or log messages we have coming inbound per minute. We also track how long it takes to process them at every step in the pipeline. These kinds of metrics are very valuable for application monitoring and troubleshooting purposes.
Pros: Reporting custom metrics to a 3rd party solution can be simpler than reporting them to a Windows performance counter and then figuring out how to report the performance counter to somewhere. (Eliminates a step!) Cons: Not taking the time to actually create some?!? How to: Create Custom Performance Counters with C#
Open source option: statsd + graphite Metrics.NET Note: Many application monitoring type products may have libraries or an API available for supporting custom metrics as part of a larger monitoring product. Check if your current tools support it.
If you don’t have an APM solution, parsing your IIS logs is one way to do basic ASP.NET performance monitoring.
Pros: Quickly viewing an IIS log file is easy to do. Visual Log Parser provides a quick way to do some basic querying against logs. Cons: Doesn’t give you any details as to why the request took as long as it did. The time taken as reported by IIS includes client network time which is longer than just time spent in your code. Many apps now use advanced URL routing which makes the URLs very unique and hard to report on (URL rewriting, REST, WCF, etc). Popular tools: Visual Log Parser ELK stack Stackify Retrace Splunk Other log management tools Read more: 13 Ways to Tail a Log File on Windows & Linux
Pros: Can be turned on for production servers at any time and turned back off when you are done. Good for identifying if a problem is happening, how often and perhaps some details as to why. Helpful for finding problems with HTTP modules. Cons: The output is giant XML files full of lots and lots of information that can be hard to decipher. Requires file system access to production servers to view. Doesn’t identify performance problems down to the method or code level like profiling does. 9. Exception Tracking One of the biggest causes of performance problems can be application exceptions. When an exception is thrown it causes the thread to pause while the stack trace is collected. Even handled exceptions that seem innocent can cause huge performance bottlenecks under heavy server load. It is important to aggregate and monitor all of your exceptions to find critical problems, new errors, and monitor error rates over time. Error or bug tracking tools are essential for any development team.
Pros: Easy to set up if you are using a logging framework like log4net or NLog. If you are not using a common logging framework, you can use Elmah. Cons: None! Do it! Learn More: Advanced Error Monitoring, Tracking & Reporting with Retrace
The Ultimate ELMAH Tutorial
Note: Manually catching and reporting errors in your code to a logging framework is a great way to collect errors. But you will likely never cover every single possible way an error could occur by doing so. Many APM providers can also collect errors via the .NET CLR Profiling APIs and that gives them visibility to every single error ever thrown. This method can collect a lot of noisy errors, but this can be really valuable for finding and eliminating unnecessary exceptions you may not otherwise know exist.
Advanced Windows & ASP.NET Monitoring Tools Some other options that can be helpful in certain situations are ETW, WMI, WinDbg or even the CLR Profiler API itself. Although these are all very low level and require some experience to know what to do with.
WinDbg is a really powerful tool for analyzing weird ASP.NET problems. Check out this blog post where we discuss using WinDbg to solve a problem caused by an async thread throwing an exception.
Conclusion on ASP.NET performance tools Depending on what you are trying to accomplish, there are a lot of ASP.NET performance tools available to you. Every application problem is different. Over time you will probably use all of the different types of tools listed here. It is really good to at least know what options are available to you and we hope you found this list helpful. Have other ideas that should be on our list? Let us by commenting our pinging us on Twitter @Stackify.
Learn how to put these tools to work: How to Troubleshoot IIS Worker Process (w3wp) High CPU Usage
In this article, we’ll discuss how to use jQuery Ajax for ASP.NET Core MVC CRUD Operations using Bootstrap Modal. With jQuery Ajax, we can make HTTP request to controller action methods without reloading the entire page, like a single page application.
Looking to outsource your asp dot net development requirement? ASP.Net is a special feature of the DOT Net framework created by Microsoft. At [HourlyDeveloper.io](https://hourlydeveloper.io/ "HourlyDeveloper.io"), we have a team of experienced...
In this article, we will discuss the quickest way to use ASP.NET Core Identity for User Login and Registration in a new or existing MVC application.
Our ASP.NET web development team has latest technological expertise and follows industry best practices to ensure that the deliverables are reliable and scalable.
In this article, you will learn how to use or integrate WordPress in ASP.NET and Running WordPress on ASP.NET Core, without PHP, or any source files on the server. The following demonstration will show you how to add WordPress as a frontend to an existing ASP.NET Core application step by step.