You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Gregory Matthews <gr...@iwebtips.com> on 2002/05/21 02:11:21 UTC

Apache::GTopLimit

Does using the Apache::GTopLimit module have the same net effect as 
restarting the server itself by simply killing off the actual processes 
which are growing beyond the set threshold, and thereby causing new 
processes to be born?

If so, this sounds like a good alternative to setting a cron task or 
manually restarting the server each day/week.

Gregory



Re: Apache::GTopLimit

Posted by Perrin Harkins <pe...@elem.com>.
> So to modify my previous question, other than the loss of some shared
> memory over time,  GTopLimit will have the same effect as restarting
the
> server?

Yes.  That shared memory is important though.

> On a side note, how are you tracking/discovering the this minimal loss
over
> time?

Apache::SizeLimit prints statistics to the error log when it kills a
process.  Also, you can just look at top.

- Perrin


Re: Apache::GTopLimit

Posted by Gregory Matthews <gr...@iwebtips.com>.
So to modify my previous question, other than the loss of some shared 
memory over time,  GTopLimit will have the same effect as restarting the 
server?

On a side note, how are you tracking/discovering the this minimal loss over 
time?

Gregory


At 08:38 PM 5/20/2002 -0400, you wrote:
> > Does using the Apache::GTopLimit module have the same net effect as
> > restarting the server itself by simply killing off the actual
>processes
> > which are growing beyond the set threshold, and thereby causing new
> > processes to be born?
>
>It does kill off processes that are getting too big, and you definitely
>should use either GtopLimit or SizeLimit to get the most out of your
>server.  However, it's not quite the same thing as a restart.  Over
>time, some of the shared memory from the parent process appears to
>become unshared, and new processes that are spawned start out with less
>shared memory because of this.  Restarting now and then takes care of
>this problem.
>
>- Perrin



Re: Apache::GTopLimit

Posted by Stas Bekman <st...@stason.org>.
Perrin Harkins wrote:
> Stas Bekman wrote:
> 
>> Perrin Harkins wrote:
>>
>>> Stas Bekman wrote:
>>>
>>>> What you are saying is that when the server is started afresh, the 
>>>> newly started child processes share more memory with the parent, 
>>>> than newly started child processes some time later. Am I correct?

>> Any ideas why?
> 
> 
> Not really.  I thought maybe it was because of something changing in the 
> parent process, but that doesn't seem possible.
> 
> There was a long thread a little while back about turning swap off and 
> on again to solve this.  I've never tried that.  I think restarting 
> every 24 hours is a good idea anyway, because I've seen strange things 
> happen now and then when a server is up for a long time.

But that's unrelated to whether you kill the processes or not. Has 
anyone seen a similar behavior as described at the top of this post, 
when you have no swapping at all?

 > I think restarting
 > every 24 hours is a good idea anyway, because I've seen strange things
 > happen now and then when a server is up for a long time.

It probably depends on what you do. I've restarted my production servers 
once in a few months, when something was going wrong. But as I said it 
depends on what do you do with mod_perl.

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Re: Apache::GTopLimit

Posted by Perrin Harkins <pe...@elem.com>.
Stas Bekman wrote:
> Perrin Harkins wrote:
> 
>> Stas Bekman wrote:
>>
>>> What you are saying is that when the server is started afresh, the 
>>> newly started child processes share more memory with the parent, than 
>>> newly started child processes some time later. Am I correct?
>>
>>
>> Yes, exactly.
> 
> 
> Any ideas why?

Not really.  I thought maybe it was because of something changing in the 
parent process, but that doesn't seem possible.

There was a long thread a little while back about turning swap off and 
on again to solve this.  I've never tried that.  I think restarting 
every 24 hours is a good idea anyway, because I've seen strange things 
happen now and then when a server is up for a long time.

- Perrin


Re: Apache::GTopLimit

Posted by Stas Bekman <st...@stason.org>.
Perrin Harkins wrote:
> Stas Bekman wrote:
> 
>> What you are saying is that when the server is started afresh, the 
>> newly started child processes share more memory with the parent, than 
>> newly started child processes some time later. Am I correct?
>
> Yes, exactly.

Any ideas why?

I always do a full restart, so I've never noticed the problem.

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Re: Apache::GTopLimit

Posted by Perrin Harkins <pe...@elem.com>.
Stas Bekman wrote:
> What you are saying is that when the server is started afresh, the newly 
> started child processes share more memory with the parent, than newly 
> started child processes some time later. Am I correct?

Yes, exactly.


Re: Apache::GTopLimit

Posted by Stas Bekman <st...@stason.org>.
Gregory Matthews wrote:
> Stas:
> 
> Since you wrote the script, do you recommend some good default settings 
> in GTopLimit to start with, i.e.,

Not really. It all depends on how many modules do you use and how big 
they are when compiled. I repeat many times in the guide, that all the 
examples are only examples. pretty much each setup is unique and there 
is no one-fit all setting.

