You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Marc Perkel <ma...@perkel.com> on 2005/09/27 17:37:16 UTC

[users@httpd] Apache - High Memory Usage Problem - HELP!

Kind of an odd problem but I'm moving my stuff to a new server and for 
some reason Apache (2.0.54) is using a lot more memory on the new server 
than on the old server.

I'm hosting the same web sites and (I think) I have all the same 
software installed. Both running Fedora Core 4. The new server is 
running the 64 bit Linux. The new server is a dual core athlon - the old 
has 2 Xeon CPUs. Both have 4 gigs of ram.

On the new server running top it shows httpd processes using:

virt 201m
res 53m
shr 11m

On the old server the httpd process show:

virt: 50k
res 14m
shr 10k

That's quite a difference.

So - what am I missing? Why is the new server using so much more ram?

-- 
Marc Perkel - marc@perkel.com

Spam Filter: http://www.junkemailfilter.com
    My Blog: http://marc.perkel.com


Re: [users@httpd] Apache - High Memory Usage Problem - HELP!

Posted by Marc Perkel <ma...@perkel.com>.
Also - reducing MaxRequestsPerChild  to 10 makes a dramatic difference 
in memory usage. Do I have a memory leak problem?

---------------------------------------------------------------------
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] Apache - High Memory Usage Problem - HELP!

Posted by Bill Sargent <do...@station51.net>.
http://httpd.apache.org/docs/2.0/mod/mpm_common.html#serverlimit

 

I would recommend looking at this as well. Not sure if you already have a
serverlimit in place. 

 

Btw, what IS your max clients?

 

 

  _____  

From: Marc Perkel [mailto:marc@perkel.com] 
Sent: Tuesday, September 27, 2005 2:22 PM
To: users@httpd.apache.org
Subject: Re: [users@httpd] Apache - High Memory Usage Problem - HELP!

 



Nick Kew wrote:



On Tuesday 27 September 2005 19:59, Marc Perkel wrote:
  

My site is fairly high traffic. about 20 gigs an hour. 60 requests a
second. Apparently I'm using prefork. Do you think MPMs would be the
better choice?
    

 
Worker would reduce memory usage.  But worker is more fussy than prefork
about working with shoddy software, and in particular anything that's not
thread-safe.  So if you use PHP (as I think you said before?) it's likely to

crash.
 
  

OK - thanks for your help. I do use PHP and I don't want to crash. ;)

But - unless I keep MaxRequestsPerChild at no more than 10 the memory usage
grows fast. Could I have a memory leak of some kind?



-- 
Marc Perkel - marc@perkel.com
 
Spam Filter: http://www.junkemailfilter.com
    My Blog: http://marc.perkel.com

Re: [users@httpd] Apache - High Memory Usage Problem - HELP!

Posted by Marc Perkel <ma...@perkel.com>.

Nick Kew wrote:

>On Tuesday 27 September 2005 19:59, Marc Perkel wrote:
>  
>
>>My site is fairly high traffic. about 20 gigs an hour. 60 requests a
>>second. Apparently I'm using prefork. Do you think MPMs would be the
>>better choice?
>>    
>>
>
>Worker would reduce memory usage.  But worker is more fussy than prefork
>about working with shoddy software, and in particular anything that's not
>thread-safe.  So if you use PHP (as I think you said before?) it's likely to 
>crash.
>
>  
>
OK - thanks for your help. I do use PHP and I don't want to crash. ;)

But - unless I keep MaxRequestsPerChild at no more than 10 the memory 
usage grows fast. Could I have a memory leak of some kind?

-- 
Marc Perkel - marc@perkel.com

Spam Filter: http://www.junkemailfilter.com
    My Blog: http://marc.perkel.com


Re: [users@httpd] Apache - High Memory Usage Problem - HELP!

Posted by Nick Kew <ni...@webthing.com>.
On Tuesday 27 September 2005 19:59, Marc Perkel wrote:
> My site is fairly high traffic. about 20 gigs an hour. 60 requests a
> second. Apparently I'm using prefork. Do you think MPMs would be the
> better choice?

Worker would reduce memory usage.  But worker is more fussy than prefork
about working with shoddy software, and in particular anything that's not
thread-safe.  So if you use PHP (as I think you said before?) it's likely to 
crash.

-- 
Nick Kew

---------------------------------------------------------------------
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] Apache - High Memory Usage Problem - HELP!

Posted by Marc Perkel <ma...@perkel.com>.
My site is fairly high traffic. about 20 gigs an hour. 60 requests a 
second. Apparently I'm using prefork. Do you think MPMs would be the 
better choice?

