Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Perl Misc (http://www.velocityreviews.com/forums/f67-perl-misc.html)
-   -   How to test speed difference of Perl/Apache and SSI/Apache (http://www.velocityreviews.com/forums/t882763-how-to-test-speed-difference-of-perl-apache-and-ssi-apache.html)

The Poor 09-27-2003 04:39 AM

How to test speed difference of Perl/Apache and SSI/Apache
 
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?

Eric J. Roode 09-27-2003 06:28 AM

Re: How to test speed difference of Perl/Apache and SSI/Apache
 
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

a@job.mx.2y.net (The Poor) wrote in news:30bcc0c9.0309262039.64792513
@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+FfFWRckNLbU7SWAM55 GNzKsAoIwt
+WG834np3tSyKutPTo/0tLZ/
=MGtR
-----END PGP SIGNATURE-----

Gregory Toomey 09-27-2003 12:26 PM

Re: How to test speed difference of Perl/Apache and SSI/Apache
 
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


All times are GMT. The time now is 10:29 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.