Using Swap

There is a Linux kernel parameter called swappiness that controls when the operating system will start using the swap space. This parameter can be set to values between 0 and 100. A lower value tells the kernel to use the swap space less frequently, and a higher value tells it to use the swap space more frequently. The default value is 60.

Here are some special cases of using swaps:

Value

Strategy

vm.swappiness = 0

  • Linux 3.5 and newer: Disables swap entirely
  • Linux 3.4 and older: Swap only to avoid an "out of memory" condition

vm.swappiness = 1

  • Linux 3.5 and newer: Minimum amount of swapping without disabling it entirely

vm.swappiness = 100

  • Linux will swap aggressively

In a scenario where Redis needs to access from the swap ...

Get Redis Essentials now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.