I run my FreePBX on a ESXi VM. For years, I’ve given it 2GB of RAM and it’s run just fine.
After a recent upgrade earlier this year, I noticed that my machine would have some sluggishness even when handling a single call. Often there would be a delay of several seconds after calls were answered and before audio was passed.
I examined the memory chart on the main FreePBX page and noticed that the memory was 52% used with 41% being cached. 3% was being used in swap file. I developed a theory that the swap file was slowing everything down.
I did some research and learned about how the cache and the swap file are used, and started to wonder why my system was using a swapfile at all. Cache is supposed to be freed up when memory is needed. In theory, swap shouldn’t be used at all unless there simply isn’t enough RAM to run the apps. At 52% usage, I was nowhere near there.
So, I learned a bit more about “Swappiness,” and I ran across this page:
https://linuxhint.com/understanding_vm_swappiness/
which indicates that Swappiness tells Linux when to start using swap files. The default is 60, which appears to mean that when free memory reaches 60% (or less), it should start using a swap file. The same page indicates that server systems should use a much lower setting. It also indicates that MariaDB based systems should set Swappiness to 1 (ONE).
The FreePBX distro has Swappiness set to 30. Given that FreePBX used MariaDB, and that swapping is undesirable, shouldn’t the FreePBX distro have swappiness set to 1???
In the meantime, I’ve increased by available RAM to 4GB, and the system seems to be working again. All the same, I thought that I’d consult the gurus and see what you think…
Should swappiness be set to 1?