Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Ranguard (1858)

Ranguard
  (email not shown publicly)
http://leo.cuckoo.org/

Journal of Ranguard (1858)

Wednesday January 16, 2002
09:54 AM

Mod_perl vs Apache::Registry vs CGI

[ #2178 ]
Well, having faffed around with the new site for work, it was still putting too much load on the machine (I've seen it spike at upto a load of 20! though the averadge is about 3). So (as was planned) I investigated converting our Apache::Registry search script into a propper mod_perl handle.

Converting Registry to mod_perl handle
First, use Apache::Request instead of CGI.pm, second use Apache::Cookie instead of CGI::Cookie (or CGI.pm's cookie stuff). This alteration was all relativly easy, just change $cgi_query (CGI.pm object) to $r, setting a value in $r is different and also you have to do $r->print() instead of just print.

The cookie stuff took me a while to get, just remember each cookie is an object not a hash! and then all becomes clear.

The results
Just hitting the search (so it shows the default form) is what I based my test on just to get a base feeling for the speed rather than complicate it with DB connections and the like. Here are the results:

Method          Req/sec        time per request
Standard CGI:   3.36     297.56 ms
Apache::Registry:   10.20     98.43 ms
Mod_perl:   73.31     13.64 ms

The jump between CGI and Registry I was expecting and as I am using Template Toolkit I was also expecting a similar (well, double to trebble) jump in performance from Registry to mod_perl. To get 7 times more requests and increase in speed was beyond anything I could have expected.

So, the lession, mod_perl good! Take the time, have a go it can make an amazing difference.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • We've been looking at improving the performance of our authentication modules, having just converted our whole cgi/module suite to mod_perl safe Perl. I haven't had the chance to write any pure mod_perl handlers before, but you've just given me a good reason to start ... cheers :)