Performance - Swappiness = 1

Description

Swappiness should be reduced as much as possible on databases of all kinds. Note: due to OOM behaviour since Linux 2.6.32+ swappiness=0 is dangerous, so to be safe we stay with swappiness=1 and throw a warning on swappiness=0.

Solution

echo 'swappiness = 1' >/etc/sysctl.d/50-swappiness.conf && sysctl -p

Check Script: performance-swappiness.sh

value=$(/sbin/sysctl -n swappiness 2>/dev/null)
if [ "$value" -gt 1 ]; then
	result_failed "sysctl swappiness != 1"
elif [ "$value" -eq 0 ]; then
	result_warning "sysctl swappiness=0, this can cause OOM kills!"
elif [ "$value" -eq 1 ]; then
	result_ok
fi