You are viewing a plain text version of this content. The canonical link for it is here.
Posted to asp@perl.apache.org by Joshua Chamas <jo...@chamas.com> on 2001/10/28 02:15:48 UTC
Re: memory problems
youenn wrote:
>
> I'm developping a site which work with apache::asp. It is very nice
> to develop but I have memory problems. I have about 170 asp scripts and
> 20 modules. Httpd memory process increase dramactly (30 M-40 M) and I
> can run a lot of httpd process (maxserver). I have tested to load all
> asp script at httpd start but I have always memory lake.
> Have you any solution to flush the memory properly ( Now I have a script
> that restart apache when computer swap) and how you manage her?
Take all the advice at http://www.apache-asp.org/tuning.html
To avoid swapping, set MaxClients lower ( depends on your system typical 20-100),
and MaxRequestsPerChild lower ( < 200 I'd recommend, maybe even 100 ).
If MaxClients is too low, try the lingerd server announced on the
mod_perl list, or go with a dual server setup, like mentioned
at http://perl.apache.org/guide/ ( I favor ProxyPass method personally ).
If you have linux, run your httpd under strace in httpd -X mode,
to see what your httpd will do post fork ( on the first request ).
Whatever is loading at that time, make sure its loaded in the
parent httpd. Typically, even for a big site, you can get it to
where each child httpd only takes 5M unshared RAM during its life
up to MaxRequests.
Benchmark your site with ab for a long period, like -c 20 -n 50000
and see if it breaks. You don't want your system to get anywhere
near swap. Always have some free RAM.
If you have any big perl objects you create during the request, make sure
to explicitly call an $Object->DESTROY(), and define DESTROY to do the
right thing. You can call this in a
$Server->RegisterCleanup( sub { $Object->DESTROY } )
You need to do this in case there are extra pointers to your objects,
in which case perl will not DESTOY them.
If you are doing database connections, use Apache::DBI.
If you are precompiling scripts, make sure they are really precompiling
with Debug -3 turned on while testing. Make sure the scripts aren't
getting reparsed post fork, then something is set wrong.
If you are not precompiling all your scripts, its OK, try the NoCache
setting for lots of scripts that don't get called all the time. If you
have a core set of includes, make sure to use DynamicIncludes setting.
And if all else fails, hire someone good ( like me :) to make
things better.
--Josh
_________________________________________________________________
Joshua Chamas Chamas Enterprises Inc.
NodeWorks Founder Huntington Beach, CA USA
http://www.nodeworks.com 1-714-625-4051
---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
For additional commands, e-mail: asp-help@perl.apache.org