Swappiness for a WordPress server
The swappiness
parameter configures how often your system swaps data out of RAM to the swap space. This is a value between 0 and 100 that represents a percentage.
With values close to zero, the kernel will not swap data to the disk unless absolutely necessary. Remember, interactions with the swap file are “expensive” in that they take a lot longer than interactions with RAM, and they can cause a significant reduction in performance. Telling the system not to rely on the swap much will generally make your system faster.
Values that are closer to 100 will try to put more data into swap in an effort to keep more RAM space free. Depending on your applications’ memory profile or what you are using your server for, this might be better in some cases.
This is a very widely opined topic. The idea behind swappiness
is that:
- 0 is no swap allocation at all
- 60 is when the memory falls below 60%
- 100 swap is enabled all the time
For instance, Red Hat1 and Digital Ocean2 recommend vm.swappiness=10
, while other hosts could recommend a higher value like vm.swappiness=60
. If it were up to MariaDB3, they’d set it to 0
.
Note, that some hosts, try to save the load on their machines, so they implement a higher value. However, that will lead to diminished performance too, as even if SSD, the reads/writes will be slower than on RAM.