Swap space in Linux is used when the physical memory (RAM) is full. If the system needs more memory resources and the RAM is full, inactive pages in memory are moved to the swap space. From a range of 0 to 100, swappiness indicates how frequently a system should use swap space based on RAM usage. We recommend the following for swap space:
By default on most Linux platforms, swapiness is set to 60. However this will make a system go into swap too frequently for Couchbase Server.
If you use Couchbase Server 2.0+ without views, we recommend setting swappiness of 10 to avoid going into swap too frequently.
If you use Couchbase Server 2.0+ with views, we recommend setting swappiness to 0 or else your system swap usage will be far too high.
Certain cloud systems by default do not have a swap partition configured. If you are using views, we recommend setting swappiness to 0. If you are not using views, you can set this to 10.
To view the currently set swappiness on your system, enter this:
Or you can use this command:
To change the swappiness, edit
/etc/sysctl.conf and add
vm.swappiness at the end of the file. After
you save this and reboot your system, this setting will be used.