Sunday, May 23, 2010

set up swappiness on boot

The swap - a space on the harddrive which the system would use if there is no more memory left. The swappiness variable which you can find under /proc/sys/vm/ controls this feature. A higher value means the system would rather use the swap space than trying to free some memory space. A lower value means - of course - the opposite.

Well, on my server the system runs on a ssd harddrive (to be exactly: they are 2 ssd's running at raid 0). The bad thing about these harddrives are, they have limited write-cycles. That means less write would keep the drives longer alive.

For that i changed that swappiness on my server to 30. To change the default setting you have to type:

sysctl vm.swappiness=30

But the problem is, with every reboot the system would loose these settings. Though, a short (boot)script could simply set it up every boot, but actually there is an easier way.

Amoung /etc there is a file called sysctl.conf. Here we can set up things like ip_forward. And we also can set up the swappiness. Just change the file and add a new line:

vm.swappiness = 30

That's all. Now on every boot, the system would set the swappiness value to 30.

No comments:

Post a Comment