- Newest
- Most votes
- Most comments
Good day, Mike. Great question and one that I don't think we focus enough on. I do have one question: Can you please let me know what your configuration looks like for the scaling in metric? You stated that once the RabbitMQ queue hits 100+, the scale out event is invoked and you start to see the number of instances increase. But once the RabbitMQ queue drops below 100, is there a desired state or rate of scale in based on the metric (something like 80 = 4 instances, 60 = 3 instances, etc.)? Based on what it looks like you're trying to accomplish, I'd recommend using something similar to what is described here with Monitoring MQ Brokers with CloudWatch and Monitoring RabbitMQ with CloudWatch. Then, based on those metrics (i.e. MessageReadyCount<=100) you can adjust your AutoScaling policy. Something else to consider would be Target Tracking Scaling Policies where you can select a metric and set a target value. Amazon ECS Service Auto Scaling creates and manages the CloudWatch alarms that control the scaling policy and calculates the scaling adjustment based on the metric and the target value.
Hopefully this points you in the right direction for being able to configure your scale in triggering event for ECS.
Thank you, Brian at AWS
A note for Target Tracking: the metric would need to be changed to be proportional to the number of tasks. Something like "messages per task", since target tracking requires metrics to change proportionally to the actual capacity being scaled. Here's a very similar article for doing this with SQS: https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-using-sqs-queue.html
Thanks Brian. As far as below 100 is concerned I'm happy for it to go back to 1 instance immediately as the message surge would have been catered for by then. I'll have a read of those today and see it I can create a solution. Cheers.
Step scaling policies support a change type of "ExactCapacity" https://docs.aws.amazon.com/cli/latest/reference/application-autoscaling/put-scaling-policy.html - so you could have an alarm trigger a scale-in policy when task count is < 100 with a type of ExactCapacity and adjustment of 1 (maybe put a tiny bit of buffer to prevent oscillation when the queue is right around that 100 value, something like <90). On the console, do this by selecting "Set to" on the Action dropdown for the Scale-in policy
Relevant content
- Accepted Answerasked 3 months ago
- asked a year ago
- AWS OFFICIALUpdated 2 months ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated a year ago
You mentioned Service AutoScaling, but also mentioned Instances a few times. Just confirming, is the issue here related to scaling the number of instances in an ECS cluster (For a non-Fargate based service), or the number of Tasks that Service AutoScaling (Application AutoScaling) is creating?