I was trying to test the CGI response time of a Perl/CGI script under two conditions: as multiple modules versus a single big script. First I installed IndigoPerl (from indigostar.com) on my Windows machine (which has an integrated apache server with mod_perl enabled by default). Then I ran this script locally against the local server:
#!/usr/local/bin/perl use strict; use LWP::Simple; use Time::HiRes; my $script = $ARGV[0]; my $totalTime = 0; my $i; for ($i=0; $i < 20; $i++) { my $before = Time::HiRes::gettimeofday(); if ( $script eq 'big' ) { print "Running big: "; if ( !defined( my $content = LWP::Simple::get('http://localhost/cgi-bin/bigtool.cgi'))) { print "failed get\n"; } } else { if ( !defined( my $content = LWP::Simple::get('http://localhost/cgi-bin/webtool.cgi'))) { print "failed get\n"; } } my $elapsed = Time::HiRes::gettimeofday() - $before; print "did $i in $elapsed seconds.\n"; $totalTime = $totalTime + $elapsed; } $totalTime = $totalTime / 20; print "Average response time for 20 requests was: $totalTime seconds.\n"; ######## end of script ######### After I set up my app (webtool.cgi) and created the single script version (bigtool.cgi), I ran this script on my machine and it showed that the single file was about 10-15% faster than the multiple modules. My first question is, is the above script a valid test of CGI response time? So, for example, should the results reflect any improvements with mod_perl enabled? Because what I found is that the response time differed less than 5% between mod_perl-enabled and mod_perl disabled configurations. The CGI application I'm testing this on is about 4,100 lines of Perl, and 114k bytes. I emailed support@indigostar, but it's been over two days and no reply yet. I figure I'd just throw this out there for feedback. From other postings, it seems like Windows mod_perl works great, and I should see a significant speed-up. btw, I'm running Windows 98 SE on a 500 MHz machine. Here's another test I did: I ran my test script remotely against my local IndigoPerl server from my remote unix account on sourceforge (because I thought maybe an interaction between the test script and the server running on the same machine). Basically, it shows the same results: enabling mod_perl only improves performance about 0-5%. I even tried this timing test against the simple one-line 'hellocgi.pl' script that came with IndigoPerl, and it's response is also similar with or without mod_perl (0.47 sec versus 0.54 seconds). Here's the thing I discoved in doing this though: when mod_perl is enabled, the disk indicator on my machine does not blink on when running the remote test script; with mod_perl disabled, the light blinks! So this would indicate that mod_perl is getting enabled and is 'working', not going to disk for requests... unfortunately, it doesn't seem to improve the overall response time much. Comments? I'm certainly hoping that either this isn't a valid test, or that IndigoPerl is just broken... -alan __________________________________________________ Do You Yahoo!? Send FREE video emails in Yahoo! Mail! http://promo.yahoo.com/videomail/