You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Batara Kesuma <bk...@ml.gaijinweb.com> on 2004/10/14 05:33:41 UTC
Memory leakage?
Hi,
I am using mod_perl 1.99_13, with Apache 2.0.49. When I start the
processes, free shows me that about 17 MB of swap is used. And ps -aux,
shows me that each httpd process eats up to 1.1 %MEM. But after about 30
minutes running, the swap memory usage will increase to up to about 200
MB, and each httpd process eats up to 2.5 %MEM. Sometimes the swap usage
will just go to 100%, and I have to restart httpd to make it returns to
normal. My RAM is 1 GB with 2 GB swap, and almost all of the scripts are
run inside ModPerl::Registry.
Is there any memory leakage? What can I do to check it?
My httpd.conf looks like this:
<IfModule prefork.c>
StartServers 20
MinSpareServers 30
MaxSpareServers 50
MaxClients 50
MaxRequestsPerChild 6000
</IfModule>
And my startup.pl:
use Apache2 ();
use ModPerl::Registry ();
use lib "/var/www/lib";
use Apache::DBI ();
use DBI ();
use HTML::Template;
use File::Find;
print STDERR "Pre-loading HTML Templates...\n";
find(
sub {
return unless /\.tmpl$/;
HTML::Template->new(
filename => "$File::Find::dir/$_",
cache => 1,
);
},
'/var/www/tmpl'
);
[root@robotland conf]# free
total used free shared buffers cached
Mem: 1035456 1019232 16224 0 7320 43484
-/+ buffers/cache: 968428 67028
Swap: 2048276 270052 1778224
[root@robotland conf]# vmstat 1
procs -----------memory---------- ---swap-- -----io---- --system ------cpu----
r b swpd free buff cache si so bi bo in cs us sy id wa
2 0 322940 7636 8008 45216 51 3 11 49 31 25 18 2 74 5
0 0 322940 7508 8008 45216 0 0 0 0 1527 518 9 2 90 0
0 0 322940 7188 8008 45088 128 0 128 0 2071 1125 25 2 72 1
0 0 322940 6748 8032 45008 316 0 316 352 1964 1145 23 3 70 4
1 0 322940 6676 8040 45228 32 0 32 52 1655 722 10 2 87 1
0 0 322940 6548 8040 45228 0 0 0 0 1853 896 18 2 80 0
0 0 322940 5844 8040 45148 340 0 340 0 1890 861 21 3 76 2
--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: Memory leakage?
Posted by Perrin Harkins <pe...@elem.com>.
On Wed, 2004-10-13 at 23:33, Batara Kesuma wrote:
> Is there any memory leakage? What can I do to check it?
There is quite a bit of discussion about optimizing memory usage what to
avoid in the mod_perl docs, mostly here:
http://perl.apache.org/docs/1.0/guide/performance.html
Usually the problem is not actual leaks, but rather programming
practices that use up lots of RAM in Perl, like slurping large files
into memory or loading huge database result sets.
- Perrin
--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: Memory leakage?
Posted by Stas Bekman <st...@stason.org>.
Batara Kesuma wrote:
> Hi Stas,
>
>
>>Batara, please try first with mod_perl 1.19_16 or the current cvs [1].
>>If it didn't make any different please tell us how much memory
>>consumes each modperl process on the startup (shared and absolute).
>>You can use Apache::VMonitor for that purpose if you have libgtop
>>installed.
>
>
> I tried mod_perl 1.19_16 with the same result.
>
> But the problem is gone after I changed MaxRequetPerChild from 6000 to
> 1000. I guess the application just eats up too much memory. Thanks a lot
> :)
It's possible that your application leaks. In which case you need to fix
that. The doc Perrin has pointed you to [1] should give you enough
information on how to deal with that situation. You didn't answer my
question about the sizes of the processes, so I can't give any further advice.
It's also possible that mod_perl 2 leaks, but w/o seeing a specific code
that we can reproduce the problem with, we can't know. So if you think
it's a mod_perl 2 problem, please shrink your code to the shortest
possible version that you still see the leak with and post it here.
p.s. Instead of tuning MaxRequestPerChild it's much better to use
Apache::SizeLimit and its friends. But at the moment it is not yet ported
to mp2, so stay tuned for when its port is announced.
Thanks.
[1] http://perl.apache.org/docs/1.0/guide/performance.html
--
__________________________________________________________________
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
--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: Memory leakage?
Posted by Batara Kesuma <bk...@ml.gaijinweb.com>.
Hi Stas,
> Batara, please try first with mod_perl 1.19_16 or the current cvs [1].
> If it didn't make any different please tell us how much memory
> consumes each modperl process on the startup (shared and absolute).
> You can use Apache::VMonitor for that purpose if you have libgtop
> installed.
I tried mod_perl 1.19_16 with the same result.
But the problem is gone after I changed MaxRequetPerChild from 6000 to
1000. I guess the application just eats up too much memory. Thanks a lot
:)
--bk
--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: Memory leakage?
Posted by Stas Bekman <st...@stason.org>.
Batara Kesuma wrote:
> Hi,
> I am using mod_perl 1.99_13, with Apache 2.0.49. When I start the
> processes, free shows me that about 17 MB of swap is used. And ps -aux,
> shows me that each httpd process eats up to 1.1 %MEM. But after about 30
> minutes running, the swap memory usage will increase to up to about 200
> MB, and each httpd process eats up to 2.5 %MEM. Sometimes the swap usage
> will just go to 100%, and I have to restart httpd to make it returns to
> normal. My RAM is 1 GB with 2 GB swap, and almost all of the scripts are
> run inside ModPerl::Registry.
>
> Is there any memory leakage? What can I do to check it?
Batara, please try first with mod_perl 1.19_16 or the current cvs [1]. If
it didn't make any different please tell us how much memory consumes each
modperl process on the startup (shared and absolute). You can use
Apache::VMonitor for that purpose if you have libgtop installed.
[1]
http://perl.apache.org/download/source.html#Development_mod_perl_2_0_Source_Distribution
--
__________________________________________________________________
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
--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html