Gentoo Archives: gentoo-user

From: William Kenworthy <billk@×××××××××.au>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Near freezes during large emerges
Date: Mon, 17 Jan 2011 01:24:02
Message-Id: 1295227315.8901.32.camel@rattus
In Reply to: Re: [gentoo-user] Near freezes during large emerges by Alan McKinnon
1 On Mon, 2011-01-17 at 03:08 +0200, Alan McKinnon wrote:
2 > Apparently, though unproven, at 02:15 on Monday 17 January 2011, Mark Knecht
3 > did opine thusly:
4 >
5 > [snip]
6 >
7 > > >> As Volker says, don't turn swap off. Make it small if you must, but
8 > > >> keep some around. It's just disk space.
9 > > >
10 > > > I thought swap was no longer necessary on a machine with sufficient
11 > > > memory. I guess I took I some bad advice a while back.
12 > >
13 > > I think the idea is never use swap if possible, but in a case where
14 > > you don't have swap space or run out of swap space I think it's still
15 > > possible to lose data. I no longer double memory in swap. In the old
16 > > days I did that. On this server I have 24GB or memory. It seems silly
17 > > to chew up 50GB of disk space for something that almost never gets
18 > > touched. If I see this machine swapping I turn something off, but I'm
19 > > the only user and here to watch what it's doing.
20 >
21 > The 2 x RAM rule is an ancient artifact that hasn't been true for, well for
22 > ages now. It came about because way back when you had to have swap to get
23 > anything done. The question is how much? The answer sucked out of someone's
24 > thumb was 2xRAM. This is a pretty useless generic value, but it was less
25 > useless than any other default.
26 >
27
28 There was in ye old unix days a good technical reason for 2xmemory for
29 swap - google didnt confirm it for me but I think old solaris used to
30 coredump memory to swap on a crash.
31
32 > Picking swap amounts is like picking a wife - there's no sane default.
33
34 love the metaphor!
35
36 > A
37 > modern desktop that swaps is unusable - enormous amounts of data has to be
38 > pulled back in from the drive. A web server that swaps is already thrashing so
39 > you always want to avoid that.
40 >
41 > Besides, RAM is cheap and a server with 24G is common place. So is 4G on a
42 > notebook. So your viewpoint is completely correct.
43 >
44 > The kernel does need some swap though - it needs wiggle room for when you DO
45 > run out of RAM, and a little bit of swap gives that. It also staves off that
46 > bastard demon spawn progeny of satan called the dreaded oom killer....
47 >
48
49 There is one case where ~2xram is still a good idea - when hibernating
50 to swap using (in my case) tuxonice - 2xram gives a reasonable safety
51 margin for hibernation plus existing swap contents.
52
53 BillK
54
55
56 --
57 William Kenworthy <billk@×××××××××.au>
58 Home in Perth!

Replies

Subject Author
Re: [gentoo-user] Near freezes during large emerges Alan McKinnon <alan.mckinnon@×××××.com>