You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by John Steel <jo...@phonewebcam.com> on 2007/07/10 16:02:57 UTC

[users@httpd] Find why httpd eats all swap

Could someone cast an eye over this please - eventually swap fills and 
the server dies. Its under very light load, a few php sites, some direct 
html pages, some perl and java.

First the system spec:

[root@master conf]# uname -r
2.6.17-1.2142_FC4smp
[root@master conf]# httpd -version
Server version: Apache/2.0.54
Server built:   Jul 26 2006 11:00:19

Check memory:

[root@master conf]# free -m
             total       used       free     shared    buffers     cached
Mem:           740        732          8          0          6        102
-/+ buffers/cache:        623        117
Swap:         1027        479        548

Ugh! Swapping already...I know how to fix it though, but before I do 
does this look normal?

[root@master conf]# ps aux | grep httpd

root     12308  0.0  1.0  40396  8068 ?        Ss   05:17   0:00 
/usr/sbin/httpd
root     12316  0.0  0.1  27344  1364 ?        S    05:17   0:00 
/usr/sbin/httpd
apache   12317  0.0  5.2 165640 39724 ?        S    05:17   0:17 
/usr/sbin/httpd
apache   12318  0.0  5.4 167080 41508 ?        S    05:17   0:20 
/usr/sbin/httpd
apache   12319  0.0  6.1 166944 46832 ?        S    05:17   0:18 
/usr/sbin/httpd
apache   12320  0.0  6.0 167876 45668 ?        S    05:17   0:16 
/usr/sbin/httpd
apache   12321  0.0  5.6 170532 43212 ?        S    05:17   0:16 
/usr/sbin/httpd
apache   12322  0.0  5.4 157364 41668 ?        S    05:17   0:18 
/usr/sbin/httpd
apache   12323  0.0  7.2 175876 54704 ?        S    05:17   0:15 
/usr/sbin/httpd
apache   12324  0.0  5.6 165480 42580 ?        S    05:17   0:17 
/usr/sbin/httpd
apache   17780  0.0  5.7 147496 43644 ?        S    07:00   0:16 
/usr/sbin/httpd
root     11529  0.0  0.0   3948   600 pts/0    R+   14:54   0:00 grep httpd

httpd is taking 53% of RAM Alright lets free some up:

[root@master conf]# service httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd:                                            [  OK  ]

Check again:

[root@master conf]# free -m
             total       used       free     shared    buffers     cached
Mem:           740        409        330          0          7        110
-/+ buffers/cache:        292        448
Swap:         1027        280        747

Bingo! Restarting httpd had a big effect on swap. I would love to know 
exactly what those httpd children were doing - is there an easy way to 
tell please?

Thanks

-- 
--------------------------
http://www.phonewebcam.com
john.steel@phonewebcam.com


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


[users@httpd] RE : Re: [users@httpd] RE : [users@httpd] Find why httpd eats all swap

Posted by Laurent FAILLIE <l_...@yahoo.com>.
--- John Steel <jo...@phonewebcam.com> a écrit :

> I did this and it still happened, but it ddn't seem
> as bad.
> What I really want to know is which vhost is causing
> it. The only thing

[...]

If all your vhost are writing the same access.log,
what you can do is an 

while true
do
sleep 1
free -m >> [path to your logs]/access.log
done

So you can see which vhost has activities b/w memories
increase.

Bye

Laurent


