Reputation: 631
In Cloud Run if I choose Zero as Minimum instances and also chose 'CPU is always allocated'
Then my question is If CPU will be allocated to "no instance", or with "CPU always allocated", at least one instance needs to be selected ?
I am not asking this question in regards to Billing/pricing.
I simply want to understand when there is no instance( as minimum is zero), then what happens to the 'CPU is always allocated"
or When "CPU is always allocated", how can minimum instance be zero ?
Upvotes: 1
Views: 1426
Reputation: 2764
CPU allocation is about individual container instances, and autoscaling about all instances in a Cloud Run service.
The autoscaler determines the number of container instances. Requests to a Cloud Run service are served by container instances. The autoscaler adds or removes instances to make sure all requests are served. If you've set minimum number of instances to zero, and no requests come to your service for a while, the autoscaler will also remove the last remaining container instance (and start a new one on-demand if requests come in later).
CPU allocation mode is about individual container instances. The CPU allocation mode always allocated is a setting that tells Cloud Run to never throttle the CPU of an individual container instance. The default behavior is to de-allocate the CPU of the container instance if that instance is not processing requests.
What happens when minimum instances is set to zero and CPU is set to be always allocated.
Upvotes: 6
Reputation: 453
Based on the following doc https://cloud.google.com/run/docs/about-instance-autoscaling#idle-instance CPU allocation and pricing only changes how you are billed for Cloud Run usage it does not affect whether your container scales down to 0 or not. I hope this makes sense.
Upvotes: 0