1

I was using a friends code on an old 2003 server with Perl and made a Perl site that runs multiple SQLs reports. On the old server, once a section was ready, it would display. For instance, the top title of the page and the first SQL report would display while the lower reports continued to run. I was moved to a new server. On the new server, the site with the same code waits for all SQLs to finish before displaying any part of the page. So the user waits with a blank screen when they could already be seeing the title and top faster running reports.

Any ideas on how I can fix this? Is it old Perl code on a new server behavior? The CGI call? One of my USE items? My HTML header or Meta?

Here is the top section of the Perl code with some names made generic.

#!/usr/bin/perl
use LWP::UserAgent;
use HTTP::Request::Common qw(POST GET);
use CGI qw(:standard);
use DBI;
use URI;

$dbh  = DBI->connect(Generic DB connection string)
$dbh1  = DBI->connect(Generic DB connection string)
$dbh2  = DBI->connect(Generic DB connection string)

my $q = new CGI();
print $q->header;

print $q->start_html(-head=>meta({-http_equiv => 'X-UA-Compatible',
             -content=>'IE=edge'}),
             -style => {'src'=>'Styles/myCSS.css'},
             -script =>{'type'=>'text/javascript','src'=>'js/jquery-1.7.2.min.js'},
             -script =>{'type'=>'text/javascript','src'=>'js/tableCollapse.js'},
                     -title=>'MyPage');
my $thingA = $q->param('A');
my $thingB = $q->param('B');

Is there an issue in that code? Or perhapse is there some issue where I have a DIV that extends from the top to the very bottom of the site encapsulating all the SQL reports? Any ideas would be appreciated. Thanks!

brian d foy
  • 129,424
  • 31
  • 207
  • 592
Mark
  • 11
  • 1
  • Hello Mark, is the script served by the same web server (e.g. Apache) and its configuration in both cases? Also curious why you have three dbh's. Are you connecting to different databases? – Himanshu Jan 20 '23 at 06:01
  • In general it is not intended for HTTP to build the response in stages and expect the browser to show it in stages. Most browsers will be helpful anyway to show what they got so far if it is consistent enough in itself to be shown already. But for this the data must be actually delivered by the server which does its own buffering when delivering the response. And the script does its own buffering too. So it not only depends on the script but also the environment and configuration of the scripts environment and of the server - nothing is known about this. – Steffen Ullrich Jan 20 '23 at 07:20
  • Himanshu, the old server and new one are different. The old one was a 2003 and the new I hear is set up with 2016 software. And there is probably a different version of Perl on them too. I don't have access to the fundamental server set ups. Yes, I connect to multiple databases for this report. Do you think this sounds like server behavior or that I'm using old PERL code on a new PERL server? Thank you for your response. – Mark Jan 20 '23 at 15:47
  • Steffen U., I don't have the IT access to find out more about the Server set up. Do you think this is more of a server settings issue? Thanks for your involvement! – Mark Jan 20 '23 at 15:49
  • See also https://stackoverflow.com/q/17059078/2766176 – brian d foy Jan 20 '23 at 16:01

1 Answers1

0

While the client may receive the base HTML quickly, there are various things in the HTML that may cause the rendered to wait. For example, it may wait for the various javascript resources to load.

Start by using a client that can show you what is happening in real time. Things such as Safari's Web Inspector, Chrome's Dev Tools, and various extensions can show you the timeline of network and renderer activity.

There are various websites that will download your page and give you a report. Google's PageSpeed is one such tool, but there are many others.

Once you've figured out what is causing the delay, you can ask a more focused question.

brian d foy
  • 129,424
  • 31
  • 207
  • 592