differentiating apache children from parents ?

2003-01-24 Thread Josh Brooks

Hello,

Is there any way to tell, simply from /proc info and/or ps output if a
certain httpd PID is a child or the parent ?

If yes, is this method applicable on any OS (linux) ?

thanks.


To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-questions in the body of the message



Re: differentiating apache children from parents ?

2003-01-24 Thread Varshavchick Alexander
you can look at the parent pid of the process in question wether it is 1
or not:

ps xa -oppid -p _PID_

But depending on what you're trying to do afterwards (for example kill the
process if you determine by some external script that there are too many
apaches running and you're not satisfied with the native apache process
maintanance mechanism), there can be better ways...

Regards


Alexander Varshavchick, Metrocom Joint Stock Company
Phone: (812)118-3322, 118-3115(fax)

On Fri, 24 Jan 2003, Josh Brooks wrote:

 Date: Fri, 24 Jan 2003 05:22:00 -0800 (PST)
 From: Josh Brooks [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Subject: differentiating apache children from parents ?


 Hello,

 Is there any way to tell, simply from /proc info and/or ps output if a
 certain httpd PID is a child or the parent ?

 If yes, is this method applicable on any OS (linux) ?

 thanks.


 To Unsubscribe: send mail to [EMAIL PROTECTED]
 with unsubscribe freebsd-questions in the body of the message



To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-questions in the body of the message



Re: differentiating apache children from parents ?

2003-01-24 Thread Josh Brooks

I want to kill apache children that exceed a certain memory size - but I
want to make sure only to kill children.  Is your method a workable way of
doing that ?  That is, I would test it and if it is +not+ 1 then I would
be ok to kill it, since it is not the parent ?



On Fri, 24 Jan 2003, Varshavchick Alexander wrote:

 you can look at the parent pid of the process in question wether it is 1
 or not:

 ps xa -oppid -p _PID_

 But depending on what you're trying to do afterwards (for example kill the
 process if you determine by some external script that there are too many
 apaches running and you're not satisfied with the native apache process
 maintanance mechanism), there can be better ways...

 Regards

 
 Alexander Varshavchick, Metrocom Joint Stock Company
 Phone: (812)118-3322, 118-3115(fax)

 On Fri, 24 Jan 2003, Josh Brooks wrote:

  Date: Fri, 24 Jan 2003 05:22:00 -0800 (PST)
  From: Josh Brooks [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Subject: differentiating apache children from parents ?
 
 
  Hello,
 
  Is there any way to tell, simply from /proc info and/or ps output if a
  certain httpd PID is a child or the parent ?
 
  If yes, is this method applicable on any OS (linux) ?
 
  thanks.
 
 
  To Unsubscribe: send mail to [EMAIL PROTECTED]
  with unsubscribe freebsd-questions in the body of the message
 



To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-questions in the body of the message



Re: differentiating apache children from parents ?

2003-01-24 Thread Varshavchick Alexander
Yes you can kill it if the pid is not 1, presuming you're not killing
it during of a query processing.


Alexander Varshavchick, Metrocom Joint Stock Company
Phone: (812)118-3322, 118-3115(fax)

On Fri, 24 Jan 2003, Josh Brooks wrote:

 Date: Fri, 24 Jan 2003 05:33:27 -0800 (PST)
 From: Josh Brooks [EMAIL PROTECTED]
 To: Varshavchick Alexander [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Subject: Re: differentiating apache children from parents ?


 I want to kill apache children that exceed a certain memory size - but I
 want to make sure only to kill children.  Is your method a workable way of
 doing that ?  That is, I would test it and if it is +not+ 1 then I would
 be ok to kill it, since it is not the parent ?



 On Fri, 24 Jan 2003, Varshavchick Alexander wrote:

  you can look at the parent pid of the process in question wether it is 1
  or not:
 
  ps xa -oppid -p _PID_
 
  But depending on what you're trying to do afterwards (for example kill the
  process if you determine by some external script that there are too many
  apaches running and you're not satisfied with the native apache process
  maintanance mechanism), there can be better ways...
 
  Regards
 
  
  Alexander Varshavchick, Metrocom Joint Stock Company
  Phone: (812)118-3322, 118-3115(fax)
 
  On Fri, 24 Jan 2003, Josh Brooks wrote:
 
   Date: Fri, 24 Jan 2003 05:22:00 -0800 (PST)
   From: Josh Brooks [EMAIL PROTECTED]
   To: [EMAIL PROTECTED]
   Subject: differentiating apache children from parents ?
  
  
   Hello,
  
   Is there any way to tell, simply from /proc info and/or ps output if a
   certain httpd PID is a child or the parent ?
  
   If yes, is this method applicable on any OS (linux) ?
  
   thanks.
  
  
   To Unsubscribe: send mail to [EMAIL PROTECTED]
   with unsubscribe freebsd-questions in the body of the message
  
 


 To Unsubscribe: send mail to [EMAIL PROTECTED]
 with unsubscribe freebsd-questions in the body of the message



To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-questions in the body of the message



Re: differentiating apache children from parents ?

2003-01-24 Thread Tim Kientzle
Josh Brooks wrote:


I want to kill apache children that exceed a certain memory size - but I
want to make sure only to kill children.



If you're having memory problems with Apache,
this is not the way to solve it.

Rather, limit the number of children
using 'MaxClients' or 'ServerLimit'.
That will restrict your total memory
usage.  (Note that restricting the number
of children can considerably improve overall
performance, especially if it prevents
the system from swapping.)

There's also a setting that limits the
total number of requests handled by a
particular child before that child
exits on its own.  That can be useful
for limiting the damage from memory
leaks, for example.

Using some of the newer MPMs, it's
also possible to designate certain children
to process memory-hungry requests and
manage overall memory usage that way.

Probably the most important point, though, is
to carefully evaluate your design choices.
mod_perl, for instance, is a notorious
memory pig.  (It's possible to limit
memory usage with mod_perl, but it requires
a great deal of care.)

Trying to kill children is just a bad
idea.  In particular, there's no way
to ensure that you kill a child between
requests, so you're gauranteed to lose
some requests if you go this way
(and quite possibly hang a few TCP
connections along the way).  Don't
do it.


Tim Kientzle



To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-questions in the body of the message