On Wed, Jul 20, 2011 at 3:30 PM, Grant <emailgr...@gmail.com> wrote:
> 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.

Yes, just uncomment it and should be automatic. (you can use "swapon"
to enable it without rebooting)

> 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?

That's 512MB. You can also create a swap file to supplement the swap
partition if you don't want to or aren't able to repartition.

I'd check the MySQL logs to see if it shows anything. Maybe check the
settings with regard to memory upper limits (Google it, there's a lot
of info about MySQL RAM management).

If you're running any other servers that utilize MySQL like Apache or
something, check its access logs to see if you had an abnormal number
of connections. Bruteforce hacking or some kind of flooding/DOS attack
might cause it to use more memory than it ordinarily would.

A Basic "what's using up my memory?" technique is to log the output of
"top" by using the -b command. Something like "top -b > toplog.txt".
Then you can go back to the time when the OOM occurred and see what
was using a lot of RAM at that time.

Reply via email to