Chapter 5. Load Testing

Load testing your web site is useful for figuring out how much capacity it can handle, but it is more important for shaking out bugs that occur only under heavy load, especially subtle threading issues that can cause deadlock and crash the site. Once the bugs are mostly gone, you should be able to get a nice logarithmic curve that shows throughput level off with increasing load, or, a nice exponential curve that shows that latency goes through the roof as load goes beyond your site’s limits.

Load Test Preparation

A good load test requires a lot of difficult preparation:

  • Test user accounts need to be set up

  • Database tables and content need to be comparable to your production system

  • System parameters between the test machines and production machines have to be synchronized

  • A realistic set of URLs should be collected for testing

  • Client connection speeds should be emulated

Log files give you a good idea of what URLs you are being asked for, but it is usually too much work to create a comprehensive and realistic test starting from log files. In fact, there is not enough data in the log files to reproduce requests because the HTTP POST input data is not recorded in log files, nor is any HTTP header information. Also, note that log file entries record the time that responses were finished, rather than the time requests arrived. This means that log files do not reflect the time distribution of requests to your site.

Emulating the distribution of client connection speeds ...

Get Web Performance Tuning, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.