 |
» |
|
|
 |
 |
 |
 |
 |
|
 |
|
|
Tuning notes: HP Apache-based Web Server v.2.0.0 technology preview on HP-UX 11.0 and 11i (PA-RISC)
These tuning notes are based on
http://httpd.apache.org/docs-2.0/misc/perf-tuning.html#runtime,
Other documents and in-house testing.
These notes provide tips on configuring your HP Apache-based Web Server
through the smart use of directives and modules, as well as tuning your
HP-UX environment.
Using directives
- Hostname lookups
http://httpd.apache.org/docs-2.0/mod/core.html#hostnamelookups
If HostNameLookups is not turned off, each client request will result in
at least one lookup request to the name server.
| Example: |
| HostNameLookups off |
|
##Turning off DNS lookups |
- Logging
- Avoid use debug, info and notice level.
- Disable referer_log and agent_log, if you don't need to keep track of
client information.
- FollowSymLinks and SymLinksIfOwnerMatch
Wherever in your URL-space you do NOT have an "Options FollowSymLinks",
or you do have an "Options SymLinksIfOwnerMatch," Apache will issue extra
system calls to check up on symlinks. One extra call per filename component
will be made. For example, if you had:
DocumentRoot /www/htdocs
<Directory />
Options SymLinksIfOwnerMatch
</Directory>
If a request is made for the URI /index.html, Apache will perform lstat(2)
on /www, /www/htdocs, and /www/htdocs/index.html. The results of these
lstats are never cached, so they will occur on every single request. If you
really desire the symlinks security checking try the following instead:
DocumentRoot /www/htdocs
<Directory />
Options FollowSymLinks
</Directory>
<Directory /www/htdocs>
Options -FollowSymLinks +SymLinksIfOwnerMatch
</Directory>
This at least avoids the extra checks for the DocumentRoot path. Note that
you'll need to add similar sections if you have any Alias or RewriteRule
paths outside of your document root. For highest performance, and no
symlink protection, set FollowSymLinks everywhere, and never set
SymLinksIfOwnerMatch.
- AllowOverride
Wherever in your URL-space you allow overrides (typically .htaccess files)
Apache will attempt to open .htaccess for each filename component. For
highest performance use AllowOverride None everywhere in your filesystem.
- Negotiation
Use a complete list of options for DirectoryIndex, listing the most common
choice first.
Example: DirectoryIndex index.cgi index.pl index.shtml index.html
- Tune NumServers, StartThreads, MinSpareThreads, MaxSpareThreads,
MaxThreadsPerChild, MaxRequestsPerChild
Apache tries to maintain a pool of spare or idle server threads, which
stand ready to serve incoming requests. In this way, clients do not need to
wait for a new threads or processes to be created before their requests
can be served. Apache assesses the total number of idle threads in all
processes, and forks or kills processes to keep this number within the
boundaries specified by MinSpareThreads and MaxSpareThreads. Since this
process is very self-regulating, it is rarely necessary to modify these
directives from their default values. The maximum number of clients that
may be served simultaneously is determined by multiplying the maximum
number of server processes that will be created (MaxClients) by the
number of threads created in each process (ThreadsPerChild).
|
|
Using modules
- Disable unused modules
Enable only the modules you need. Pre-processing and post-processing modules
like mod_speling, mod_include and mod_log_config create a lot of overhead.
Use http://httpd.apache.org/docs-2.0/mod/index.html to determine
which modules are used with your configuration, and which you can remove.
- mod_vhost_alias
This module uses less memory than VirtualHost directive, when it is
used for a huge number of virtual hosts with similar configurations.
- mod_perl
In CGI scripts, using mod_perl is 10 times faster than regular CGI.
Configuring HP-UX environment
- Tuning the OS
Tune kernel parameters maxproc, shmem, maxfd, etc.
- Monitor the memory
Make sure the web server has enough memory.
- Renice
Increase the priority of Apache process.
- TCP/IP parameters tuning
You might want to tune the system listen queue when you receive errors
relating to insufficient buffer space (ENOBUFS) error from client socket.
On HP-UX 11.x the system listen queue parameter is called
tcp_conn_request_max. The utility for listing/modifying network settings
is called "ndd".
The following are equivalent commands to use on HP-UX 11.x:
- To check the current setting of the system listen queue:
ndd -get /dev/tcp tcp_conn_request_max
- To adjust the system listen queue size to 256, for example:
ndd -set /dev/tcp tcp_conn_request_max 256
|
|
|
|
 |
 |
 |
 |
| Example: |
| Parameter |
Scope |
Default value |
Tuned value |
| maxfiles |
/stand/system |
2048 |
4096 * |
| maxfiles_lim |
/stand/system |
2048 |
4096 * |
| tcp_time_wait_interval |
ndd/dev/tcp |
60000 |
60000 |
| tcp_conn_request_max |
ndd/dev/tcp |
20 |
1024 --> 4096 |
| tcp_ip_abort_interval |
ndd/dev/tcp |
600000 |
60000 |
| tcp_keepalive_interval |
ndd/dev/tcp |
72000000 |
900000 |
| tcp_rexmit_interval_initial |
ndd/dev/tc |
1500 |
1500 |
| tcp_rexmit_interval_max |
ndd/dev/tcp |
60000 |
60000 |
| tcp_rexmit_interval_min |
ndd/dev/tcp |
500 |
500 |
| tcp_xmit_hiwater_def |
ndd/dev/tcp |
32768 |
32768 |
| tcp_recv_hiwater_def |
ndd/dev/tcp |
32768 |
32768 |
|
 |
|
 |
 |
|
 | |
 |
 |
|
Avoid using NFS
Don't use files on NFS for "LockFile" or "Scriptsock" directives.
This will cause the system to hang.
|
Examples: |
| LockFile |
|
NON_NFS_PATH/lockfile.lock |
| Scriptsock |
|
NON_NFS_PATH/logs/cgisock |
Other configuration
-
Use a cache proxy
Use cache proxy to cache the web pages.
Legal notices
Copyright (c) Hewlett-Packard Company 1997-2001. All Rights Reserved.
Reproduction, adaptation, or translation without prior written
permission is prohibited, except as allowed under the copyright laws.
UNIX® is a registered trademark in the United States and other countries,
licensed exclusively through X/Open Company Limited.
WHILE THE INFORMATION IN THIS PUBLICATION IS BELIEVED TO BE ACCURATE,
HEWLETT-PACKARD MAKES NO WARRANTY OF ANY KIND WITH REGARD TO THIS
MATERIAL, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Hewlett-Packard
shall not be liable for errors contained herein or for incidental or
consequential damages in connection with the furnishing, performance
or use of this material. Information in this publication is subject
to change without notice.
Java and all Java-based trademarks and logos are trademarks or
registered trademarks of Sun Microsystems, Inc. in the U.S. and
other countries.
|
|  |
 |
 |
 |
 |
|