Thursday, April 22, 2010

tuning linux OS parameters

cat /proc/sys/fs/file-max
set fs.file-max=102642 into /etc/sysctl.conf

Increase default socket send/receive buffer

sysctl -w net.core.rmem_default=262144
(default socket receive buffer)

sysctl -w net.core.wmem_default=262144
(default socket send buffer)

sysctl -w net.core.rmem_max=262144
(max socket receive buffer)
sysctl -w net.core.wmem_max=262144
(max socket send buffer size)

Optimize MTU. The TCP maximum transfer unit is 1512 on the Internet. If you are sending larger packets it's a good idea to increase MTU size in order to reduce packet fragmentation (especially if you have a slow network)

vi /etc/sysconfig/network-scripts/ifcfg-xxx (eth0 for instance)

– add "MTU=9000" (for gigabit ethernet)
– restart the interface (ifdown eth0;ifup eth0)

Use Big Memory Pages

Default page size is 4KB (usually too small!)
Check page size with:

#cat /proc/meminfo

If you see "HugePage_Total," "HugePages_Free" and "Hugepagesize", you can apply this optimization

example to set 2GB Heap Size

#echo 2147483647 > /proc/sys/kernel/shmmax
#echo 1000 > /proc/sys/vm/nr_hugepages

No comments:

Post a Comment

Followers