Have you ever been upset by the Linux tendancy to swap… Especially when trying to allocate a large InnoDB buffer pool.. Look at the following output:
total used free shared buffers cached
Mem: 2041888 1991096 50792 0 52 954592
-/+ buffers/cache: 1036452 1005436
Swap: 975200 1308 973892
There is still 50792 + 52 + 954592 = 1005436 of free memory and Linux starts to swap!!! The reason is hidden here:
yves@yves-laptop:~$ cat /proc/sys/vm/swappiness
The swappiness controls the Linux to swap for the File cache. For a file server or a web server or even MySQL with MyISAM tables, the file cache is interesting but for InnoDB or NDB Cluster it is close to useless. Only put a “0” in that proc entry (echo 0 > /proc/sys/vm/swappiness) and add “vm.swappiness = 0” to /etc/sysctl.conf to preserve the setting after reboot and the problem is gone.