Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Load balancer based on CPU utilization

How to setup a load balancer between 2 instances based on CPU utilisation?

If my first instance having more than 50% utilisation, second should load.

like image 528
Jasil Op Avatar asked Mar 16 '26 19:03

Jasil Op


1 Answers

If you are using the Elastic Load Balancer service on AWS, then it is not possible to route based upon CPU Utilization.

From How Elastic Load Balancing Works - Elastic Load Balancing:

With Application Load Balancers, the load balancer node that receives the request evaluates the listener rules in priority order to determine which rule to apply, and then selects a target from the target group for the rule action using the round robin routing algorithm. Routing is performed independently for each target group, even when a target is registered with multiple target groups.

With Network Load Balancers, the load balancer node that receives the connection selects a target from the target group for the default rule using a flow hash algorithm, based on the protocol, source IP address, source port, destination IP address, destination port, and TCP sequence number. The TCP connections from a client have different source ports and sequence numbers, and can be routed to different targets. Each individual TCP connection is routed to a single target for the life of the connection.

With Classic Load Balancers, the load balancer node that receives the request selects a registered instance using the round robin routing algorithm for TCP listeners and the least outstanding requests routing algorithm for HTTP and HTTPS listeners.

like image 59
John Rotenstein Avatar answered Mar 19 '26 13:03

John Rotenstein