Gentoo Archives: gentoo-user

From: Grant <emailgrant@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] mysqld invoked oom-killer
Date: Thu, 21 Jul 2011 17:00:12
Message-Id: CAN0CFw3Vsuiccq5MpVQ_WrO2Dp_AHNOUO7YZ0Kc4tGLFOirTKw@mail.gmail.com
In Reply to: Re: [gentoo-user] mysqld invoked oom-killer by Michael Mol
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 on
4 >>>>> something I read previously that I later found out was wrong so I
5 >>>>> suppose I should activate it.  Is fstab the way to do that?  I have a
6 >>>>> commented line in there for swap.
7 ...
8 > Also, run a caching proxy if at all possible. That made the single
9 > biggest difference for my server.
10 >
11 > Other useful things:
12 > * Set the MaxRequestsPerChild to something like 450. As part of their
13 > caching, things like mod_php will grow the process size a bit as the
14 > apache process gets old in the tooth. Setting MaxRequestsPerChild
15 > lower causes the process to expire and be replaced sooner. On my
16 > server, I see apache processes consume about 60MB towards the end, and
17 > then cycle back and consume about 22MB.
18
19 Default is 10000 so 450 might be too low.
20
21 > * On my server, I have MinSpareServers at 10, and MaxSpareServers at
22 > 12. I handle spikes pretty well, and free the memory quickly.
23
24 I use 20 and 40 for Min and Max respectively.
25
26 > * If you're using PHP, set memory_limit in php.ini as low as your
27 > applications can survive.
28 >
29 > I'm assuming you're running on a VPS or similar. At 512MB of RAM with
30 > a web server and database server, you need to keep things very tight.
31
32 I have 4GB RAM. 512MB is the size of my currently unused swap partition.
33
34 - Grant