What is important to understand with Apache is that there is a parent
process, which effectively acts as a supervisor process, and the child
processes which actually accept and handle requests. When one uses
'restart' with the traditional 'apachectl' management command, it only
kills off and restarts the child processes and does not stop the
parent process. Because the child processes are a fork of the parent
process, if for some reason there was a memory leak in the parent
process, that leak would be inherited by the child process on a
'restart'. To fully kill off the parent and the children, you would do
a 'stop' followed by a 'start' if using 'apachectl'. As to what the
Webfaction script does I can only speculate.

What you need to thus do is get 'ps' to also output the 'PPID' value
using 'l' flag so you can work out which is the parent 'httpd'
process. For example:

$ ps axlwww | egrep '(PPID|httpd)'

  UID   PID  PPID CPU PRI NI      VSZ    RSS WCHAN  STAT  TT
TIME COMMAND
    0   429     1   0  31  0    31364   2004 -      Ss    ??
0:00.11 /usr/local/apache-2.2.4/bin/httpd -k start
   70   430   429   0  31  0    30524    592 -      S     ??
0:00.00 /usr/local/apache-2.2.4/bin/httpd -k start
  501   431   429   0  31  0    31136    852 -      S     ??
0:00.01 /usr/local/apache-2.2.4/bin/httpd -k start
  501   432   429   0  31  0    31136    848 -      S     ??
0:00.01 /usr/local/apache-2.2.4/bin/httpd -k start
   70   433   429   0  31  0    45296   1172 -      S     ??
0:00.01 /usr/local/apache-2.2.4/bin/httpd -k start
   70   434   429   0  31  0    45296   1176 -      S     ??
0:00.01 /usr/local/apache-2.2.4/bin/httpd -k start

The parent process here is 429. Normally this process should only use
quite small amounts of private memory. I have never seen an instance
of where the parent process ballooned out in size, but if you have a
dodgy Apache module it feasibly might. For example, from 'top':

  PID COMMAND      %CPU   TIME   #TH #PRTS #MREGS RPRVT  RSHRD  RSIZE
VSIZE
  434 httpd        0.0%  0:00.01  27    55    93   496K  2.73M  1.15M
44.2M
  433 httpd        0.0%  0:00.01  27    55    93   496K  2.73M  1.14M
44.2M
  432 httpd        0.0%  0:00.00   1    10    37   204K  2.50M   848K
30.4M
  431 httpd        0.0%  0:00.00   1    10    37   208K  2.50M   852K
30.4M
  430 httpd        0.0%  0:00.00   1    10    33   188K  2.02M   592K
29.8M
  429 httpd        0.0%  0:00.11   1    11    38    60K  2.73M  1.96M
30.6M

Ie., 60Kbytes here only, versus 200-500Kbytes for children.

Anyway, work out whether how you are restarting Apache is killing of
the parent process. If not work out how to restart Apache so it is.
Also look at how much memory the parent is using and see if it is
small.

This at least is some sanity checks you can do.

BTW, what Apache modules are actually being loaded using LoadModule
directive.


Graham

On May 30, 11:42 am, chrominance <[EMAIL PROTECTED]> wrote:
> I've restarted apache several times, using the restart command in the
> webapps/django directory provided by Webfaction. Perhaps there's a
> more absolute restart command I don't know about, but I'm pretty sure
> that's the one--whenever I use it, memory usage seems to go down.
>
> Also, I'm not sure if this is relevant, but whenever I do restart the
> apache processes, memory usage doesn't reset to the same baseline
> level--for example, the site ran just fine with about 30-40MB of RAM
> over the weekend, but restarting apache now only gets us down to about
> 65MB. And upon my last check the apache processes peaked at about
> 85MB. If there's a memory leak in my application, it wouldn't still
> leak after I've restarted apache, would it?
>
> I'll try the Webfaction forum too. Thanks, and keep the advice coming!
>
> On May 29, 8:15 pm, "Jay Parlar" <[EMAIL PROTECTED]> wrote:
>
> > On 5/29/07, chrominance <[EMAIL PROTECTED]> wrote:
>
> > > I've recently put up a newspaper site on Webfaction that was developed
> > > without much concern for memory limits--coming from PHP, my knowledge
> > > of memory issues is practically nil. Of course, Webfaction's plans all
> > > have memory limits, and we're currently on Shared 1, which imposes a
> > > 40MB limit. We're running the standard apache2/mod_pythonconfig, with
> > > media served via a separate apache2 process as Webfaction and the
> > > Django site recommends. The Debug setting has been set to False. I
> > > believe those are the standard steps recommended for reducing resource
> > > usage.
>
> > Did you remember to restart Apache after setting Debug to False? I
> > have a site running on Shared1, and the memory usage was close to what
> > you have, until I set Debug to False and restarted.
>
> > Also, you might want to ping the Webfaction Django forum
> > (http://forum.webfaction.com/viewforum.php?id=19) as they're pretty
> > good about responding, and one of the admins might check if something
> > is wrong with your config.
>
> > And I *believe* the "3 small sites" comes from the fact that on
> > Shared1, a max of 3 Apache processes will run, so you can run a site
> > on each process. I might be completely wrong on that though.
>
> > Jay P


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to