-
November 15th, 2010, 22:43
#1
Basic Apache performance


Apache Timeout setting
The timeout setting is the number of seconds before data "sends" or "receives" (to or from the client) time out. Having this set to a high number forces site visitors to "wait in line" which adds extra load to the server.
- First backup the file with the following command:
cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.bkup.kb-246.1 - The following command opens httpd.conf and searches for the term Timeout:
vi +/Timeout /etc/httpd/conf/httpd.conf You should see the following lines:
# Timeout: The number of seconds before receives and sends time out.
Timeout 120 - Edit the section that reads:
Timeout 120 to a more reasonable value like the following:
Timeout 20 - Save this file by pressing the escape key followed by :wq! which will save the file and exit vi.
- Restart Apache to apply the changes:
/etc/init.d/httpd restart
Max Client Settings
On (dv) Dedicated-Virtual v2.0 Servers:
- First backup the file with the following command:
cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.bkup.kb-246.2 - The following command opens httpd.conf and searches for MaxClients:
vi +/MaxClients /etc/httpd/conf/httpd.conf You should see the following section marked prefork MPM. - Edit the section that reads:
<IfModule prefork.c>
StartServers 2
MinSpareServers 1
MaxSpareServers 5
MaxClients 10
MaxRequestsPerChild 1000
</IfModule>
to something more like this:
- For Base servers:
<IfModule prefork.c>
StartServers 1
MinSpareServers 1
MaxSpareServers 3
MaxClients 50
MaxRequestsPerChild 1000
</IfModule> - For Rage servers:
<IfModule prefork.c>
StartServers 2
MinSpareServers 2
MaxSpareServers 5
MaxClients 100
MaxRequestsPerChild 1000
</IfModule> - For Extreme servers:
<IfModule prefork.c>
StartServers 2
MinSpareServers 2
MaxSpareServers 5
MaxClients 200
MaxRequestsPerChild 1000
</IfModule>
- Save this file and restart Apache to apply the changes:
/etc/init.d/httpd restart
On (dv) Dedicated-Virtual v3.x Servers:
- First backup the file with the following command:
cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.bkup.kb-246.2 - The following command opens httpd.conf and searches for MaxClients:
vi +/MaxClients /etc/httpd/conf/httpd.conf You should see the following section marked prefork MPM. - Edit the section that reads:
<IfModule prefork.c>
StartServers 1
MinSpareServers 1
MaxSpareServers 20
ServerLimit 20
MaxClients 150
MaxRequestsPerChild 4000
</IfModule>
to something more like this:
- For Base servers:
<IfModule prefork.c>
StartServers 1
MinSpareServers 1
MaxSpareServers 3
ServerLimit 50
MaxClients 50
MaxRequestsPerChild 4000
</IfModule> - For Rage servers:
<IfModule prefork.c>
StartServers 2
MinSpareServers 2
MaxSpareServers 5
ServerLimit 100
MaxClients 100
MaxRequestsPerChild 4000
</IfModule> - For Extreme servers:
<IfModule prefork.c>
StartServers 2
MinSpareServers 2
MaxSpareServers 5
ServerLimit 200
MaxClients 200
MaxRequestsPerChild 4000
</IfModule> - For Nitro servers:
<IfModule prefork.c>
StartServers 20
MinSpareServers 20
MaxSpareServers 50
ServerLimit 500
MaxClients 500
MaxRequestsPerChild 4000
</IfModule>
- Save this file and restart Apache to apply the changes:
/etc/init.d/httpd restart
NOTE:
If you are running into frequent Apache crashes you can check the error_log for MaxClients-related problems.
To check your error logs to see if you have MaxClient issues you can run the following command as root:
grep -i maxclient /var/log/httpd/error_log* If this command returns any results after making the above changes you may need to fine-tune the MaxClients variables further
.
-
-
November 15th, 2010 22:43
# ADS