5

Will test results with 1000 users be similar to those I get with 10,000 users? Will a 10x increase in memcache usage change the results I get, if I also have 10x the instances running?

I've been using memcache for a lot of things, and it's been working great. Now, I want to put MORE in it, caching the results of several key queries. The queries are different for each user, and I have a thousand users a week right now.

I'm wary of this strategy. I could spend a while implementing this, and find that for my thousand users it works great. But, say my site grows in popularity, and suddenly I have 10,000 users. Will I see a decrease in memcache performance?

I'm worried about a very drastic decrease. I could imagine that there is some invisible limit, like 1GB of memcache data I'm allowed to use. Suddenly, with a 10x increase in usage, I could be way past that limit and see a large amount of thrashing or something.

This seems very hard for a customer to test - I'd love a comment from an App Engine insider.

Thanks for any insight!

Riley Lark
  • 20,660
  • 15
  • 80
  • 128
  • Similar question is here: http://stackoverflow.com/questions/2175586/how-much-memory-of-memcache-is-available-to-a-google-app-engine-account The answer is a little vague, but the general idea is that the amount of memcache capacity scales. – Moishe Lettvin Mar 08 '12 at 19:36
  • Ah, thanks for pointing me there. I guess I'll take it! ;) – Riley Lark Mar 08 '12 at 21:13

3 Answers3

2

The internals of Memcache implementation on GAE are only known to Google, so asking such questions on a general public site is unlikelly to get you definite answers.

But let me speculate: if you take a look at the new Python NDB API you'll see that by default ALL datasore gets are cached (partially) in memcache. So if Google is doing it by default on a large scale, then I guess they made sure memcache is scalable.

EDIT:

Additionally, GAE sessions also use Memcache to cache session data by default, meaning all apps that use sessions (= most Web apps) also use Memcache on large scale.

Peter Knego
  • 79,991
  • 11
  • 123
  • 154
0

You could always fake a memcache by writing serialised data to the blobstore...

David
  • 1
0

App Engine memcache will scale as much as you want as long as you don't have hot keys.

As you scale up, you will need to move from shared memcache to dedicated memcache, which you buy in units of 1GB for your exclusive use.

In addition to getting the right amount of memory, you will also need to make sure you have enough memcache to handle the load. As described in the App Engine memcache docs, each GB of memcache can support about 10k key-operations/second, if the item are about 1 kB in size.

The one thing that can really limit your scaling is hot keys. The 10k keyops/s per GB only applies if you have an even distribution of keys. If you have a small number of keys with a disproportional amount of the traffic, then they can exceed the capacity of part of the backend system. The memcache viewer section in the Admin Console will display your top keys to help you diagnose hot keys.

Eamonn O'Brien-Strain
  • 3,352
  • 1
  • 23
  • 33