if you are on a distribution based on redhat 6 there are some interesting tools which can help in fine tuning the system for different workloads. e.g. if you’d like to put a database on
your server there a various settings you might want to adjust ( kernel, disks, network … ). if you use the system as a workstation other settings might make more sense ( power saving settings, for example ).
as this blog mainly is about databases i’ll focus there, obviously. first of all you’ll need the software:
yum install tuned
as tuned is a service you’ll need to enable and start it.
service tuned start chkconfig tuned on chkconfig --list | grep tuned
let’s see what happend. the main configuration file for tuned is located in /etc:
/etc/tuned.conf
if you take a look at the file you will find a main section and various plugins sections (e.g. DiskTuning or CPUTuning).
next several default tuning profiles have been created:
ls -l /etc/tune-profiles/ active-profile default desktop-powersave enterprise-storage functions laptop-ac-powersave laptop-battery-powersave latency-performance server-powersave spindown-disk throughput-performance virtual-guest virtual-host
each of these directories contains the same configuration files ( ktune.sh, ktune.sysconfig, sysctl.ktune, tuned.conf ) which specify the various settings which will be set once the profile becomes active.
you can list the available profiles with the tune-adm command, too:
tuned-adm list Available profiles: - server-powersave - laptop-ac-powersave - latency-performance - default - desktop-powersave - enterprise-storage - virtual-guest - virtual-host - spindown-disk - laptop-battery-powersave - throughput-performance Current active profile: default
… which additionally tells us that the default profile is the one which is active at the moment.
another way to check the active profile is:
tuned-adm active
if you want to create a new profile just copy an existing one and adjust the settings you want to:
cp -pr /etc/tune-profiles/enterprise-storage/ /etc/tune-profiles/my_profile tuned-adm list | grep my_profile - my_profile
for databases you’ll probably need maximum throughput, so let’s activate the throughput-performance profile:
tuned-adm profile throughput-performance Stopping tuned: [ OK ] Switching to profile 'throughput-performance' Applying ktune sysctl settings: /etc/ktune.d/tunedadm.conf: [ OK ] Calling '/etc/ktune.d/tunedadm.sh start': [ OK ] Applying sysctl settings from /etc/sysctl.conf Applying deadline elevator: sda [ OK ] Starting tuned: [ OK ]
according to the documentation and the output from above this should change the io scheduler to deadline ( which is recommended for databases ). is this true ?
cat /sys/block/sda/queue/scheduler noop anticipatory [deadline] cfq
seems to work. does this survive a reboot?
reboot tuned-adm active cat /sys/block/sda/queue/scheduler noop anticipatory [deadline] cfq
very good. no need to adjust this in the bootloader anymore.
if you want to check which kernel settings have been adjusted by activating this profile just have a look at the configuration files:
cat /etc/tune-profiles/throughput-performance/sysctl.ktune
include any kernel setting you need in there and you’re fine.
as profiles may be switched on the fly several profiles activated at different times of the day might make sense, too.