speeding up perl script execution under apache

Discussion in 'Perl Misc' started by stig erikson, Oct 29, 2004.

  1. stig erikson

    stig erikson Guest

    Hello.
    Even though this might be more of an apache question i will try here.

    We have a few perl scripts in production, they run in a web service
    environment. We use apache 2 with the mod_cgi module that came with
    apache on redhat. We have performance problems.
    It is run on a rather slow Pentium II 200Mhz server and it will be
    change in some not too far future but we would like to do something
    meanwhile.

    The entire script (from first to last line) takes about 0.05-0.1 second
    to run. When we run it on apache it will take around 2.5 seconds to
    execute the entire script.
    The overhead from executing perl and "compiling" the script is almost
    2.5 seconds. This is the problem. (serving static pages is fast, so the
    problem is execution of scripts).
    The total execution time ir rather consistant no matter what script is
    run. For all scripts we run the overhead time is approximately 2.5 seconds.

    We would like to minimize the overhead to gain time.
    Preferrably we dont want to change the scripts.
    Is there something we can do cut down the overhead time?
    Make perl start faster och make the compilation faster?
    Even a cut of the overhead from 2.5 to 2.0 seconds would help.

    Thank you
    Stig
     
    stig erikson, Oct 29, 2004
    #1
    1. Advertising

  2. stig erikson <> wrote in
    news:Ausgd.10125$:

    > Hello.
    > Even though this might be more of an apache question i will try here.


    Rather you asked it in the right place.

    > The overhead from executing perl and "compiling" the script is almost
    > 2.5 seconds. This is the problem. (serving static pages is fast, so
    > the problem is execution of scripts).


    Then you should look into using mod_perl:

    http://perl.apache.org/

    http://perl.apache.org/docs/1.0/guide/getwet.html#Porting_Existing_CGI_Scri
    pts_to_run_under_mod_perl

    > We would like to minimize the overhead to gain time.
    > Preferrably we dont want to change the scripts.


    There is no silver bullet. More memory ought to help.

    There is really not that much else we can say here. This is a programming
    group.

    Sinan.
     
    A. Sinan Unur, Oct 29, 2004
    #2
    1. Advertising

  3. stig erikson wrote:
    > The overhead from executing perl and "compiling" the script is almost
    > 2.5 seconds.


    <snip>

    > We would like to minimize the overhead to gain time. Preferrably we
    > dont want to change the scripts. Is there something we can do cut
    > down the overhead time?


    You are screaming "mod_perl". Assuming that the scripts are well
    written, there is at least not much you need to change to achieve a
    significant performance improvement through mod_perl.

    --
    Gunnar Hjalmarsson
    Email: http://www.gunnar.cc/cgi-bin/contact.pl
     
    Gunnar Hjalmarsson, Oct 29, 2004
    #3
  4. stig erikson wrote:

    > Hello.
    > Even though this might be more of an apache question i will try here.
    >
    > We have a few perl scripts in production, they run in a web service
    > environment. We use apache 2 with the mod_cgi module that came with
    > apache on redhat. We have performance problems.
    > It is run on a rather slow Pentium II 200Mhz server and it will be
    > change in some not too far future but we would like to do something
    > meanwhile.


    I've written my own article/chechlist on this!
    http://gregorytoomey.com/index.php?option=content&task=view&id=2&Itemid=2


    > The entire script (from first to last line) takes about 0.05-0.1 second
    > to run. When we run it on apache it will take around 2.5 seconds to
    > execute the entire script.
    > The overhead from executing perl and "compiling" the script is almost
    > 2.5 seconds. This is the problem. (serving static pages is fast, so the
    > problem is execution of scripts).
    > The total execution time ir rather consistant no matter what script is
    > run. For all scripts we run the overhead time is approximately 2.5
    > seconds.


    Your setup is way under powered. My aim is to get my Perl cgi executing
    under 0.1 sec. See my article.

    > We would like to minimize the overhead to gain time.
    > Preferrably we dont want to change the scripts.
    > Is there something we can do cut down the overhead time?
    > Make perl start faster och make the compilation faster?
    > Even a cut of the overhead from 2.5 to 2.0 seconds would help.
    >
    > Thank you
    > Stig


    gtoomey
     
    Gregory Toomey, Oct 29, 2004
    #4
    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. dpackwood
    Replies:
    3
    Views:
    1,868
  2. Luis P. Mendes

    speeding up Python script

    Luis P. Mendes, May 18, 2005, in forum: Python
    Replies:
    10
    Views:
    605
    Luis P. Mendes
    May 18, 2005
  3. Tom Salzmann
    Replies:
    3
    Views:
    288
  4. The Poor
    Replies:
    2
    Views:
    260
    Gregory Toomey
    Sep 27, 2003
  5. kath
    Replies:
    4
    Views:
    814
    J. Gleixner
    Apr 9, 2007
Loading...

Share This Page