Memcache behaves differently on EU server than on US server

55 views
Skip to first unread message

Hooman Korasani

unread,
Apr 8, 2016, 2:03:24 PM4/8/16
to Google App Engine
As strange as this may sound, I have the exact same code published on a US-EAST server and on a EU server.
Both server have billing enabled.

Th expiration is set to 7200 seconds.

memcache.set(memcache_key, result_dic, 7200)

And I have cron jobs enabled to rerun the line of code above to refresh the cache for the unique key.

- description: Cache 0:20 hour
url : /worker/topnews-cache-update
schedule: every day 0:20

- description: Cache 2:20 hour
url : /worker/topnews-cache-update
schedule: every day 2:20

This works perfectly fine for the US-EAST server.
Memcache dashboard shows 2,064 items in cache.

Memcache dashboard on the EU server however looses the objects very fast.  In a short amount of time the objects disappear back to zero, despite the fact that the cron jobs keep running successfully.

It is the same code deployed on the two servers, why is memcache acting like this?

Thanks,
Houman

Barry Hunter

unread,
Apr 8, 2016, 2:24:49 PM4/8/16
to google-appengine
Is this with Shared Memcache, or you using Dedicated Memcache? 



Remember if using Shared, you are at the 'mercy' of what the neighbouring applications are doing. If other apps are using memcache heavily, your keys may be evicted sooner. 


You perhaps lucky in the US datacenter, but have a 'noisy' neighbour on the EU system. 



--
You received this message because you are subscribed to the Google Groups "Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-appengi...@googlegroups.com.
To post to this group, send email to google-a...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-appengine.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-appengine/61f22415-2594-4594-bb71-70e692624223%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Houman Khorasani

unread,
Apr 8, 2016, 3:36:43 PM4/8/16
to google-a...@googlegroups.com
Yes it is a shared memcache. Interesting I didn't think about that.  A shame the jump to dedicated is so expensive. The whole point of memcache is using it instead of datastore for performance reasons. 

But $0.06 per GB per hour can easily add up to $1 a day.  

Thanks

Houman Khorasani
Venus Cloud Ltd
Mobile: 07787 454 077
http://www.venuscloud.com

--
You received this message because you are subscribed to a topic in the Google Groups "Google App Engine" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-appengine/WwALN5Bll-E/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-appengi...@googlegroups.com.

To post to this group, send email to google-a...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-appengine.

Barry Hunter

unread,
Apr 8, 2016, 7:51:21 PM4/8/16
to google-appengine
The whole point of memcache is using it instead of datastore for performance reasons. 


Well yes, kinda. 

But an important point its its 'best effort'. Even with 'dedicated memcache' you can't rely on data staying there. 

Your cache may be lost at any point (say your app moves between datacenters) or even if Google simply moves memcached to a new server. Its a normal part of operation that data is evicted/lost

... use it when you can, but your app should cope just fine if its data is not in memcache (albeit a bit slower) 


(ie filling it via cron is not a good way to use it) 


Store your data in the datastore, just cache it memcache as well. App works if memcache is available or not. Most of the time memcache will be available, so you won't pay for datastore reads. 
 
Reply all
Reply to author
Forward
0 new messages