Linux Kernel Tuning for Centos 7

`tuned` should already be installed for Cent 7 and default profile is balanced.

tuned-adm profiles can be found in this directory

ls /usr/lib/tuned/
 
balanced/               latency-performance/    powersave/              virtual-guest/
desktop/                network-latency/        recommend.conf          virtual-host/
functions               network-throughput/     throughput-performance/

 
To see what the active profile is:
tuned-adm active

 
To activated tuned xxx
tuned-adm profile xxx

 

 

latency-performance

  • latency-performance
    • Profile for low latency performance tuning.
    • Disables power saving mechanisms.
    • CPU governor is set to performance and locked to the low C states (by PM QoS).
    • CPU energy performance bias to performance.
    • This profile is the Parent profile to "network-latency".

 
Activate tuned latency-performance for CentOS 7

tuned-adm profile latency-performance

 
For CentOS 7, the latency-performance profile includes the following tweaks
cat /usr/lib/tuned/latency-performance/tuned.conf
[cpu]
force_latency=1
governor=performance
energy_perf_bias=performance
min_perf_pct=100
 
[sysctl]
kernel.sched_min_granularity_ns=10000000
vm.dirty_ratio=10
vm.dirty_background_ratio=3
vm.swappiness=10
kernel.sched_migration_cost_ns=5000000

 

network-latency

  • network-latency
    • This is a Child profile of "latency-performance".
    • That this means is that if you were to activate network-latency profile via tuned, it would automatically enable latency-performance, then make some additional tweaks to improve network latency.
    • Disables transparent hugepages, and makes some net.core kernel tweaks.

 

cat /usr/lib/tuned/network-latency/tuned.conf
[main]
include=latency-performance
 
[vm]
transparent_hugepages=never
 
[sysctl]
net.core.busy_read=50
net.core.busy_poll=50
net.ipv4.tcp_fastopen=3
kernel.numa_balancing=0

 

throughput-performance

  • throughput-performance
    • This is the Parent profile to virtual-guest, virtual-host and network-throughput.
    • This profile is optimized for large, streaming files or any high throughput workloads.
    • Recommended if the system is not using "enterprise class" storage.

 

cat /usr/lib/tuned/throughput-performance/tuned.conf
[cpu]
governor=performance
energy_perf_bias=performance
min_perf_pct=100
 
[vm]
transparent_hugepages=always
 
[disk]
readahead=>4096
 
[sysctl]
kernel.sched_min_granularity_ns = 10000000
kernel.sched_wakeup_granularity_ns = 15000000
vm.dirty_ratio = 40
vm.dirty_background_ratio = 10
vm.swappiness=10

 

virtual-guest

  • virtual-guest
    • Profile optimized for virtual guests based on throughput-performance profile.
    • It additionally decreases virtual memory swapiness and increases dirty_ratio settings.

 

cat /usr/lib/tuned/virtual-guest/tuned.conf
[main]
include=throughput-performance
 
[sysctl]
vm.dirty_ratio = 30
vm.swappiness = 30

 

virtual-host

  • virtual-host
    • Profile optimized for virtual hosts based on throughput-performance profile.
    • It additionally enables more aggressive write-back of dirty pages.

 

cat /usr/lib/tuned/virtual-host/tuned.conf
[main]
include=throughput-performance
 
[sysctl]
vm.dirty_background_ratio = 5
kernel.sched_migration_cost_ns = 5000000

 

I/O scheduler

echo "deadline" > /sys/block/sda/queue/scheduler
vim /etc/grub2.cfg

menuentry 'CAKE 3.0, with Linux 3.10.0-229.1.2.el7.x86_64' ...
    ...
    linux16 ... elevator=deadline
    ...

 

Install IOzone

wget http://www.iozone.org/src/current/iozone3_430.tar
tar xvf iozone3_430.tar
cd iozone3_394/src/current
make
make linux

 

Performance Test

./iozone -s 30g -i 0 -i 1 -r 64k -f /mnt/storage/iozone-data -Rb ./iozone.xls
echo 2 > /proc/sys/vm/drop_caches
除非特別註明,本頁內容採用以下授權方式: Creative Commons Attribution-ShareAlike 3.0 License