Re: Q: How to improve CGI performance for this?



"avtanski@xxxxxxxxx" <avtanski@xxxxxxxxx> said:
I'm not sure that this is the right group for this question - Googling
for similar questions gave me always "comp.lang.perl.misc", but if this
is OT here, please, let me know.

The problem I'm having is with a CGI script that needs to load and
parse some data from a quite large file, then do some extra processing
based on user form input and return. The slow part is (I guess)
loading and parsing the data from the file.

Glad to see you've been able to improve the situation already.

2) Switching to PHP - this means rewriting everything, what a mess...

Even though people are sceptical on this, it might be one idea.
Not for the language, but for the execution mode. More below.

3) Using something like FastCGI, providing that the hosting provider
have it. Do you think this can help? I don't know much about FastCGI,
can I somehow preload the data in memory and just use it from the
script?

4) Using mod_perl? Don't know much about it too. Can I parse the data
from the file once, have it stored in memory and each time my script is
invoked access it? How much cooperation is required from my provider
for this?

mod_perl and FastCGI require co-operation from your provider. Both
will provide the same effect as switching to PHP most probably would.

The issue is, with perl run as CGI, every time someone accesses your
script, it will be loaded, parsed and compiled. And run.

PHP is much more commonly run as a module, and herein lies the difference.
The page using PHP will be loaded, parsed and compiled once (per server
worker process), which is a huge difference. Every subsequent request
through the same worker process will have a ready-to-run version of
the page. FastCGI will provide the same, as will mod_perl.
--
Wolf a.k.a. Juha Laiho Espoo, Finland
(GC 3.0) GIT d- s+: a C++ ULSH++++$ P++@ L+++ E- W+$@ N++ !K w !O !M V
PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++
"...cancel my subscription to the resurrection!" (Jim Morrison)
.



Relevant Pages

  • Re: FastCGI and DB connections / global variables?
    ... Jerry Stuckle wrote: ... has already been developed running Win2K and PHP 4, ... switch over to FastCGI. ... add the following to the end of each script ...
    (comp.lang.php)
  • Making a .php page a .cgi page
    ... I have somebody or some people who are abusing a Perl based .cgi script. ... I have written a PHP page which reports this abuse as per $_SERVER. ...
    (comp.lang.php)
  • python and php prblem with apache
    ... when i try to execute cgi script in browser. ... When I check the apache log error ... The other is with php script. ...
    (alt.os.linux.suse)
  • Re: ssi and Perl/CGI
    ... How do I go about passing variables to the script via include virtual ... I'll give cmd a whirl, though cgi seems to work great if all my page ... content is coming from the CGI script. ...
    (perl.beginners)
  • Re: CGI Question
    ... leftframe.cgi, not javascript. ... > a CGI script (and it's initially called with NO ... > and the right frame contains an HTML file. ...
    (perl.beginners)