开发者

Task Queue VS. URLFetch

I need to run a script (python) in App Engine for many times. One possibility is just to run a loop and use urlfetch with a link to the 开发者_开发技巧script. The other one is to open a task with the script URL.

What is the difference between both ways? It seems like Tasks have a quota (100,000 daily free tasks) so why should I use them?

Thanks,

Joel


Briefly:

  1. Bulk adding tasks to the queue will probably be easier, and possibly quicker, than using URLFetch. Although using async url-fetches might help with this.

  2. When a task fails, it will automatically retry. Assuming you check the status of your call, URLFetch might just hang for a while before you get some type of error.

  3. You can control the rate at which tasks are executed. So if you add 1,000 tasks fast you can let them slowly run at 10 / minute (or whatever you want), helping you not blow through your other quotas.

  4. If you enable billing, the free quota is 20,000,000 / tasks per day.

  5. Depending on what you are doing, tasks can be transactionally enqueued, which gives you some really powerful abilities.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