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