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.

CPU boost graphic.jpg

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.

Results

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:

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.

Get started

You can enable startup CPU boost for your existing Cloud Run service with one command:

code_block
[StructValue([(u’code’, u’$ gcloud beta run services update SERVICE –cpu-boost’), (u’language’, u”), (u’caption’, <wagtail.wagtailcore.rich_text.RichText object at 0x3e7b07db2810>)])]
startup cpu boost.jpg

Even better, Cloud Functions uses startup CPU boost by default. To learn more, check out the documentation.

Related Article

Cloud Run min instances: Minimize your serverless cold starts

With Cloud Run’s new min instances feature, you can ensure your application never scales entirely to zero if you don’t want it to.

Read Article