I have slow HDD and 5.5 GB of RAM, and thus I'm using zram and no any disk swap.

According to my observations, the lack of disk cache has much worse impact on performance than active swapping. While swapping freezes only processes that quickly increase RAM usage or were swapped out because of inactivity, accidental reducing of disk cache freezes many of processes that rely on disk read operations and increases Load Average to >4x of the cores number.

So it would be better to always have at least 0.5 GB of RAM reserved for disk read cache under any circumstances. However, even with vm.swappiness=100 it is not always kept up: if some process is quickly increasing the RAM usage, or there are already several gigabytes in swap, amount of free RAM still can be reduced to 100–300 MB.

Does the Linux kernel have any explicit handles to set a minimal amount of RAM that should be always reserved for buff/cache?

  • You should fit in 5.5GB RAM or buy more. Using swap is always an expensive operation. – Ipor Sircer Oct 29 '18 at 16:03
  • @IporSircer RAM is never enough: the more is available, the more hungry bloatware will devour it. Techniques like ulimiting, cgrouping and UKSM are efficient for fighting that too, but I came for suggestions on softening the situation when s**t already happened, not on preventing that (in general, it is not even 100% possible, as any program may accidentally leak, and no any large, but still limited, amount of RAM will help with that). – bodqhrohro Oct 29 '18 at 17:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.