Bill Sargent wrote:

>Well if you're running the stock Apache, it should work just fine. 
>
>http://httpd.apache.org/docs/2.0/mpm.html
>
>Theres the link to read about MPMs and the different types :) Worker MPM
>tends to be good for high traffic sites and saves RAM. Prefork is default
>with Apache (Not sure about precompiled FC4 binaries though). If your sites
>are not getting a lot of traffic, I recommend prefork because with my
>experience, its faster. 
>
>You can determine which one yours uses by running "httpd -l" and you'll see
>something like this:
>
>Compiled in modules:
>  core.c
>  mod_access.c
>  mod_auth.c
>  mod_include.c
>  mod_log_config.c
>  mod_env.c
>  mod_setenvif.c
>  prefork.c
>  http_core.c
>  mod_mime.c
>  mod_status.c
>  mod_autoindex.c
>  mod_asis.c
>  mod_cgi.c
>  mod_negotiation.c
>  mod_dir.c
>  mod_imap.c
>  mod_actions.c
>  mod_userdir.c
>  mod_alias.c
>  mod_so.c
>
>
>As you can see, mine is prefork. It'll say worker.c otherwise. :)
>
>Sorry I can't be of much more assistance than that. I don't like precompiled
>binaries. I prefer to compile my own things because I feel I have more
>control over things like memory and speed... as in I can compile in what I
>need and not have things I don't need. :)
>
>Thanks,
>Bill
>
>-----Original Message-----
>From: Marc Perkel [mailto:marc@perkel.com] 
>Sent: Tuesday, September 27, 2005 1:35 PM
>To: users@httpd.apache.org
>Subject: Re: [users@httpd] Apache - High Memory Usage Problem - HELP!
>
>
>
>Bill Sargent wrote:
>
>  
>
>>Did you compile apache yourself?
>>
>>If you did, did you strip the binary
>>
>>Strip --strip-unneeded httpd 
>>
>>? That would make the memory footprint smaller I believe. 
>>
>>Stripping libphp4.so as well might save some memory.
>>
>>Are you using worker mpm or prefork? 
>>
>>(does worker even work on 64?)
>>
>> 
>>
>>    
>>
>Thanks for your response.
>
>I'm using the stock Apache RPM that comes with Fedora Core 4 on both 
>servers. What is MPM and PREFORK? Which do I want and why? And how do I 
>tell what I have and set up what I should have?
>
>
>---------------------------------------------------------------------
>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
>
>
>
>---------------------------------------------------------------------
>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
>
>  
>

-- 
Marc Perkel - marc@perkel.com

Spam Filter: http://www.junkemailfilter.com
    My Blog: http://marc.perkel.com


RE: [users@httpd] Apache - High Memory Usage Problem - HELP!

Posted by Bill Sargent <do...@station51.net>.
Well if you're running the stock Apache, it should work just fine. 

http://httpd.apache.org/docs/2.0/mpm.html

Theres the link to read about MPMs and the different types :) Worker MPM
tends to be good for high traffic sites and saves RAM. Prefork is default
with Apache (Not sure about precompiled FC4 binaries though). If your sites
are not getting a lot of traffic, I recommend prefork because with my
experience, its faster. 

You can determine which one yours uses by running "httpd -l" and you'll see
something like this:

Compiled in modules:
  core.c
  mod_access.c
  mod_auth.c
  mod_include.c
  mod_log_config.c
  mod_env.c
  mod_setenvif.c
  prefork.c
  http_core.c
  mod_mime.c
  mod_status.c
  mod_autoindex.c
  mod_asis.c
  mod_cgi.c
  mod_negotiation.c
  mod_dir.c
  mod_imap.c
  mod_actions.c
  mod_userdir.c
  mod_alias.c
  mod_so.c


As you can see, mine is prefork. It'll say worker.c otherwise. :)

Sorry I can't be of much more assistance than that. I don't like precompiled
binaries. I prefer to compile my own things because I feel I have more
control over things like memory and speed... as in I can compile in what I
need and not have things I don't need. :)

Thanks,
Bill

-----Original Message-----
From: Marc Perkel [mailto:marc@perkel.com] 
Sent: Tuesday, September 27, 2005 1:35 PM
To: users@httpd.apache.org
Subject: Re: [users@httpd] Apache - High Memory Usage Problem - HELP!



Bill Sargent wrote:

>Did you compile apache yourself?
>
>If you did, did you strip the binary
>
>Strip --strip-unneeded httpd 
>
>? That would make the memory footprint smaller I believe. 
>
>Stripping libphp4.so as well might save some memory.
>
>Are you using worker mpm or prefork? 
>
>(does worker even work on 64?)
>
>  
>
Thanks for your response.

