Is there a way to completely restrict using swap if there are buffers/cache in use? And use swap only to prevent Out-Of-Memory Killer.
Is there a way to forbid using swap if are there still buffers/caches that could be flushed?
What options should I tweak? My guess would be something along the lines of
swappiness
vm.dirty_bytes
vm.dirty_background_bytes
vm.dirty_bytes
The reason why I need it: I have proprietary software that doesn't work properly if a swap is used, but the system consumes a lot of buff/cashe.
If I manually (and regularly every 2-3 hours) clean buff/cache by using this command
sync; echo 3 > /proc/sys/vm/drop_caches
everything works fine.
But if I just let it be, the software starts to perform badly, even if I have set up vm.swappiness=1
, it just give it a little bit more time to live ...
Yep, I tried to disable swap altogether, but It didn't work well. Because there are rare cases when there is a high load it is better than the application giving timeout error, which just breaks because out of memory error.
– glorsh66 Dec 31 '21 at 16:49