How to test speed difference of Perl/Apache and SSI/Apache

T

The Poor

I am using SSI now and it can not include external things. I want to
use Perl/CGI to do that, but worried about slower speed. How do I
test/benchmark the different of loading on Perl/Apache and SSI/Apache.

in perl
open a file for read, print it, close file

in ssi
include the file

because the network speed vary much, how do i calculate the speed of
the perl vs ssi? i can easily open/read/print/close 100 times in perl,
but i can not do that in ssi to compare...

i know in perl open/write is not multithread. how about open/read. can
many perl instances open and read the same file? what is the max
number of perl programs open the same perl? what the list of
ssi?--same as the limit of apache?

In term of speed, what is the best choice? PHP/Apache,
Mod_Perl/Apache, Fast_cgi/Apache, standred Perl/Apache, C exe/Apache,
jsp/Apache?
 
E

Eric J. Roode

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

(e-mail address removed).2y.net (The Poor) wrote in @posting.google.com:
In term of speed, what is the best choice? PHP/Apache,
Mod_Perl/Apache, Fast_cgi/Apache, standred Perl/Apache, C exe/Apache,
jsp/Apache?

I can't speak for PHP or JSP, having no experience with them.

C executable is probably the fastest of the other choices. Bitch to write,
though. And you do have the overhead of forking a new process.

Standard CGI is by far the slowest. By *FAR*.

FastCGI and mod_perl are much faster than standard perl CGI. They are
comparable in speed. The relative speeds vary based on how well the
programs are written, what functions they are actually performing, etc. I
believe that a well-written FastCGI program is a hair faster than a well-
written mod_perl program, all other things being equal -- but for most
intents and purposes, it's a toss-up.

I personally find FastCGI programs easier to write and debug than mod_perl
programs. And FastCGI scales better, but that's only an issue if you have
a humongous website that's serving hundreds of thousands of requests a day.

Faster still would be an Apache module written in C. Those are a royal
pain to write and debug, though.

- --
Eric
$_ = reverse sort $ /. r , qw p ekca lre uJ reh
ts p , map $ _. $ " , qw e p h tona e and print

-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>

iQA/AwUBP3Ut7GPeouIeTNHoEQLxUQCg9WC+FfFWRckNLbU7SWAM55GNzKsAoIwt
+WG834np3tSyKutPTo/0tLZ/
=MGtR
-----END PGP SIGNATURE-----
 
G

Gregory Toomey

It was a dark and stormy night, and The Poor managed to scribble:
I am using SSI now and it can not include external things. I want to
use Perl/CGI to do that, but worried about slower speed. How do I
test/benchmark the different of loading on Perl/Apache and SSI/Apache.

in perl
open a file for read, print it, close file

in ssi
include the file

because the network speed vary much, how do i calculate the speed of
the perl vs ssi? i can easily open/read/print/close 100 times in perl,
but i can not do that in ssi to compare...

But you can write two Perl script using LWP::Simple to retrieve the two different URLs using get(). One URL is for the Perl cgi, the otheris for SSI.
Its a easy matter to time each of the scripts.


For example, URL1.pl contains:
#!/usr/bin/perl
use strict;
use LWP::Simple;
get('http://mysite.com/Perltest.cgi');

URL2.pl contains:
#!/usr/bin/perl
use strict;
use LWP::Simple;
get('http://mysite.com/ssitest');


and in linux you just 'time URL1.pl' and 'time URL2.pl' will tell you how long it takes to retrieve each page.


gtoomey
 

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,734
Messages
2,569,441
Members
44,832
Latest member
GlennSmall

Latest Threads

Top