Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

How to Do a Performance Audit of Your .NET Website


Published on

The hardest part about website performance optimization is identifying the root cause.

In this presentation, Bruce Chapman, Director of Cloud and Web Operations at DNN, shows you how to perform a comprehensive performance audit of your .NET website.

You’ll learn how to uncover the causes of performance issues, and understand that improving performance is often straightforward once the root cause is identified.

Published in: Technology
  • Be the first to comment

How to Do a Performance Audit of Your .NET Website

  1. 1. How to do a Performance Audit of your .NET Website Bruce Chapman
  2. 2. The Performance Audit Common Scenario • Live .NET Website • Not running to full potential • Key stakeholders want it ‘faster’ Performance Audit • Look at each individual part • Know which parts to improve What we will cover: • Breaking down overall performance of .NET Website • Understanding tools and processes to discover problems • Providing a report and recommendations
  3. 3. Common .NET Website Architecture Html JS Client Side Files ASP.NET Page .NET API SQL Database Each Tier needs to be checked for performance issues
  4. 4. Our Example Site Evoq 8.5 Build (DNN Platform Base) Site has been modified to add in performance problems. Home Page Products Page
  5. 5. Analysis Tool - NewRelic Multiple Purpose Server/Site Monitoring Tool • Add Agent to .NET Application • Add Server Agent to Windows/IIS and SQL Server Works by: • Monitoring code in the .NET runtime • Injecting a beacon into sampled page loads • Monitoring system-level resources via Server Agents Reports via NewRelic Website • Embeddable Reports available • Free and Paid tiers available
  6. 6. Analysis Tool – Microsoft Application Insights Performance, Exception and Diagnostic Tool • Add agent to .NET Application • Create Account via Azure Portal Works by: • Tracking Http requests • Browser tracking via injected code • Exception log ingestion • Server Performance Counters Reports via Azure Portal • Customized Reports • Free tiers & pay for extra data points
  7. 7. Step 1 : Understand the Problem NumberofAffectedPages Number of Affected Users Problem Impact Site Issue Page Issue Specific Issue
  8. 8. Understanding the Problem Monitoring Software • Overall site performance • Compare response time / load NewRelic : Apdex Score • Samples data to provide score • Ratio of Satisfied/Dissatisfied • Page & App performance Azure Application Insights • Average Server Response Time • Average Page Load Time • Individual Request drill-down • Performance Buckets • Request Duration • Responses by Operation (page/API)
  9. 9. Drill into the Problem – Identify Pages to Analyze Page Specific Issues different to Site Issues • High volume high performance can mask low volume low performance Site Apdex Home Page Apdex Product Page Apdex High Volume, Good Apdex Low Volume, Patchy Apdex
  10. 10. Analysis Tool : Page Load Time Chrome extension • Simple Plug-in for Chrome • Measures page load speed of sites • Gives simple breakdown of load times • Quick and Easy – gives instant feedback
  11. 11. Step 2 : Analyze Specific Page Performance Quantify the performance of problem page • Multiple page browse iterations (5-20) • Copy results into Spreadsheet • Check for consistency/inconsistency Check some other pages • Find the worst page to analyse • Confirm assumptions of page vs site issue Server Response vs Page DOM • Look at the slowest part first • Look for unusual issues like DNS • Check for consistency (add to sheet)
  12. 12. Analysis Tool : Free Service for testing pages • Choose connection type • Run multiple tests • Add in custom headers Report: • Scores page • Shows individual components • Reports have permanent URLs to save for tests
  13. 13. Understanding Web Page Test Results • First Byte : Time taken for Browser to get first response • Start Render : When the Browser receives enough data to render • Document Complete : All resources are loaded • Fully Loaded : Page is completely rendered Home page clearly has a problem – further investigation needed
  14. 14. Record Page Speed Values Keep the values from the page load test • Comparison of First/Second request shows effectiveness of caching Add the statistics to the Performance Audit Report
  15. 15. Understanding Web Page Waterfall View Waterfall View • Sequential loading • Colors show stages of resource load Used to Identify: • Slow resources • Blocking calls • Bandwidth & Memory requirements Impact of TTFB on page load time
  16. 16. Step 3 : Analyze Server Side Performance Server Side Performance : Making TTFB Faster • ASP.NET Page Performance • Database Performance • API Performance (AJAX/SPA Code) Key Questions • ASP.NET Page Generation : Where is time being spent? • API Calls : How fast are the API calls? • Database Queries : How many, how long for? • Server Load : How much CPU / Memory is used?
  17. 17. Analysis Tool – Glimpse • Open Source .NET Analysis Platform • Runs as a Diagnostics tool against server side code • Installed as a Component on the Server
  18. 18. ASP.NET Page Performance ASP.NET Pages – Request => [code happens] => Response Key Questions : • Where is time being spent? How can it run faster? • How can we measure this in a production runtime environment? Measurement Tool : Glimpse / Page Life Cycle
  19. 19. ASP.NET Page Tracing • Glimpse can act as a tracing listener • Install Glimpse as per instructions • Add System.Diagnostics.Trace.WriteLine(“”) calls to suspect code DoMyStuff(); Listener Wrapper Add trace to web.config
  20. 20. Reading Trace with Glimpse Glimpse Trace Output - Shows Trace Statements inserted - Differential Time count shows slow statements
  21. 21. Finding Slow Database Queries with Glimpse Glimpse shows the DB Queries/Times The ‘SQL’ tab lists the number of queries and the execution time. Sometimes requires several iterations to determine slow queries – caching and query plans may cause intermittent slow running.
  22. 22. Analysis Tool – SQL Server Profiler SQL Server Trace ships with SQL Server • Requires elevated permissions to connect • Traces the execution of statements • Best results by carefully setting filters – works well with strong naming standards of Stored Procedures
  23. 23. Database Performance - NewRelic Useful for Identifying Slow Procedures • Measures time taken and individual avg response time • Look for slow procedures running frequently : highest impact • Does not identify slow procedures for individual requests (unless SP only run on that request)
  24. 24. Record Slow Queries Query text & Speed recorded in Performance Audit Report
  25. 25. Step 4 : Browser Resource Performance Waterfall Results identify long-running or slow-loading resources: Select slow items for more information
  26. 26. Finding Oversize and Broken Resources Images / Videos / Large CSS files • Slow Loading Time • File Size Look for redirects / 404 / 401 response codes List large Resources
  27. 27. Step 5: Check for Site-wide Issues • Check for issues which may be slowing down the server • Not related to a specific page • Hardware issues, software issues • Exception Logs Exception log from Log4Net output
  28. 28. Analysis Tools - Server Resources • Check Server Resources during running Process Explorer (Sysinternals Suite) • Inspect individual threads • Identify memory leaks Windows Task Manager
  29. 29. Completed Performance Audit Report Guide for reporting and list of items to fix
  30. 30. Start Fixing the Site •Prioritize by •Performance Gain •Ease of Fix •Access to Skills •Change one thing at a time •Re-test to determine & document change •Update Audit Report with new figures •Repeat endlessly for continuous gains Next Steps for fixing issues
  31. 31. After Fixing Example Site 1.5 seconds Fixes Made - Scale down images to reduce size - Fix 404 for broken resource - Fix slow running SQL Procedure - Fix slow running .NET code Improvement : 7 seconds
  32. 32. New WebPageTest Results New TTFB : 255 ms Reduced repeat requests Reduced page size
  33. 33. Resources NewRelic Application Insights us/services/application-insights/ Page Load Timer load-timer Web Page Test Glimpse Process Explorer -us/processexplorer To learn more about our .NET CMS: