How to speed up your apache server via apache optimisation. Have communication for any kind of mail servers like, Qmail, Postfix, Exim, Exchange etc.

1 post   •   Page 1 of 1
SagarD
 
Posts: 23
Joined: Thu Nov 19, 2015 11:50 am

How to speed up your apache server via apache optimisation.

by SagarD » Wed Jan 06, 2016 11:54 am

In this post I will show you tricks to make your webserver faster. Before starting I would like to tell you, this Article is not necessary meant for cPanel servers but you can also apply for all types of apache web servers. So don’t stop reading this article if you don’t have cPanel server.

First login to your server as root.

All apache configurations are located in “/usr/local/apache/conf/httpd.conf” open this file in your favorite text editor.

vi /usr/local/apache/conf/httpd.conf

MaxClients – Total number of concurrent connections. Following is formula to determine the right value for your server.
MaxClients = 150 x RAM (Per GB)

For ex. If you have 2 GB Ram then set this value to 300
There is no reason for you to set it any higher unless you have a specific problem with this value. A high value can lead to a complete server hang in case of a DOS attack. A value too low can create timeout problems for your clients if the limit is reached.

ServerLimit – This value should be same as MaxClients
ServerLimit = 150 x RAM (GB)

MinSpareServers and MaxSpareServers – MaxSpareServers and MinSpareServers control how many spare (unused) child-processes
Apache will keep alive while waiting for more requests to put them to use. Each child-process consumes resources, so having MaxSpareServers set too high can cause resource problems. On the other hand, if the number of unused servers drops below MinSpareServers, Apache will fork (an expensive operation) new child-processes until MinSpareServers is satisfied.

Keep those to

MinSpareServers 5
MaxSpareServers 10

If you have more them 2 GB of RAM and you run a resource intensive website consider increasing MaxSpareServers.

MaxRequestsPerChild – It controls the number of request the a child serves before the child is killed. This should not be set too low as it will put an unnecessary load on the apache server to recreate the child.
MaxRequestsPerChild 1000 for 1 GB RAM

KeepAlive and MaxKeepAliveRequests
KeepAlive provides long-lived HTTP sessions which 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, but having keepalive on is also a resource intensive setting.

You should KeepAlive only if the loading time of your pages is the most important factor in your business and you can invest money to get more powerful hardware. If you decide to KeepAlive I suggest you set MaxKeepAliveRequest low to something like 2 seconds.

StartServers – Sets the number of child server processes created on startup.
Sets the number of child server processes created on startup. This setting depends greatly on the type of webserver you run. If you run low traffic websites on that server set it low to something like 5. If you have resource intensive websites on that server you should set it close to MaxClients.

StartServers 5

Timeout – The amount of time Apache will wait for three things:
The total amount of time it takes to receive a GET request, The amount of time between receipt of TCP packets on a POST or PUT request, the amount of time between ACKs on transmissions of TCP packets in responses.

The default value is 300. You should set time to something a bit lower. A setting of 150 is probably ok. This will also help in case of small DOS attacks. Do NOT set it any lower then 10 as your users will start having timeout problems.

Timeout 150

After you have done with the necessary changes you can restart Apache.
To also save the changes in the database you will have to run:

/usr/local/cpanel/bin/apache_conf_distiller –update

You can check to see if the changes were accepted and will not be discarded at the next apache recompile by running

/usr/local/cpanel/bin/build_apache_conf

Thanks for viewing our topic “Apache tuning and optimization on cPanel 11.x server”.

1 post   •   Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest

It is currently Thu Nov 26, 2020 8:52 pm