|Pivotal GemFire||All versions|
The purpose of this article is to describe how to configure swappiness and why it is important to configure it correctly on a GemFire distributed system.
Swapping, also known as paging, is the use of secondary storage to store and retrieve application data on disk for use in RAM memory. The Operating System, by default, may choose to swap out a process or some of its heap due to low usage even if it is not running low on RAM. Swappiness is performed in order to prepare the OS for eventual memory requests. Swappiness should be avoided for GemFire JVMs.
Swapping can have a significant negative impact on GemFire's performance and should be avoided. Often, swapping manifests itself as GemFire nodes being forced out of the distributed system due to long periods of unresponsiveness.
How to avoid swapping on a GemFire host:
There are two ways to avoid memory being written to disk by Linux:
- Setting swappiness to 0.
- Locking memory.
Setting swappiness to 0:
The swappiness setting on Linux is a value between 0 and 100, where higher values encourage more optimistic swapping. The default value is 60. For GemFire, the swappiness should always be disabled by setting it to 0. This way the offload from memory to disk is controlled by GemFire using overflow or eviction instead of being at the mercy of the OS.
To avoid swapping, ensure that sufficient RAM memory is available on the host and that the number of running processes is accounted for and do not consume all the available RAM. Tools such as top can be used to monitor swap rates.
To see the current swappiness value that is set, enter the following at the command prompt:
To set the swappiness permanently, modify the
Using memory locking:
Please refer to the Locking Memory section of the User´s Guide for GemFire 9.0 for how to avoid heap or off-heap memory being swapped out to disk by the OS.