On Thu, Jul 21, 2011 at 11:39 AM, Grant <emailgr...@gmail.com> wrote: > Hi Alan, I think it was your advice I took a long time ago when I > stopped installing new machines with a swap partition and disabled it > on my already-installed machines. Some time later, others on this > list caught wind of what I'd done and told me I was an idiot. Is > there a consensus on this? If the drawbacks and advantages of using > swap cancel each other out, I won't use it.
I think it's basically like this: No swap = If you run out of memory, OOM-killer starts killing things "randomly" and stuff breaks. With Swap = System does not run out of memory, so things don't die, but it runs poetntially much slower during that period of high memory usage depending on your disk speed and how heavily it is leaning on swap at that moment (if it is actively trying to use more data in RAM than you physically have RAM for, it's a total slowdown disaster). If it's a case of run-away memory usage, it'll run out of swap, too, anyway, so having swap in that case only delays the OOM-killer. I think if you have 4GB of RAM you shouldn't need any swap under normal circumstances. I have a gentoo box with just 256MB of RAM that's running web server (apache + php), mail server (postfix + dovecot), and database (mariadb), and it works fine if i disable swap. I do normally have swap enabled on it, though, because emerging sometimes uses a lot of RAM.