Cover V07, I04
Article
Figure 1
Figure 2
Figure 3
Sidebar 1

apr98.tar


Sidebar : Recipes for Web Servers

There are some recipes for configuring Web servers. UNIX HTTP servers expecting a large connection rate can benefit from some kernel tuning. These adjustments prepare the UNIX kernel to support the kind of load generated by HTTP proccesses and its associated services [1, 4]. Other adjustments in addition to kernel tuning are also listed here:

  1. Listen queue. The size of the listen queue corresponds to the maximum number of connections pending in the kernel. If the queue is too small, clients will sometimes see "connection refused" or "connection timed out" messages. A value of 128 for the listen queue is recommended for Web servers. In Solaris, this parameter is called tcp_conn_req_max and can be read and written using the ndd command on the TCP device /dev/tcp). Be warned that Solaris versions earlier than 2.5 restrict the listen queue size to 32; upgrade is necessary.

  2. Network buffers. The machine must have enough memory to buffer the data that is sent out. In some UNIX versions these buffers are referred to as mbufs. If netstat -m shows request for memory denied, try to increase mbufs.

  3. Keepalive. A high traffic Web site can often be drowned with accumulated, dead, idle connections that have not properly closed. The default timeout value is 2 hours (7200000ms). If you have a high traffic Web site, you should lower this value to about 15 minutes.

  4. Monitor the number of retransmits using the netstat -s command. Examine the following values: tcpOutDataSegs, tcpRetransSegs, tcpOutDataBytes, tcpRetransBytes; if the retransmission values are greater than 30 to 40% of the total, you should delay the retransmission to accommodate slower networks.

  5. System memory. Try to get lots of system memory, especially if your server is doing some server-side processing. A maximum of 128 Mb per processor is recommended. If some of your server processing involves database searches (e.g., search engines) try to use the system memory to cache the database tables. While this can be very costly for large legacy databases, it can be practically used for Intranet search engines, because most of the search operations are done over preprocessed indexes.

  6. Logging. Try to reduce logging to a minimum and avoid doing some log processing in the Web server (e.g., DNS lookups). Turning off the HTTP server logs can increase performance by 20%. If you need to do DNS lookups to produce access statistics, do it on a separate machine. Avoid using the UNIX system logger (syslogd) to log any HTTP server activity.

  7. Web server configuration. Threaded Web servers can be configured to optimize the amount of Web server processes started and the number of threads to be serviced by each process. You may need to play with these parameters to obtain the best results. Some of these settings can be added at system boot, for example, by adding them to /etc/init.d/inetinit (values are in milliseconds):

    /usr/sbin/ndd -set /dev/tcp tcp_keepalive_interval 900000
    /usr/sbin/ndd -set /dev/tcp tcp_rexmit_interval_min 3000
    /usr/sbin/ndd -set /dev/tcp tcp_rexmit_interval_initial 3000
    /usr/sbin/ndd -set /dev/tcp tcp_rexmit_interval_max 10000
    /usr/sbin/ndd -set /dev/tcp tcp_close_wait_interval 60000
    /usr/sbin/ndd -set /dev/tcp tcp_ip_abort_interval 60000