Google, please offer a true serverless in-memory cache

05 Nov 2019

I have been a loyal and happy Google App Engine (GAE) user for a very long time.

1st Gen GAE

I really loved the 1st generation GAE, it offered all the services you needed in a true serverless fashion. Background tasks, cron jobs, a database (Datastore), and memory caching (memcache).

The only issue was vendor lock-in, but considering all the benefits I could live with that drawback.

2nd Gen GAE

Then came the 2nd generation GAE with a mission to free us all from the vendor lock-in "problem".

Migrating from the 1st generation GAE to the 2nd generation requires you to use a bit different set of tools and libraries in your web app.

For example, you'd have to use the new ndb library for communicating with Datastore. It requires some code changes, but nothing terrible.

Or, for example, you'd have to use the new Cloud Tasks library instead of the old GAE tasks. Here's how the code looked before/after:

# 1st gen GAE Python 2 background tasks
from google.appengine.api import taskqueue


# 2nd gen GAE Python 3 Cloud Tasks library
from import tasks_v2

client = tasks_v2.CloudTasksClient()
parent = client.queue_path(project_id, region_name, queue_name)

task = {
    'app_engine_http_request': {
        'http_method': 'POST',
        'relative_uri': "/tasks/send-email",
        'body': json.dumps(task_params).encode(),

client.create_task(parent, task)

A bit more code is required in the 2nd Gen GAE apps compared to 1st Gen, but nothing terrible.

All of these tools (datastore, tasks, cron jobs) are available for the 2nd gen GAE in the same serverless (and pay-as-you-go) manner as they were for the 1st gen GAE.

Except for one: in-memory cache.

Memorystore is not serverless

The 1st gen GAE has a very convenient in-memory caching implementation called memcache (based on Memcached).

In 2nd gen GAE, you cannot use memcache anymore, but there's another option that Google now offers: Memorystore.

Memorystore is a managed Redis service, which would be great except for the fact that it is NOT SERVERLESS.

Memorystore requires you to spin up a Redis server instance (in a similar way that you would start a Compute Engine instance), run it 24/7 and pay for it on a per-hour basis.

This is not serverless and it's not a pay-as-you-go model in a way that, for example, Cloud Tasks, Firestore/Datastore, and Cloud Scheduler offer (where you pay per operation).

Using memcache on the 1st gen GAE was very easy:

from google.appengine.api import memcache

memcache.add(key="some-key", value="some value")
value = memcache.get(key="some-key")

On the other hand, if you want to set up Memorystore, you have to spin up a Redis server instance and then configure a VPC Access Connector to connect your GAE app with the Redis server instance. For anyone that wants to have a serverless web app setup, this is an overkill.

Google, please create a true serverless in-memory cache service

Caching is the only missing piece to complete your serverless offer, Google.

Instead of having us to spin up a fully-fledged Redis instance that runs 24/7, you should offer a simple serverless pay-as-you-go Memcached service.

If you do this, I can forgive that you don't offer an in-built Google authentication on GAE anymore:

from google.appengine.api import users

user = users.get_current_user()

I can forget that you ever had a GAE SDK with a nice GUI tool (GAE Launcher).

And I can forgive that you require me to install Python 2 and Java JDK even if the only thing I want to do is to run my Python 3 GAE app locally (Cloud SDK requires Python 2 and Firestore/Datastore Emulator requires Java JDK).

Please, Google, bring the (serverless) caching back. ;)

Please share this article via your social media channels:

Comments (5)

Adding new comments has been disabled.

Please ask questions or give other feedback via Reddit: r/AppEngine. You can also tag our official account by mentioning it in the comment/topic: u/GAEdevs.

Frank DERVILLE - Memorystore is not compulsory. But when your project grows, you'll eventually need a caching service.

- Matt on 01 Jun 2020

Is Memorystore compulsory for all projects? or only those who use memcache explicitly in their code?

- Frank DERVILLE on 03 May 2020

Totally agree. This is such a PITA. Reads from memcache used to be free and NDB used the cache to fetch instances by key. This made a significant amount of entity reads never hit the Datastore. This all worked completely transparently.

- Ivan on 12 Dec 2019

Absolutely agree 100%! Loved GAE until nemcache was dropped!. :(

- Simon on 08 Nov 2019

Totally agree with this! Please please do it Google!

- Andrew B on 07 Nov 2019