Are you are benchmarking Apache
on the first run of the mod_perl program? It only gets
faster the second time the program is run by a particular
http daemon.
If you have many http daemons running,
you will have to do many requests before you notice
your program suddenly running faster.
Also, you might try reducing the number of print
statements in your code.
I think that perl's IO system has changed somewhat
since I wrote
Re: Speeding up commercial Web applications,
but I think that the advice there is still good.
There are a few other optimizations that can improve
print statements, but the improvements are small.
Things to experiment with are:
-
Eliminate string interpolation. This is about
a 1% improvement in my version of perl.
- Use commas to separate print arguments instead of
concatenating them as strings with the . operator.
Another mod_perl optimization is to move as much
computation as possible to a BEGIN {}
block, so it is only computed during the first run
of your code. Similarly, put cleanup code in
an END {} block.
It is easy to get confusing answers when profiling
mod_perl. I use Time::HiRes and print
the profiling information to STDERR. This is tedious
but I suspect that the more deluxe profiling modules
were not written with mod_perl in mind!
The ultimate test is load testing, which I do with
a bunch of lwp GET requests running at the
same time. With this I discover other Apache
parameters to tune, such as the number of requests
to service before restarting the http daemon.
These server restarts require perl to reload
the modules.
It should work perfectly the first time! - toma
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.