====== Linux OS Tuning/Optimizations ======
===== High i/o wait tuning for File Servers =====
Under “Server”→“General” tab, change “Priority” configuration to “-19”. Process priority can be set from -19 to 20, -19 is the highest, 20 is the lowest.
===== Change to 'deadline' I/O scheduler =====
* From command line (change the device 'sda' to appropriate device):
echo “deadline” > /sys/block/sda/queue/scheduler
* kernel parameter, change /boot/grub/menu.lst, add kernel parameter
elevator=deadline
===== Change VM parameters =====
There are two variables which control the behaviour of VM flushing and allocation and affect network and disk performance
* vm.dirty_background_ratio
* vm.dirty_ratio
To set these values from command line
echo 20 > /proc/sys/vm/dirty_background_ratio
echo 60 > /proc/sys/vm/dirty_ratio
to make it permanent, edit /etc/sysctl.conf:
vm.dirty_background_ratio = 20
vm.dirty_ratio = 60
===== Increase readahead =====
To get current readahead value:
$ blockdev --getra /dev/sda
256
To increase it to a higher value like 16K:
$ blockdev --setra 16384 /dev/sda
===== Disable updating access time stamp for file system =====
Edit /etc/fstab, remove "atime" attribute if there is, add "noatime" attribute. The noatime change can significantly improve your server's file i/o performance.
#sample /etc/fstab line before change
LABEL=/ / ext3 defaults 1 1
#sample /etc/fstab line after noatime change
LABEL=/ / ext3 defaults ,noatime 1 1
===== Kernel Network Tuning =====
Add the follwing to /etc/sysctl.conf
#increase local ports
net.ipv4.ip_local_port_range = 1024 65535
#reduce the number of time_wait connections
#these 3 lines can reduce your time_wait count by several hundred percent.
#however you should not use the following lines in a NATed configuration.
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_fin_timeout = 30
Then call sysctl to make them active
sysctl -p