Linux menu

Wednesday, September 17, 2014

How To Increase Performance and Tune Linux Servers I


1 - Make changes to /proc/sys/kernel

- This setting is dynamic and no reboot is required. 
- This is good for testing settings but will not persist after reboot
echo 256 > /proc/sys/kernel/msgmni
echo 8192 > /proc/sys/kernel/msgmax
echo 65536 > /proc/sys/kernel/msgmnb
echo 300 32000 64 1024 > /proc/sys/kernel/sem
echo "1" > /proc/sys/kernel/core_uses_pid
echo "/var/log/core.%e.%p" > /proc/sys/kernel/core_pattern


2 - /etc/sysctl.conf
- Changing settings here makes them persistent
kernel.sem = 300 307200 32 1024           
kernel.msgmni = 256
kernel.shmmni = 4096
kernel.core_pattern = /var/log/core.%e.%p
Check settings with:
>egrep "kernel.sem|kernel.msg|kernel.shm|core_p|core_u" /etc/sysctl.conf  
kernel.sem = 300 307200 32 1024           
kernel.msgmnb = 65536
kernel.msgmni = 256
kernel.msgmax = 65536
kernel.shmmni = 4096
kernel.shmall = 4294967296
kernel.shmmax = 68719476736
kernel.core_pattern = /var/log/core.%e.%p
kernel.core_uses_pid = 1



3 - /etc/security/limits.conf
add lines:
*               soft    core           unlimited
*               hard    core           unlimited
*               soft    nofile         8192
*               hard    nofile         63535
NOTE:
Making changes to /etc/security/limits.conf file does not change the ulimit values for the currently running NetBackup daemons if they were started by the init scripts in /etc/init.d. The ulimit changes will take affect once NetBackup daemons are restarted from the root shell.

4- /etc/pam.d/login
add line:
session    required     /lib/security/pam_limits.so

5 - /etc/profile
add line:
ulimit -S -c unlimited > /dev/null 2>&1 ulimit -aH

Confirm settings after login with:
>ulimit -aH
core file size          (blocks, -c) unlimited
data seg size           (kbytes, -d) unlimited
max nice                        (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 137215
max locked memory       (kbytes, -l) 32
max memory size         (kbytes, -m) unlimited
open files                      (-n) 63535
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
max rt priority                 (-r) 0
stack size              (kbytes, -s) unlimited
cpu time               (seconds, -t) unlimited
max user processes              (-u) 137215
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

See Also: 3rd party guide to tuning 10Gb network cards on Linux

Tuning 10Gb network cards on Linux

http://www.kernel.org/doc/ols/2009/ols2009-pages-169-184.pdf

NOTE:
The settings provided in this document are an example of tuning values and are for reference use only. Caution is advised when modifying system and user tuning values as the changes may not be appropriate for your particular system. Always make a backup of any configuration files before making any changes.



No comments: