0

I'm using cloud run to run a node.js app with lru-cache and auto scaling. I have created a route to allow external services to reset the application's cache. I am now looking for a way to target every running container of the app and to curl the cache reset route.

Would you have any suggestions on how to target every running container (depending on how many were deployed through autoscaling) for a service through HTTP ? I'm wondering if there is a way to do this through specific headers or something.

J Dubuis
  • 101
  • 1
  • I don't quite understand your question. Cloud Run is a managed service and you have instances when you have traffic and 0 otherwise. Can you please explain in details what do you want to achieve? what documentation are you following? what steps did you follow to achieve the "route to allow external services to reset the application's cache." any code snippets or reproducible steps are very helpful also in solving this. – Methkal Khalawi Sep 03 '20 at 10:13
  • It's an application route powered by polka on Node.js. Basically if you hit the http endpoint it resets local cache (this is not linked to cloud run in any way it's simple business logic). I've used the cloud scheduler to keep the website online at all times. It simply fires an http request to avoid a cold start when an actual user tries to connect. So my situation is the following: I have one or more instances running my app. Each instance has a local memory cache. I was looking for a way to reset that local memory cache on every instance at the same time. – J Dubuis Sep 03 '20 at 12:15
  • It seems it is not possible to target specific instances through HTTP. I don't actually need this anymore since I moved to using redis to have a common cache solution between all containers but it does seem like something that might be useful. – J Dubuis Sep 03 '20 at 12:17
  • Hi @JDubuis , as I said Cloud Run is a managed service and the idea behind these kind of products is that you should not care about the underlying infrastructure as this is all abstracted and manged for you. now if this doesn't satisfy your use then you should opt for another solution and using Cloud memorystore for redis here with Cloud Run is really what you need – Methkal Khalawi Sep 04 '20 at 08:00

0 Answers0