2009年6月4日 星期四

Linux System - Tuning Linux server performance before adopting the server production

If We want to setup a high performance and throughput networked server. We may follow the directions of this article to achieve the purpose.

Modify the system settings
sysctl -w net.core.rmem_max=8388608
sysctl -w net.core.wmem_max=8388608
sysctl -w net.ipv4.tcp_moderate_rcvbuf=1
sysctl -w net.ipv4.tcp_rmem="32768 87380 8388608"
sysctl -w net.ipv4.tcp_wmem="16384 65536 8388608"
sysctl -w net.ipv4.tcp_mem="8388608 8388608 8388608"
sysctl -w net.ipv4.tcp_syncookies=0
ulimit -n 65535
ulimit -s unlimited
ulimit -u unlimited




# increase Linux TCP buffer limits
sysctl -w net.core.rmem_max=8388608
sysctl -w net.core.wmem_max=8388608

# increase Linux autotuning TCP buffer limits
sysctl -w net.ipv4.tcp_moderate_rcvbuf=1
sysctl -w net.ipv4.tcp_rmem="32768 87380 8388608"
sysctl -w net.ipv4.tcp_wmem="16384 65536 8388608"
sysctl -w net.ipv4.tcp_mem="8388608 8388608 8388608"

# stop syn blocking
sysctl -w net.ipv4.tcp_syncookies=0

# maximum number of open file descriptors (modify the open files number per process)
# This parameter is the important factor that determine the process can open how many file descriptor / socket number.
ulimit -n 65535

How to modify the configure file to make the modification effectiveness after
reboot

Ans:
We can modify the /etc/sysctl.conf to make the new setting effective after system reboot.

In the /etc/security/limits.conf, add
* soft nofile 8192 (modify to the max value of soft)
* hard nofile 20480 (modify to the max value of hard)

After this modification, relogin and type "ulimit -a" will show the open fd size of per process

沒有留言: