Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #7462

Re: Output status during processing

From Jerry Stuckle <jstucklex@attglobal.net>
Newsgroups comp.lang.php
Subject Re: Output status during processing
Date 2012-11-04 20:21 -0500
Organization A noiseless patient Spider
Message-ID <k774bp$5s8$1@dont-email.me> (permalink)
References <k76fcg$8at$1@dont-email.me> <afo4vnFfjeU1@mid.uni-berlin.de> <k76o3p$dn$1@dont-email.me>

Show all headers | View raw


On 11/4/2012 4:52 PM, Scott Johnson wrote:
> On 11/4/2012 1:28 PM, M. Strobel wrote:
>> Am 04.11.2012 20:23, schrieb Scott Johnson:
>>> Hello
>>>
>>> I hate to come here with a question without any tried code but I
>>> really do not even
>>> know where to start, I have never attempted this before without a net.
>>>
>>> What I would like to do is provide an output to the browser during a
>>> long processing
>>> term.
>>>
>>> Exactly what I am doing is this.
>>>
>>> I am loading a csv file to update inventory.
>>>
>>> During this process I am flushing the current Table and then loading
>>> the new and then
>>> comparing the inventory table to a product table and would like to
>>> provide status of
>>> where we are in the process what items matched and changed and so
>>> forth in real time.
>>>
>>> I have done some similar tasks in JS but with minimal steps in the
>>> processing then
>>> what I am trying to accomplish.
>>>
>>> I did some binging and found that it may have to do with output
>>> buffering but nothing
>>> particular to my situation. (as far as I could find)
>>>
>>> If this is possible could someone point me in the right direction and
>>> I will do the
>>> leg work.
>>
>> Are you starting your long running job in the browser? Not good, the
>> whole setup is
>> designed for request-response, and not long running jobs.
>>
>> I would try to design the long running update-compare job as a
>> separate process,
>> writing status or progress information to a file/a db table. Then you
>> have a
>> corresponding script you call in your browser, showing you status and
>> progress. This
>> could be done with whole page refreshs or with ajax.
>>
>> /Str.
>>
>
> Ok that makes makes sense.
>
> And yes it was started in the browser on a file upload from a form field.
>
> I could use AJAX to load the file and then process it in the background
> sending status points as it goes through AJAX.
>
> I have done this is the past just not for so many steps to perform.
>
> The more I read about the PHP buffer functions, I could not find a way
> that would periodically send text without a header issue.
>
> Guess why they have different tools for the different needs.
>
> Thanks Str.
>
> Scotty
>
>

Nope, but it has nothing to do with php.  HTTP is a request/response 
protocol; the client sends a request and expects a response within the 
time specified by the browser's timeout value.

But then this causes a problem also, because PHP has a buffer (for 
efficiency), the server has a buffer (also for efficiency), routers 
along the way may have buffers (again, for efficiency), and the client's 
system may have a buffer (hmmm... efficiency?) and finally the browser 
may have a buffer.

The bottom line is - the HTTP protocol is pretty much useless for 
long-running tasks.  The time it takes to send data to the browser is 
dependent on a lot of things, and the browser's timeout values are 
independent of anything the server can control.

If you need such processing, I suggest you look into other methods of 
communications.  Java applets, for instance, can work with non-http 
protocols.

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Output status during processing Scott Johnson <noonehome@chalupasworld.com> - 2012-11-04 11:23 -0800
  Re: Output status during processing "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-11-04 22:28 +0100
    Re: Output status during processing Scott Johnson <noonehome@chalupasworld.com> - 2012-11-04 13:52 -0800
      Re: Output status during processing Jerry Stuckle <jstucklex@attglobal.net> - 2012-11-04 20:21 -0500
        Re: Output status during processing Scott Johnson <noonehome@chalupasworld.com> - 2012-11-04 19:10 -0800
          Re: Output status during processing crankypuss <noemail@noemail.invalid> - 2012-11-05 07:24 -0700
      Re: Output status during processing Denis McMahon <denismfmcmahon@gmail.com> - 2012-11-05 12:40 +0000
        Re: Output status during processing Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-11-05 17:32 +0100
  Re: Output status during processing Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-11-05 14:22 +0100
    Re: Output status during processing Scott Johnson <noonehome@chalupasworld.com> - 2012-11-05 11:59 -0800
      Re: Output status during processing Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-11-06 00:21 +0100

csiph-web