Andrew Green wrote: > [My apologies for two copies of my original message turning up. My bad.] > > In article <00a901c1a44d$7d087d70$18020c0a@PerriHar>, > Perrin Harkins <[EMAIL PROTECTED]> wrote: > > >>I would not expect PerlRun to use less memory than Registry. >> > > What I meant was that I have about a dozen of these little scripts. My > understanding is that PerlRun uses the embedded Perl interpreter, but > compiles and executes the scripts individually on each request, whereas > Registry caches the compiled version, potentially meaning a dozen > compiled versions cached for each of a bunch of processes. I figured > using PerlRun would avoid that, but provide a useful intermediate > performance boost by not forking perl each time. > > Have I misunderstood?
Yes and No, PerlRun flushes the namespace of the script, and Perl will reuse the memory freed by this flush, but it won't shrink the process, since the memory is never given back to the system till the process quits. So I you do save some memory, but not all of it. Check with the Apache::Status module which will show you exactly how much you save. See the notes in the guide and the manpage. But you miss an important point. If you use PerlRun, you add an overhead of compilation of your scripts. If you were using Registry your response will be faster => you need less servers to serve the same load, => you need less memory overall. Again I cannot tell you absolutely that it's true for all cases, you have to measure it yourself. The guide's performance chapter provides a plenty of examples on how to approach the problems. Also read about memory sharing and preloading in the same chapter http://perl.apache.org/guide/performance.html >>Does the module have a package name? Are you exporting the variables >>from it? Seeing some code would help. >> > > It does, and what confuses me is the intermittent nature of the problem. > > Anyway, here's some code (snipped wildly into a minimal test case, and > with the paths replaced): > > The module: > > #!/usr/bin/perl > > package Article7::Woking::Overseer; > > use strict; > require Exporter; > use vars qw(@ISA @EXPORT $root $dbmx); > > @ISA = qw(Exporter); > @EXPORT = qw($dbmx); > > $dbmx = 'path-to-data-files'; > > 1; > > > ...and the PerlRun program: > > #!/usr/bin/perl > > use strict; > use CGI qw(:standard); > use Fcntl; > use MLDBM qw(DB_File Storable); > use lib 'path-to-directory'; > use Article7::Woking::Overseer; > > print header(-type => 'text/html; charset=utf-8'); > > tie(my %accom, 'MLDBM', "$dbmx/accom.dbmx", O_RDONLY, 0644) or die > "Can't open $dbmx/accom.dbmx: $!\n"; > > [...] > > The error log reveals that it's this tie that kills the program -- $dbmx > remains undef, so the file isn't found. I think your problem is that you don't declare the local variable when you import it. See: http://perl.apache.org/guide/perl.html#Using_Global_Variables_and_Shari and especially http://perl.apache.org/guide/perl.html#Using_Exporter_pm_to_Share_Globa -- _____________________________________________________________________ Stas Bekman JAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide http://perl.apache.org/guide mailto:[EMAIL PROTECTED] http://ticketmaster.com http://apacheweek.com http://singlesheaven.com http://perl.apache.org http://perlmonth.com/