简体   繁体   English

AWS ECS 集群自动扩展与服务自动扩展

[英]AWS ECS cluster auto-scaling vs service auto-scaling

this is my first time using amazon ecs service.这是我第一次使用亚马逊 ecs 服务。

I have searched online for awhile to understand auto-scaling with ecs services.我在网上搜索了一段时间以了解使用 ecs 服务的自动缩放。

I found there are two options to auto-scale my application.我发现有两个选项可以自动扩展我的应用程序。 But, There are some I don't understand.但是,有一些我不明白。

First is Service auto scaling which track the cpu/memory metric from cloudWatch and increase the task number accordingly.首先是服务自动缩放,它跟踪来自 cloudWatch 的 cpu/内存指标并相应地增加任务数量。

Second is cluster auto scaling which needs to create auto scaling resource, create capacity provider and so on.二是集群伸缩,需要创建伸缩资源,创建容量提供者等。 But, in Tutorial: Using cluster auto scaling , it can run the task definition without service.但是,在教程:使用集群自动扩展中,它可以在没有服务的情况下运行任务定义。 But it also seems increasing the task number in the end.但它似乎也最终增加了任务数量。

So what's the different and 'pros and cons' between them?那么它们之间有什么不同和“利弊”呢?

I will try to explain briefly.我将尝试简要解释一下。

  • A Task is a container which is running our code(from a docker image).任务是运行我们代码的容器(来自 docker 映像)。
  • As Service is making sure that given desired no of tasks are maintained. As Service确保维护给定的任何所需任务。
  • We will be running these services in ECS backed by EC2 or Fargate.我们将在由 EC2 或 Fargate 支持的 ECS 中运行这些服务。 Ec2 is machines managed by us. Ec2 是我们管理的机器。 Fargate is machines managed by AWS. Fargate是由 AWS 管理的机器。

Scaling: Ultimately, We will be scaling the tasks just by setting desired no of tasks between min and max tasks, based on CPU or any other metric of individual task.缩放:最终,我们将根据 CPU 或单个任务的任何其他指标,通过在最小任务和最大任务之间设置所需的任务数来缩放任务。 This is called service auto scaling.这称为服务自动缩放。

  • Fargate: Since AWS will manage necessary VMs behind the scenes, we can set any no of desired tasks we want and seamlessly scale without worrying about any infrastructure. Fargate:由于 AWS 将在后台管理必要的虚拟机,我们可以设置任何我们想要的任务并无缝扩展,而无需担心任何基础设施。
  • EC2: We can't seamlessly scale services because we need to add/remove EC2 instances behind the scenes too. EC2:我们无法无缝扩展服务,因为我们也需要在后台添加/删除 EC2 实例。 We need to auto scale these instances also based on cpu or any other metrics of the Ec2 machines, which is called Cluster scaling.我们还需要根据 cpu 或 Ec2 机器的任何其他指标自动扩展这些实例,这称为集群扩展。

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

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