Search code examples
amazon-ec2redhatswap

Swappiness getting reset to default on reboot


I wanted to set vm.swappiness value for my Amazon EC2 instance runnign RedHat Enterprise 7. I am able to set it manually after machine starts using

sudo sysctl -w vm.swappiness=10

But vm.swappiness gets reset to default 30 once I stop and start my instance. I googled for it and found couple of solutions like

  • Adding vm.swappiness = 10 in /etc/sysctl.conf. But this didn't work.

  • Adding vm.swappiness = 10 in /etc/sysctl.conf and adding sysctl -p in /etc/rc.local. This also didn't work. When I run sysctl -p manually, it works correctly.


Solution

  • Nevermind. Found solution after consulting AWS support for same. Need to change the value in /usr/lib/tuned/virtual-guest/tuned.conf.