Gentoo Archives: gentoo-user

From: Alan McKinnon <alan.mckinnon@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] mysqld invoked oom-killer
Date: Fri, 22 Jul 2011 16:06:33
Message-Id: 2055397.i3ciHmqJ4q@nazgul
In Reply to: Re: [gentoo-user] mysqld invoked oom-killer by kashani
1 On Thursday 21 July 2011 17:26:33 kashani did opine thusly:
2 > On 7/21/2011 4:53 PM, Grant wrote:
3 > > So swap isn't treated exactly like RAM. It actually has special
4 > > handling in Linux which makes it beneficial to have on almost
5 > > any
6 > > Linux system? According to Alan, things get very bad when a
7 > > Linux system hits swap. How can behavior like this be
8 > > beneficial:
9 > >
10 > > "When a linux machine hits swap, it does so very aggressively,
11 > > there is nothing nice about it at all. The entire machine slows
12 > > to a painstaking crawl for easily a minute at a time while the
13 > > kernel writes pages out to disk, and disk is thousands of times
14 > > slower than RAM.
15 > >
16 > > It gets so bad that you can't even run a shell properly to try
17 > > and see what's going on and kill the actual memory hog."
18 > >
19 > > Also, aren't you likely to wear out your hard disk sooner using
20 > > swap?
21 >
22 > 1. swap is good. Unless you have a good reason, leave it there. You
23 > do not have a good reason to remove it and neither does anyone
24 > else.
25 >
26 > 2. Don't use the swap that you have. It's slow. It is not a
27 > replacement for RAM.
28 >
29 > 3. If you use a little bit of swap, 100-200MB, that's fine. It's
30 > also a sign you need more RAM.
31 >
32 > 4. If you're using all your RAM and a couple of GB of swap, you're
33 > screwed. Avoid this.
34 >
35 > 5. Swap that you never write to or read from never needs to hit the
36 > drives. If you're worried about drive wear, turn off logging.
37
38 Excellent summary of swap; says a lot of what I was trying to say but
39 didn't succeed.
40
41 I might argue with your point #1, but then I would be nit-picking and
42 it's very dependant on circumstance anyway. As in all things IT, YMMV
43
44 --
45 alan dot mckinnon at gmail dot com