MogileFS Perl initialisation / performance issues.

Tomas Doran tom at
Fri Apr 18 17:05:52 UTC 2008

On Fri, 2008-04-18 at 11:49 +0200, Ferdy Galema wrote:
> Hello,
> Let's say I'm running the following snippet in apache2/mod_perl, all
> with the default configuration:
> #========================================#
> #!/usr/bin/perl
> use strict;
> use CGI qw(:standard);
> use MogileFS::Client;
> #just serve the image directly for now
> print "Content-type: image/jpeg\n\n";
> print $$image;
> #========================================#

That doesn't look like mod_perl to me? Looks like an old style CGI.

> -Does it get initialised everytime a request is made? Is that okay
> performance wise? 

Yes it does. That's not too bad performance wise, but not the best if
you're trying to shave your request down to ms.. However loading perl
(and loading / compiling the modules) on each request (as you appear to
be a CGI) will be a much bigger overhead than connecting to mogileFS
here as you're a CGI.

> If not, can it be made global in a way?

Yes, just use a closure to hold the mogile object, and it'll stay


More information about the mogilefs mailing list