顯示具有 Linux Systen 標籤的文章。 顯示所有文章
顯示具有 Linux Systen 標籤的文章。 顯示所有文章

2010年3月3日 星期三

Verified Memory Usage

1. top
we can observe the memory usuage from the top 2 lines of mem/Swap usage
Mem: 3693568k total, 850148k used, 2843420k free, 145076k buffers
Swap: 8385920k total, 0k used, 8385920k free, 372780k cached

2. cat /proc/meminfo
# cat /proc/meminfo
MemTotal: 3693568 kB
MemFree: 2830268 kB

3. free
# free -m -t
total used free shared buffers cached
Mem: 7982 3576 4406 0 625 2677
-/+ buffers/cache: 272 7709
Swap: 10236 0 10236
Total: 18219 3576 14643

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

2008年8月4日 星期一

Disable selinux

When packaging an application on RHEL or CentOS, you may receive the following error:
# cannot restore segment prot after reloc: Permission denied
This is likely due the the SE Linux setting being set to "enforcing"
To temporarily disable enforcement on a running system

# /usr/sbin/setenforce 0

Or you can disable selinux temprary by the following method
# echo 0 > /selinux/enforce