Apache Optimization For Low Resources

Running a server with low resources can be a pain but also an opportunity to learn and optimize it then you can rest assured that all possible solutions were used. From my experience web and database servers consume the most resources on a shared environment, remember that you can always increment or reduce as you see fit and the settings are similar to the ones used for a low traffic site. The default configuration file for Apache2 can be found at. /etc/apache2/apache2.conf Using IfModule mpm_prefork_module

StartServers 5 MinSpareServers 5 MaxSpareServers 10 MaxClients 20 MaxRequestsPerChild 0

Brief description of options

StartServers How many child server should be started by httpd (parent server). MinSpareServers Minimum number of server processes kept spare. MaxSpareServers Maximum number of server processes kept spare. MaxClients Maximum number of server processes allowed to start. MaxRequestsPerChild Maximum number of requests a process can server .

Apache tries to start and stop servers based on the current load for example if traffic decreases and too many idle server are running Apache will kill some until it reaches the number specified in “MinSpareServers”. On the other hand if a lot of request arrive in a short or close amount of time and few servers are running Apache will start more servers up to the number specified in MaxClients . Configuration example for a low traffic site. Using IfModule mpm_prefork_module

StartServers 1 MinSpareServers 1 MaxSpareServers 8 MaxClients 10 MaxRequestsPerChild 400

Dont forget to restart the webserver. sudo /etc/init.d/apache2 reload Soon I will have a post on reducing the load MySQL places on a server.