cheryld has asked for the wisdom of the Perl Monks concerning the following question:

I looking into pre compiling the perl scripts on my site to hopefully speed things up. I just quickly picked a script and ran perlcc scriptx.pl.....looks like I got a bunch of errors on stuff that's missing!

I'm not sure how much this will help but my server is bogging down and something needs to be done. I'm not looking forward to the idea of rewriting it all. Any thoughts on compiled perl, how to, things needed, ANYTHING would be greatly appreciated.

Thanks.

Replies are listed 'Best First'.
Slow server problem, was Re: PerlCC - advice on how to
by Albannach (Monsignor) on Jul 18, 2001 at 08:09 UTC
    There are likely many different things you might do to speed up your server, but some will definitely be more effective than others, so it would be well worth your while to spend some time figuring out where your bottleneck actually is. While mod_perl will indeed save you a lot of startup time, if for instance your scripts are doing large database queries or computationally intensive tasks, is startup time an issue? Your problem could be any number of things from a lack of memory to a fundamental design flaw, but if you don't know, you may end up doing a lot of work for little or no gain.

    For a recent example, while I don't know what your level of Perl expertise is, it may be that some simple code and/or algorithm modifications could be very beneficial. As an example, in this case a very simple modification produced a factor of 40 speed improvement.

    --
    I'd like to be able to assign to an luser

Re: PerlCC -advice on how to
by lshatzer (Friar) on Jul 18, 2001 at 07:19 UTC
    If your scripts are CGI's, I'd suggest mod_perl before trying to "compile" your perl scripts, since that does not speed things up as most people think. mod_perl will get rid of most of your starup time when running perl cgis.

    Also last time I checked perlcc was still experimental.
Re: PerlCC -advice on how to
by jepri (Parson) on Jul 18, 2001 at 07:22 UTC
    Compiling your CGI scripts is the wrong way to go. You need to use mod_perl, FastCGI, SpeedyCGI or another variant. You can get huge speed increases by installing one of these programs, and you don't necessarily have to rewrite any code (although you can get it even faster with a rewrite).

    It is possible for Perl scripts running under mod_perl to spank pretty much any other CGI apps. When I installed mod_perl my scripts went from about .5 secs to <.1, and then I started tweaking them.

    ____________________
    Jeremy
    I didn't believe in evil until I dated it.

Re: PerlCC -advice on how to
by jlongino (Parson) on Jul 18, 2001 at 09:29 UTC
    I think Albannach is on the right track. You should step back and take stock of your entire system and its performance. Not just Perl. What other applications does your server run? It is more likely that some other process or shortage of bandwidth/storage/memory may be the problem.

    Does your server also run NNTP? We use to run a news server on our "web" box and finally had to shut it down because it soaked too many resources (disk space, CPU cycles and bandwidth).

    Are you running sendmail on it? A couple of our boxes were shut down for a few days because holes in our sendmail daemons allowed spammers to use it as a relay for hundreds of thousands of messages. The effect was gradual not instantaneous. We had to install TCP wrappers to close the holes.

    You might want to talk to the System Administrator and find out if they have time accounting activated or can use tools like top to monitor allocated process resources).

    If you are running a web server, you might want to check out the message and error logs for potential problems. You can probably generate some connection statistics via the web server administration utilities. Our Netscape server periodically chews up cycles for no apparent reason and has to be stopped and restarted.

    Occasionally our backups run at times they shouldn't and slow down the system enough to generate complaints from our Web Services department.

    Hope these suggestions yield some results.

Re: PerlCC -advice on how to
by xphase_work (Pilgrim) on Jul 18, 2001 at 16:36 UTC
Re: PerlCC -advice on how to
by Anonymous Monk on Jan 29, 2012 at 07:22 UTC
    #!perl -W ## ## printenv -- demo CGI program which just prints its environment ## print "Content-type: text/html; charset=windows-1251\n\n"; #print "Content-type: text/plain; charset=iso-8859-1\n\n"; print "<HTML><HEAD><TITLE>Environment</TITLE></HEAD>\n"; print "<BODY>\n"; foreach $var (sort(keys(%ENV))) { $val = $ENV{$var}; # $val =~ s|\n|\\n|g; # $val =~ s|"|\\"|g; print "${var}=\"${val}\"\n"; print "<BR >"; } print "</BODY></HTML>\n";