确保ECS仅在新任务就绪时才杀死旧任务 [英] Ensure ECS only kills old tasks when new ones are ready

查看:110
本文介绍了确保ECS仅在新任务就绪时才杀死旧任务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们拥有基于Docker的ECS服务,该服务一旦启动,就需要在开始准备处理请求之前同步应用程序状态.这可能会花费一些时间(过程开始后的几秒钟).

We have Docker-based ECS services where once the process is up, it needs to synchronize application state before it is ready to start serving requests. This can take some time (a number of seconds after the process starts).

在使用ECS Services时,更改任务定义版本会触发滚动替换任务(良好),但是这样做太快了.一旦任务达到RUNNING状态,下一个任务就被杀死.但是RUNNING只是意味着该过程已经开始,并不意味着它已经满足了其内部所有要求就可以开始工作...在这种情况下,还没有准备好服务请求

When using ECS Services, changing the task definition version triggers a rolling replacement of the tasks (good), but it does it too quickly. Once a task reaches a RUNNING state, the next task is killed. But RUNNING just means the process is started, it doesn't mean it's met all its own internal requirements to be ready to do work... in this case, not ready to serve requests

整个更新过程是如此之快,以至于在某些情况下,所有旧任务在任何新任务完成其状态加载之前就被杀死了,最终导致中断.

This entire update process happens so quickly that in some cases, all the old tasks are killed before any of the new tasks have finished loading their state, and we end up with an outage.

什么是最好的或正确的方法,以确保ECS服务在新任务真正热起来之前不会终止旧/热任务.完全在线,而不仅仅是容器进程正在运行?

What is the best or correct way to ensure ECS Services doesn't terminate old/hot tasks until the new tasks are actually hot & fully online, and not simply that the container process is running?

推荐答案

您可以通过设置以下参数来控制部署的速度:

You can control the speed at which a deployment proceeds by setting the following parameters:

  • deploymentConfiguration (specifically, the minimumHealthyPercent in your case)
  • enabling health checks (with load balancer health checks if you are using a load balancer or with container health checks)
  • setting healthCheckGracePeriodSeconds (for load balancer health checks) or startPeriod (for container health checks) to account for the start up synchronization time.

这篇关于确保ECS仅在新任务就绪时才杀死旧任务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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