mod_perl on apache 1.3 and 2.0 performance test, old vs new. strage..

P

Pablo S

Hi there Perl folks, I am comparing performance on a new server
platform I am demoing and wanted to share this weird thing:

It started out when I noticed some expensive local db calls on my
mod_perl box were taking a while on the new, slightly beefier system.
They are the same accept for:

OLD system:
(a celeron 1.8 w/ 512SDRAM linux 2.4 running perl 5.6.1,
postgresql-7.2.1-5 with a perl web db on Apache/1.3.23 mod_perl 1.26
and dbi 1.37 with peristent db connections via apache:dbi. ) this
thing runs awesome, as in, it is FAST, for what it does.

NEW system:
(a p4 2.6 w/ 512DDR266 running the same web app via perl 5.8.3 on
fedora core 2 linux 2.6 postgresql-7.4.2-1 w/ Apache/2.0.49 &
mod_perl/1.99_12 & apache:dbi.) it, at this point, sucks and is
noticably slower to load pages, pull from DBI, and even do simple
loops.

Httpd.conf on apache2.0
Alias /cgi-bin /var/www/cgi-bin
<Directory /var/www/cgi-bin>
SetHandler perl-script
PerlResponseHandler ModPerl::Registry
PerlOptions +ParseHeaders
Options +ExecCGI
</Directory>

and on 1.3
Alias /cgi-bin/ "/home/httpd/cgi-bin/"
<Location /cgi-bin>
SetHandler perl-script
PerlHandler Apache::Registry
Options ExecCGI
allow from all
PerlSendHeader On
</Location>

I have one page where I run many queries. On the old server, it loads
in 1.5 seconds. On the new server, with the same data, it takes 6. I
am trying to find out why. After going nuts all over Pg, apache:dbi,
and all orders of other stuff I had both servers run your basic

my $i=10000000;
while ($i) {
$i--;
}
print "done!";

thing. The 1.8 is done in 2 seconds, the 2.4 takes almost 8.

Is apache the culprit? I was running all over looking at the database
I was talking to, etc etc, but heres a simple loop taking about 3x as
long.

Thank you for your interest!! Any comments welcome.
 
T

Tore Aursand

[ Bad performance with Apache 2.x over Apache 1.x ]

Is apache the culprit? I was running all over looking at the database I
was talking to, etc etc, but heres a simple loop taking about 3x as
long.

You have to hone your benchmarking skills. You'll easily find out if one
Apache version is serving slower than another Apache version by simple
running the 'ab' tool on a simple HTML file;

% /usr/local/apache/bin/ab -n 100000 -k -c 4 http://localhost/test.html

'test.html' should - of course - not contain very much. Just some simple
HTML markup with no outside references (ie. images, CSS files, etc.)

Moving on to the next step: Create a simple script like this:

#!/usr/bin/perl
#
use strict;
use warnings;

my $i = 100_000_000;
while ( $i > 0 ) {
$i--;
}

Run this script with each of the Perl versions you have. Something tells
me that this really is a Perl issue, but that your fastest Perl version is
compiled differently than that slower Perl version.

I experienced the same thing when upgrading from Perl 5.6.0 to Perl 5.6.1;
The former was installed as plain RPM with all the fance stuff included,
while the latter was compiled specifically for the computer I was running
at that time, with just the necessary stuff enabled.

The result: Perl 5.6.1 was _a lot_ faster than the previous version, and
I could easily benchmark that from a simple "routine" as the one above.

I'll be happy to see your benchmark results!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,154
Members
46,701
Latest member
XavierQ83

Latest Threads

Top