Home > Net >  Does startup time for Cloudrun docker image delays autoscaling?
Does startup time for Cloudrun docker image delays autoscaling?

Time:02-05

I am currently using express.js as the main backend. However, I have found that fastify is generally faster in performance.

But the downside of fastify is that it has a relatively slow startup time.

I am curious that would it slow down the autoscaling of Cloudrun?

I've seen that Cloudrun autoscales when the usage is over 60%.

In this case, I am thinking slow startup time can delay the response while autoscaling which can be a reason not to use fastify. How does this exactly work?

CodePudding user response:

A slow cold start doesn't influence the autoscaller. The service scale according to the CPU usage and the number of queries.

If you track the number of created instance with benchmarks, you can see that you can have suddenly 50 concurrent requests, 5 to 10 instances are created by the Cloud Run autoscaller. Why? Because if the traffic suddenly increase with a lot of concurrent request, it can means that slope can continue and you can have soon 100 or 200 concurrent request and Cloud Run service is prepared to absorb that traffic.

If you scale slowly to 50 concurrent requests, you can have only 1 or 2 instances set up.


Anyway, it's just a thing that I noted in my previous tests. In addition, keep in mind that, if you have a sustained traffic, the cold start is a marginal case. You will lost a few milliseconds "rarely", and it doesn't imply a framework change.

My recommendation is to keep what is the best and the most efficient for you (you cost at least 100 times more than the Cloud Run cost!!)

  •  Tags:  
  • Related