-1

I want to create an AWS Elastic Classic Load balancer with different EC2 instances. I have different EC2 instances: For example m3 instance with Ubuntu OS and the other instance is m4-large instance with RHEL7 OS.

Is it possible to pull these both instances under same load balancer? What configuration should be done if its different instances?

2
  • ok.. What about the instance types? Like m3 (3.75 GB RAM) and m4 (7.5 GB RAM) and other configuration differences will be a problem for load balancer configuration?
    – Kiran
    Mar 17, 2017 at 7:16
  • Why would the backend instance matter? ELB is working at the application layer surely.
    – user9517
    Mar 17, 2017 at 7:28

1 Answer 1

1

My general recommendation is to put the same instance sizes behind an ELB.

According to AWS documentation ELB uses the least outstanding requests algorithm, so it will try to send requests to the least loaded server. However, in 2013 an AWS staff member said that ELB uses Round Robin. That would mean you want to use instances the same size. Given the documentation is more precise, I'd be inclined to go with what the documentation says, but here's what they say.

Davin @ AWS (from their forums)

You are correct, the ELB uses the round robin algorithm at the availability zone level. This means that if your ELB is multi-az the incoming requests will be distributed between the availability zones and then distributed across the instances within each AZ.

For this reason we recommend distributing your traffic across the same number of instances within each AZ to ensure even processing of the requests. We also recommend using instances of the same size to enable consistent behaviour for monitoring and management.

If you do mix instance sizes then you may find your smaller instances lack resources during peak loading whereas your larger instances may be under-utilized and wasting resources.

A scenario: the servers initially get 5 jobs each. The faster server finishes two jobs but the slower server only finishes one. So the next two jobs go to the faster server. By now the slower server has finished its work, so it will likely get the next request.

All in all, I suspect it'll be ok - the slower server will be given less work to do, at least if you have a fairly standard use case.

The operating system on the server is irrelevant, so long as they both service requests. They don't even have to service the requests in the same way, but it'd be best if they did.

I'd also avoid put t2 instances behind the ELB unless you fully understand both T2 instances and your application's load behaviour. If you instance runs out of CPU credits ELB should send less traffic to it, so long as it really does do least connections. However if the traffic is served quickly, and there's a lot of traffic, the routing algorithm might not distribute traffic effectively.

4
  • Per the "Routing Algorithm" section of the linked AWS doc, ELBs will use a "least outstanding requests" selection algorithm for HTTP/HTTPS requests, which is different from the least connections algorithm. And for TCP listeners (vs HTTP/HTTPS listeners), round robin selection is used.
    – Castaglia
    Mar 17, 2017 at 17:17
  • True, I'll edit. They're reasonably similar, I guess the main difference would be if requests didn't get their own connection.
    – Tim
    Mar 17, 2017 at 18:37
  • @Tim what is your source for "never put t2 instances behind the ELB"? Mar 19, 2017 at 2:06
  • I read it somewhere. It's probably not a hard and fast rule, but it's probably a good guideline to follow until someone understands enough about AWS to know when they can be used. The general idea is they run out of CPU credits at different rates, then their performance drops through the floor. The ELB's least outstanding requests algorithm should cater for this and send it less traffic, but in general having a constant amount of CPU available in each instance behind an ELB is recommended. Anyone who can work out the exceptions can ignore the guideline :)
    – Tim
    Mar 19, 2017 at 5:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .