I am running Ubuntu 14.04 guest virtual box on Windows 7 host. Recently, following instructions here, I created a 7GB swap on my Ubuntu guest which has been running super-slow on 3.6GB RAM with no swap till then. I retained swappiness at 60.
But then, I did not see any performance improvement at all for two days - and my swap use remained at 0 all that time, even after I rebooted and all. I could see the free RAM falling towards low hundreds, with below being my last check:
xxx@vagrant-ubuntu-trusty-64:~$ free -m
total used free shared buffers cached
Mem: 3466 3222 244 11 67 842
-/+ buffers/cache: 2312 1153
Swap: 7167 0 7167
Then, like a really sharp phase transition, everything started running fast one fine second. I immediately checked and looked like swap must have started kicking in around that very second:
xxx@vagrant-ubuntu-trusty-64:~$ free -m
total used free shared buffers cached
Mem: 3466 3302 164 36 16 540
-/+ buffers/cache: 2745 721
Swap: 7167 10 7157
My question:
Why did swap not kick in earlier, and how to control when swap kicks in? And after kicking in, besides swappiness, what else controls swap/ram usage ratio?