Apache 1.3.x Web Server Performance Tuning on HP-UX 11.x (Rev C,
10/23/01)
Kernel Parameters
Parameter Default Value Recommended Value
maxusers 32 128
nproc 20+8*MAXUSERS 20+128*MAXUSERS
maxuprc 75 8192
nkthread ((NPROC*7)/4)+16 8192
max_thread_proc 64 1024
maxdsiz 0x04000000 0x10000000
maxfiles 60 2048
maxfiles_lim 1024 2048
nflocks 200 16384
semmns 128 512
semmni 64 256
ninode ((NPROC+16+MAXUSERS)+32+(2*NPTY)) 2((NPROC+16+MAXUSERS)+32+(2*NPTY))
nfile (16*(NPROC+16+MAXUSERS/10+32+2*(NPTY+NSTRPTY+NSTRTEL)) (16*(NPROC+16+MAXUSERS/2+32+2*(NPTY+NSTRPTY+NSTRTEL))
Tune with sam(1M) -> Kernel Configuration -> Configurable Parameter
Web Server Directives
Directive Default Value Recommended Value
Timeout 300 Site-specific (see note)
MaxKeepAliveRequests 100 Site-specific (see note)
KeepAliveTimeout 15 Site-specific (see note)
MinSpareServers 5 5 or 1 x the number of CPUs, whichever is
greater
MaxSpareServers 10 2 x MinSpareServers
StartServers 5 5 or 1 x the number of CPUs, whichever is
greater
MaxClients 150 250
SSLSessionCacheTimeout 300 1200
HostnameLookups Off Off
Tune by changing the directive value in the httpd.conf configuration
file
Timeout
The Timeout directive defines the amount of time, in seconds, that the
web serve
r will wait for each of the following:
1) the amount of time to receive a GET request
2) the amount of time between receipt of TCP packets on a POST or PUT
request
3) the amount of time between ACKs on transmissions of TCP packets in
responses
MaxKeepAliveRequests
The MaxKeepAliveRequests directive limits the number of requests allowed
per con
nection when KeepAlive is on. If set to 0, unlimited requests will be
allowed. T
his setting should be kept to a high value for best web server
performance.
KeepAliveTimeout
The KeepAliveTimeout directive sets the maximum amount of time, in
seconds, that
a connection stays open waiting for additional requests from the same
client on
the same connection. Once the request has been received, the Timeout
directive
applies. Setting this directive to a high value on a heavily loaded web
server m
ay cause performance problems. The higher the setting, the more server
processes
will be kept waiting on idle client connections. The maximum value of
this dire
ctive is 60.
Some heavily loaded sites disable KeepAlive entirely. Setting
KeepAliveTimeout t
o around 5 seconds is usually a good compromise between balancing
available proc
esses with minimizing network I/O.
Network Parameters
Parameter Default Recommended Value
tcp_conn_request_max 20 1024
tcp_fin_wait_2_timeout 0 (infinite) 900000
tcp_ip_abort_interval 600000 60000
tcp_keepalive_interval 72000000 900000
tcp_rexmit_interval_initial 500 Site-specific (see note)
Tune with ndd(1).
Example to check the current value: ndd -get /dev/tcp
tcp_ip_abort_interval
Example to set the parameter: ndd -set /dev/tcp tcp_ip_abort_interval
900000
tcp_rexmit_interval_initial
This default timeout value of 500 milliseconds is fine on a LAN, but
could be in
adequate for the much larger latencies on the Internet. A reasonable
setting for
a high-latency environment is 1000 milliseconds. A more precise way to
monitor
the retransmission delay is with netstat -s. Compare the TCP data
packets (or by
tes) sent to the data packets (or bytes) retransmitted. If more than
20% of the
data packets (or bytes) are being retransmitted, try setting the
tcp_rexmit_int
erval_initial to a higher value. Be aware, however, that increasing the
delay wi
ll make a lousy connection run more slowly than it would otherwise.
Sources
“VitualVault Performance Tuning Guide”, Hewlett-Packard, 2001.
“Apache the Definitive Guide”, 2nd Edition, O’Reilly, 1999.
“Web Performance Tuning”, O’Reilly, 1998.
“Apache 1.3 Process Model Overview”,
http://csyserv.cup.hp.com/manual/ibm/9atper
f.htm