Optimize Apache using Webmin to consume lower memory
You can optimize your Apache to use lower RAM in systems where there are shortage of memory or the memory usages are near limit! Here, we are showing how to reduce apache memory usages using Webmin control panel!
How to?
- Browse to the Webmin Apache Webserver module
- Click on “Processes and Limits”
- Change the following to the values shown:
Maximum spare server processes 3
Minimum spare server processes 2
Initial server processes 3
Optionally, remove any modules you aren’t using. This actually will reduce memory usage more than anything else–but it’s hard to guess what modules you’ll want/need to do your job.
mod_perl is needed for the new Analytics module in Virtualmin, but otherwise everything can be run under cgi or fcgid…and if memory is a real problem, you may have to give up on Analytics (or set it up manually without our mod_perl filter).
Disabling mod_php4 or mod_php5 is cool (but if you’ve been using it for PHP scripts, you’ll need to make the switch to fcgid first, and reset permissions and ownership up your PHP scripts in domain homes) and will shave quite a bit off the process size.
Other possibilities for disabling: auth_dbm, disk_cache, proxy (but this removes quite a bit of functionality), include (removes Server Side Include functionality), status.
Because Apache is probably the biggest process on any hosting system…if you’re dealing with a VERY small memory system (under 256M), then you’ll have to cut it down a lot. This isn’t really optional in that case.
You can also edit the apache configuration file manually! Here is a sample apache configuration file that is good for systems with low memory:
KeepAlive On
KeepAliveTimeout 3<IfModule prefork.c>
StartServers  3
MinSpareServers 2
MaxSpareServers 3
ServerLimit 100
MaxClients  100
MaxRequestsPerChild 500
</IfModule><IfModule worker.c>
StartServers 2
MaxClients 150
MinSpareThreads 15
MaxSpareThreads 50
ThreadsPerChild 15
MaxRequestsPerChild 0
</IfModule>
a WordPress rating system
Related posts:
- Optimizing Virtualmin to consume lower RAM
- Apache configuration (httpd.conf) checking
- Updating Apache using Cpanel EasyApache
- Configuring your Firewall for Webmin
- Secure and Optimize your Virtual Private Server (VPS)