Note: Portions of this post are adapted from a DNN eBook, "How to Do a Performance Audit of Your .NET Website." (free download)
If you're responsible for the operation and performance of ASP.NET websites, then this post was written for you.
First, the bad news: your ASP.NET website is having performance issues. Visitors and end users are complaining and your boss just sent you an ALL CAPS email to get this resolved.
The good news: there are a number of free tools you can use to diagnose and troubleshoot ASP.NET performance issues. Some tools below are unique to .NET, while others can run on any website.
Here are the tools we'll cover in this post:
- Page Load Time
- Microsoft Edge F12 Developer Tools
- Expert Tip from Ryan Moore
- SQL Server Profiler
- Process Explorer
- Azure Application Insights
Page Load Time
Page Load Time is an extension for the Chrome browser that’s available in the Chrome Web Store. After visiting a web page, click on the Page Load Time extension icon to see recorded timings for page load events (e.g. Redirect, DNS, Connect, etc.). Page Load Time works for any web page and is platform independent.
Pictured: Page Load Time result from the top-level DNN blog page.
Establish a baseline of load time metrics across key web pages. When we use this tool, we enter the data into a spreadsheet and watch changes or trends over time. We also compare load times across pages, to determine whether there are page-specific or site-wide performance issues.
Completely free, with source code available at GitHub.
From the listing in the Chrome Web Store, click the "Add to Chrome" button. Confirm that the Page Load Time extension icon has been added in the upper right of your Chrome browser. Then, visit a web page. When the page has finished loading, click the icon to see the page load statistics.
According to its website, WebPagetest is "an open source project that is primarily being developed and supported by Google as part of our efforts to make the web faster." Visit the main WebPagetest website and enter your page URL to run a test from several locations around the world.
Pictured: A portion of the Waterfall View for The New York Times' website.
Look for the requests that take a long time to complete (e.g. the length of the rectangle will be longer than others), as those may be your performance culprits.
It may surprise you how many requests are made to external sites (e.g. Facebook, LinkedIn, advertising networks and more). The response time of these external requests are outside of your control. Review all external requests and remove those that are no longer needed.
Visit the WebPagetest page and enter your page URL. You can specify the Test Location and choose from a long list of browsers. Try a number of combinations and see how they correlate to load times. It could be that page performance is an issue with certain browsers, but not others.
You can also open the "Advanced Settings" tab to customize a number of parameters. For us, what's most useful is to keep the default settings and then analyze the Waterfall View. This helps us identify possible culprits on the page. It could be as simple as a very large, non-compressed image file.
Microsoft Edge F12 Developer Tools
F12 Developer Tools provide diagnostic information within the Microsoft Edge browser. They were previously known as Internet Explorer Developer Tools and built in to the Internet Explorer browser.
A number of improvements were recently made to the tools. According to Microsoft's online documentation page, "The new tools are built in TypeScript, and are always running, so no reloads are required."
F12 Developer Tools provide some of the same diagnostic capabilities of Page Load Time and WebPagetest. Because it's built in to Microsoft Edge, access this tool directly in your browser, without installing a browser extension or visiting a separate website.
Completely free, as part of the Microsoft Edge browser.
After visiting the page you want to diagnose, pressing the F12 key opens the Developer Tools to the last viewed panel. Pressing F12 again hides Developer Tools. There are a number of panels (i.e. tabs) available in F12 Developer Tools:
The Elements panel helps you view the page's HTML and inspect CSS. It’s equivalent to right-clicking on the page and selecting "Inspect element." The Console panel can be used for debugging and adhoc testing. You can enter commands into a running web page via a command line and inspect return values of key variables and functions.
The Debugger helps you test and troubleshoot your code by browsing and searching code files, stepping through the execution of code and more. The Network panel details the individual HTTP requests made from the page, helps you measure page load time and helps identify network events that cause bottlenecks.
The Performance panel details where CPU cycles are spent when loading your page and provides a step-by-step breakdown of the processes consuming execution time. The Memory panel graphs the memory consumption of your page and helps identify potential memory issues in your code. It also provides memory usage data by object type, instance count and more.
Last, but not least, the Emulation panel helps simulate different visitor conditions: device types, browsers, screen sizes and geographic origins.
Note: Thanks to Chin Bae for suggesting the inclusion of F12 Developer Tools.
Image source: The Glimpse homepage, getglimpse.com.
Glimpse is an open source debugging and profiling tool that's popular among ASP.NET developers. Nik Molnar and Anthony van der Hoorn created Glipmse and released it at Microsoft's Mix conference in 2011. In 2015, Microsoft announced that Molnar and van der Hoorn joined the Visual Studio team.
According to the Glimpse homepage, "once installed, Glimpse inspects web requests as they happen, providing insights and tooling that reduce debugging time and empower every developer to improve their web applications."
Completely free, with source code available at GitHub.
The getting started page on the Glimpse site details the three main steps: Downloads, Enable and Use. In addition, Microsoft provides detailed documentation on installing and enabling Glimpse, model binding and using Glimpse on Azure.
Related blog post: If you're not using Glimpse with ASP.NET for debugging and profiling, you're missing out (by Scott Hanselman of Microsoft).
For DNN users, there's a tool called dnnGlimpse that's available at GitHub from Joe Brinkman. You can download and install dnnGlimpse on your DNN site. You’ll get the benefits of Glimpse without having to install it separately.
Expert Tip: Load Impact and Sonarwhal
Ryan Moore, Owner of The Moore Creative Company and co-chair of the Southern Fried DNN user group, contributed the following tip:
``Load Impact does load testing for sites.
You post a permission file to the root of your site "loadimpact.txt" and then can use the system to perform simulated load on the site so that you can benchmark performance under stress. It's free at a basic level, then costs money at higher levels with more complex testing.
It might be more security-related than performance-related, but several Microsoft employees are contributors to sonarwhal, which scans a site to see a wide range of things.
Though it's fairly new, it's been added to my list of tools to help scan a DNN instance checking for potential performance and security issues.''
SQL Server Profiler
SQL Server Profiler ships with SQL Server. It creates database traces and analyzes trace results. According to its documentation page, "Microsoft SQL Server Profiler is a graphical user interface to SQL Trace for monitoring an instance of the Database Engine or Analysis Services. You can capture and save data about each event to a file or table to analyze later."
A common culprit of a slow-loading web page is a long-running SQL query. Whether it's record locking or a complex join, SQL Server Profiler can help identify the offending queries. Once identified, you can work with your developer or database administrator to optimize the queries.
SQL Server Profiler works well with using recognizable naming standards for stored procedures. Carefully set your filters, or you'll have to sift through a sea of information.
Free with your purchase of SQL Server.
Consult this SQL Server Profiler documentation page for instructions on how to start the application.
Process Explorer is a free, Windows Sysinternals tool that provides detailed information about the processes running on a Windows server.
Windows Sysinternals is a suite of free utilities hosted on Microsoft's TechNet site. The site, originally called NT Internals, was developed in 1996 by Mark Russinovich and Bryce Cogswell and acquired by Microsoft in 2006. The SearchWindowsServer website provides a further history of the site.
Process Explorer is useful for determining which programs have particular files or directories open. It also shows which handles and DLLs the programs have open or loaded. It can also be used to analyze resources consumed (e.g. memory, CPU) by processes, much like the related Task Manager utility.
In a video posted to his YouTube channel, Microsoft's Scott Hanselman shows how he used Process Explorer and a related tool called Process Monitor to troubleshoot a problem. He calls Process Explorer “a Task Manager on steroids.”
Hanselman described these tools by saying they're "a reminder that Windows isn't a black box and most things aren't a black box. So knowing that you can peek in and ask the question, 'What exactly is going on here' is really important."
Here’s a direct download of the Process Explorer executable (ZIP file). And here's a link to run it directly from Sysinternals Live. You can also visit the Sysinternals Suite page and download the entire suite from there.
Related article from PCWorld: How to use Process Explorer, Microsoft's free, supercharged Task Manager alternative
Azure Application Insights
Announced by Microsoft at their Build 2015 conference in San Francisco, Azure Application Insights is an Application Performance Monitoring (APM) solution.
How does Azure Application Insights work? According to the product’s overview page, "You install a small instrumentation package in your application, and set up an Application Insights resource in the Microsoft Azure portal. The instrumentation monitors your app and sends telemetry data to the portal."
Azure Application Insights can proactively monitor the performance of your ASP.NET website and web applications. Its Smart Detection feature uses machine learning to provide proactive analysis and alerting of performance issues.
To quote Microsoft, "If there is a sudden rise in failure rates, or abnormal patterns in client or server performance, you get an alert. This feature needs no configuration. It operates if your application sends enough telemetry."
In addition, the Application Insights portal provides customizable dashboards, "live stream" views of metrics in real-time and Application Maps that show a visual layout of dependency relationships of application components.
You can also use Analytics in Application Insights to perform custom queries of your site's telemetry (e.g. performance) data.
Application Insights is not limited to .NET. It supports a wide variety of languages, platforms and frameworks, including J2EE, NodeJS and Android.
Azure Application Insights operates in a freemium model: it’s Basic package is free to use for 1GB of data or less. Additional data is priced at $2.30 per GB per month.
The Enterprise package is priced at $15 per node, with a data limit of 200 MB per node per day. If you’re running sites with moderate traffic levels, you'll probably be fine with the free Basic package. By default, the telemetry data collected by Application Insights is sent to a Microsoft Azure portal. Unless you direct the data stream to a custom endpoint, you will need a Microsoft Azure subscription.
The first step is to add Application Insights to your ASP.NET web application. Once Application Insights is passing telemetry data to the Azure Portal, you can monitor statistics and detect issues in your application. Read this step-by-step guide from Microsoft on adding Application Insights to your web application.
Note: For developers, the Application Insights SDK is integrated into Visual Studio 2017. You can analyze performance issues via Azure Application Insights telemetry data directly in Visual Studio. If you're running an older version of Visual Studio, you can manually add Application Insights.
Application Insights Module for DNN
Note: Added on December 4, 2017.
David Rodriguez authored a DNN module to send telemetry data to Application Insights from your DNN site. The telemetry it sends includes page views, trace information (e.g. from log4net) and exceptions. Get more details in this blog post from David or download the module from GitHub.
In addition, watch this presentation by David Rodriguez, "Website monitoring with Application Insights" on Microsoft's Channel 9 site.
Whether a site is running ASP.NET, J2EE or PHP, resolving performance issues is often straightforward once the primary causes are identified. It’s the art of identifying the culprits that can be the most challenging.
Thankfully, there are a number of free tools available. We hope you found this list useful. Use the comments section below to let us know about the free ASP.NET performance tools that you use. Thanks!
How to Do a Performance Audit of Your .NET Website
Now that you've read about free tools to troubleshoot ASP.NET website performance, learn about a framework for putting them to use. Our eBook guides you through a website performance audit, using many of the tools featured in this post.
Oftentimes, improving website performance can be straightforward once you identify the root cause of performance issues.
Download the eBook now.