Mom and Pop vs. McDonalds
This is the Mom and Pop method of managing your web server's
performance. An small businessman opening a neighborhood sandwich
shop usually lays out its store and kitchen by instinct, and makes
changes later on by eyeballing what is slowing down sales - maybe
he needs a cash register that is easier and faster to use, because
customers always end up waiting for their order to be rung up.
But a major chain like McDonalds doesn't rely on instinct and
eyeballing to plan out its restaurant operations. McDonalds
analyzes the process of serving customers scientifically, using
quantitative analysis to determine the most efficient way to
serve 5,000 customers a day at a particular restaurant. If
they expect 5,000 customers a day, they calculate how fast
customers will be coming in at the peak times. If the peak
hours have 16 customers coming in per minute, and each customer
transaction at a register takes an average of 45 seconds, how
many registers should the restaurant be able to have open? How
many fry cooks are needed to supply that number of registers?
McDonalds knows that failing to analyze these numbers and
design their systems for them means either turning away
customers, and therefore profits, or wasting money on unneeded
equipment and staff.
If your web site is smallish operation, the online equivalent
to a mom and pop shop, then hard core capacity planning probably
isn't worth your time. But if you're serving millions of users
and big money is riding on serving pages to as many of them as
possible, it would not be a bad idea to take a scientific
approach to ensuring that you're delivering.
Numbers and your Web site
Capacity Planning for Web Performance, by Daniel A. Menasce and Virgilio A.F. Almeida, addresses the issues of how to quantitatively analyze what your needs are, in terms of serving content to web users, and how to structure your hardware and software systems to deliver to those needs. This isn't new ground - computer engineers use these methods to determine how large the cache needs to be on your PC to deliver the best performance, based on the kinds of programs you are likely to be running on it. Network engineers calculate how to divide up a large corporate LAN, and what kind of routers and bridges they'll need, to keep traffic flowing most efficiently.
What Menasce and Almeida are doing with this book is to show how to apply these well known principles to Internet servers. They study typical types of Internet server uses, from file servers, database servers, to application servers. They analyze the network protocols and software architectures involved in delivering information from an Internet site all the way through to the web browser, giving examples and information needed to calculate their impact on performance. The authors also detail the various mathematical models which can be used to represent the pipeline between server and user.
Imagine that you are the server administrator for a site whose owners want to deliver 1,000,000 page views per week to meet their ad revenue goals. They also decide that average response time between a user clicking on a link and seeing the page needs to be below 8 seconds, since their research shows that above that time they lose 40% of users to impatience.
Chunking some numbers
You would first determine what that boils down to as far as bytes. Some basic server log analysis can give you an idea of the different kinds of files served up per page view. Perhaps each HTML page has an average size of 12 K, and for each one served an average of 4.2 gifs at 20K each, and 0.2 .class Java files with an average size of 20 K, and 0.4 CGI programs are run delivering an average of 16 K of output each. You'd crank these (totally fictitious) numbers to find that for each page view, your site delivers 106.4 K of data per page view. The overhead of HTTP and TCP/IP protocols might bring this up to 112 K per page.
If you figure that at peak, your site will be handling 12,000 page views per hour at a pretty constant rate, then your system needs to be able to handle 22.4 MB/minute, or 373 K per second. This is equivalent to about 3.3 page views per second, or 17.4 file hits per second.
You can also take some measurements to find out how long, on average, each of those CGI programs takes to run on the server, and each of the Java applets take to run on a typical user's PC.
Using the numbers
Once you have these numbers, you can analyze each step in the browser to server to browser chain to determine how long each step takes, and where you need to focus to get the speed you need. Perhaps you need to buy a heavier server to handle database accesses which are slowing things down. It may be that a caching system, RAID, or fatter network connection is the way to go. Or if a lot of the time involves running Perl CGI programs, perhaps migrating your server side code to faster server plug-ins written in C++ will get you a large gain in performance.
The Book
Menasce and Almeida's book is not light reading. The authors are both computer science professors, and their book is packed with equations and mathematical proofs demonstrating models to be used in capacity planning. In short, this is a textbook.
The first few chapters give an overview of the types of systems the principles of the book will apply to, and describes the technologies involved in them. It describes client server systems, giving a good explanation of the differences between file servers, database servers, and application servers. It goes into details of network topologies and protocols, covering what you need to understand to be able to appreciate how they affect performance.
The third chapter is "Performance Issues in Client/Server Environments", which gives an introduction to some of the theoretical models for analyzing sharing of resources. These same theories used by McDonalds to analyze how to cook burgers and get them to waiting customers quickly are used to analyze how to deliver data to web users quickly.
By the fourth chapter Menasce and Almeida are analyzing the details of web transactions, with metrics for the effects of infrastructure such as proxies, caches, and mirrors as well as web servers and the Internet itself.
After that things get rather technical. This text gets into hard core details of analyzing and forecasting your system's workload, benchmarking, and system level and component level performance models.
So who should care?
This is an essential book for any Internet or Intranet site whose owners and administrators are serious about performance. If performance is one of those things that you think would be nice, but isn't important enough for you to dedicate a good amount of time to sitting down and crunching out numbers to achieve it, then this book will be shelf-ware. This book should be read by those responsible for planning the technology infrastructure for a major web site.