I'm using the stock Apache RPM that comes with Fedora Core 4 on both 
servers. What is MPM and PREFORK? Which do I want and why? And how do I 
tell what I have and set up what I should have?


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



---------------------------------------------------------------------
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] Apache - High Memory Usage Problem - HELP!

Posted by Marc Perkel <ma...@perkel.com>.

Bill Sargent wrote:

>Did you compile apache yourself?
>
>If you did, did you strip the binary
>
>Strip --strip-unneeded httpd 
>
>? That would make the memory footprint smaller I believe. 
>
>Stripping libphp4.so as well might save some memory.
>
>Are you using worker mpm or prefork? 
>
>(does worker even work on 64?)
>
>  
>
Thanks for your response.

I'm using the stock Apache RPM that comes with Fedora Core 4 on both 
servers. What is MPM and PREFORK? Which do I want and why? And how do I 
tell what I have and set up what I should have?


---------------------------------------------------------------------
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] Apache - High Memory Usage Problem - HELP!

Posted by Bill Sargent <do...@station51.net>.
Did you compile apache yourself?

If you did, did you strip the binary

Strip --strip-unneeded httpd 

? That would make the memory footprint smaller I believe. 

Stripping libphp4.so as well might save some memory.

Are you using worker mpm or prefork? 

(does worker even work on 64?)



________________________________________
From: Marc Perkel [mailto:marc@perkel.com] 
Sent: Tuesday, September 27, 2005 1:03 PM
To: users@httpd.apache.org
Subject: Re: [users@httpd] Apache - High Memory Usage Problem - HELP!



Joe Orton wrote:

On Tue, Sep 27, 2005 at 08:37:16AM -0700, Marc Perkel wrote:
Kind of an odd problem but I'm moving my stuff to a new server and for 
some reason Apache (2.0.54) is using a lot more memory on the new server 
than on the old server.

I'm hosting the same web sites and (I think) I have all the same 
software installed. Both running Fedora Core 4. The new server is 
running the 64 bit Linux. The new server is a dual core athlon - the old 
has 2 Xeon CPUs. Both have 4 gigs of ram.

64-bit platforms will in general show more memory use than a 32-bit 
platform due to pointers etc being twice as big.  Linux on amd64 will 
also appear to have unnaturally virtual memory use due to the way the 
loader/kernel interact.  But this isn't actually physical RAM being used 
up so don't worry about it.

To compare the two systems make sure that you have exactly the same 
modules being loaded; PHP for instance will show up larger VM use 
because it drags in so many shared libraries.

Thanks for your reply - but the differences are very dramatic. Makes me
think there's something else different. I'm trying to remember - isn't there
a php trick that shows you the php configuration in html form? Maybe I could
compare the two installations. Or is there a httpd trick to display modules
and memory usage?

I could use some tricks to diagnose this.

The new server - running top looks like this:

  532 apache    15   0  199m  51m  11m  0.0   0:00
/usr/sbin/httpd                                                
 1091 apache    15   0  199m  51m  11m  0.0   0:00
/usr/sbin/httpd                                                
  866 apache    15   0  240m  45m  11m  0.0   0:00
/usr/sbin/httpd                                                
32135 apache    16   0  235m  40m  11m  0.0   0:00
/usr/sbin/httpd                                                
  583 apache    15   0  235m  40m  11m  0.0   0:00
/usr/sbin/httpd                                                
  850 apache    15   0  235m  40m  11m  0.0   0:00
/usr/sbin/httpd                                                
  857 apache    16   0  233m  38m  11m  0.0   0:00
/usr/sbin/httpd                                                
25277 apache    16   0  186m  38m  11m  0.0   0:00
/usr/sbin/httpd                                                

The old server running top looks like this:

13393 apache    16   0 49924  30m  13m  0.0   0:01
/usr/sbin/httpd                                                
 1539 apache    16   0 49832  30m  13m  0.0   0:00
/usr/sbin/httpd                                                
 5883 apache    15   0 49780  30m  13m  0.0   0:00
/usr/sbin/httpd                                                
32091 apache    16   0 49780  30m  13m  0.0   0:00
/usr/sbin/httpd                                                
 1537 apache    16   0 49692  30m  13m  0.0   0:00
/usr/sbin/httpd                                                
 1540 apache    16   0 49692  30m  13m  0.0   0:00
/usr/sbin/httpd                                                
 9882 apache    16   0 49760  30m  13m  0.0   0:00
