1 |
Apparently, though unproven, at 02:15 on Monday 17 January 2011, Mark Knecht |
2 |
did opine thusly: |
3 |
|
4 |
[snip] |
5 |
|
6 |
> >> As Volker says, don't turn swap off. Make it small if you must, but |
7 |
> >> keep some around. It's just disk space. |
8 |
> > |
9 |
> > I thought swap was no longer necessary on a machine with sufficient |
10 |
> > memory. I guess I took I some bad advice a while back. |
11 |
> |
12 |
> I think the idea is never use swap if possible, but in a case where |
13 |
> you don't have swap space or run out of swap space I think it's still |
14 |
> possible to lose data. I no longer double memory in swap. In the old |
15 |
> days I did that. On this server I have 24GB or memory. It seems silly |
16 |
> to chew up 50GB of disk space for something that almost never gets |
17 |
> touched. If I see this machine swapping I turn something off, but I'm |
18 |
> the only user and here to watch what it's doing. |
19 |
|
20 |
The 2 x RAM rule is an ancient artifact that hasn't been true for, well for |
21 |
ages now. It came about because way back when you had to have swap to get |
22 |
anything done. The question is how much? The answer sucked out of someone's |
23 |
thumb was 2xRAM. This is a pretty useless generic value, but it was less |
24 |
useless than any other default. |
25 |
|
26 |
Picking swap amounts is like picking a wife - there's no sane default. A |
27 |
modern desktop that swaps is unusable - enormous amounts of data has to be |
28 |
pulled back in from the drive. A web server that swaps is already thrashing so |
29 |
you always want to avoid that. |
30 |
|
31 |
Besides, RAM is cheap and a server with 24G is common place. So is 4G on a |
32 |
notebook. So your viewpoint is completely correct. |
33 |
|
34 |
The kernel does need some swap though - it needs wiggle room for when you DO |
35 |
run out of RAM, and a little bit of swap gives that. It also staves off that |
36 |
bastard demon spawn progeny of satan called the dreaded oom killer.... |
37 |
|
38 |
|
39 |
-- |
40 |
alan dot mckinnon at gmail dot com |