I started exploring fargate in Amazon Web Service and it is working as expected.
Now when I try to apply different auto scaling policy, I couldn't get the difference between Step-Scaling and Target Tracking policy
I understand the step scaling policy is :
We specify MULTIPLE thresholds Along with different responses.
Threshold A - add 1 instance when CPU Utilization is between 40% and 50%
Threshold B - add 2 instances when CPU Utilization is between 50% and 70%
Threshold C - add 3 instances when CPU Utilization is between 70% and 90%
And so on and so on
(i.e) There are multiple thresholds
1) But I couldn't understand how the target tracking policy works?
2) Not sure about the difference between Step scaling and Target Tracking policy
Thanks,
Harry
I'd try and answer your questions.
- But I couldn't understand how the target tracking policy works?
Well, AWS creates the Cloudwatch alarm for you on basis of the target specified by you. It monitors the alarm and in the event of any alarm breach, tries to keep the metric near the target value by scaling in or scaling out. Additionaly, target tracking scaling policy also adjusts to the changes in the metric due to a changing load pattern.
- Not sure about the difference between Step scaling and Target Tracking policy
I'd go for a target tracking policy if I am sure that my scaling metric increases/decreases in proportion of the number of instances in the auto scaling group. On the other hand, if I'd want more fine grained control of the scaling in or scaling out I'd go for step scaling say for example I've a real time websocket application behind a load balancer (with least connection algorithm) and the average CPU utilization suddenly starts jumping over 80, I'd add maybe 3-4 instances so that all new connections get routed to my new instances and the other instances get a breather.
So if I understand correctly, in step scaling we need to specify the alarm range as I mentioned in the question but in target tracking, we need to specify one target value like 90 percent which indicates that it if the instances has 90 percent of CPU then it spans another one?
Yes that's correct. AWS ECS takes care of spawning another task/instance so that it keeps the metric under check.
It makes sure it maintains the 90 percent max CPU in all the instances Say if my target value is 90 percent?
No, it doesn't make sure that if your target value is 90 percent, all the instances will be under 90 percent CPU. A target value is usually an average metric over all the instances in your scaling group. You can define your own metrics but that should be compatible with the target tracking policy. You can find more about that here (https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-scaling-target-tracking.html).