On 12/30/2011 12:34 AM, Claudio Roberto França Pereira wrote:
Anyway, for the last days, my machine has been really slow, with mouse
lag, input delay, and other things. I imediately associated it to the
lack of free RAM, but I always rushed to check the RAM usage with htop
and it were never really high. So today I decided to turn my swap
partition off. And the system is FLYING. I mean, it's pratically a new
machine, now it's usable and reliable.
[...]
Usable, yes. Reliable, no ;-) Once RAM runs out, random processes get
killed. Possible data loss due to that.
So, should I ban swap partitions entirely from my life? Is that ok?
No. You simply tweak swappiness. In your /etc/sysctl.conf, add this:
vm.swappiness = 20
The default value is 60. Which makes the system use swap very early on.
With 20, you pretty much will swap only when really needed. I've read
somewhere that values lower than 20 are not recommended, but I don't
remember where or why.