简体   繁体   中英

How to share cache between multiple Google App Engine instances which each have multiple vCPUs?

SITUATION:

I am trying to implement caching for rate-limited third-party API requests my website needs to make.

Apparently, basic solutions such as:

https://www.npmjs.com/package/node-cache

won't even share cache between CPUs, much less between instances ?

Is that correct ?

And if it is, how can I share cache between instances so that I have one unified cache for my website across instances ?

After googling for a while, it seems Redis would be a solution. But from what I gathered, I would have to host Redis on it's own dedicated instance for the cache to be unique across my website VM instances ?

What if the instance hosting Redis is overloaded and also needs to be auto-scaled to multiple instances ?


QUESTION:

How can I implement shared cache between VM instances of my website ?

You could add to your GAE application a 1st generation standard environment service which would:

  • act as a caching service for your node.js (or other 2nd generation standard environment or flexible environment) service(s) and, under the hood, use itself the GAE memcache service , only available in those 1st gen standard environments.
  • maybe even make itself those rate-limited 3rd party API calls, it will probably be simpler to properly coordinate the cached results that way
  • be configured for auto scaling to address the scalability concern

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM