CentOS 7 tuned profile for redis

Updated at by

Redis might spill a few warnings about transparent hugepages, overcommit memory or tcp backlog during startup depending on your OS and redis configuration. Instead of fiddling with /etc/sysctl.conf, kernel line /etc/grub.d/00_derp.conf and /etc/rc.local and whatnot, you can use a tuned profile to fix all of those.

Check the current active profile, which is virtual-guest in this example.

cat /etc/tuned/active_profile

Create a new profile for redis

mkdir /etc/tuned/hurr-durr-redis

Copy the current active profile from /usr/lib/tuned/virtual-guest/tuned.conf

cp /usr/lib/tuned/virtual-guest/tuned.conf /etc/tuned/hurr-durr-redis/

Edit the /etc/tuned/hurr-durr-redis/tuned.conf and add the blocks and/or lines depending on what warnings you got.


# Redis : WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis.
# Fix by disabling THP

# Copied from 'virtual-guest' in /usr/lib/tuned/virtual-guest/tuned.conf
vm.dirty_ratio = 30
vm.swappiness = 30

# Redis : WARNING overcommit_memory is set to 0! Background save may fail under low memory condition.
# Fix by enabling vm.covercommit_memory
vm.overcommit_memory = 1

# Redis : WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128
# Fix by setting somaxconn value over 511
net.core.somaxconn = 512

Reload tuned.service (might not be necessary)

systemctl reload tuned.service

List all profiles and you should see your new redis profile in the list.

tuned-adm list

Set the new profile as active

tuned-adm profile hurr-durr-redis

Aaaand restart redis

systemctl restart redis.service

Hopefully no more warnings :)

Share on FacebookShare on Facebook Share on TwitterShare on Twitter

Leave a comment