App Engine memcache: shared vs dedicated

Also posted on GitHub.

Google App Engine has two memcache options: shared and dedicated. We’ve used shared for Bridgy, which is pretty stingy, averaging 1-3MB total cache space. Our oldest entry is usually just an hour or so old.

Dedicated would obviously be better, but it costs money: $.06/GB/hour ie $1.44/GB/day. Still, I tried it for a couple days to see what the difference would be.

Answer: not much. We definitely got more space, but it didn’t seem to noticeably change request latency, cache hit ratio, frontend instances, or anything else meaningful. Graphs below. I switched to dedicated at around -2.5d, and switched back at around -.75d.

A few interesting conclusions:

  • Right now, we actually like the fact that our memcache entries expire fairly quickly, at least for a couple things: discovered webmention endpoints and resolved URLs (ie followed redirects). With a dedicated 1GB of cache, those would probably last for months, so we’d need to start setting an expiration on them.
  • Hit ratio didn’t change much. That means our cache misses are mostly due to wholly new items, not to old items that got evicted.

It’s also interesting that almost a day after I switched back to shared memcache, our cache data wasn’t flushed, which implies we stayed in the dedicated area and just got capped at the current size at that point. Maybe there’s an infrequent cron job that moves apps back to shared.

Total cache size:

Memcache traffic:

Memcache hit ratio:

Request latency:

Frontend instances:

One thought on “App Engine memcache: shared vs dedicated

Leave a Reply

Your email address will not be published.