Reputation: 85
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?
Upvotes: 3
Views: 568
Reputation: 101139
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.
Upvotes: 2