开发者

Google App Engine: Is adding to the task queue faster than doing a datastore write?

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?

开发者_如何转开发

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


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.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