Jump to content

Apache Memory Leak?


bbristow

Recommended Posts

Well, I hope someone can point me in the right direction on this one.  I have been running my web server a few years and have started to pay better attention to the log files and what the server is trying to tell me.  However, I am a bit stumped on this one.  My server is a P4 3.2 Hyper threaded machine running FreeBSD.  The machine has anywhere from 10-100 active web clients at a time and normally serves up about 1-2 gigs of web traffic a day.  The machine had 1 gig of ram in it and I noticed that the usage of ram was at 100% so I increased it to 2 gigs and within 20 minutes, the usage was back at 100%.  Does apache have a memory leak?  I am running apache version 1.3.33.  Below are some of my server info and log files.

Here is the results of TOP:
last pid: 94636;  load averages:  0.07,  0.12,  0.14                                                                                                                                            up 0+21:45:24  17:58:38
148 processes: 1 running, 146 sleeping, 1 zombie
CPU states: 10.9% user,  0.0% nice,  3.9% system,  0.4% interrupt, 84.8% idle
Mem: 1483M Active, 166M Inact, 257M Wired, 96M Cache, 199M Buf, 8376K Free
Swap: 1992M Total, 54M Used, 1938M Free, 2% Inuse

  PID USERNAME  PRI NICE  SIZE    RES STATE  C  TIME  WCPU    CPU COMMAND
88963 www        2  0 23572K 17132K sbwait 0  0:01  1.86%  1.86% httpd
44913 www        2  0 41560K 35100K accept 0  0:15  1.46%  1.46% httpd
2454 www        2  0 23364K 16712K accept 0  1:22  1.17%  1.17% httpd
46977 www        2  0 25728K 19248K sbwait 0  0:04  0.83%  0.83% httpd
46985 www        2  0 25216K 18744K sbwait 0  0:11  0.78%  0.78% httpd
60011 www        2  0 23408K 16920K sbwait 0  0:02  0.63%  0.63% httpd
48715 root        2  0 36492K 30712K select 0  0:10  0.10%  0.10% suidperl
94568 qscand    -6  0  5480K  4956K piperd 0  0:00  0.27%  0.10% perl5.8.6
94534 root      28  0  2096K  1204K CPU0  0  0:00  0.10%  0.05% top
  175 mysql      2  0 51988K 17764K poll  0 356:09  0.00%  0.00% mysqld
  856 root        2  0  2104K  860K select 0  3:09  0.00%  0.00% top
  212 qscand      2  0 28164K 25196K poll  0  1:26  0.00%  0.00% clamd
3191 root        2  0 39280K 31604K select 0  1:14  0.00%  0.00% suidperl
42968 www        2  0 40716K 34236K accept 0  0:30  0.00%  0.00% httpd
40549 www        2  0 40100K 33628K accept 0  0:26  0.00%  0.00% httpd
46982 www        2  0 33764K 27288K accept 0  0:23  0.00%  0.00% httpd
  132 root        2  0  884K  312K poll  0  0:22  0.00%  0.00% supervise
64141 www        2  0 46296K 39844K accept 0  0:21  0.00%  0.00% httpd
40546 www        2  0 34828K 28348K accept 0  0:21  0.00%  0.00% httpd
40550 www        2  0 35148K 28668K accept 0  0:21  0.00%  0.00% httpd
46716 www        2  0 38320K 31848K accept 0  0:19  0.00%  0.00% httpd
30078 www        2  0 24668K 18048K sbwait 0  0:16  0.00%  0.00% httpd
46730 www        2  0 42388K 35924K accept 0  0:14  0.00%  0.00% httpd
46736 www        2  0 35452K 29000K accept 0  0:14  0.00%  0.00% httpd
46733 www        2  0 43116K 36664K accept 0  0:13  0.00%  0.00% httpd
46975 www        2  0 38644K 32168K accept 0  0:13  0.00%  0.00% httpd
46978 www        2  0 32972K 26496K accept 0  0:13  0.00%  0.00% httpd
64135 www        2  0 31728K 25228K accept 0  0:11  0.00%  0.00% httpd
44883 www        2  0 31068K 24592K accept 0  0:10  0.00%  0.00% httpd
  354 root        2  0 26668K 15456K select 0  0:10  0.00%  0.00% suidperl
46329 www        2  0 33580K 26916K sbwait 0  0:10  0.00%  0.00% httpd
46033 www        2  0 33452K 26976K accept 0  0:10  0.00%  0.00% httpd
46951 www        2  0 32092K 25592K accept 0  0:10  0.00%  0.00% httpd
44897 www        2  0 35428K 28932K accept 0  0:08  0.00%  0.00% httpd
46984 www        2  0 29768K 23276K accept 0  0:07  0.00%  0.00% httpd
46715 www        2  0 31116K 24652K accept 0  0:07  0.00%  0.00% httpd
59996 www        2  0 33420K 26964K accept 0  0:07  0.00%  0.00% httpd
58779 www        2  0 29832K 23352K accept 0  0:07  0.00%  0.00% httpd
46726 www        2  0 23404K 16920K accept 0  0:07  0.00%  0.00% httpd
58773 www        2  0 32476K 26004K accept 0  0:07  0.00%  0.00% httpd
58751 www        2  0 23476K 16964K accept 0  0:07  0.00%  0.00% httpd
46725 www        2  0 23288K 16796K sbwait 0  0:06  0.00%  0.00% httpd
46731 www        2  0 31624K 25144K sbwait 0  0:06  0.00%  0.00% httpd
  124 root      -6  0  872K  200K piperd 0  0:06  0.00%  0.00% readproctit
  139 qmails      2  0  984K  468K select 0  0:06  0.00%  0.00% qmail-send
  138 vpopmail    2  0  928K  436K accept 0  0:06  0.00%  0.00% tcpserver
