apache-performance-tuning
NOTE: the changes below (from the default ubuntu 8.04 LTS apache2 installation) brought memory usage down
from 16MB per apache2 process to about 5MB AND reduced the number of process from 8 (for 1 user with 2 pages open)
to 3...
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Timeout
Lower the amount of time the server will wait before failing a request.
Timeout 45
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
MaxKeepAliveRequests 100
KeepAliveTimeout 15
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
prefork [default MPM for Apache 2.0 and 1.3]:
Apache 1.3-based.
Multiple processes, 1 thread per process, processes handle requests.
Used for security and stability.
Has higher memory consumption and lower performance over the newer Apache 2.0-based threaded MPMs.
worker:
Apache 2.0-based.
Multiple processes, many threads per process, threads handle requests.
Used for lower memory consumption and higher performance.
Does not provide the same level of isolation request-to-request, as a process-based MPM does.
DEFAULT CONFIGURATION
StartServers 8
MinSpareServers 5
MaxSpareServers 20
MaxClients 150
MaxRequestsPerChild 1000
StartServers 2
MaxClients 150
MinSpareThreads 25
MaxSpareThreads 75
ThreadsPerChild 25
MaxRequestsPerChild 0
ThreadsPerChild 250
MaxRequestsPerChild 0
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
THESE SETTINGS DEPEND ON INTENDED PERFORMANCE, THIS IS FOR A LOW/MED END LOW UTILIZED SERVER...
StartServers 2
MinSpareServers 2
MaxSpareServers 5
MaxClients 50
MaxRequestsPerChild 1000
StartServers 2
MaxClients 50
MinSpareThreads 5
MaxSpareThreads 25
ThreadsPerChild 25
MaxRequestsPerChild 1000
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
MaxClients ? (RAM - size_all_other_processes)/(size_apache_process)
KeepAlive
Enable HTTP persistent connections to improve latency times and reduce server load significantly [25% of original load is not uncommon].
prefork MPM:
KeepAlive On
KeepAliveTimeout 2
MaxKeepAliveRequests 80
worker and winnt MPMs:
KeepAlive On
KeepAliveTimeout 15
MaxKeepAliveRequests 80
With the prefork MPM, it is recommended to set 'KeepAlive' to 'Off' otherwise a client will tie up an entire process
for that span of time.
Usually it's more useful to simply set the 'KeepAliveTimeout' value to something very low
[2 seconds seems to be the ideal value].
This is not a problem with the worker MPM [thread-based], or under Windows [which only has the thread-based winnt MPM].
With the worker and winnt MPMs, the default 15 second timeout is setup to keep the connection open for the
next page request; to better handle a client going from link to link. Check logs to see how long a client remains
on each page before moving on to another link. Set value appropriately [do not set higher than 60 seconds].
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Directive MaxRequestsPerChild is used to recycle processes. When this directive is set to 0, an unlimited amount of requests are allowed per process.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Set each "Directory" Directive to AlloOverride None unless you intend on using .htaccess
AllowOverride None
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
http://www.devside.net/articles/apache-performance-tuning