简体   繁体   English

AWS ECS - 使用 CloudWatch 警报的自动缩放无法按预期工作

[英]AWS ECS - autoscaling using CloudWatch alarm does not work as expected

I have configured a CloudWatch alarm in order to trigger auto scaling for an ECS service.我已配置 CloudWatch 警报以触发 ECS 服务的 Auto Scaling。 The alarm is configured to trigger auto scaling when there's a certain number of scheduled activities in a step function.警报配置为在步骤 function 中有一定数量的计划活动时触发自动缩放。

But when testing with 1000+ scheduled activities in the step function, the alarm is raised, but the number of scheduled activities showed in CloudWatch metrics is much lower than the number scheduled activities I see in the step function itself.但是,在步骤 function 中使用 1000 多个计划活动进行测试时,会发出警报,但 CloudWatch 指标中显示的计划活动数量远低于我在步骤 function 本身中看到的计划活动数量。 Therefore either no scale up occurs, or a much lower number of machines is因此,要么没有扩大规模,要么机器数量少得多

This is the alarm configuration:这是警报配置:

{
    "Type": "AWS::CloudWatch::Alarm",
    "Properties": {
        "AlarmName": "thumbnails-generator-scaling-alarm",
        "ActionsEnabled": true,
        "OKActions": [],
        "AlarmActions": [
            "arn:aws:autoscaling:us-west-2:111111111111:scalingPolicy:8694a867-85ee-4740-ba70-7b439c3e5fb3:resource/ecs/service/prod/thumbnails-generator:policyName/thumbnails-generator-scaling-policy"
        ],
        "InsufficientDataActions": [],
        "MetricName": "ActivitiesScheduled",
        "Namespace": "AWS/States",
        "Statistic": "SampleCount",
        "Dimensions": [
            {
                "Name": "ActivityArn",
                "Value": "arn:aws:states:us-west-2:111111111111:activity:thumbnails-generator-activity-prod"
            }
        ],
        "Period": 300,
        "EvaluationPeriods": 1,
        "DatapointsToAlarm": 1,
        "Threshold": 0,
        "ComparisonOperator": "GreaterThanOrEqualToThreshold",
        "TreatMissingData": "missing"
    }
}

This is the auto scale configuration:这是自动缩放配置:

自动缩放配置

Please advise what can I do in order to make the auto scale work properly.请告知我该怎么做才能使自动缩放正常工作。

I guess you need to use Sum instead of SampleCount statistic.我猜你需要使用Sum而不是SampleCount统计数据。

SampleCount is the number of data points during the period. SampleCount 是该期间的数据点数。

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

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