46737 www        2  0 27760K 21296K accept 0  0:06  0.00%  0.00% httpd
64137 www        2  0 33812K 27344K accept 0  0:06  0.00%  0.00% httpd
46958 www        2  0 23332K 16880K accept 0  0:05  0.00%  0.00% httpd
  135 qmaill    -6  0  904K  352K piperd 0  0:04  0.00%  0.00% multilog
46321 www        2  0 24244K 17708K accept 0  0:04  0.00%  0.00% httpd
46976 www        2  0 27224K 20740K accept 0  0:04  0.00%  0.00% httpd
40531 www        2  0 30000K 23548K accept 0  0:04  0.00%  0.00% httpd
46734 www        2  0 23616K 17084K accept 0  0:04  0.00%  0.00% httpd
  143 vpopmail    2  0 38508K 18172K poll  0  0:03  0.00%  0.00% python
46959 www        2  0 23328K 16840K accept 0  0:03  0.00%  0.00% httpd
  266 root        2  0 10032K  3336K select 0  0:03  0.00%  0.00% httpd
46328 www        2  0 23452K 16952K accept 0  0:03  0.00%  0.00% httpd
40547 www        2  0 24276K 17776K accept 0  0:03  0.00%  0.00% httpd
46708 www        2  0 23324K 16832K accept 0  0:02  0.00%  0.00% httpd
64126 www        2  0 25848K 19348K accept 0  0:02  0.00%  0.00% httpd
46732 www        2  0 23248K 16748K accept 0  0:02  0.00%  0.00% httpd
  133 qmaill    -6  0  904K  352K piperd 0  0:02  0.00%  0.00% multilog
46983 www        2  0 23156K 16668K accept 0  0:02  0.00%  0.00% httpd
64136 www        2  0 23296K 16804K accept 0  0:02  0.00%  0.00% httpd


and here is the apache log:
[Tue Jan 30 06:32:06 2007] [info] server seems busy, (you may need to increase StartServers, or Min/MaxSpareServers), spawning 8 children, there are 14 idle, and 71 total children
[Tue Jan 30 06:32:07 2007] [info] server seems busy, (you may need to increase StartServers, or Min/MaxSpareServers), spawning 16 children, there are 22 idle, and 79 total children
[Tue Jan 30 07:57:09 2007] [info] server seems busy, (you may need to increase StartServers, or Min/MaxSpareServers), spawning 8 children, there are 30 idle, and 74 total children
httpd in malloc(): warning: recursive call
FATAL:  emalloc():  Unable to allocate 0 bytes
[Tue Jan 30 08:53:23 2007] [info] server seems busy, (you may need to increase StartServers, or Min/MaxSpareServers), spawning 8 children, there are 26 idle, and 79 total children
[Tue Jan 30 09:28:28 2007] [info] server seems busy, (you may need to increase StartServers, or Min/MaxSpareServers), spawning 8 children, there are 16 idle, and 75 total children
[Tue Jan 30 09:28:29 2007] [info] server seems busy, (you may need to increase StartServers, or Min/MaxSpareServers), spawning 16 children, there are 24 idle, and 83 total children
[Tue Jan 30 12:10:51 2007] [info] server seems busy, (you may need to increase StartServers, or Min/MaxSpareServers), spawning 8 children, there are 14 idle, and 74 total children
[Tue Jan 30 12:10:52 2007] [info] server seems busy, (you may need to increase StartServers, or Min/MaxSpareServers), spawning 16 children, there are 21 idle, and 82 total children
[Tue Jan 30 14:54:37 2007] [info] server seems busy, (you may need to increase StartServers, or Min/MaxSpareServers), spawning 8 children, there are 26 idle, and 67 total children
[Tue Jan 30 15:14:59 2007] [info] server seems busy, (you may need to increase StartServers, or Min/MaxSpareServers), spawning 8 children, there are 30 idle, and 50 total children
[Tue Jan 30 15:15:40 2007] [info] server seems busy, (you may need to increase StartServers, or Min/MaxSpareServers), spawning 8 children, there are 17 idle, and 63 total children
[Tue Jan 30 15:15:41 2007] [info] server seems busy, (you may need to increase StartServers, or Min/MaxSpareServers), spawning 16 children, there are 24 idle, and 71 total children
[Tue Jan 30 16:14:19 2007] [info] server seems busy, (you may need to increase StartServers, or Min/MaxSpareServers), spawning 8 children, there are 29 idle, and 63 total children

In my Apache config:
MinSpareServers 32
MaxSpareServers 64
StartServers 32

Any ideas or recommendations?

Thanks for your help!

-Bobby
Link to comment
Share on other sites

I've only used Apache 2+ and I haven't experienced this, but here are some ideas:

- Google.
- Read through [url=http://httpd.apache.org/docs/1.3/misc/perf-tuning.html]Apache Performance Tuning[/url].
- What is your KeepAliveTimeout?
- What is your MaxRequestsPerChild?
- What programming languages/applications are you using with Apache? ...What are they doing? Basic stuff?
Link to comment
Share on other sites

I just changed my Max Clients down to 36 from 512?  Is this a good or bad idea?

Here are some of my other settings:

MaxRequestsPerChild 500
KeepAliveTimeout 10
I am using php and cgi.  The most advanced php think that I run is Gallery.  I have about 6 different galleries on my server

Link to comment
Share on other sites

Re. Max clients - Im not really sure. 36 should be sufficient.

If you running gallery - its not the number of clients that would slow it down - its the database connections.

Just yesterday - I realised/found the "Performance" tab in gallery - caches the photos and pages which saves a LOAD of load on the server. I highly recommend it.

-steve
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.