简体   繁体   中英

Always CPU with 0 minimum instances

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?

云运行配置

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 .

  • If no requests come to the service, the autoscaler removes the last container instance. There are now zero container instances, and there is no CPU allocated (since there are no instances).
  • If there are incoming requests, one or more container instances are active. They'll have CPU allocated during the entire container lifecycle.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM