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

Discussion in 'Perl Misc' started by The Poor, Sep 27, 2003.

  1. The Poor

    The Poor Guest

    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?
    The Poor, Sep 27, 2003
    #1
    1. Advertising

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

    .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+FfFWRckNLbU7SWAM55GNzKsAoIwt
    +WG834np3tSyKutPTo/0tLZ/
    =MGtR
    -----END PGP SIGNATURE-----
    Eric J. Roode, Sep 27, 2003
    #2
    1. Advertising

  3. 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
    Gregory Toomey, Sep 27, 2003
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. efiedler
    Replies:
    1
    Views:
    2,015
    Tim Ward
    Oct 9, 2003
  2. e n | c k m a

    Speed diff between SSI and PHP?

    e n | c k m a, Jul 31, 2004, in forum: HTML
    Replies:
    16
    Views:
    850
    Sid Ismail
    Jul 31, 2004
  3. Anarki
    Replies:
    1
    Views:
    281
    Alf P. Steinbach
    Aug 12, 2007
  4. Weng Lei-QCH1840
    Replies:
    1
    Views:
    174
    Thomas
    Aug 15, 2003
  5. Guy
    Replies:
    6
    Views:
    241
    Ben Morrow
    Dec 5, 2003
Loading...

Share This Page