0

I have already set vm.swappness to 0, but the system still uses swap after sometime the rest of memory is filled by cache. This leads to high load and high latency, probably because I put SWAP and the system on the same hard disk?

I have read through https://help.ubuntu.com/community/SwapFaq/#What_is_swappiness_and_how_do_I_change_it.3F And I found "The Linux kernel automatically moves RAM reserved by programs--but not really used--into swap, so that it can serve the better purpose of extending cached memory." Is this the true reason? How can I avoid this so I can still use swap for unforeseeable circumstances?

fpmurphy
  • 4,636
  • The classic answer here is 'why do you want to'? If the kernel has decided memory is better used as filesystem cache, why do you think differently? Usually when ths happens there are blocks of memory that have never (or very seldomly) been used, and it's more optimal to swap them out and make use of the memory than it is to have them lying around consuming space. – GarethHumphriesAcc Jun 13 '19 at 04:44
  • Sounds very similar to a problem I had https://unix.stackexchange.com/questions/499485/how-do-i-use-swap-space-for-emergencies-only – Philip Couling Jun 13 '19 at 04:48
  • The accepted answer may not be right for everyone but it worked well for me. You might want to reconsider how much swap you need or if you need it at all. After much reading I am less and less convinced that it's needed. Certainly anything over 1gb is likely to cause performance issues over time if if you find a way to use it. – Philip Couling Jun 13 '19 at 04:52

0 Answers0