====== Reducing your memory usage ====== ===== Preflight ===== - To see your current memory usage: prstat -Z -s cpu - For more ways to check memory usage, see [[check-processes#checking-memory-usage|checking memory usage]]. - For more useful commands, see [[shell-cheatsheet|the shell cheat-sheet]]. ===== Apache & MySQL ===== This information needs to be cleaned up and pulled into the wiki ... for now here are some articles to look through: - [[http://discuss.joyent.com/viewtopic.php?id=16413|Joyent forum post on apache memory]] - [[http://www.onlamp.com/pub/a/onlamp/2004/02/05/lamp_tuning.html|lamp tuning]] - [[http://2bits.com/articles/tuning-the-apache-maxclients-parameter.html|Tuning maxclients]] - [[http://emergent.urbanpug.com/?p=60|Optomizing Apache and MySQL for low memory]] ==== Common problems ==== === Wild card used in Virtualhost entries === - Listen on the specific IP - Good:Listen 1.2.3.4:80 Listen 1.2.3.4:443 - Bad: Listen *Listen *:80Listen *:443 - Virtualhost entries - Good: - Bad: ===== Rails Applications ===== [[accelerators:tuning_rails]] ===== Webmin ===== Webmin can optionally be configured to use much less memory (~10MB continuously, and ~50MB peak during complex operations). Edit /etc/webmin/miniserv.conf and comment out the preload= line. This makes Webmin slower on systems that have plenty of memory, but it makes it use a lot less memory most of the time (with all of the normal preload stuff in a complete Virtualmin system it is about 80-90MB continuous with peaks of 110-120MB during complex operations). preload is a precaching mechanism for some commonly used libraries, primarily used for Virtualmin related modules. ===== Remove unused applications ===== This is a hard one to really give a step by step on. Only you know what you are using in your stack. The best way to see is to use svcs -a and see what is what on your machine and start picking through the items. To remove one thing you use svcadm disable so for example if you are using PostgreSQL and not MySQL then to remove MySQL from memory you would do this: svcsadm disable cswmysql5