appengine TaskQueue count

Go To StackoverFlow.com

1

Since there is no way to know the TaskQueue count programmatically according to AppEngine Taskqueue: is there a way to determine the queue depth? , I am thinking of using the cache to monitor the queue. Is it advisable or is it a cardinal sin? (I know that cache cannot be 100% reliable, 89% reliable-ness is fine for me)

2012-04-05 20:23
by Win Myo Htet
'the cache'? Do you mean memcache? Why do you need to know how many tasks are in the queue - Nick Johnson 2012-04-08 05:29
yeh, mem cache. I am polling some data depending on the availability time stamp and if the data is not yet available at the time, it will be soon. Thus, I have used the calculated task queue and attempt retry of the task queue instead of the regular cron job. I also want to reduce the CPU usage an unnecessary taskqueue, thus I want to monitor the task queue. I am all hear for the better solution or appengine idiomatic way of solving such problem - Win Myo Htet 2012-04-08 14:20
Sorry, I don't understand what part of that requires knowing how many tasks are in the queue. Can you clarify - Nick Johnson 2012-04-09 03:44
When the data is not ready at the stated time stamp, it creates a new task queue to retry within a minute. There are also other services waiting for that data and if they don't find the data at the stated time stamp, they want to make sure that the retried task queue is in place or if not will create a a new task queue. Sometime the data is not ready for what ever reason and it is way passed the time stamp (it is not in my control), then a bunch of task queues are created unnecessarily(wasting CPU time). I just need one task queue(like an intelligent cron job) to be there - Win Myo Htet 2012-04-09 04:05
It sounds like you should be using task names to prevent duplicate tasks being inserted, like this: http://blog.notdot.net/2010/05/App-Engine-Cookbook-On-demand-Cron-Job - Nick Johnson 2012-04-09 04:49
Thanks Nick. I am already using taskname. I will read your blog in the morning. It's 1:30am(EST) here - Win Myo Htet 2012-04-09 05:22


1

Its not a question of reliability, cache can be cleared at any time and then your left with zero. you need to store the count in the datastore.

Look into sharding counters for a tutorial on how to have good write throughput on the datastore.

2012-04-05 21:09
by Shay Erlichmen
I am using TaskQueue as some Thread like manner sleep and continue loop so writing to datastore is overkill for me, imho. I am fine with hypothetical 11% failure rate where the TaskQueue count is left with 0 - Win Myo Htet 2012-04-05 21:25
Ads