On Wednesday 20 July 2011 13:30:05 Grant did opine thusly:
> I ran into an out of memory problem.  The first mention of it in the
> kernel log is "mysqld invoked oom-killer".  I haven't run into this
> before.  I do have a swap partition but I don't activate it based
> on something I read previously that I later found out was wrong so
> I suppose I should activate it.  Is fstab the way to do that?  I
> have a commented line in there for swap.
> 
> Can anyone tell how much swap this is:
> 
> /dev/sda2           80325     1140614      530145   82  Linux swap /
> Solaris
> 
> If it's something like 512MB, that may not have prevented me from
> running out of memory since I have 4GB RAM.  Is there any way to
> find out if there was a memory leak or other problem that should be
> investigated?

To activate swap, put a line in fstab like so:

/dev/sda2       none            swap        sw                 0 0

However, you do not want to use it. it is not the life-saver some 
howto authors on the internet claim it to be.

When a linux machine hits swap, it does so very aggressively, there is 
nothing nice about it at all. The entire machine slows to a 
painstaking crawl for easily a minute at a time while the kernel 
writes pages out to disk, and disk is thousands of times slower than 
RAM.

It gets so bad that you can't even run a shell properly to try and see 
what's going on and kill the actual memory hog.

My personal rule of thumb: if you hit swap, the bad thing has already 
gone very very south, usually to the point where you can't do much 
about it and it's already too late. Besides, that bastard deomon spawn 
of satan called the oom-killer is likely about to kick in and REALLY 
make your day. Anyone else notice how oom-killer seems to be hard 
coded to zap the most inconvenient process of all?.....

What you need to be doing is monitor your memory usage during normal 
conditions and deal with issues before they become problems.


-- 
alan dot mckinnon at gmail dot com

Reply via email to