AWS ECS 是否支持每个容器的动态可扩展性?
Does AWS ECS support per container dynamic scalability?
Amazon 的 EC2 Container Service 允许您 运行 任意数量的容器,它会自动选择一个 EC2 实例来 运行 容器。这是很棒的功能。但是,我们真正关心的是自动可伸缩性。
场景:
- 我通过 AWS ECS 控制台启动容器。
- HTTP 请求开始出现。
- HTTP 负载随时间显着增加。
- CPU(或 RAM)容器的使用率越来越接近 100%。
问题1:ECS会运行多一个容器自动吗?
问题 2:当 CPU(或 RAM)负载变低时,ECS 会自动关闭其中一个容器吗?
不,您无法使用基本 ECS 进行全自动扩展。您可以做的是在负载变高时创建警报,并让警报触发更新以增加集群大小。
2017 年 11 月 29 日更新
AWS Fargate is a technology for Amazon ECS and EKS* that allows you to
run containers without having to manage servers or clusters. With AWS
Fargate, you no longer have to provision, configure, and scale
clusters of virtual machines to run containers.
这允许扩展容器而不用担心使用 ECS 服务级别扩展配置的底层基础设施。
所以它没有说得那么明确,Nathaniel 肯定是正确的,但 this blog from April 9th 今年似乎暗示至少你可以做你想做的事
Long-Running Applications Previously, Amazon ECS included two ways to
schedule Docker containers on a cluster. You could run tasks once for
processes such as batch jobs that perform work and then stop. You
could also make calls to the Amazon ECS APIs to retrieve state
information about the cluster and then use it to power a third-party
or custom-written scheduler.
With today’s launch you can also use the new Amazon ECS Service
scheduler to manage long-running applications and services. The
Service scheduler helps you maintain application availability and
allows you to scale your containers up or down to meet your
application’s capacity requirements. Here’s what it does for you:
Load Balancing – The Service scheduler allows you to distribute
traffic across your containers using Elastic Load Balancing. Amazon
ECS will automatically register and deregister your containers from
the associated load balancer. Health Management – The Service
scheduler will also automatically recover containers that become
unhealthy (fail ELB health checks) or stop running to make sure that
you have the desired number of healthy containers available to run
your application. Scale-Up and Scale-Down – You can scale your
application up and down by changing the number of containers you want
the service to run. Update Management – You can update your
application by changing its definition or using a new image. The
scheduler will automatically start new containers using the new
definition and stop containers running the previous version. It will
wait for the ELB connections to drain if ELB is used. You can also use
these new facilities to implement a basic service discovery model. You
can list the services that are running in a cluster and then use the
ELB as the service endpoint.
理想情况下,您应该在 ec2 和 ecscontainer 级别进行缩放。
如果您使用 ASG,可以在 ASG 上配置基于 cloudwatch 警报的 ec2 扩展。
对于容器缩放,您将必须编写一个 lambda 函数或具有某种可以在 cloudwatch 警报上触发以进行缩放的应用程序。
2016年5月18日,ECS发布弹性伸缩功能。您不需要 Lambda 来构建服务级别的扩展能力。
请参阅下面的版本和功能文档
http://docs.aws.amazon.com/AmazonECS/latest/developerguide/service-auto-scaling.html
截至 2017 年 12 月,亚马逊宣布了名为 Fargate 的新服务。引用 link:
AWS Fargate makes it easy to scale your applications. You no longer have to worry about provisioning enough compute resources for your container applications. After you define your application requirements (e.g., CPU, memory, etc.), AWS Fargate manages all the scaling and infrastructure needed to run your containers in a highly-available manner. You no longer have to decide when to scale your clusters or pack them for optimal utilization.
我假设粗体文本表示 Fargate 会为我上下扩展资源。虽然不是 100% 确定。
Amazon 的 EC2 Container Service 允许您 运行 任意数量的容器,它会自动选择一个 EC2 实例来 运行 容器。这是很棒的功能。但是,我们真正关心的是自动可伸缩性。
场景:
- 我通过 AWS ECS 控制台启动容器。
- HTTP 请求开始出现。
- HTTP 负载随时间显着增加。
- CPU(或 RAM)容器的使用率越来越接近 100%。
问题1:ECS会运行多一个容器自动吗?
问题 2:当 CPU(或 RAM)负载变低时,ECS 会自动关闭其中一个容器吗?
不,您无法使用基本 ECS 进行全自动扩展。您可以做的是在负载变高时创建警报,并让警报触发更新以增加集群大小。
2017 年 11 月 29 日更新
AWS Fargate is a technology for Amazon ECS and EKS* that allows you to run containers without having to manage servers or clusters. With AWS Fargate, you no longer have to provision, configure, and scale clusters of virtual machines to run containers.
这允许扩展容器而不用担心使用 ECS 服务级别扩展配置的底层基础设施。
所以它没有说得那么明确,Nathaniel 肯定是正确的,但 this blog from April 9th 今年似乎暗示至少你可以做你想做的事
Long-Running Applications Previously, Amazon ECS included two ways to schedule Docker containers on a cluster. You could run tasks once for processes such as batch jobs that perform work and then stop. You could also make calls to the Amazon ECS APIs to retrieve state information about the cluster and then use it to power a third-party or custom-written scheduler.
With today’s launch you can also use the new Amazon ECS Service scheduler to manage long-running applications and services. The Service scheduler helps you maintain application availability and allows you to scale your containers up or down to meet your application’s capacity requirements. Here’s what it does for you:
Load Balancing – The Service scheduler allows you to distribute traffic across your containers using Elastic Load Balancing. Amazon ECS will automatically register and deregister your containers from the associated load balancer. Health Management – The Service scheduler will also automatically recover containers that become unhealthy (fail ELB health checks) or stop running to make sure that you have the desired number of healthy containers available to run your application. Scale-Up and Scale-Down – You can scale your application up and down by changing the number of containers you want the service to run. Update Management – You can update your application by changing its definition or using a new image. The scheduler will automatically start new containers using the new definition and stop containers running the previous version. It will wait for the ELB connections to drain if ELB is used. You can also use these new facilities to implement a basic service discovery model. You can list the services that are running in a cluster and then use the ELB as the service endpoint.
理想情况下,您应该在 ec2 和 ecscontainer 级别进行缩放。
如果您使用 ASG,可以在 ASG 上配置基于 cloudwatch 警报的 ec2 扩展。
对于容器缩放,您将必须编写一个 lambda 函数或具有某种可以在 cloudwatch 警报上触发以进行缩放的应用程序。
2016年5月18日,ECS发布弹性伸缩功能。您不需要 Lambda 来构建服务级别的扩展能力。
请参阅下面的版本和功能文档
http://docs.aws.amazon.com/AmazonECS/latest/developerguide/service-auto-scaling.html
截至 2017 年 12 月,亚马逊宣布了名为 Fargate 的新服务。引用 link:
AWS Fargate makes it easy to scale your applications. You no longer have to worry about provisioning enough compute resources for your container applications. After you define your application requirements (e.g., CPU, memory, etc.), AWS Fargate manages all the scaling and infrastructure needed to run your containers in a highly-available manner. You no longer have to decide when to scale your clusters or pack them for optimal utilization.
我假设粗体文本表示 Fargate 会为我上下扩展资源。虽然不是 100% 确定。