logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Coding & Scripting Corner View previous topic :: View next topic
Reply to topic   Topic: incremental page rendering not working
Author
Bob3Rocks



Joined: 03 Nov 2016
Posts: 2
Location: USA, Santa Rosa

PostPosted: Thu 03 Nov '16 20:19    Post subject: incremental page rendering not working Reply with quote

I have created a number of CGI tools which print output from a Perl script to a web page. Sometimes the output from a script can be very slow to complete, and in these cases it is nice to see the output which has completed in real time. That way the end user is not waiting several minutes for a response from the server. I think this is called "incremental page rendering" on the web browser side.

This has worked great on many servers where I have installed scripts; most recently, Fedora 20 (more specifically, NST-20) --

root@NST_20:~# httpd -V
Server version: Apache/2.4.10 (Fedora)
Server built: Dec 17 2014 10:28:55
Server's Module Magic Number: 20120211:36
Server loaded: APR 1.5.1, APR-UTIL 1.5.3
Compiled using: APR 1.5.1, APR-UTIL 1.5.3
Architecture: 32-bit
Server MPM: prefork
threaded: no
forked: yes (variable process count)
Server compiled with....
-D APR_HAS_SENDFILE
-D APR_HAS_MMAP
-D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
-D APR_USE_SYSVSEM_SERIALIZE
-D APR_USE_PTHREAD_SERIALIZE
-D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
-D APR_HAS_OTHER_CHILD
-D AP_HAVE_RELIABLE_PIPED_LOGS
-D DYNAMIC_MODULE_LIMIT=256
-D HTTPD_ROOT="/etc/httpd"
-D SUEXEC_BIN="/usr/sbin/suexec"
-D DEFAULT_PIDLOG="/run/httpd/httpd.pid"
-D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
-D DEFAULT_ERRORLOG="logs/error_log"
-D AP_TYPES_CONFIG_FILE="conf/mime.types"
-D SERVER_CONFIG_FILE="conf/httpd.conf"

On a new server, Fedora 24 (NST-24), the incremental page rendering does not work --

root@NST24:~# httpd -V
Server version: Apache/2.4.23 (Fedora)
Server built: Jul 18 2016 15:38:14
Server's Module Magic Number: 20120211:61
Server loaded: APR 1.5.2, APR-UTIL 1.5.4
Compiled using: APR 1.5.2, APR-UTIL 1.5.4
Architecture: 64-bit
Server MPM: prefork
threaded: no
forked: yes (variable process count)
Server compiled with....
-D APR_HAS_SENDFILE
-D APR_HAS_MMAP
-D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
-D APR_USE_SYSVSEM_SERIALIZE
-D APR_USE_PTHREAD_SERIALIZE
-D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
-D APR_HAS_OTHER_CHILD
-D AP_HAVE_RELIABLE_PIPED_LOGS
-D DYNAMIC_MODULE_LIMIT=256
-D HTTPD_ROOT="/etc/httpd"
-D SUEXEC_BIN="/usr/sbin/suexec"
-D DEFAULT_PIDLOG="/run/httpd/httpd.pid"
-D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
-D DEFAULT_ERRORLOG="logs/error_log"
-D AP_TYPES_CONFIG_FILE="conf/mime.types"
-D SERVER_CONFIG_FILE="conf/httpd.conf"


I am sure there is a simple answer to this question, and I am still scratching my head trying to find it after much trial and error & Google searching.

Any insight would be appreciated.
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7360
Location: Germany, Next to Hamburg

PostPosted: Sat 12 Nov '16 22:55    Post subject: Reply with quote

With other languages it is possible to use a flush() function to print a current output. I don't know if such a thing exists in perl.
Back to top
Bob3Rocks



Joined: 03 Nov 2016
Posts: 2
Location: USA, Santa Rosa

PostPosted: Thu 17 Nov '16 18:18    Post subject: Reply with quote

Thanks for the reply James Bond. I will look into that, although I've never used a function like that before to update the page. I think this must have to do with a security setting.
Back to top
glsmith
Moderator


Joined: 16 Oct 2007
Posts: 2268
Location: Sun Diego, USA

PostPosted: Thu 17 Nov '16 18:46    Post subject: Reply with quote

Isn't this called "Server Push," at least that's what I thought it was but in perl server push doesn't work on all browsers. Not with my test years ago.
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7360
Location: Germany, Next to Hamburg

PostPosted: Sat 19 Nov '16 10:01    Post subject: Reply with quote

Googling a bit I found for perl autoflush from IO::

I'm not sure if that does the same as http://php.net/manual/en/function.flush.php

A different strategie could be running a few smaller script and get the content with ajax requests to the front end.
Back to top


Reply to topic   Topic: incremental page rendering not working View previous topic :: View next topic
Post new topic   Forum Index -> Coding & Scripting Corner