阅读背景:

AWS EC2 Auto Scaling Groups:我得到Min和Max,但是Desired实例的限制是什么?

来源:互联网 

When you setup an Auto Scaling groups in AWS EC2 Min and Max bounds seem to make sense:

在AWS EC2中设置Auto Scaling组时Min和Max界限似乎有意义:

  • The minimum number of instances to scale down to based on policies
  • 根据策略缩减到的最小实例数
  • The maximum number of instances to scale up to based on policies
  • 根据策略扩展到的最大实例数

However, I've never been able to wrap my head around what the heck Desired is intended to affect.

但是,我从来没有能够绕过Desired想要影响的东西。

I've always just set Desired equal to Min, because generally, I want to pay Amazon the minimum tithe possible, and unless you need an instance to handle load it should be at the Min number of instances.

我总是将Desired设置为Min,因为通常情况下,我想向亚马逊支付可能的最低价格,除非你需要一个实例来处理负载,否则它应该是Min的实例数。

I know if you use ElasticBeanstalk and set a Min to 1 and Max to 2 it sets a Desired to 2 (of course!)--you can't choose a value for Desired.

我知道如果你使用ElasticBeanstalk并将Min设置为1而Max设置为2则将Desired设置为2(当然!) - 你不能为Desired选择一个值。

What would be the use case for a different Desired number of instances and how does it differ? When you expect AWS to scale lower than your Desired if desired is larger than Min?

对于不同的Desired数量的实例,它的用例是什么?它有何不同?如果您希望AWS比预期更低,那么如果需要大于Min?

4 个解决方案

#1


28  

Here are the explanations for the "min, desired and max" values from AWS support:

以下是AWS支持中“min,desired和max”值的解释:

MIN: This will be the minimum number of instances that can run in your auto scale group. If your scale down CloudWatch alarm is triggered, your auto scale group will never terminate instances below this number

MIN:这是可以在自动缩放组中运行的最小实例数。如果触发了缩小CloudWatch警报,则您的自动缩放组将永远不会终止低于此数字的实例

DESIRED: If you trip a CloudWatch alarm for a scale up event, then it will notify the auto scaler to change it's desired to a specified higher amount and the auto scaler will start an instance/s to meet that number. If you trip a CloudWatch alarm to scale down, then it will change the auto scaler desired to a specified lower number and the auto scaler will terminate instance/s to get to that number.

期望:如果您为扩展事件触发CloudWatch警报,那么它将通知自动缩放器将其更改为指定的更高数量,并且自动缩放器将启动实例以满足该数量。如果您将CloudWatch警报绊倒以缩小,则它会将所需的自动缩放器更改为指定的较低数字,并且自动缩放器将终止实例以获取该数字。

MAX: This will be the maximum number of instances that you can run in your auto scale group. If your scale up CloudWatch alarm stays triggered, your auto scale group will never create instances more than the maximum amount specified.

MAX:这是您可以在自动缩放组中运行的最大实例数。如果您的扩展CloudWatch警报仍然被触发,您的自动缩放组将永远不会创建超过指定最大数量的实例。

#2


15  

Think about it like a sliding range UI element.

把它想象成一个滑动范围的UI元素。

With min and max, you are setting the lower bound of your instance scaling. Withe desired capacity, you are setting what you'd currently like the instance count to hover.

使用min和max,您将设置实例缩放的下限。通过所需的容量,您可以将当前想要的实例数设置为悬停。

Example: You know your application will have heavy load due to a marketing email or product launch...simply scale up your desired capacity beforehand:

示例:您知道由于营销电子邮件或产品发布,您的应用程序将负载过重...只需事先扩展您所需的容量:

aws autoscaling set-desired-capacity --auto-scaling-group-name my-auto-scaling-group --desired-capacity 2 --honor-cooldown

Source

资源

#3


4  

When you expect AWS to scale lower than your Desired if desired is larger than Min?

如果您希望AWS比预期更低,那么如果需要大于Min?

This happens when you set a CloudWatch alarm based on some AutoScaling policy. Whenever that alarm is triggered it will update the DesiredCount to whatever is mentioned in config.

当您根据某些AutoScaling策略设置CloudWatch警报时,会发生这种情况。每当触发该警报时,它都会将DesiredCount更新为config中提到的任何内容。

e.g., If an AutoScalingGroup config has Min=1, Desired=3, Max=5 and there is an Alarm set on an AutoScalingPolicy which says if CPU usage is <50% for consecutive 10 mins then Remove 1 instances then it will keep reducing the instance count by 1 whenever the alarm is triggered until the DesiredCount = MinCount.

例如,如果AutoScalingGroup配置的Min = 1,Desired = 3,Max = 5并且AutoScalingPolicy上设置了一个Alarm,它表示连续10分钟的CPU使用率是否<50%然后删除1个实例然后它将继续减少每当触发警报直到DesiredCount = MinCount时,实例计数为1。

Lessons Learnt: Set the MinCount to be > 0 or = DesiredCount. This will make sure that the application is not brought down when the mincount=0 and CPU usage goes down.

经验教训:将MinCount设置为> 0或= DesiredCount。这将确保在mincount = 0且CPU使用率下降时应用程序不会关闭。

#4


0  

Based on my reading, in layman's terms, DesiredCapacity value is automatically updated on scale-in and scale-out events.

根据我的阅读,用外行人的话来说,DesiredCapacity值会自动更新为缩小和缩小事件。

In other words,

换一种说法,

Scale-in or Scale-out are done by decreasing or increasing the DesiredCapacity value.

通过降低或增加DesiredCapacity值来完成放大或缩小。


分享到: