> > If you're writing new code then I would recommend writing handlers and
> > avoiding Apache::Registry altogether.
>
> I had been thinking about whether to do this.  Why do you
> recommend avoiding
> Apache::Registry?  Is there a performance penalty for using it?

We sometimes use Apache::Registry scripts to implement a simple MVC model
(look back in the archives for about a thousand different implementations of
MVC using mod_perl!).  Perl modules are the model, the Apache::Registry
scripts are the controller, and a template provides the view.  It keeps our
configuration brain-dead since there are no PerlModule directives other than
Apache::Registry.

There are a few performance penalties when using Apache::Registry:

* Scripts are compiled at first request instead of server start unless you
use something like Apache::RegistryLoader.  So, the first request per child
will be a little bit slower and you don't get to share memory between httpd
children.  (Memory sharing can be a big problem.)

* Every request runs through Apache::Registry::handler before your script
gets called which has overhead including some setup code, an extra stat(),
and a chdir().  (PerlRun and RegistryNG uses $r->finfo but Registry does an
extra stat() -- not sure if there's a reason for that.)

- Kyle

Reply via email to