DEV Community

Wakeup Flower
Wakeup Flower

Posted on

2 LB algorithms Round Robin & Least Outstanding Requests

Scenario

  • Web app behind an Application Load Balancer (ALB).
  • Some EC2 instances are overloaded (too many outstanding requests).
  • CloudWatch shows higher:

    • Request count
    • Response time
  • Requirement: Do not forward new requests to overloaded instances.


Key background:

ALBs support two main load-balancing algorithms:

  1. Round Robin (default) – evenly distributes requests, without considering instance load.
  2. Least Outstanding Requests (LOR) – sends new requests to the target with the fewest active (in-flight) requests, providing adaptive load distribution.

When some instances get slower (more outstanding requests), LOR automatically directs new traffic to the less busy instances.


Metric relevance

  • RequestCountPerTarget → shows how many requests each target handled.
  • ActiveConnectionCount → number of open connections (relevant for HTTP keep-alives or WebSockets).
  • TargetResponseTime → average response time, good for observation but not for routing logic directly.

The ALB’s Least Outstanding Requests algorithm inherently considers the number of active requests per target—it doesn’t need CloudWatch metrics directly for routing. But among the given choices, the ones referencing ActiveConnectionCount and RequestCountPerTarget correctly describe load indicators.


Option analysis

Option Algorithm Metrics Notes
A Round robin RequestCountPerTarget + ActiveConnectionCount ❌ Round robin ignores load; not suitable.
B Least outstanding requests RequestCountPerTarget + ActiveConnectionCount ✅ Correct — uses LOR algorithm, which addresses overloaded instances.
C Round robin RequestCount + TargetResponseTime ❌ Round robin still ignores load.
D Least outstanding requests RequestCount + TargetResponseTime ❌ “TargetResponseTime” not used by the ALB algorithm; LOR uses outstanding request count.

Why:

  • The Least Outstanding Requests algorithm automatically avoids sending new requests to busy instances.
  • Metrics like RequestCountPerTarget and ActiveConnectionCount confirm the balancing effectiveness, but the ALB handles this logic internally.

Top comments (0)