Gentoo Archives: gentoo-user

From: Grant <emailgrant@×××××.com>
To: Gentoo mailing list <gentoo-user@l.g.o>
Subject: Re: [gentoo-user] mysqld invoked oom-killer
Date: Thu, 21 Jul 2011 16:40:57
Message-Id: CAN0CFw0=YbebnuNAm_xs-JqUY0eBDkdR62OT5NF2hihNUf+-RA@mail.gmail.com
In Reply to: Re: [gentoo-user] mysqld invoked oom-killer by Alan McKinnon
1 >> I ran into an out of memory problem.  The first mention of it in the
2 >> kernel log is "mysqld invoked oom-killer".  I haven't run into this
3 >> before.  I do have a swap partition but I don't activate it based
4 >> on something I read previously that I later found out was wrong so
5 >> I suppose I should activate it.  Is fstab the way to do that?  I
6 >> have a commented line in there for swap.
7 >>
8 >> Can anyone tell how much swap this is:
9 >>
10 >> /dev/sda2           80325     1140614      530145   82  Linux swap /
11 >> Solaris
12 >>
13 >> If it's something like 512MB, that may not have prevented me from
14 >> running out of memory since I have 4GB RAM.  Is there any way to
15 >> find out if there was a memory leak or other problem that should be
16 >> investigated?
17 >
18 > To activate swap, put a line in fstab like so:
19 >
20 > /dev/sda2       none            swap        sw                 0 0
21 >
22 > However, you do not want to use it. it is not the life-saver some
23 > howto authors on the internet claim it to be.
24 >
25 > When a linux machine hits swap, it does so very aggressively, there is
26 > nothing nice about it at all. The entire machine slows to a
27 > painstaking crawl for easily a minute at a time while the kernel
28 > writes pages out to disk, and disk is thousands of times slower than
29 > RAM.
30 >
31 > It gets so bad that you can't even run a shell properly to try and see
32 > what's going on and kill the actual memory hog.
33 >
34 > My personal rule of thumb: if you hit swap, the bad thing has already
35 > gone very very south, usually to the point where you can't do much
36 > about it and it's already too late. Besides, that bastard deomon spawn
37 > of satan called the oom-killer is likely about to kick in and REALLY
38 > make your day. Anyone else notice how oom-killer seems to be hard
39 > coded to zap the most inconvenient process of all?.....
40 >
41 > What you need to be doing is monitor your memory usage during normal
42 > conditions and deal with issues before they become problems.
43
44 Hi Alan, I think it was your advice I took a long time ago when I
45 stopped installing new machines with a swap partition and disabled it
46 on my already-installed machines. Some time later, others on this
47 list caught wind of what I'd done and told me I was an idiot. Is
48 there a consensus on this? If the drawbacks and advantages of using
49 swap cancel each other out, I won't use it.
50
51 - Grant

Replies

Subject Author
Re: [gentoo-user] mysqld invoked oom-killer Paul Hartman <paul.hartman+gentoo@×××××.com>
Re: [gentoo-user] mysqld invoked oom-killer Alan McKinnon <alan.mckinnon@×××××.com>