home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam    

Book HomeWebmaster in a Nutshell, 3rd EditionSearch this book

Chapter 20. Web Performance

Sometimes it seems that no matter how fast your web site is, it's never fast enough. Pages don't load quickly enough, scripts always seem to take forever, and streaming video or audio brings everything to a standstill. The slower things are, the more likely it is that a user will become frustrated and give up. Improving web performance is a constant struggle for every webmaster.

In this chapter, we look at techniques to improve web performance from several different perspectives. Users can upgrade software or hardware, tweak some settings on their browser, or choose a faster modem or ISP. HTML authors can reduce the size of the content being transmitted. Programmers can do quite a bit to improve the execution of CGI programs or other scripts. Most importantly, administrators can reconfigure server software or their website design to greatly reduce the load. Most of this chapter concentrates on the administrator's role in improving performance.

This chapter gives only a brief discussion of web performance and how to improve it. See Web Performance Tuning by Patrick Killelea (O'Reilly) for a more thorough discussion.

20.1. Client-Side Performance

As a user, your ability to improve web performance is limited by the choices others have made about content, programming, and administration. A slow web site is not going to be fast no matter what client accesses it. Still, there are some things you can do to improve your overall experience.

20.1.1. Memory

If you have the money to improve your hardware, buy more memory rather than a machine with a faster CPU. Having the latest CPU will not make as much difference as having a lot of memory. These days, "a lot of memory" means 256 MB or 512 MB.

20.1.2. MTU Size

If you're more ambitious (or don't have a lot of money to throw away on hardware), another potential way to increase browser performance is to tune your MTU size. This can make a big difference if your current MTU is wrong for your connection to your ISP.

MTU stands for "Maximum Transmission Unit," which is the largest packet your PC will send out. You want it to be big enough to carry as much as the other end will accept, but not too big, or your performance will suffer when the other side keeps rejecting packets and telling your PC to send smaller ones. You can use one of the many MTU tuners on the market such as PPP Boost, MTU-speed pro, NetMedic, and Vital Signs.

You can manually figure out your optimum MTU from a Linux machine using the ping command:

% ping -M do -s 1500 www.myISP.com

From a Windows machine, use the following command from the DOS prompt:

C:\>ping -f -l 1500 www.myISP.com

(Use your own ISP's web site in place of www.myISP.com.)

A value of 1500 bytes may get you an error like "Packet needs to be fragmented, but DF set." Keep reducing the value until the ping works; this gives you the optimum value for your MTU.

How you set the MTU depends on the operating system. See http://www.sysopt.com/maxmtu.html for additional information on setting MTUs under Windows. On Linux, you can modify your MTU like this:

# /sbin/ifconfig eth0 mtu 1500

You can get the source code for a version of traceroute that finds MTUs along a route from the code published with Richard Stevens' book TCP/IP Illustrated, Vol 1 (Addison-Wesley). The code is available at ftp://ftp.uu.net/published/books/stevens.tcpipiv1.tar.Z. Use the modified traceroute program to learn about the MTU between yourself and points you commonly visit. On an Ethernet LAN, the MTU is generally set to be 1500 bytes, and this is the way many clients such as Windows 95 are configured by default; but on the Internet you sometimes get better performance if you set the MTU to 576.

Library Navigation Links

Copyright © 2003 O'Reilly & Associates. All rights reserved.