slow cgi

Discussion in 'NZ Computing' started by Shane, Aug 28, 2005.

  1. Shane

    Shane Guest

    Im writing some cgi scripts ( no really I am :)
    but they are taking _ages_ to ..err.. w/ever the word is
    On the system I am writing them for, they _must_ be in perl, or perhaps
    C++ but Im not cleverer 'nuff :\
    When I say slow, I timed one at 30 seconds
    it had four jobs
    run a system command
    do a regexp on the output
    do another regexp on the output
    send it to a web browser

    any ideas how to speed it up?
    note: php is _NOT_ an option
    Ta


    --
    Hardware, n.: The parts of a computer system that can be kicked

    The best way to get the right answer on usenet is to post the wrong one.
    Shane, Aug 28, 2005
    #1
    1. Advertising

  2. Shane

    Matthias Guest

    Shane wrote:

    > any ideas how to speed it up?


    You might have to post your source code for anyone to be able to help
    you with that...

    -- Matthias
    Matthias, Aug 28, 2005
    #2
    1. Advertising

  3. Shane

    AD. Guest

    On Mon, 29 Aug 2005 09:51:16 +1200, Shane wrote:

    > Im writing some cgi scripts ( no really I am :) but they are taking
    > _ages_ to ..err.. w/ever the word is On the system I am writing them for,
    > they _must_ be in perl, or perhaps C++ but Im not cleverer 'nuff :\
    > When I say slow, I timed one at 30 seconds it had four jobs
    > run a system command
    > do a regexp on the output
    > do another regexp on the output
    > send it to a web browser
    >
    > any ideas how to speed it up?


    mod_perl?

    --
    Cheers
    Anton
    AD., Aug 28, 2005
    #3
  4. Shane

    Shane Guest

    On Mon, 29 Aug 2005 10:35:20 +1200, AD. wrote:

    > On Mon, 29 Aug 2005 09:51:16 +1200, Shane wrote:
    >
    >> Im writing some cgi scripts ( no really I am :) but they are taking
    >> _ages_ to ..err.. w/ever the word is On the system I am writing them
    >> for, they _must_ be in perl, or perhaps C++ but Im not cleverer 'nuff :\
    >> When I say slow, I timed one at 30 seconds it had four jobs run a system
    >> command
    >> do a regexp on the output
    >> do another regexp on the output
    >> send it to a web browser
    >>
    >> any ideas how to speed it up?

    >
    > mod_perl?


    could be an option.. top is showing perl is using up to 49% of my proc
    but its _painful_ waiting for simple scripts to spit output out,
    I _really_ should get a better proc for my OBSD machine (200 MHz)

    --
    Hardware, n.: The parts of a computer system that can be kicked

    The best way to get the right answer on usenet is to post the wrong one.
    Shane, Aug 29, 2005
    #4
  5. Shane

    Shane Guest

    On Mon, 29 Aug 2005 09:51:16 +1200, Shane wrote:

    > Im writing some cgi scripts ( no really I am :) but they are taking
    > _ages_ to ..err.. w/ever the word is On the system I am writing them for,
    > they _must_ be in perl, or perhaps C++ but Im not cleverer 'nuff :\
    > When I say slow, I timed one at 30 seconds it had four jobs
    > run a system command
    > do a regexp on the output
    > do another regexp on the output
    > send it to a web browser
    >
    > any ideas how to speed it up?
    > note: php is _NOT_ an option
    > Ta


    Discovered the problem ( or one of them)
    #!/usr/bin/perl -wT

    use CGI qw:)standard);
    use CGI::Carp qw(warningsToBrowser fatalsToBrowser);


    using these two modules is chewing up resources, the second one is only
    for troubleshooting, however removing the first one means I have to write
    up the code for the jobs that are being handled by CGI.pm
    <insert genuine tears>

    for the moment I am going to put up with the (now 15 second pauses) but
    when I finish, in the name of speed, efficiency, etc. I will rewrite what
    is needed
    <insert more genuine tears>

    Thanks all


    --
    Hardware, n.: The parts of a computer system that can be kicked

    The best way to get the right answer on usenet is to post the wrong one.
    Shane, Aug 29, 2005
    #5
  6. In article <-a-geek.net>,
    Shane <-a-geek.net> wrote:

    >use CGI qw:)standard);
    >use CGI::Carp qw(warningsToBrowser fatalsToBrowser);
    >
    >using these two modules is chewing up resources, the second one is only
    >for troubleshooting, however removing the first one means I have to write
    >up the code for the jobs that are being handled by CGI.pm


    My Perl CGIs invariably have the following lines in them:

    use CGI;
    use CGI::Carp;

    and they do *not* chew up lots of CPU just starting up. In my case, all
    the errors end up in /var/log/httpd/error_log or equivalent (and the
    browser user just sees "Internal Server Error" if anything goes wrong),
    but I can cope with that.

    >> note: php is _NOT_ an option


    Wise man. :)
    Lawrence D’Oliveiro, Sep 9, 2005
    #6
  7. Shane

    Shane Guest

    On Fri, 09 Sep 2005 20:09:39 +1200, Lawrence D’Oliveiro wrote:

    > In article <-a-geek.net>,
    > Shane <-a-geek.net> wrote:
    >
    >>use CGI qw:)standard);
    >>use CGI::Carp qw(warningsToBrowser fatalsToBrowser);
    >>
    >>using these two modules is chewing up resources, the second one is only
    >>for troubleshooting, however removing the first one means I have to write
    >>up the code for the jobs that are being handled by CGI.pm

    >
    > My Perl CGIs invariably have the following lines in them:
    >
    > use CGI;
    > use CGI::Carp;
    >
    > and they do *not* chew up lots of CPU just starting up. In my case, all
    > the errors end up in /var/log/httpd/error_log or equivalent (and the
    > browser user just sees "Internal Server Error" if anything goes wrong),
    > but I can cope with that.
    >
    >>> note: php is _NOT_ an option

    >
    > Wise man. :)


    Thanks Lawrence
    After reinventing the wheel I was told CGI::Lite might have been an
    option, however there is no denying that removing use CGI;
    use CGI::Carp qw(warningsToBrowser fatalsToBrowser);
    from my scripts decreased runtime for scripts from >25 seconds to ~6
    seconds

    also I had to write a script that downloaded files from client machines
    via http, and not being able to use CGI.pm meant
    another couple days (I was arguing with Redbaiter far too much) of
    reinventing the wheel

    btw.. the time taken for me to write that script has been an issue of
    late, apparently its supposed to take '5 minutes' although the person
    making that critique doesnt appear able to write _any_ scripts

    I have written a series of scripts for administrating my OpenBSD box, and
    am looking at finalising the code, and making some eye-candy (Jebus
    eye-candy is hard compared to back end work :)



    --
    Hardware, n.: The parts of a computer system that can be kicked

    The best way to get the right answer on usenet is to post the wrong one.
    Shane, Sep 9, 2005
    #7
    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. Expert lino fitter

    Re: slow slow slow!

    Expert lino fitter, Dec 10, 2008, in forum: Computer Support
    Replies:
    0
    Views:
    623
    Expert lino fitter
    Dec 10, 2008
  2. Expert lino fitter

    Re: slow slow slow!

    Expert lino fitter, Dec 10, 2008, in forum: Computer Support
    Replies:
    5
    Views:
    624
    Expert lino fitter
    Dec 12, 2008
  3. Beauregard T. Shagnasty

    Re: slow slow slow!

    Beauregard T. Shagnasty, Dec 10, 2008, in forum: Computer Support
    Replies:
    2
    Views:
    644
    Shel-hed
    Dec 10, 2008
  4. chuckcar

    Re: slow slow slow!

    chuckcar, Dec 10, 2008, in forum: Computer Support
    Replies:
    0
    Views:
    515
    chuckcar
    Dec 10, 2008
  5. General Patron

    Re: slow slow slow!

    General Patron, Dec 11, 2008, in forum: Computer Support
    Replies:
    0
    Views:
    494
    General Patron
    Dec 11, 2008
Loading...

Share This Page