Google App Engine:比添加数据存储更快地添加到任务队列? [英] Google App Engine: Is adding to the task queue faster than doing a datastore write?

查看:99
本文介绍了Google App Engine:比添加数据存储更快地添加到任务队列?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图通过向任务队列添加后台任务来优化我的应用程序的某些用户部分,而不是立即执行操作。对于CPU密集型任务来说,这是明显的选择,但是如何保存数据呢?

I'm trying to optimize some of the user facing parts of my app by adding background tasks to the task queue rather than performing the operations right away. For CPU intensive tasks it's an obvious choice to do it this way, but what about for simply saving data?

执行taskqueue.add()操作或db.put()操作,还是差不多?

Is it faster on average to perform a taskqueue.add() operation or a db.put() operation, or is it about the same?

推荐答案

是的,勉强。不过,任务队列有效载荷被限制为10kb,并且性能差异足够小,因此您不应仅使用任务队列任务来存储数据存储区记录。如果您担心数据存储延迟,请查看 async API 或Guido的 NDB项目,以便您可以在等待的同时继续做其他工作为了完成。

Yes, marginally. Task queue payloads are limited to 10kb, though, and the performance difference is small enough you shouldn't use a task queue task just to store a datastore record. If you're concerned about datastore latency, look into the async API or Guido's NDB project so you can continue to do other work while you wait for the put to finish.

这篇关于Google App Engine:比添加数据存储更快地添加到任务队列?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