简体   繁体   English

始终具有 0 个最小实例的 CPU

[英]Always CPU with 0 minimum instances

In Cloud Run if I choose Zero as Minimum instances and also chose ' CPU is always allocated '在 Cloud Run 中,如果我选择作为最小实例并选择“始终分配 CPU

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?那么我的问题是,如果 CPU 将分配给“无实例”,或者“CPU 始终分配”,至少需要选择一个实例?

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"我只是想了解什么时候没有实例(因为最小值为零),那么“CPU 总是分配的”会发生什么

or When "CPU is always allocated", how can minimum instance be zero?或者当“始终分配 CPU”时,最小实例如何为零?

云运行配置

CPU allocation is about individual container instances, and autoscaling about all instances in a Cloud Run service. CPU 分配与单个容器实例有关,而自动缩放与 Cloud Run 服务中的所有实例有关。

The autoscaler determines the number of container instances .自动缩放器确定容器实例的数量 Requests to a Cloud Run service are served by container instances.对 Cloud Run 服务的请求由容器实例提供。 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. CPU 分配模式是关于单个容器实例的。 The CPU allocation mode always allocated is a setting that tells Cloud Run to never throttle the CPU of an individual container instance.始终分配的 CPU 分配模式是一种设置,它告诉 Cloud Run 从不限制单个容器实例的 CPU。 The default behavior is to de-allocate the CPU of the container instance if that instance is not processing requests.默认行为是在容器实例未处理请求时取消分配该实例的 CPU。

What happens when minimum instances is set to zero and CPU is set to be always allocated .当 minimum instances 设置为零并且 CPU 设置为始终分配时会发生什么

  • 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).现在容器实例为零,并且没有分配 CPU(因为没有实例)。
  • If there are incoming requests, one or more container instances are active.如果有传入请求,一个或多个容器实例处于活动状态。 They'll have CPU allocated during the entire container lifecycle.他们将在整个容器生命周期内分配 CPU。

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.基于以下文档https://cloud.google.com/run/docs/about-instance-autoscaling#idle-instance CPU 分配和定价只会改变您对 Cloud Run 使用的计费方式,它不会影响您的容器是否缩放降为 0 或不降为 0。 I hope this makes sense.我希望这是有道理的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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