Web servers accept requests and return replies. The reply can be a static page, custom dynamic content, or an error. While there is a lot of variation in performance depending on load, an individual request for a static page typically takes only one-tenth of a second from the time the request arrives at the server until the response is pushed back out. Modem latency, Internet latency, and even browser-parsing time are all likely to be larger than that, so a lightly loaded web server will not be a bottleneck.
A heavily loaded web server is another story. Web servers tend to go nonlinear when loaded beyond a certain point, degrading rapidly in performance. This chapter is about why that happens and what your options are for getting the most out of your web server software.
While their basic function has remained the same, web servers have evolved quite a bit from over the years.
generation of web servers were just another Unix service launched on
demand from inetd, which reads
/etc/services on startup and listens to the
ports specified. When a request comes in on one of
inetd’s ports, it launches the
program specified in
/etc/services to deal with
requests on that port. This requires calling the
exec( ) system calls:
fork( ), to clone inetd to get a process, and
exec( ), to write over that process with another process that can service the request. This mechanism is intended ...