NYCPHP Meetup

NYPHP.org

[nycphp-talk] Output Buffering and Blank Page

Thomas O'Neill tommyo at gmail.com
Fri May 21 14:37:58 EDT 2004


Hey Everyone!

I have a problem that is about half solved and I am looking for some
input from the group.

The site I work for has a large member base (~1000 - 3000 members
online at any given time)

We have output buffering turned on to improve performance.  It seems
to work great but on scripts that have large queries the user will see
a blank white page until the script finishes. Sometimes this can be
annoying when the script takes more then a few seconds to execute.

In order to avoid this I have come up with a scheme that works very
well but I would really appreciate some criticism/tips to improve it.

The Scheme is comprised of three parts the loading script, the process
script and the display script.

Loading Script
-----------------------------
Displays a cute loading icon and forwards GETS/POSTS to an embedded image.
When the page/image finishes loading (javascript onload) the page is
forwarded on to the display script.

Process Script (embedded image in the Loading Script)
-----------------------------
The process Script will do all the work and create the output that
normally is shot out to the screen after waiting for the white/blank
screen to go away.  When the script is finished the output is stored
to a session variable and the buffer cleared.  Finally a one pixal png
will be output so the Loading Script will know its done.

Display Script
-----------------------------
The user will be directed here after the process script is done.  If
the output of the process script is in the session variable it is
displayed and the session variable is unset.  The user sees the
results.

So at this point this little hack is working great in my staging area.
How will this scale to all of our users?  Is it safe to put the html
(about 1k) into the sessions for that many people at the same time? Am
I going at this problem all wrong?

Thanks in advance everyone!

TOM O'NEILL



More information about the talk mailing list