1 |
On 7/21/2011 10:22 AM, Grant wrote: |
2 |
>>> I ran into an out of memory problem. The first mention of it in the |
3 |
>>> kernel log is "mysqld invoked oom-killer". I haven't run into this |
4 |
>>> before. I do have a swap partition but I don't activate it based on |
5 |
>>> something I read previously that I later found out was wrong so I |
6 |
>>> suppose I should activate it. Is fstab the way to do that? I have a |
7 |
>>> commented line in there for swap. |
8 |
> ... |
9 |
>> If you're running any other servers that utilize MySQL like Apache or |
10 |
>> something, check its access logs to see if you had an abnormal number |
11 |
>> of connections. Bruteforce hacking or some kind of flooding/DOS attack |
12 |
>> might cause it to use more memory than it ordinarily would. |
13 |
> |
14 |
> I don't know why I didn't check the apache2 error log before, but I |
15 |
> got the following entry 2 seconds before the server became |
16 |
> unresponsive: |
17 |
> |
18 |
> [error] server reached MaxClients setting, consider raising the |
19 |
> MaxClients setting |
20 |
> |
21 |
> I use the default 256 for MaxClients. This confirms the server was |
22 |
> brought down by too many child processes consuming too much memory. |
23 |
> Looking back at the access_log, it's clear this condition was caused |
24 |
> by the single IP which requested one of my pages about 300 times over |
25 |
> the course of 1 minute. This caused my entire server to lock up for |
26 |
> hours until I rebooted it. |
27 |
> |
28 |
> I hesitate to reduce MaxClients from 256. I think my server should be |
29 |
> able to handle it since it's the default. So I need to prevent my |
30 |
> apache2 child processes from consuming so much memory? apache2 was |
31 |
> restarted about an hour before the lockup so it had a pretty fresh |
32 |
> start. I do use mod_perl which is a memory hog from what I |
33 |
> understand. Do I just need more RAM? |
34 |
|
35 |
Most people do not think about this correctly. Can your server run |
36 |
10000 Apache processes? No, not enough resources. 1000? No, same |
37 |
problem. 256? I'd say no based on this thread. If you're not going to |
38 |
set it at 10000 why try to keep it at 256? |
39 |
Next image a grocery store with 256 checkout lanes, but only four |
40 |
cashiers. Four cashiers trying to run that many lanes is actually slower |
41 |
than having only four lanes. However 32 lanes could faster than 4. |
42 |
People can have their groceries setup, baggers aren't getting in the |
43 |
way, etc. The analogy breaks down a bit, but you get the point. |
44 |
|
45 |
There is no performance gain in configuring for concurrency your |
46 |
hardware and software can not support. |
47 |
|
48 |
kashani |