Apache Optimization

MaxClients
—————

The number of worker processes is limited by the parameter MaxClients.

MaxClients = Total RAM dedicated to the web server / Max child process size.

The default value of  MaxClients is 150.

If we have a server with 1gb of ram and  child process take an average size
of 20 mb.

We can set the  MaxClients as 1024/20 = 52

—————————————————————

StartServers
—————-

The StartServers directive sets the number of child server processes created
on startup. As the number of processes is dynamically controlled depending on
the load, there is usually little reason to adjust this parameter.

The default value is 5, which is enough for most of the situations. We can
try lowering this value in extreme cases.

—————————————————————

MinSpareServers
————————
The MinSpareServers directive sets the desired minimum number of idle child
server processes. An idle process is one which is not handling a request. If
there are fewer than MinSpareServers idle, then the parent process creates
new children at a maximum rate of 1 per second.

Tuning of this parameter should only be necessary on very busy sites. Setting
this parameter to a large number is almost always a bad idea.

The default value is 5. We can try lowering this value inorder to reduce the
load.

——————————————————————————-
MaxSpareServers
————————

The MaxSpareServers directive sets the desired maximum number of idle child
server processes. An idle process is one which is not handling a request. If
there are more than MaxSpareServers idle, then the parent process will kill
off the excess processes.

Tuning of this parameter should only be necessary on very busy sites. Setting
this parameter to a large number is almost always a bad idea. If you are
trying to set the value lower than MinSpareServers, Apache will automatically
adjust it to MinSpareServers + 1.

The default value is 10.

———————————————————————————–

MaxRequestsPerChild
—————————–

The MaxRequestsPerChild directive sets the limit on the number of requests
that an individual child server process will handle. After
MaxRequestsPerChild requests, the child process will die. If
MaxRequestsPerChild is 0, then the process will never expire.

The default option is set as 0, that is the process will never expire.
Usually setting this value as 250-500 is preferable.

————————————————————–

KeepAlive
————-

The Keep-Alive extension  allow multiple requests to be sent over the same TCP
connection. In some cases this has been shown to result in an almost 50%
speedup in latency times for HTML documents with many images. To enable
Keep-Alive connections, set KeepAlive On.

The dynamic content such as CGI output, SSI pages, and server-generated
directory listings will generally not use Keep-Alive connections .

If we are getting too many connection timedd out error it is better to turn
this option off.

————————————————————–

KeepAliveTimeout
————————

The number of seconds Apache will wait for a subsequent request before closing
the connection. Once a request has been received, the timeout value specified
by the Timeout directive applies.

Setting KeepAliveTimeout to a high value may cause performance problems in
heavily loaded servers. The higher the timeout, the more server processes
will be kept occupied waiting on connections with idle clients.

—————————————————————–

HostnameLookups
————————-

Determines whether Apache does a reverse DNS lookup on
client addresses so it can write hostnames in the logfile.

A lot of people turn this on so they can have country reports
etc in their traffic reports.

The default is Off in order to save the network traffic for those sites that
don’t truly need the reverse lookups done. It is also better for the end
users because they don’t have to suffer the extra latency that a lookup
entails.

Heavily loaded sites should leave this directive Off, since DNS lookups can
take considerable amounts of time. The utility logresolve, compiled by
default to the bin subdirectory of your installation directory, can be used
to look up host names from logged IP addresses offline.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s