Middy
Middy

Reputation: 91

How to programmatically look up google app instances

I have implemented instance mem-caches because we have very static data and the memcache is not very reliable and rather slow compared to an instance cache.

However there is some situations where I would like to invalidate the instance caches. Is there any way to look them up?

Example Admin A updates a large gamesheet on instance A and that instance looks up all other instances and update the data using a simple REST api.

Upvotes: 1

Views: 170

Answers (1)

Adam Thomason
Adam Thomason

Reputation: 1003

TL;DR: you can't.

Unlike backends, frontend instances are not individually addressable; that is, there is no way for you to make a RESTy URLFetch call to a specific frontend instance. Even if they were, there is no builtin mechanism for enumerating frontend instances, so you would need to roll your own, e.g. keeping a list of live instances in the datastore and adding to it in a warmup request and removing on repeated connect failure. But at that point you've just implemented a slower, more costly, and less available memcache service.

If you moved all the cache services to backends (using your instance-local static, or, for instance, running a memcached written in Go as a different app version), it's true you would gain a degree of control (or at least transparency) regarding evictions. Availability, speed, and cost would still likely suffer.

Upvotes: 1

Related Questions