![]() |
This User Guide is for performance tuning the Apache web server, not an application server like Tomcat, JBoss, Ruby on Rails, or GlassFish. For information on troubleshooting sites using those application servers, see their specific User Guides - http://support.eapps.com/kb |
![]() |
Any web server optimization and tuning will be wasted if your VPS does not have enough resources to serve your sites |
![]() |
Changing some of these values to a higher number without a corresponding increase in server resources will actually cause your web server to perform worse, not better. Many of these values will cause your web server to consume more memory, and if you do not have enough memory available, changing these values can significantly decrease the performance of your sites. |
[root@eapps-example ~]# cd /etc/httpd/conf [root@eapps-example conf]# ll httpd.conf -rw-r--r-- 1 root root 39329 Aug 11 13:13 httpd.conf [root@eapps-example conf]# cp httpd.conf{,.back} [root@eapps-example conf]# vi httpd.conf |
# prefork MPM # StartServers: number of server processes to start # MinSpareServers: minimum number of server processes which are kept spare # MaxSpareServers: maximum number of server processes which are kept spare # ServerLimit: maximum value for MaxClients for the lifetime of the server # MaxClients: maximum number of server processes allowed to start # MaxRequestsPerChild: maximum number of requests a server process serves <IfModule prefork.c> StartServers 1 MinSpareServers 1 MaxSpareServers 5 ServerLimit 10 MaxClients 10 MaxRequestsPerChild 4000 </IfModule> |
[root@eapps-example conf]# service httpd restart Stopping httpd: [ OK ] Starting httpd: [ OK ] [root@eapps-example conf]# |
![]() |
The same warnings apply for modifying php.ini as for modifying httpd.conf - if your VPS does not have the resources available to properly serve your sites, then any type of performance tuning will be wasted, and in fact may make your site perform worse, not better. |
[root@eapps-example ~]# cd /etc [root@eapps-example etc]# cp php.ini{,.bak} [root@eapps-example etc]# vim php.ini |
memory_limit = 32M ; Maximum amount of memory a script may consume (16MB) |
; Maximum allowed size for uploaded files. upload_max_filesize = 2M |
[Wed Aug 05 14:13:59 2009][error] server reached MaxClients setting, consider raising the MaxClients setting [Fri Aug 07 11:50:32 2009][error] server reached MaxClients setting, consider raising the MaxClients setting [Mon Jul 20 15:52:50 2009][error] server reached MaxClients setting, consider raising the MaxClients setting [Sat Jul 18 09:31:56 2009][error] server reached MaxClients setting, consider raising the MaxClients setting |
[root@eapps-example ~]# ps -ef | grep -c httpd 13 [root@eapps-example ~]# |
[root@eapps-example ~]# top -b -c -n 1 | grep httpd | awk '{print $6}' 18m 18m 18m 18m 21m 18m 19m 18m 18m [root@eapps-example ~]# |
[root@eapps-example ~]# service httpd stop Stopping httpd: [ OK ] [root@eapps-example ~]# free -m total used free shared buffers cached Mem: 432 26 405 0 0 0 -/+ buffers/cache: 26 405 Swap: 0 0 0 [root@eapps-example ~]# |