[Beowulf] disabling swap on cluster nodes?

Lyle Bickley lbickley at bickleywest.com
Mon Feb 9 11:16:54 PST 2015

Rather that totally disabling swap, we create a relatively small swap
partition and set "swappiness" to "1". The swappiness setting
determines the "willingness" of the kernel to use swapping - so "1"
means "only swap if you REALLY must".

Here's more information on setting "swappiness":
Controlling swap
Because swap is intended as a supplement to memory, the process by which items are swapped in and out is automatic, giving the user little choice what goes into it. However, since kernel 2.6 a small tweak was added to configure how quickly the system swaps items – swappiness.

Swappiness is an arbitrary number from 0 to 100 that indicates how fast you want the system to page items out to disk, freeing up precious RAM. The higher the number, the sooner pages will be written out to swap. You can alter swappiness either temporarily or permanently, as outlined below. Before you go about that, check the value currently set:

sysctl vm.swappiness

A simple terminal command is all that is required to change swappiness for the current session. If you want to keep things in memory longer than the current value provides, try lowering swappiness. For example, setting a value of 40:

sudo sysctl vm.swappiness=40

The nice thing about this, is that you can change the setting without rebooting and find a nice threshold that suits your needs. After restarting, the settings will be returned to the default value, so once you find a preferred value, you may decide to change swappiness permanently.

This is only slightly harder, but not by much. It actually involved adding or editing a parameter in a single file.

Modify with your favorite editor: /etc/sysctl.conf

Search for “vm.swappiness”. If your editor finds it, great! Just change the value from the current to your desired. If the value is not found, scroll to the bottom of sysctl.conf and add it. In either case, it should look like this:


On succeeding boots, this value will be the default. We can re-read the config file, verifying any changes:

sudo sysctl -p

Note: The entire text above cut and pasted from:
and updated to generalize the editing procedure...

Bickley Consulting West Inc.

"Black holes are where God is dividing by zero"

More information about the Beowulf mailing list