Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS Auto Scaling Group - Application Load Balancer Request Count Per Target

On AWS, you can create an auto scaling policy which scales based on "Application Load Balancer Request Count Per Target".

Like this:

enter image description here

This has a min of 1 instance and a max of 5. It should aim to achieve 10 "Request count per target" for my ElbTargetGroup.

My question is, what is "Application Load Balancer Request Count Per Target"?

Is this:

  • Number of active connections to targets from the load balancer divided by number of targets?
  • Number of requests per 5 minutes divided by number of targets?
  • Number of requests per 1 minute divided by number of targets?

The documentation here just says:

The average number of requests received by each target in a target group. You must specify the target group using the TargetGroup dimension.

Also, how long does it have to be over that target for it to start creating new instances? The main reason I ask is that I have sent many requests to this load balancer, but scaling events aren't being triggered.

like image 425
ThePerson Avatar asked Dec 02 '17 19:12

ThePerson


People also ask

What is Target request count?

RequestCountPerTarget is a load balancer metric. The ELB metrics are always over 1 minute, as outlined in the documentation: Elastic Load Balancing reports metrics to CloudWatch only when requests are flowing through the load balancer.

What is request count in load balancer?

1. Request Counts. Whether, as a total sum of all the requests coming in across all load balancers or on a per-minute basis, monitoring request counts can help your organization understand more than you think.

Does an Auto Scaling group need a load balancer?

When you use Elastic Load Balancing with your Auto Scaling group, it's not necessary to register individual EC2 instances with the load balancer. Instances that are launched by your Auto Scaling group are automatically registered with the load balancer.

How many EC2 instances can you have in an Auto Scaling group?

If you specify scaling policies, then Amazon EC2 Auto Scaling can launch or terminate instances as demand on your application increases or decreases. For example, the following Auto Scaling group has a minimum size of one instance, a desired capacity of two instances, and a maximum size of four instances.


2 Answers

RequestCountPerTarget is a load balancer metric. The ELB metrics are always over 1 minute, as outlined in the documentation:

Elastic Load Balancing reports metrics to CloudWatch only when requests are flowing through the load balancer. If there are requests flowing through the load balancer, Elastic Load Balancing measures and sends its metrics in 60-second intervals. If there are no requests flowing through the load balancer or no data for a metric, the metric is not reported.

So if you stick to this metric, there is no need to pay for detailed EC2 instance metrics. This is only relevant if you need to use something like the CPU utilization on the instances.

like image 195
Hagen Avatar answered Sep 18 '22 14:09

Hagen


The answer is your first choice: "Number of active connections to targets from the load balancer divided by number of targets" Whether the metric is over i or 5 minutes, depends on your CloudWatch settings as explained below.

You can see all the metric definitions for load balancers in the AWS ALB doc

Not that there is both a "RequestCount" and "RequestCountPerTarget" where the later is the former divided by the number of active targets.

You can see both these metrics in the CloudWatch console, but more simply in the EC2 console. Select Target Groups on the left pain and then the Monitoring tab. (Note that there is a lot of overlap between the monitoring tab of Target Groups and Monitoring in the Load Balancer screen)

In terms of how long it takes for autoscaling to act after a change, note that by default CloudWatch checks metrics every 5 minutes. AWS recommends you turn on detailed monitoring to get metrics every minute

like image 38
AstroTom Avatar answered Sep 18 '22 14:09

AstroTom