Engineering Notes

LINUX Memory Overcommit

/proc/sys/vm/overcommit_memory

By default CentOS 5 (and maybe others) allows applications to request more memory than is available.  This is not good in a server environment.

What happens when all physical memory is used?

OOM-KILLER goes out and kills processes unpredictably!  You will see it doing this in /var/log/messages.

Turn this off on a live server:


echo 2 > /proc/sys/vm/overcommit_memory

Turn this off between reboots:

add the following lines in /etc/sysctl.conf
vm.overcommit_memory=2
vm.overcommit_ratio=100

To me, this kind of design thinking is like using a credit card to pay for emergencies.

More information and props to http://opsmonkey.blogspot.com/2007/01/linux-memory-overcommit.html

Open Port 3306 on CentOS


 
vim /etc/sysconfig/iptables
-I INPUT -p tcp --dport 3306 -m state --state NEW,ESTABLISHED -j ACCEPT
-I OUTPUT -p tcp --sport 3306 -m state --state ESTABLISHED -j ACCEPT
/etc/init.d/restart