New startup CPU boost improves cold starts in Cloud Run, Cloud Functions
Group Product Manager
We are announcing startup CPU boost for Cloud Run and Cloud Functions 2nd gen, a new feature allowing you to drastically reduce the cold start time of Cloud Run and Cloud Functions. With startup CPU boost, more CPU is dynamically allocated to your container during startup, allowing it to start serving requests faster. For some workloads we measured, startup time was cut in half.
Making cold starts a little warmer
A "cold start" is the latency encountered in the processing of a request that is due to the startup of a new container instance to serve that request. For example, when a Cloud Run service scales down to zero instances, and a new request reaches the service, an instance needs to be started in order to process this request. In addition to the zero-to-one scale event, cold starts often happen when services are configured to serve a single concurrent request, or during traffic scaling events. Minimum instances can be used to remove the cold-start encountered when going from zero to one instance, but min-instances aren't a solution for all cold-starts as traffic scales out to higher numbers of instances. As part of our continued efforts to give you more control over cold start latency, startup CPU boost can help speed up every cold start.
Java applications, in particular, appear to greatly benefit from the startup CPU boost feature. Internal testers and private preview customers reported the following startup time reductions for their Java applications:
up to 50% faster for the Spring PetClinic sample application
up to 47% faster for a Native Spring w/GraalVM service
up to 23% faster for a plain Java Cloud Functions
Customers testing the feature in private preview with Node.js have observed startup time reductions of up to 30%, a significant improvement, a bit less than Java due to the single-threaded nature of Node.js. Each language, framework, and code base will see different levels of benefit.
You can enable startup CPU boost for your existing Cloud Run service with one command:
Even better, Cloud Functions uses startup CPU boost by default. To learn more, check out the documentation.