Six Apart News & Events

Behind the Scenes - Paul Lindner

Behind The Scenes is a new series where we here at Six Apart discuss what tools (software, technology, etc.) we use to do our work.

There are many worthy tools and technologies that make my job much easier as a server engineer. Kickstart, yum, and yam for rpm management, cfengine for server cloning, and cacti and nagios for monitoring. For me mod_perl is one of the most useful and most underrated technology platforms out there. We use it to make Typepad run quickly, and it can do the same with your Movable Type blog too.

mod_perl has been around for over eight years, running all manner of web sites. By embedding executable perl code directly inside the Apache web server one realizes order of magnitude speed and throughput gains. But that's just the beginning -- mod_perl is much more than just a faster way to run CGI scripts. The big gain is direct access to the Apache API via simple Perl calls. In fact if you're comfortable with MT style plugins you've already half way to understanding how mod_perl works.

In mod_perl a plugin is called a handler. You can have handlers run at any Apache Phase. Common phases include Content-Generation, URL to filename mapping, MIME Type translation, user authentication and authorization, logging and cleanup. The amount of control is simply amazing.

With mod_perl in my toolbelt I've been able to:

  • Control the Apache URL mapping phase to do sophisticated transformations that would take a page or two in mod_rewrite.
  • Control user authentication and authorization using Perl connections to weird external sources.
  • Write special logging modules that interface directly with Apache's log handling code.
  • Execute non-interactive code after the request completes in a CleanupHandler.
  • And of course generate web content at blazing speed.

Lucky for me, we get to use all of the fancy features of mod_perl for our hosted service Typepad.

If you're interested in mod_perl for your own use check out the Movable Type and mod_perl documentation for further instructions.

Comments