When you assign more memory to buffers than your server has physical RAM, swapping can happen. swapping degrades performance significantly.
SWAP is slower than RAM, because it is used on a physical disk (magnetic or SSD). In other words, it is an emulated memory on disk.
We have to tweak a kernel parameter called swappines, to avoid MySQL/MariaDB data being SWAP instead of RAM.
The balance between swapping out runtime memory and dropping pages from the system page cache can be done using swapping value. The bigger the value, the more system will swap. The smaller the value, the less the system will swap.
The maximum is 100, the minimum is 0, and the default is 60.
Add the following line in your sysctl.conf file in /etc/sysctl.conf to change this parameter in the persistence mode.
vm.swappiness = 0
Cheers!