Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Computing > NZ Computing > slow cgi

Reply
Thread Tools

slow cgi

 
 
Shane
Guest
Posts: n/a
 
      08-28-2005
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.

 
Reply With Quote
 
 
 
 
Matthias
Guest
Posts: n/a
 
      08-28-2005
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
 
Reply With Quote
 
 
 
 
AD.
Guest
Posts: n/a
 
      08-28-2005
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

 
Reply With Quote
 
Shane
Guest
Posts: n/a
 
      08-28-2005
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.

 
Reply With Quote
 
Shane
Guest
Posts: n/a
 
      08-29-2005
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.

 
Reply With Quote
 
Lawrence D’Oliveiro
Guest
Posts: n/a
 
      09-09-2005
In article <(E-Mail Removed)-a-geek.net>,
Shane <(E-Mail Removed)-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.
 
Reply With Quote
 
Shane
Guest
Posts: n/a
 
      09-09-2005
On Fri, 09 Sep 2005 20:09:39 +1200, Lawrence D’Oliveiro wrote:

> In article <(E-Mail Removed)-a-geek.net>,
> Shane <(E-Mail Removed)-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.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: slow slow slow! Expert lino fitter Computer Support 5 12-12-2008 04:00 PM
Re: slow slow slow! General Patron Computer Support 0 12-11-2008 11:01 PM
Re: slow slow slow! chuckcar Computer Support 0 12-10-2008 11:25 PM
Re: slow slow slow! Beauregard T. Shagnasty Computer Support 2 12-10-2008 09:03 PM
Re: slow slow slow! Expert lino fitter Computer Support 0 12-10-2008 02:33 PM



Advertisments