FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Output status during processing
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Output status during processing [message #179532 is a reply to message #179531] Mon, 05 November 2012 03:10 Go to previous messageGo to previous message
Scott Johnson is currently offline  Scott Johnson
Messages: 196
Registered: January 2012
Karma:
Senior Member
On 11/4/2012 5:21 PM, Jerry Stuckle wrote:
> 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.
>

Yeah I can see there can be a bottle-neck/lag issue anywhere which would
be useless for anything real time (which I use loosely).

Thanks for the input.

Scotty
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: adding a method to a built-in class ?
Next Topic: Help required with UPDATE columns
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Fri Dec 20 18:37:22 GMT 2024

Total time taken to generate the page: 0.05926 seconds