Preface
Do you think that only experts with a deep understanding of the inner workings of ASP.NET, SQL Server, and IIS can improve a website's performance? Think again, because this book tosses that notion out of the window. This book will help you resolve every web developer's nightmare a slow website with angry managers looking over your shoulder and raging calls from advertisers and clients. You don't have the time or energy to gain a thorough and complete understanding of ASP.NET performance optimization. You just need your site to run faster! This book will show you how.
This hands-on book shows how to dramatically improve the performance of your ASP.NET-based website straight away, without forcing you through a lot of theoretical learning. It teaches you practical, step-by-step techniques that you can use right away to make your site faster with just the right amount of theory; you need to make sense of it all.
Unlike other performance-related books, here you'll first learn how to pinpoint the bottlenecks that hold back your site's performance, so that you can initially focus your time and energy on those areas of your site where you can quickly make the biggest difference. It then shows you how to fix the bottlenecks you found with lots of working code samples and practical advice, and just the right amount of theoretical detail.
What this book covers
Chapter 1, High Level Diagnosis shows how to determine which aspect of loading a web page is taking too long generating the page on the server, transferring the page to the browser, loading the images, or loading JavaScript and CSS files.
Chapter 2, Reducing Time to First Byte shows how to further pinpoint the bottleneck if you found it takes too long to generate a web page on the server. Examples of possible bottlenecks are lack of memory or CPU resources and slow database access.
Chapter 3, Memory shows how to reduce memory usage.
Chapter 4, CPU shows how to reduce CPU usage.
Chapter 5, Caching shows how to get the most out of the caching features provided by browsers, proxies, ASP.NET, and IIS.
Chapter 6, Thread Usage shows how to use asynchronous programming to prevent your web site from running out of IIS worker threads.
Chapter 7, Reducing Long Wait Times shows how to reduce delays due to off -box session modes, thread locks, disk accesses, and communication with other servers.
Chapter 8, Speeding up Database Access shows how to speed up database accesses on the database server, such as identifying and fixing expensive queries.
Chapter 9, Reducing Time to Last Byte shows how to further pinpoint the bottlenecks if you find that it takes too long to transfer a web page to the browser. It also shows how to reduce ViewState and white space overhead.
Chapter 10, Compression shows how to get the most out of the compression features provided by IIS 6 and IIS 7. This can dramatically reduce the size of web pages and JavasScript and CSS files, as they travel over the Internet.
Chapter 11, Optimizing Forms shows how to reduce the number of form submissions and the delay caused by each submission. This includes implementing client-side form validation and five forms of asynchronous communication with the server.
Chapter 12, Reducing Image Load Times shows how to reduce the number of images on the page and their file sizes, how to better cache images, and how to load more of them concurrently.
Chapter 13, Improving JavaScript Loading shows how to compress JavaScript and CSS files and how to reduce their impact on page rendering.
Chapter 14, Load Testing shows how to do load testing, and how to create a load testing environment using spare computers.
What you need for this book
Software required to run the sample software in the book:
1. Vista Home Premium or higher, or Windows 7 Home Premium or higher
Note that the Starter and Home Basic versions of these operating systems do not include IIS 7 and so, they can't be used.
2. Visual Studio 2008 Express Web Developer Edition or later, or a paid version of Visual Studio 2008 or later.
Free download is available at http://www.microsoft.com/express/Downloads/#2010-Visual-Web-Developer.
3. SQL Server 2008 Express or later
Free download is available at http://www.microsoft.com/express/database/.
4. .NET Framework 3.5
Free download is available at http://www.microsoft.com/downloads/en/details.aspx?FamilyId=333325fd-ae52-4e35-b531-508d977d32a6&displaylang=en.
If you have installed a version of Visual Studio 2008, you don't need to install .NET Framework 3.5 because it is included with Visual Studio 2008. If you only have a version of Visual Studio 2010 on your machine, you may need to install .NET Framework 3.5 to be able to run the sample code with Visual Studio 2010.
Who this book is for
This book is written for ASP.NET/SQL Server-based website developers who want to speed up their site using simple, proven tactics without going through a lot of unnecessary theoretical learning. If your website isn't performing well, this is the ideal book for you.
Conventions
In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.
Code words in text are shown as follows: " This exposes the method Dispose()
, which disposes the object."
A block of code is set as follows:
using (SqlConnection connection = new SqlConnection(connectionString)) { // use connection ... } // connection.Dispose called implicitly
Any command-line input or output is written as follows:
USE TuneUp ALTER DATABASE TuneUp SET ENABLE_BROKER WITH ROLLBACK IMMEDIATE
New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "Check the Allow checkbox in the Modify row and click on OK."
Note
Warnings or important notes appear in a box like this.
Note
Tips and tricks appear like this.
Reader feedback
Feedback from our readers is always welcome. Let us know what you think about this book"what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.
To send us general feedback, simply send an e-mail to< feedback@packtpub.com>
, and mention the book title via the subject of your message.
If there is a book that you need and would like to see us publish, please send us a note in the SUGGEST A TITLE form on www.packtpub.com or e-mail< suggest@packtpub.com>
.
If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.
Customer support
Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.
Note
Downloading the example code for this book
You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.
Errata
Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books maybe a mistake in the text or the code we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/support, selecting your book, clicking on the let us know link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.
Piracy
Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.
Please contact us at< copyright@packtpub.com>
with a link to the suspected pirated material.
We appreciate your help in protecting our authors, and our ability to bring you valuable content.
Questions
You can contact us at< questions@packtpub.com>
if you are having a problem with any aspect of the book, and we will do our best to address it.