Amazon ECS中的最小健康百分比和最大百分比是多少 [英] What is the minimum healthy percent and maximum percent in Amazon ECS

查看:106
本文介绍了Amazon ECS中的最小健康百分比和最大百分比是多少的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经具有Docker和EC2的经验。但是我是ECS的新手。有人可以帮助我了解这两个参数的实际作用,区别和用法。

I already have the experience in Docker and EC2. But I'm new to ECS. Can someone help me to understand what these two parameters actually does, their difference and usage.

官方文档说:


最低健康百分比代表您的下限数量的下限服务的任务,这些任务在部署期间必须保持为RUNNING状态,以所需任务数的百分比(四舍五入到最接近的整数)的百分比表示。使用此参数,可以在不使用其他群集容量的情况下进行部署。例如,如果您的服务具有所需的四个任务数量,并且最小健康百分比为50%,则调度程序可以在启动两个新任务之前停止两个现有任务以释放群集容量。不使用负载平衡器的服务任务如果处于运行状态,则被视为运行状况良好;如果使用负载均衡器的服务的任务处于运行状态,并且托管在其上的容器实例被负载均衡器报告为正常,则它们被视为运行状况良好。控制台中最小运行状况百分比的默认值为50%,AWS CLI,AWS开发工具包和API的默认百分比为100%。

The minimum healthy percent represents a lower limit on the number of your service's tasks that must remain in the RUNNING state during a deployment, as a percentage of the desired number of tasks (rounded up to the nearest integer). This parameter enables you to deploy without using additional cluster capacity. For example, if your service has a desired number of four tasks and a minimum healthy percent of 50%, the scheduler may stop two existing tasks to free up cluster capacity before starting two new tasks. Tasks for services that do not use a load balancer are considered healthy if they are in the RUNNING state; tasks for services that do use a load balancer are considered healthy if they are in the RUNNING state and the container instance it is hosted on is reported as healthy by the load balancer. The default value for minimum healthy percent is 50% in the console and 100% for the AWS CLI, the AWS SDKs, and the APIs.

最大百分比参数表示在部署过程中处于RUNNING或PENDING状态的服务任务数的上限,以所需任务数的百分比表示(四舍五入到最接近的整数)。使用此参数可以定义部署批处理大小。例如,如果您的服务具有所需的四个任务数量,并且最大百分比值为200%,则调度程序可以在停止四个较旧的任务之前启动四个新任务(前提是可以使用执行此任务所需的群集资源)。最大百分比的默认值为200%。

The maximum percent parameter represents an upper limit on the number of your service's tasks that are allowed in the RUNNING or PENDING state during a deployment, as a percentage of the desired number of tasks (rounded down to the nearest integer). This parameter enables you to define the deployment batch size. For example, if your service has a desired number of four tasks and a maximum percent value of 200%, the scheduler may start four new tasks before stopping the four older tasks (provided that the cluster resources required to do this are available). The default value for maximum percent is 200%.

我仍然对这两个参数不清楚。

I still didn't get a clear idea about these two parameters.


  1. 使用最低健康百分比,如果我的服务具有4个任务的期望数量,而最低健康百分比为25%,则现有/调度程序将启动/停止新任务吗?

  2. 使用最大百分比,如果我的服务具有所需数量的4个任务,并且最大百分比值为50%,则调度程序将启动/停止多少个现有/新任务?

  3. 如果我的服务仅运行一个任务,如何设置这些参数以停止现有任务并运行新任务。


推荐答案


  1. 所需任务为4,最小健康为25然后,在部署过程中,ECS允许在启动新任务之前停止除1之外的所有任务

  2. 最大数量应为100+,这样配置就没有意义了。但是,如果您有4个所需的任务,且最多有150%的任务,那么ECS可以在停止其他任务之前启动2个新任务。


    • 要确保在重新部署期间运行的任务不会超过1个,则需要将期望值设置为1,最小设置为0%,最大设置为100%。

    • 如果要确保总有至少1个任务在运行,您需要将期望值设置为1,最小设置为100%,最大设置为200%。

  1. With desired tasks at 4 and minimum health at 25% then during deployment ECS is allowed to stop all tasks except 1 before it starts new tasks
  2. Maximum should be 100+ so that configuration does not make sense. But if you have 4 desired tasks and maximum at 150% then ECS is allowed to start 2 new tasks before it stops other tasks.
    • If you want to make sure there is never more than 1 task running during redeployment then you need to set desired to 1, minimum to 0% and maximum to 100%.
    • If you want to make sure there is always at least 1 task running you need to set desired to 1, minimum to 100% and maximum to 200%.

其他示例。如果需要4,则最小为50%,最大为150%。然后,ECS可以决定在部署期间将要执行的操作。

Other example. If you have desired at 4, minimum at 50% and maximum of 150%. Then ECS can decide what it will do during deployment.


  • 如果群集没有更多资源,它可以决定停止2个任务,在新版本中启动2个新任务,等待健康的新任务。然后停止剩余的两个任务并启动两个新任务。

  • 如果群集具有更多资源,则ECS可以决定在停止现有任务之前启动两个新任务。

或者您可以这样看。在重新部署期间,ECS需要在MinimumPercent / 100 *期望的任务和MaximumPercent / 100 *期望的任务之间运行。在这种情况下,需要2-6个任务。

Or you could look at it this way. During redeployment ECS needs to run between MinimumPercent/100*desired and MaximumPercent/100*desired tasks. In this case between 2-6 tasks.

这篇关于Amazon ECS中的最小健康百分比和最大百分比是多少的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