More Who's Your Daddy
June 19, 2000
Deciding just which Perl modules to pre-load into the Apache parent server,
such as with our startup.pl script, is a
judgment call. If, for
instance, only one of your Perl scripts used the module
Text::ParseWords, it would not be a great idea to pre-load this
module in startup.pl, or else every single Apache child process will
inherit this code. That can only lead to bloated chubby children, which
simply eat more memory than they're worth.
On a similar note, it would also be possible to pre-load an entire Perl
script into the Apache parent server. The obvious allure is that the whole
script would only be compiled once, inherited by each child. But like a
stack of chocolate chip pancakes, the idea sounds a lot better than it is --
pre-loading these scripts into the Apache parent will significantly bloat
the children. Once again, bloated children eat RAM -- this is especially bad
because when you eat too much RAM, you run the gamble of running out of
physical RAM, forcing the operating system to hit virtual memory on the
hard drive. Indigestion indeed, because hitting the hard disk for virtual
RAM will incur such a large performance penalty that any gains made by
pre-loading a script will be more than wiped out.
Measuring and tuning actually memory consumption is unfortunately not a
simple task, and depends quite a bit on the operating system your Apache
runs on. Rather than fill these pages with detailed and mind-numbing memory
analyses details, we must instead cop-out and refer you to the very thorough
and not at all tedious benchmarking procedures described by Stas Bekman in
his
mod_perl guide: Know Your Operating System.
Who's Your Daddy?
The Perl You Need to Know
Database Savoir Faire
|