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