/usr/sbin/httpd                                                
 9895 apache    16   0 48940  29m  13m  0.0   0:00
/usr/sbin/httpd                                                



Re: [users@httpd] Apache - High Memory Usage Problem - HELP!

Posted by Marc Perkel <ma...@perkel.com>.

Joe Orton wrote:

>On Tue, Sep 27, 2005 at 08:37:16AM -0700, Marc Perkel wrote:
>
>>Kind of an odd problem but I'm moving my stuff to a new server and for 
>>some reason Apache (2.0.54) is using a lot more memory on the new server 
>>than on the old server.
>>
>>I'm hosting the same web sites and (I think) I have all the same 
>>software installed. Both running Fedora Core 4. The new server is 
>>running the 64 bit Linux. The new server is a dual core athlon - the old 
>>has 2 Xeon CPUs. Both have 4 gigs of ram.
>>
>
>64-bit platforms will in general show more memory use than a 32-bit 
>platform due to pointers etc being twice as big.  Linux on amd64 will 
>also appear to have unnaturally virtual memory use due to the way the 
>loader/kernel interact.  But this isn't actually physical RAM being used 
>up so don't worry about it.
>
>To compare the two systems make sure that you have exactly the same 
>modules being loaded; PHP for instance will show up larger VM use 
>because it drags in so many shared libraries.
>
>
Thanks for your reply - but the differences are very dramatic. Makes me 
think there's something else different. I'm trying to remember - isn't 
there a php trick that shows you the php configuration in html form? 
Maybe I could compare the two installations. Or is there a httpd trick 
to display modules and memory usage?

I could use some tricks to diagnose this.

The new server - running top looks like this:

  532 apache    15   0  199m  51m  11m  0.0   0:00 
/usr/sbin/httpd                                               
 1091 apache    15   0  199m  51m  11m  0.0   0:00 
/usr/sbin/httpd                                               
  866 apache    15   0  240m  45m  11m  0.0   0:00 
/usr/sbin/httpd                                               
32135 apache    16   0  235m  40m  11m  0.0   0:00 
/usr/sbin/httpd                                               
  583 apache    15   0  235m  40m  11m  0.0   0:00 
/usr/sbin/httpd                                               
  850 apache    15   0  235m  40m  11m  0.0   0:00 
/usr/sbin/httpd                                               
  857 apache    16   0  233m  38m  11m  0.0   0:00 
/usr/sbin/httpd                                               
25277 apache    16   0  186m  38m  11m  0.0   0:00 
/usr/sbin/httpd                                               

The old server running top looks like this:

13393 apache    16   0 49924  30m  13m  0.0   0:01 
/usr/sbin/httpd                                               
 1539 apache    16   0 49832  30m  13m  0.0   0:00 
/usr/sbin/httpd                                               
 5883 apache    15   0 49780  30m  13m  0.0   0:00 
/usr/sbin/httpd                                               
32091 apache    16   0 49780  30m  13m  0.0   0:00 
/usr/sbin/httpd                                               
 1537 apache    16   0 49692  30m  13m  0.0   0:00 
/usr/sbin/httpd                                               
 1540 apache    16   0 49692  30m  13m  0.0   0:00 
/usr/sbin/httpd                                               
 9882 apache    16   0 49760  30m  13m  0.0   0:00 
/usr/sbin/httpd                                               
 9895 apache    16   0 48940  29m  13m  0.0   0:00 
/usr/sbin/httpd                                               




Re: [users@httpd] Apache - High Memory Usage Problem - HELP!

Posted by Joe Orton <jo...@redhat.com>.
On Tue, Sep 27, 2005 at 08:37:16AM -0700, Marc Perkel wrote:
> Kind of an odd problem but I'm moving my stuff to a new server and for 
> some reason Apache (2.0.54) is using a lot more memory on the new server 
> than on the old server.
> 
> I'm hosting the same web sites and (I think) I have all the same 
> software installed. Both running Fedora Core 4. The new server is 
> running the 64 bit Linux. The new server is a dual core athlon - the old 
> has 2 Xeon CPUs. Both have 4 gigs of ram.

64-bit platforms will in general show more memory use than a 32-bit 
platform due to pointers etc being twice as big.  Linux on amd64 will 
also appear to have unnaturally virtual memory use due to the way the 
loader/kernel interact.  But this isn't actually physical RAM being used 
up so don't worry about it.

To compare the two systems make sure that you have exactly the same 
modules being loaded; PHP for instance will show up larger VM use 
because it drags in so many shared libraries.

joe

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