> use Apache::GTopLimit;
> 
> Apache::GTopLimit->set_max_size(10000);
> Apache::GTopLimit->set_min_shared_size(4000);
> Apache::GTopLimit->set_max_unshared_size(6000);

Use Apache::VMonitor and it'll give you a good idea what are the 
settings that you want. Since it shows you the shared and max sizes.

> $Apache::GTopLimit::CHECK_EVERY_N_REQUESTS = 2;

This one is easy. If your processes are losing the shared memory slowly, 
raise this number, so less checks will be made. Otherwise keep it small. 
Again work with Apache::VMonitor and you will figure out the perfect setup.

> I would like to start with recommended defaults and tweak if necessary 
> from there.

See above.


__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Re: Apache::GTopLimit

Posted by Gregory Matthews <gr...@iwebtips.com>.
Stas:

Since you wrote the script, do you recommend some good default settings in 
GTopLimit to start with, i.e.,

use Apache::GTopLimit;

Apache::GTopLimit->set_max_size(10000);
Apache::GTopLimit->set_min_shared_size(4000);
Apache::GTopLimit->set_max_unshared_size(6000);

$Apache::GTopLimit::CHECK_EVERY_N_REQUESTS = 2;

I would like to start with recommended defaults and tweak if necessary from 
there.

Thanks.

Gregory











At 01:33 AM 5/22/2002 +0800, you wrote:
>Perrin Harkins wrote:
>>Stas Bekman wrote:
>>
>>>Hmm, when a new process starts it shares *everything* with the parent. 
>>>Why do you say that it's not?
>>
>>It doesn't share everything with the parent.  As soon as it forks there 
>>is unshared memory, and after the first request it handles there is 
>>usually more.
>>Over time, the average amount of shared memory among child processes 
>>seems to gradually decrease.  Restarting fixes this.
>
>What you are saying is that when the server is started afresh, the newly 
>started child processes share more memory with the parent, than newly 
>started child processes some time later. Am I correct?
>
>__________________________________________________________________
>Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
>http://stason.org/     mod_perl Guide ---> http://perl.apache.org
>mailto:stas@stason.org http://use.perl.org http://apacheweek.com
>http://modperlbook.org http://apache.org   http://ticketmaster.com
>



Re: Apache::GTopLimit

Posted by Stas Bekman <st...@stason.org>.
Perrin Harkins wrote:
> Stas Bekman wrote:
> 
>> Hmm, when a new process starts it shares *everything* with the parent. 
>> Why do you say that it's not?
> 
> 
> It doesn't share everything with the parent.  As soon as it forks there 
> is unshared memory, and after the first request it handles there is 
> usually more.
> 
> Over time, the average amount of shared memory among child processes 
> seems to gradually decrease.  Restarting fixes this.

What you are saying is that when the server is started afresh, the newly 
started child processes share more memory with the parent, than newly 
started child processes some time later. Am I correct?

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Re: Apache::GTopLimit

Posted by Perrin Harkins <pe...@elem.com>.
Stas Bekman wrote:
> Hmm, when a new process starts it shares *everything* with the parent. 
> Why do you say that it's not?

It doesn't share everything with the parent.  As soon as it forks there 
is unshared memory, and after the first request it handles there is 
usually more.

Over time, the average amount of shared memory among child processes 
seems to gradually decrease.  Restarting fixes this.

- Perrin


Re: Apache::GTopLimit

Posted by Stas Bekman <st...@stason.org>.
Perrin Harkins wrote:
>>Does using the Apache::GTopLimit module have the same net effect as
>>restarting the server itself by simply killing off the actual
> 
> processes
> 
>>which are growing beyond the set threshold, and thereby causing new
>>processes to be born?
> 
> 
> It does kill off processes that are getting too big, and you definitely
> should use either GtopLimit or SizeLimit to get the most out of your
> server.  However, it's not quite the same thing as a restart.  Over
> time, some of the shared memory from the parent process appears to
> become unshared, and new processes that are spawned start out with less
> shared memory because of this.  

Hmm, when a new process starts it shares *everything* with the parent. 
Why do you say that it's not?

It doesn't matter if the process gets killed because of 
MaxRequestPerChild or FooLimit thresholds.

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Re: Apache::GTopLimit

Posted by Perrin Harkins <pe...@elem.com>.
> Does using the Apache::GTopLimit module have the same net effect as
> restarting the server itself by simply killing off the actual
processes
> which are growing beyond the set threshold, and thereby causing new
> processes to be born?

It does kill off processes that are getting too big, and you definitely
should use either GtopLimit or SizeLimit to get the most out of your
server.  However, it's not quite the same thing as a restart.  Over
time, some of the shared memory from the parent process appears to
become unshared, and new processes that are spawned start out with less
shared memory because of this.  Restarting now and then takes care of
this problem.

- Perrin