Your use case is perfect for the task queue. We use a similar model: get a request then fire off a task to log some stuff to the database and jam a value in memcache if required. This way control is returned back to the user as quickly as possible.
On 24 January 2012 08:07, Brandon Wirtz <[email protected]> wrote: > Sigh... > > Now I have to go do a re-write... Save MORE money on my GAE bill. Maybe > Google should pay you and me not to post to the forums. :-) > > > -----Original Message----- > From: [email protected] > [mailto:[email protected]] On Behalf Of Jeff Schnitzer > Sent: Monday, January 23, 2012 12:53 PM > To: [email protected] > Subject: Re: [google-appengine] 'Flush' Like "I'm tapping out but keep > working" in Python? > > Task Queues execute on frontend instances just like normal requests. > They will only spin up a 2nd instance if the additional task traffic crosses > the normal latency/idle threshold. > > Tasks are processed just like normal requests; they share the same memcache, > instance memory, etc as your normal application. > > Tasks are, however, separate requests so if you have some thread local data > it won't be available in the later task execution thread. Also sometimes > the task queues get backed up so it's hard to absolutely predict when a task > will be run. Usually it's pretty instantaneous though. > > One thing that makes tasks easier is the Deferred feature, available in both > Python and Java. > > The task queue rocks. I lean on it pretty heavily. Also, you can enlist > some number of tasks (5, I think) transactionally, which creates a good way > to work around 2pc issues. > > Jeff > > On Mon, Jan 23, 2012 at 2:58 PM, Brandon Wirtz <[email protected]> wrote: >> Apparently nothing. But having only been doing python for a year, I >> was trying to do it the PHP way. >> >> Now that I know... This looks great, and it appears that what I should >> have done with ASync writes should have been done with task queues. >> >> Do Task Queues Execute on the Front end instances? Or will adding >> tasks spin up a second instance? >> >> I'm currently serving 30k visitors a day per instance, and I don't >> know if tasks would take some users from 1 instance to 2 instances. >> >> -Brandon >> >> >> -----Original Message----- >> From: [email protected] >> [mailto:[email protected]] On Behalf Of Jeff Schnitzer >> Sent: Monday, January 23, 2012 11:15 AM >> To: [email protected] >> Subject: Re: [google-appengine] 'Flush' Like "I'm tapping out but keep >> working" in Python? >> >> On Mon, Jan 23, 2012 at 1:49 PM, Brandon Wirtz <[email protected]> > wrote: >>> >>> But can I say "Your process will be completed shortly" close the >>> output, and then Log some stuff, make some updates to the data store, >>> but let the user get on with life? >> >> How would this be different than shunting any remaining work off to >> the task queue? >> >> Jeff >> >> -- >> You received this message because you are subscribed to the Google >> Groups "Google App Engine" group. >> To post to this group, send email to [email protected]. >> To unsubscribe from this group, send email to >> [email protected]. >> For more options, visit this group at >> http://groups.google.com/group/google-appengine?hl=en. >> >> >> >> -- >> You received this message because you are subscribed to the Google Groups > "Google App Engine" group. >> To post to this group, send email to [email protected]. >> To unsubscribe from this group, send email to > [email protected]. >> For more options, visit this group at > http://groups.google.com/group/google-appengine?hl=en. >> > > -- > You received this message because you are subscribed to the Google Groups > "Google App Engine" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/google-appengine?hl=en. > > > > -- > You received this message because you are subscribed to the Google Groups > "Google App Engine" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/google-appengine?hl=en. > -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.
