ASP.NET Site Performance Secrets
By Matt Perdeck
5/5
()
About this ebook
Related to ASP.NET Site Performance Secrets
Related ebooks
Ajax in Action Rating: 0 out of 5 stars0 ratingsPHP and MongoDB Web Development Beginner’s Guide Rating: 0 out of 5 stars0 ratingsPHP Oracle Web Development: Data processing, Security, Caching, XML, Web Services, and Ajax Rating: 0 out of 5 stars0 ratingsASP.NET MVC 4 Mobile App Development Rating: 0 out of 5 stars0 ratingsBuilding Websites with OpenCms Rating: 0 out of 5 stars0 ratingsPHP 5 CMS Framework Development - 2nd Edition Rating: 0 out of 5 stars0 ratingsASP.NET AJAX in Action Rating: 0 out of 5 stars0 ratingsAlfresco One 5.x Developer’s Guide - Second Edition Rating: 3 out of 5 stars3/5Node.js 6.x Blueprints Rating: 0 out of 5 stars0 ratingsJavaScript for .NET Developers Rating: 0 out of 5 stars0 ratingsjQuery Mobile Web Development Essentials - Third Edition Rating: 0 out of 5 stars0 ratingsASP.NET 2.0 Web Parts in Action: Building Dynamic Web Portals Rating: 0 out of 5 stars0 ratingsAJAX Interview Questions, Answers, and Explanations: AJAX Certification Review Rating: 0 out of 5 stars0 ratingsOData Programming Cookbook for .NET Developers Rating: 0 out of 5 stars0 ratingsNW.js Essentials Rating: 0 out of 5 stars0 ratingsGetting Started with Bootstrap 3.2 Rating: 0 out of 5 stars0 ratingsjQuery 1.3 with PHP Rating: 0 out of 5 stars0 ratingsASP.NET 4.0 in Practice Rating: 0 out of 5 stars0 ratingsPHP Ajax Cookbook Rating: 2 out of 5 stars2/5Pentaho Analytics for MongoDB Cookbook Rating: 0 out of 5 stars0 ratingsPhpStorm Cookbook Rating: 0 out of 5 stars0 ratingsASP.NET jQuery Cookbook - Second Edition Rating: 0 out of 5 stars0 ratingsBuilding Websites with VB.NET and DotNetNuke 4 Rating: 1 out of 5 stars1/5JavaScript Everywhere Second Edition Rating: 0 out of 5 stars0 ratingsProgressive web app A Clear and Concise Reference Rating: 0 out of 5 stars0 ratingsNoSQL Databases A Complete Guide - 2020 Edition Rating: 0 out of 5 stars0 ratingsJavaScript Concurrency Rating: 0 out of 5 stars0 ratingsNosql A Complete Guide - 2019 Edition Rating: 0 out of 5 stars0 ratingsWordPress 3.0 jQuery Rating: 0 out of 5 stars0 ratingsMastering MeteorJS Application Development Rating: 4 out of 5 stars4/5
Information Technology For You
Health Informatics: Practical Guide Rating: 0 out of 5 stars0 ratingsCompTIA ITF+ CertMike: Prepare. Practice. Pass the Test! Get Certified!: Exam FC0-U61 Rating: 0 out of 5 stars0 ratingsHow To Use Chatgpt: Using Chatgpt To Make Money Online Has Never Been This Simple Rating: 0 out of 5 stars0 ratingsWordPress Plugin Development: Beginner's Guide Rating: 0 out of 5 stars0 ratingsWindows Registry Forensics: Advanced Digital Forensic Analysis of the Windows Registry Rating: 4 out of 5 stars4/5How to Write Effective Emails at Work Rating: 4 out of 5 stars4/5AWS Certified Cloud Practitioner: Study Guide with Practice Questions and Labs Rating: 5 out of 5 stars5/5The Ultimate Guide to Landing a Network Engineering Job Rating: 0 out of 5 stars0 ratingsComputer Science: A Concise Introduction Rating: 4 out of 5 stars4/5Creating Online Courses with ChatGPT | A Step-by-Step Guide with Prompt Templates Rating: 4 out of 5 stars4/5Practical Ethical Hacking from Scratch Rating: 5 out of 5 stars5/5Data Analytics for Beginners: Introduction to Data Analytics Rating: 4 out of 5 stars4/5An Ultimate Guide to Kali Linux for Beginners Rating: 3 out of 5 stars3/5Hacking Essentials - The Beginner's Guide To Ethical Hacking And Penetration Testing Rating: 3 out of 5 stars3/5The Basics of Hacking and Penetration Testing: Ethical Hacking and Penetration Testing Made Easy Rating: 4 out of 5 stars4/5Inkscape Beginner’s Guide Rating: 5 out of 5 stars5/5The Certified Fintech Professional Rating: 5 out of 5 stars5/5The Programmer's Brain: What every programmer needs to know about cognition Rating: 5 out of 5 stars5/5DNS in Action Rating: 0 out of 5 stars0 ratingsQuantum Computing for Programmers and Investors: with full implementation of algorithms in C Rating: 5 out of 5 stars5/5Summary of Super-Intelligence From Nick Bostrom Rating: 5 out of 5 stars5/5CompTIA Network+ CertMike: Prepare. Practice. Pass the Test! Get Certified!: Exam N10-008 Rating: 0 out of 5 stars0 ratingsA Civic Technologist's Practice Guide Rating: 0 out of 5 stars0 ratingsSupercommunicator: Explaining the Complicated So Anyone Can Understand Rating: 3 out of 5 stars3/5Computer Organization and Design: The Hardware / Software Interface Rating: 4 out of 5 stars4/5ChatGPT: The Future of Intelligent Conversation Rating: 4 out of 5 stars4/5CompTIA A+ CertMike: Prepare. Practice. Pass the Test! Get Certified!: Core 1 Exam 220-1101 Rating: 0 out of 5 stars0 ratingsCybersecurity for Beginners : Learn the Fundamentals of Cybersecurity in an Easy, Step-by-Step Guide: 1 Rating: 0 out of 5 stars0 ratings
Reviews for ASP.NET Site Performance Secrets
1 rating0 reviews
Book preview
ASP.NET Site Performance Secrets - Matt Perdeck
it.
Chapter 1. High Level Diagnosis
Being responsible for a site with slowly loading pages is simply not good. Having twitchy managers look over your shoulder, angry phone calls from advertisers, and other such nastiness is simply no fun. Unfortunately, it can happen to even the best developer—one day your site is cruising along just fine and the next morning, it is really slow. Of course, it may not be completely your fault. Moving the site to that cheap hosting plan may have a bearing on it, or the advertising campaign that marketing just launched without telling you, driving massive traffic to the site. In the end, it doesn't matter—all eyes are on you to make the site faster, and do it quickly. Of course, if you slip in performance improvements in regular releases, there is a better chance you'll avert that sort of crisis.
The problem is that generating even a moderately complex web page involves many lines of code and many different files. Seeing that time is always short, you'll want to zero in on those lines of code and those files that have the biggest impact on performance, leaving everything else for another day. Do this in a structured, top-down way, and you'll get it done more quickly and with a greater chance of success.
In this chapter, you'll learn the following:
The overall process of assuring good performance, and how performance tuning fits into this.
How to generate Waterfall charts as a way to identify those aspects of your site that cause web page performance issues.
A number of scenarios of poor performance and how to recognize each scenario using the Waterfall charts you generated. With each scenario, you'll find a reference to the specific chapter that shows how to further pinpoint the bottleneck, and then eliminate it.
In this chapter, we'll stay at a fairly general level; in the subsequent chapters, we'll dive deeply into the technical aspects of improving your website's performance. This will include performance monitoring (Chapter 2, Reducing Time to First Byte), IIS thread usage (Chapter 6, Thread Usage), database access (Chapter 8, Speeding up Database Access), and on-the-fly JavaScript compression and on-demand loading (Chapter 13, Improving JavaScript Loding).
To see how to load test your code without touching your production environment, refer to Chapter 14,Load Testing.
Assuring good performance
Before you start diagnosing and fixing performance issues, let's first have a quick look at how this fits in to the overall process of assuring good performance. This process consists of these parts:
Continuous monitoring
Setting performance goals
Iterative improvements
Let's go through each part of the process one-by-one.
Continuous monitoring
The performance of your website is affected by both the things you control, such as code changes, and the things you cannot control such as increases in the number of visitors or server problems. Because of this, it makes sense to monitor the performance of your site continuously. That way, you find out that the site is becoming too slow before your manager does.
At the end of this section, you'll find a list of monitoring services that will keep an eye on your site.
What do you mean by site is becoming too slow
? Glad you asked.
Setting performance goals
When this books talks about performance, it ultimately talks about page load time—that's what your visitors and potential customers experience.
It pays to have a clear understanding of how fast is fast enough. Spending time and effort on making your site faster is time and effort not spent on other improvements. There is little point in making your site faster if it is already fast enough.
Your manager, client, or marketing department may have ideas about what constitutes fast enough
. Alternatively, visit the page Website Response Times at http://www.useit.com/alertbox/response-times.html to gain inspiration for setting performance goals.
Ok, you've been monitoring your site, and found it is getting too slow. What now?
Iterative improvements
Because websites, web servers, and browsers are such complex beasts, it pays to make improvements in a deliberate fashion. Hence, these two golden rules:
One change at a time: Because multiple changes can affect each other in surprising ways, life will be much easier if you implement and evaluate changes one-by-one.
Test, test, test: You don't know whether your change really is an improvement until you have tested it thoroughly. Make sure that performance after the change is better than performance before the change, and be ready to roll back your changes if it isn't; what works for other sites may not work for your site.
This process makes your site run faster. An iterative process is shown as following:
Record the current performance.
Diagnose the performance problem—identify the single most important bottleneck.
Fix that one bottleneck (remember, one change at a time).
Test your change. Has performance improved? If it didn't, roll back your change and come up with a better fix. If it did, go back to step 1.
As a result of this, making your site faster is an iterative process:
If you find bottlenecks that currently do not pose a problem, but will come back to bite you in the future, it may be good to fix them, now that they are clear in your head.
We can capture all this in a flowchart:
Monitoring services
If you search Google for site monitoring service
, you'll find lots of companies that will monitor your website's performance for you. They also alert you when the response time gets too high, indicating your site is down.
Here are a few of the monitoring services that offer a free plan at the time of this writing. Note that the descriptions below relate to the free plan. If you are prepared to spend a bit of money, check their websites for their offerings:
Pingdom:http://www.pingdom.com/
Pages you can monitor: 1
Checking frequency: Once every 1, 5, 15, 30, or 60 minutes
Checks from: United States, Asia, Europe
Sends alerts via: E-mail, SMS, Twitter or iPhone
Reporting: Detailed downloadable stats showing the result of each check
Mon.itor.us:http://mon.itor.us/
Pages you can monitor: Unlimited (1 per contact e-mail address)
Checking frequency: Once every 30 minutes
Checks from: United States, Europe
Sends alerts via: E-mail, SMS, Twitter, or IM
Reporting: Weekly reports, real-time graph
dotcom-monitor:http://www.dotcom-monitor.com/
Free 30-day trial
Pages you can monitor: Unlimited
Checking frequency: Once per minute
Checks from: United States, Europe, Israel
Sends alerts via: E-mail, Phone, SMS, Pager, SNMP
Reporting: Daily, weekly, and monthly e-mails, extensive online reports, and graphs
247webmonitoring:http://247webmonitoring.com/
Pages you can monitor: 5
Checking frequency: Once every 15, 30, or 60 minutes
Checks from: United States
Sends alerts via: E-mail
Reporting: Real-time graph
Now that we've seen the process of assuring satisfactory performance, let's focus on how to diagnose and fix performance problems. After all, that is what this book is all about.
High-level diagnosis with Waterfall charts
Because our goal is to make a given web page load quicker, let's enumerate the components that make up a web page:
The file with the HTML: In the ASP.NET world, this file normally has the extension .aspx. Because of this, in the remainder of this book, I'll refer to this file as the main .aspx file. Without this file, there is no page. Generating this file most often takes most of the server resources required to generate the overall page.
Images and flash files: These files are often large and numerous.
JavaScript and CSS files: These files can block rendering of the page.
Based on this, we can categorize bottlenecks that slow down the page-loading into these broad categories:
Main .aspx file takes too long to generate
Main .aspx file takes too long to transfer from server to browser
Images (and flash files) take too long to transfer
JavaScript and CSS files block page rendering
In order to speed up loading of a page, we need to know in which of these categories the bottleneck falls. This is the focus of the remainder of this chapter. Once you know the broad category, you can further pinpoint the bottleneck and fix it. You'll see how in the subsequent chapters.
How do I figure out in which broad category the bottleneck falls? A simple way to do that is with a Waterfall