Long running task in Cloud Run with CPU always allocated

Viewed 443

I know that since Oct-21 Cloud Run supports background jobs.

Anyone knows what happens with long-running background jobs in the following scenario?

  • CPU always allocated is set to true
  • min. number of instances is set to 1
  • there are multiple instances at the same time due to higher load and each of them is coincidentally running a background job

Are all of those background jobs guaranteed to finish OR just the one running on that "always on" instance?

Thanks!

1 Answers

Instances created above minimum instances are subject to termination.

Note 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 unless it is kept active using minimum instances.

Combining CPU always allocated with a number of minimum instances results in a number of container instances up and running with full access to CPU resources, enabling background processing use cases like pulling Pub/Sub messages.

https://cloud.google.com/run/docs/configuring/cpu-allocation

Related