On Mon, 2011-01-17 at 03:08 +0200, Alan McKinnon wrote: > Apparently, though unproven, at 02:15 on Monday 17 January 2011, Mark Knecht > did opine thusly: > > [snip] > > > >> As Volker says, don't turn swap off. Make it small if you must, but > > >> keep some around. It's just disk space. > > > > > > I thought swap was no longer necessary on a machine with sufficient > > > memory. I guess I took I some bad advice a while back. > > > > I think the idea is never use swap if possible, but in a case where > > you don't have swap space or run out of swap space I think it's still > > possible to lose data. I no longer double memory in swap. In the old > > days I did that. On this server I have 24GB or memory. It seems silly > > to chew up 50GB of disk space for something that almost never gets > > touched. If I see this machine swapping I turn something off, but I'm > > the only user and here to watch what it's doing. > > The 2 x RAM rule is an ancient artifact that hasn't been true for, well for > ages now. It came about because way back when you had to have swap to get > anything done. The question is how much? The answer sucked out of someone's > thumb was 2xRAM. This is a pretty useless generic value, but it was less > useless than any other default. >
There was in ye old unix days a good technical reason for 2xmemory for swap - google didnt confirm it for me but I think old solaris used to coredump memory to swap on a crash. > Picking swap amounts is like picking a wife - there's no sane default. love the metaphor! > A > modern desktop that swaps is unusable - enormous amounts of data has to be > pulled back in from the drive. A web server that swaps is already thrashing > so > you always want to avoid that. > > Besides, RAM is cheap and a server with 24G is common place. So is 4G on a > notebook. So your viewpoint is completely correct. > > The kernel does need some swap though - it needs wiggle room for when you DO > run out of RAM, and a little bit of swap gives that. It also staves off that > bastard demon spawn progeny of satan called the dreaded oom killer.... > There is one case where ~2xram is still a good idea - when hibernating to swap using (in my case) tuxonice - 2xram gives a reasonable safety margin for hibernation plus existing swap contents. BillK -- William Kenworthy <[email protected]> Home in Perth!

