Phoenix.pm: mod_perl

Lowell Hamilton syz at broken-bit.com
Wed Mar 27 23:30:10 CST 2002


On Wed, 2002-03-27 at 22:05, Andrew Johnson wrote:

> http://take23.org/docs/guide/
Highly groovy =) Exactly what I was looking for ... I saw it before but
only references to it and never the actual doc.  

> Yeah, sorry 'bout that; I just get a bit defensive because some people
> still sneer at mod_perl and its users, mostly based on their own
> (failed) attempts at trying to make it work.  In fact, I recently had
> (another) argument with my former boss about mod_perl (and I don't even
> work for him anymore)!

Hehe ..gotta love it .. From my experience so far, mod_perl is a
beautiful thing, but you have to know what it's doing before you start
(which is documented well), and follow the rules .. (but people should
be doing that in regular code anyway if it anything more than a one
liner).  Mod_perl seems to be a buzzword everywhere .. "Wow this is neet
tell your CTO" but when it comes to implementing it, people chicken out
and go to php.  

> Interesting...I never played much with Apache::PerlRun.  
PerlRun just stuffs the perl intrepter in the apache process, so instead
of launching the perl executable (expensive and memory intensive on most
platforms) it uses the apache process which is already running to
execute the script.  It cuts the startup time to about 1/4 in a script
with dbi/cgi and a bunch of other big modules in it.  It compiles the
script on invocation, but it executes like Apache::Registry, so the
Apache::* modules work (especially connection pooling .. spawning new db
connections and authenticating can chew up a good 50-100ms even to a
local mysql db. and is also great for avoiding lock contention on a
berkley db).. but the compiled script isn't cached and all variables are
dumped between executions. 

> I'd check out
> rewriting the code into Perl modules and pre-loading them at startup
> (that should at _least_ cut down on compilation time).  Also try using
> Apache::Registry or even writing your app as full Apache modules
> (scripts running in Apache::Registry and Apache::PerlRun are always
> going to be slower and consume more memory than full Apache modules). 
> Definitely check out the mod_perl Guide; I bet it'll have some info to
> help you out!

Thanks for the help! I'm just starting to go from a cut/paste world to
chopping everything into oo modules (too many projects to do in too
short a timeframe so I never got to learn).


-- 
: Lowell Hamilton     syz at b r o k e n - b i t . c o m :
: Linux  OpenBSD  IDS/firewall  Security  QMail  Perl :




More information about the Phoenix-pm mailing list