New CPU allocation controls allow you to run more workloads on Cloud Run
Google Cloud has added the ability to allocate CPU for Cloud Run container instances even outside of request processing, allowing you to run more workloads on the serverless container platform.
With this, you can now change your existing Cloud Run service to always have CPU allocated from the Google Cloud Console. When you opt in to "CPU always allocated", you are charged for the entire lifecycle of container instances, from when a container is started to when it is terminated.
In a blog post on Monday, Steren Giannini, Senior Product Manager, Google Cloud Platform, highlighted the following use cases that the new feature unlocks with Cloud Run:
- Executing background tasks and other asynchronous processing work after returning responses
- Leveraging monitoring agents like OpenTelemetry that may assume access to CPU in background threads
- Using Go's Goroutines or Node.js async, Java threads, and Kotlin coroutines
- Moving Spring Boot apps that use built-in scheduling/background functionality
- Listening for Firestore changes to keep an in-memory cache up to date
It is worth mentioning that even if CPU is always allocated, Cloud Run autoscaling is still in effect and may terminate container instances if they aren't needed to handle incoming traffic. An instance will never stay idle for more than 15 minutes after processing a request.
Google News