The misspelling master is on the Web.
   _________	100 % Dictionnary Free !
  /        /(
 /  Dico  / /	Pleins d'autres fautes sur
/________/ /	
(#######( /	http://destroyedlolo.homeunix.org
Quoi, des fautes d'orthographe! Pas possible ;-D.


      _____________________________________________________________________________ 
Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail 

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] RE : [users@httpd] Find why httpd eats all swap

Posted by John Steel <jo...@phonewebcam.com>.
Laurent FAILLIE wrote:
> Do avoid resources problem, I reduced both MaxClients
> and MaxRequestsPerChild in order to force more
> frequent child recycling (0 means unlimited).
>
>   
I did this and it still happened, but it ddn't seem as bad.
What I really want to know is which vhost is causing it. The only thing 
I know for sure is it isn't java because it still did it when java was
disabled.

How about another approach. Sometimes the leaks happen so quick I can 
see the "free -m" swap value go down each time I hit it at the command line.
When thats happening I'm sure one of the vhosts is under load, but its 
not possible for me to find which one without rewriting the access log 
defs for 120+ vhosts. Nor disturbing them
actually as the owners use them for charging 3rd parties.
Is there a way I can intercept/monitor the apache traffic at a high 
level, just to show me whats being asked for? Something like tail -f 
access.log but for everything going through httpd?
Can I start httpd differently to achieve this?

Thanks
> My production system is an old sparc station w/ 128 or
> 256 Mb of RAM depending on my cluster status.
>
> Bye
>
> Laurent
>
>
> The misspelling master is on the Web.
>    _________	100 % Dictionnary Free !
>   /        /(
>  /  Dico  / /	Pleins d'autres fautes sur
> /________/ /	
> (#######( /	http://destroyedlolo.homeunix.org
> Quoi, des fautes d'orthographe! Pas possible ;-D.
>
>
>       _____________________________________________________________________________ 
> Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail 
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>
>
>   


-- John
--------------------------
http://www.phonewebcam.com
john.steel@phonewebcam.com


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] RE : [users@httpd] Find why httpd eats all swap

Posted by John Steel <jo...@phonewebcam.com>.
Laurent FAILLIE wrote:
> Hi John,
>
> --- John Steel <jo...@phonewebcam.com> a écrit :
>
>   
>> Could someone cast an eye over this please -
>> eventually swap fills and 
>> the server dies. Its under very light load, a few
>> php sites, some direct 
>> html pages, some perl and java.
>>     
>
> It's depend mainly about what your site is doing.
> Anyway, mines are dealing with large JPEG images and
> consume quite lot of memory. Unfortunately, it seems
> that memory allocated by apache and/or php are not
> always released to the system.
>
> Do avoid resources problem, I reduced both MaxClients
> and MaxRequestsPerChild in order to force more
> frequent child recycling (0 means unlimited).
>
> My production system is an old sparc station w/ 128 or
> 256 Mb of RAM depending on my cluster status.
>
>   
Thanks for your help - I'd not tried tuning Apache so have done as you 
suggest an will monitor it now.
> Bye
>
> Laurent
>
>
> The misspelling master is on the Web.
>    _________	100 % Dictionnary Free !
>   /        /(
>  /  Dico  / /	Pleins d'autres fautes sur
> /________/ /	
> (#######( /	http://destroyedlolo.homeunix.org
> Quoi, des fautes d'orthographe! Pas possible ;-D.
>
>
>       _____________________________________________________________________________ 
> Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail 
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>
>
>   


-- 
--------------------------
http://www.phonewebcam.com
john.steel@phonewebcam.com


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


[users@httpd] RE : [users@httpd] Find why httpd eats all swap

Posted by Laurent FAILLIE <l_...@yahoo.com>.
Hi John,

--- John Steel <jo...@phonewebcam.com> a écrit :

> Could someone cast an eye over this please -
> eventually swap fills and 
> the server dies. Its under very light load, a few
> php sites, some direct 
> html pages, some perl and java.

It's depend mainly about what your site is doing.
Anyway, mines are dealing with large JPEG images and
consume quite lot of memory. Unfortunately, it seems
that memory allocated by apache and/or php are not
always released to the system.

Do avoid resources problem, I reduced both MaxClients
and MaxRequestsPerChild in order to force more
frequent child recycling (0 means unlimited).

My production system is an old sparc station w/ 128 or
256 Mb of RAM depending on my cluster status.

Bye

Laurent


The misspelling master is on the Web.
   _________	100 % Dictionnary Free !
  /        /(
 /  Dico  / /	Pleins d'autres fautes sur
/________/ /	
(#######( /	http://destroyedlolo.homeunix.org
Quoi, des fautes d'orthographe! Pas possible ;-D.


      _____________________________________________________________________________ 
Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail 

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org