carock

Well-Known Member
Sep 25, 2002
270
9
168
St. Charles, MO
Anyone know how I can figure out why Apache is eating up all my server memory?

The server crashed last night from using up all the swap space and free memory.

After restart this morning, I'm trying to figure out what is using all that swap.

I did a top and sorted by VIRT mem to find this....

Swap: 1020088k total, 879068k used, 141020k free, 1010676k cached

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
12115 nobody 25 0 715m 648m 2292 S 0 16.7 0:45.41 httpd
4697 nobody 17 0 716m 425m 3556 S 0 11.0 1:20.09 httpd
5931 nobody 17 0 715m 366m 3644 S 0 9.4 1:18.60 httpd
27179 nobody 15 0 517m 315m 3088 S 0 8.1 1:34.47 httpd



715 meg per process???

The only addon I have is the Apache mod_bwlimited. I guess I could try removing that to see if it helps. I've had it installed for a month or so now though without this problem.

Thanks,
Chuck
 
Last edited:

carock

Well-Known Member
Sep 25, 2002
270
9
168
St. Charles, MO
I've done that once or twice since the server was originally set up.

Is that something that needs to be done each time I upgrade apache or something?

I ended up killing those Apache child processes, but I could not find any way to tell what activated them, or which site they were serving. All the other Apache children were 17meg or so resident memory usage.

So far they haven't returned. I'm wondering if they aren't triggered by some kind of programming loop in a php script or something???

Thanks,
Chuck
 

AndyReed

Well-Known Member
PartnerNOC
May 29, 2004
2,217
4
193
Minneapolis, MN
Anyone know how I can figure out why Apache is eating up all my server memory?

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
12115 nobody 25 0 715m 648m 2292 S 0 16.7 0:45.41 httpd
This command should help in finding who is exahusting your Apache resources:
/bin/grep $(lsof -p PID | grep cwd | awk '{print $9}' | awk -F '/' '{ print $3 }') /etc/userdomains
 

chirpy

Well-Known Member
Verifed Vendor
Jun 15, 2002
13,437
33
473
Go on, have a guess
Which version of PHP are you running? If witnessed a memory leak in v4.4.6 which was cured by downgrading to v4.4.4 - though of course, this opens up security issues, though v4.4.6 has holes in it too. Might be worth a try.