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

Hi


Summary:
If I access the script in question (on a webserver) from my machine, it returns results in 0.5 seconds. For everyone else, it takes 30 seconds.

Script setup:
I have a script that is called directly with no arguments (eg http://domain.com/cgi-bin/script.pl) and returns HTML generated from a template file and database file located on the same server as the script. It is hosted on a Windows2000 server (not my choice) running ActivePerl. The ISP it is hosted on is different to my IPP.

Problem:
If I call http://domain.com/cgi-bin/script.pl I get the HTML returned in 0.5 seconds (even if I shift-refresh). Everyone else seemingly waits 30 seconds for the generated HTML to be displayed.

Attempted Troubleshooting:
I tried adding a coded 'stopwatch' to the script. It is started on the first line of the script and is stopped right before the output - the output of the stopwatch is then printed rather than the final two lines of the script, which are:
print $html_output;
exit;

Troubleshooting Results:
If I do this, everyone can read the stopwatch output in 0.5 secs of acessing the script (they get a total 'script running' time of under a second).

I have been coding perl for 3-4 years, albeit not as a professional, and this completely baffles me. If anyone is willing to help, I would be willing to email them a copy of the script if necessary. I am loathe to post the code here in full for fear of a horde of comments criticising my code without addressing the problem.

Thank you

Daniel Adams

Replies are listed 'Best First'.
Re: Huge variance in script run time
by eric256 (Parson) on Dec 10, 2003 at 00:51 UTC

    Its control-F5 in IE to force the refresh. I've noticed thought that IE does seem to cheat sometimes with forms and forcing the refresh. Clearing the temp files always seems to work though.

    In your trouble shooting you don't mention if they still take 30 seconds to view the page or is it that with the print they get the output sooner? I'm not clear on that.


    ___________
    Eric Hodges
      Thank you for your response. To address your points:

      - control-F5 makes the page still load in 0.5secs for me, same as refresh. it shows fresh data if added to the database file too, I'm am not viewing a cached copy to the best of my knowedge, and why would my machine cahce the results and non-one elses?

      - if I replace the printing of the HTML output with the printing instead of the stopwatch results, the results display instantaneously on any machine.

      This is all AFAIK - as I say, it works fine on mine so I am relying on what others tell me - I consistently here they experience a 30second delay for the HTML to generate on their screen. If you (or anyone else) wants to email me, I will provide the URL and/or code on an individual basis if you want to check it.

      Thanks for the help so far - Dan
Re: Huge variance in script run time
by Roger (Parson) on Dec 10, 2003 at 04:41 UTC
    Could it be a proxy (server) problem with your network?

Re: Huge variance in script run time
by waswas-fng (Curate) on Dec 10, 2003 at 05:20 UTC
    could it be some funky reverse dns resolve blocking issue on the webserver?


    -Waswas
      Thank you all for your help. Someone has pointed out the problem to me now - as suspected, the code itself is fine, but the server was having a tizzy-fit over been asked to display some CSS from within the HTML. QUite why this meant a 30secon delay is unclear but I've removed the CSS now.

      Thanks all

      Dan