memcache vs task queue

70 views
Skip to first unread message

Lawrence Mok

unread,
Dec 27, 2012, 3:22:09 AM12/27/12
to google-a...@googlegroups.com
I am wondering if I'm doing right. Could someone give me some comment on this:

I have an application which need to write to memcache for all of the generated response. However I am guessing the act of "writing to memcache" would still spend time e.g. 50ms before it's done then the app engine send the completed http response back to client. 

What I do now is to call the task queue API to separate this "write to memcache" as an external task. Would this help speeding up the use-facing response time? Or actually writing to task queue is still slower than writing to memcache and is it still a blocking function?

By the way, I'm using the "Go" language and the "Delay" package as described in https://developers.google.com/appengine/docs/go/taskqueue/delay


Randy Shoup

unread,
Dec 27, 2012, 2:42:21 PM12/27/12
to google-a...@googlegroups.com
In general, writing to memcache directly will be an order of magnitude faster than queueing up a task with that data.  The task queue will persist your data in multiple disks and across multiple data centers for reliability, while memcache will only write to memory in the local data center.

Both APIs support mechanisms to write asynchronously without blocking.

Lawrence Mok

unread,
Dec 27, 2012, 8:05:28 PM12/27/12
to google-a...@googlegroups.com
Thanks Randy! Then I'll use memcache straight ahead.

vlad

unread,
Dec 28, 2012, 6:25:21 PM12/28/12
to google-a...@googlegroups.com
Note that trying to run memcache or Datastore access asynchronously is pointless unless you have some other activity to do in the interim. Your request handler will NOT finish until all async calls have completed.
Reply all
Reply to author
Forward
0 new messages