RE: continue working after finishing up with the http client

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



hi tom...

if i understand your state diagram/workflow process. your server repsonds to
the client request, with two actions...

 action 1) return data to client relatively fast
 action 2) insert the data into your cache (or whereever) which takes
time...

is this correct?

do you have to somehow use the 'new'/updated cache data in the future
actions with the client...

it might be possible for you to have a setup, where you have an external
cron process, or other continually running process that does the cache
insertions....



-----Original Message-----
From: Tom Worster [mailto:fsb@xxxxxxxxxx]
Sent: Wednesday, May 27, 2009 7:14 AM
To: bruce; php-general@xxxxxxxxxxxxx
Subject: Re:  continue working after finishing up with the http
client


On 5/27/09 9:50 AM, "bruce" <bedouglas@xxxxxxxxxxxxx> wrote:

> exacly what are you trying to accomplish? is this in a web app? has the
user
> hit the site, logged in, etc?
>
> can you provide an example of what the sequence of events are that you're
> trying to deal with..

it is a web app.

let's say for example that we're processing an ajax query. say we can
normally generate and deliver the response to the client quickly but the
speed depends on a cache with a relatively low miss rate.

now, when we get a cache miss, imagine that generating the client response
from scratch takes significantly less time than generating and inserting the
new cache entry corresponding to the query. so we want to send the response
to the client and then process the cache entry.

without getting into whether or not this cache design makes sense, my
question in this example is: what options are there for ending the http
transition and then continuing on to do the cache update work?


> -----Original Message-----
> From: Tom Worster [mailto:fsb@xxxxxxxxxx]
> Sent: Wednesday, May 27, 2009 6:27 AM
> To: php-general@xxxxxxxxxxxxx
> Subject:  continue working after finishing up with the http client
>
>
> what options are there to do the following:
>
> 1. receive request from client (including post data)
>
> 2. do some work, update the db, prepare output for client
>
> 3. send output and finish up with the client
>
> 4. do some more work that might take considerable time, updating the db
some
> more
>
> it would be convenient and efficient if step 4 took place within the same
> process as steps 1-3. but output control seems not to be sufficient:
> ob_flush(); flush(); sends the output but leave the client waiting for
more.
> is there a way to close the connection as though exit; were called but
> without quitting the script?
>
> alternatively the script could start another process, copy over whatever
> data is needed and disconnect from it. but that has its overheads on the
> server.
>
> are the other possibilities?



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux