Cloud Run Don't Wait For Scale Up

761 Views Asked by At

I have a web application. The cold start time of the backend service is about 10 second which is very high. I was not able to reduce the cold start time. As a second solution, I am wondering if can requests that makes cloud run service scale up handled by already running instances. After the new scaled containers ready, new requests will be handled by scaled up containers. Does Google Cloud support that?

2

There are 2 best solutions below

4
guillaume blaquiere On

You have a brand new feature for that. It's Health Probe you can put on your service to detect when the instance is ready to serve traffic, or unhealthy and no new request will be routed to it.

Have a try on it, it should solve your issue!

2
cvu On

As a second solution, I am wondering if can requests that makes cloud run service scale up handled by already running instances.

I think what you really want is min-instances. This means you always will have an instance that is ready to serve requests.

Otherwise, I don't think there is any solution that would solve the problem that you have. If new requests come in, you are going to need to scale up either way, and there is nothing around the 10 second cold start. So implement min-instances with a base-line that is appropriate for your traffic.