About the Book
The book is divided in 13 chapters dealing with the following topics:
Chapter 1, with the What and the Why section sets the stage by introducing concepts and terminology such as the different forms of testing, profiling and explains why it's important to quantify and measure code performance.
The second chapter deals with performance targets and helps you understand important things to measure and optimize, such as the (average) response times and the "time to first byte". It also talks about the load on your application you want to target such as the number of concurrent users, peak usage and growth of the application.
Chapter 3 deals with what information you need to collect to make good judgment calls about performance. It discusses the importance of a base line test for comparison, talks about the things you can measure such as CPU and memory usage, response times, requests per second (for web applications) and more. It also helps your recognize patterns in memory usage for normal applications and those with memory leaks. The chapter closes off with a description of many of the performance counters found in Windows that can be monitored with Performance Monitor.
Chapter 4 - Implementing Your Test Rig guides you through setting up your systems and network for performance tests and profiling. It deals with general network issues and shows you how to install and configure Visual Studio Team Test (or higher) and how to distribute and configure the workstation, the controllers and the agents. A useful chapter if you're new to this, although I find it lacking some detail here and there. And although Chapter 3 already introduced you to the many counters that can be tracked with Performance Monitor, this chapter introduces that tool as if it hasn't been mentioned before.
Chapter 5 gets a bit more practical and shows you how to record and replay web tests using Visual Studio. These tests can be part of performance tests. Again, a bit more detail would have been nice. You can figure out most of the stuff shown in this walk through yourself, but often it's the details behind the tests that are more important. More pointers to what to watch for, what to measure and what to ignore would have been welcome. I did like the tip about using Fiddler to record (some) of your tests. This can be especially handy with remote clients that have performance problems but don't have access to Visual Studio.
In the next chapter, Chapter 6 - Application Profiling - you get introduced to a number of tools for performance and memory profiling: Red Gate's own ANTS Memory and Performance profilers, Microfocus DevPartner Studio Professional 9.1 and Visual Studio 2008. Although you might expect that a lot of time is spent discussing Red Gate's tools, I found the balance between the three tools to be quite fair. A very useful section in this chapter is "What to look for" near the end of the chapter as it shows you a number of key indicators for problems and a resolution.
Despite the usefulness of that section, I was hoping to see a more in-depth explanation of these tools. The guidance is pretty basic, showing you how to profile your application but a much more detailed explanation of the results and how to interpret them would have been great. The problem with topics like this is probably to come up with good examples. They are either a bit contrived or too simple, or require a lot of code and setup to demonstrate. This in turn makes it difficult to show how to really use these tools, and you pretty much have to wait until you have a real problem in your own application. This is not something specific to this book but something I've seen in other books about performance as well.
Chapter 8 deals with memory profiling. It provides a lot of valuable insight in how garbage collection in .NET works. Since garbage collection is crucial to high performance applications, it's important to understand when and how it occurs, and this chapter digs deep in the internal working, showing you how the three garbage collection generations work and when they execute. You'll see how memory leaks can occur and how to find them using a number of tools, including ANTS, Studio Professional 9.1, Visual Studio and CLRProfiler, a free tool developed by Microsoft. Unfortunately, this tool works against the 2.0 run-time of the .NET framework only.
Chapter 9 discusses the performance testing process and provides tips on how to embed performance optimizations in your overall development strategy.
The next chapter deals with common areas for performance improvements. You learn a few tricks to optimize data access, how to use caching and cache dependencies (for example against SQL Server), discusses the risks of reflection and ORM frameworks, and talks about other potential performance areas such as the network, string manipulation, asynchronous web pages, data binding, caching and more.
Chapter 11 deals with things you need to consider when developing an application that needs to be load balanced and talks about topics such as shared state server, shared configuration options and briefly about Azure as the ultimate load balanced platform.
The chapter on Internet Information Services adds a lot of value in that it shows you some of the inner workings of IIS, crucial knowledge for building and maintaining high performing applications. Even if you're not an administrator responsible for managing IIS servers, this chapter provides a lot of background you can use in developing your ASP.NET applications.
This is a pretty decent book about performance in .NET, with a strong focus on web applications. If you're not a performance expert already, you'll take away a lot from this book. With the tips, tricks and background information you learn from this book you will be able to create high performing applications. My worries about a strong focus on the Red Gate tools was ungrounded; most of the tools get equal attention.
However, I wouldn't be me if I didn't have something to complain about or wish for. First of all, the book could have been edited better. It doesn't always flow naturally and introduces concepts that were already introduced in prior chapters. Also, the discussion of multiple tools in the same chapter causes some chapters to flow a bit illogical. A number of chapters could have a bit more depth, especially the ones dealing with the various tools and how to interpret the results they generate. Figuring out the basic operations of a tool is something you can easily accomplish yourself, but really understanding what the tools are telling you and how to respond to that is very important. If you read this book, be sure to follow the chapters with the tools that are discussed so you can do some more exploring yourself.
The book's strong focus on optimizing web applications does not reflect in the title or in the text on the back cover. Although a lot of the techniques you learn from this book are applicable in Web and other .NET applications, a lot of the optimizations such as those presented in Chapter 13, are for web applications only. Being a web developer myself, this was no problem for me, but it's something to be aware of.
Finally, the book itself could be improved a bit. Within seconds after opening it, the pages for the TOC fell out. The code font is a bit too large causing unnecessary wrapping and a more consistent theme for screen shots would give the book a more professional appearance. Screen shots from Windows 7 with the transparent Aero theme and drop shadows around Windows borders just doesn't translate well to print. Also, referring to "purple bars" (page 48) in a black and white book confuses matters, something you'll have no trouble with in the eBook version. Finally, the ugly font and capitalization of URLs doesn't make them very easy to retype in a browser.
Final score: 4 out of 5 stars