0

I have 50-60 aws instances running behind an ALB in AWS. I can get the total request count in the cloudwatch monitoring section, but is there anyway I can get to know how many requests are actually being directed to each instances from the ALB in real time.

Arjun Prasad
  • 173
  • 1
  • 13
  • If you need a rough idea: divide by 50-60. If you need it more exact than that, add CloudWatch metrics for the individual instances' webserver access logs. – ceejayoz Jun 01 '18 at 14:39

2 Answers2

1

What are you trying to accomplish? There isn't a simple way to do this with default metrics in Cloudwatch.

However, AWS now supports "Metric Math" if you wanted to use that to calculate a value. You could use that and a network in / out metric to estimate the traffic per instance, or you could use a custom metric from the instance.

If it doesn't need to be real-time, you could process the instance logs, push them into firehose or cloudwatch logs and build metrics off that.

chris
  • 3,993
  • 6
  • 28
  • 37
  • What are you trying to accomplish? - I'm using spotinst for scaling up instances and I have 2 different instance types present. I wanna know the number of requests each instance can handle before they become unhealthy. – Arjun Prasad Jun 04 '18 at 07:25
0

For access logs it should be possible to enable ALB logs, and analyze them. The field target contains the information to which instance the request was routed.

https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-access-logs.html#access-log-entry-format

Another way to find out the maximim amount of requests for an instance type is to setup a loadtest witb e.g. Apache Jmeter, build a set of requests from e.g. ALB logs, and run them against a single instance while monitoring the instance metrics. Doing so, make sure TLS is terminated the same way as in the production setup. TLS can have a major impact on test results with high request counts. In case you have a ALB / ELB in the test calls be aware that these need time to ramp up or "pre-heat" them as otherwise requests could be dropped there.

hargut
  • 3,908
  • 7
  • 10