This is an excerpt from the latest version perlfaq3.pod, which
comes with the standard Perl distribution. These postings aim to
reduce the number of repeated questions as well as allow the community
to review and update the answers. The latest version of the complete
perlfaq is at
http://faq.perl.org .
--------------------------------------------------------------------
3.19: How can I make my CGI script more efficient?
Beyond the normal measures described to make general Perl programs
faster or smaller, a CGI program has additional issues. It may be run
several times per second. Given that each time it runs it will need to
be re-compiled and will often allocate a megabyte or more of system
memory, this can be a killer. Compiling into C isn't going to help you
because the process start-up overhead is where the bottleneck is.
There are two popular ways to avoid this overhead. One solution involves
running the Apache HTTP server (available from
http://www.apache.org/ )
with either of the mod_perl or mod_fastcgi plugin modules.