user3406181
user3406181

Reputation: 121

How to scale out haproxy node itself?

As i am having one application in which architecture is as per below,

users ---->  Haproxy load balancer(TCP Connection) -> Application server 1
                                                   -> Application server 2  
                                                   -> Application server 3

Now i am able to scale out and scale in application servers. But due to high no of TCP connections(around 10000 TCP connections), my haproxy load balancer node RAM gets full, so further not able to achieve more no of TCP connections afterwords. So need to add one more node for happroxy itself. So my question is how to scale out haproxy node itself or is there any other solution for the same?

As i am deploying application on AWS. Your solution is highly appreciated.

Thanks, Mayank

Upvotes: 2

Views: 991

Answers (1)

thun
thun

Reputation: 488

Use AWS Route53 and create CNAMEs that point to your haproxy instances.

For example:

Create a CNAME haproxy.example.com pointing to haproxy instance1. Create a second CNAME haproxy.example.com pointing to haproxy instance2.

Both of your CNAMEs should use some sort of routing policy. Simplest is probably round robin. Simply rotates over your list of CNAMEs. When you lookup haproxy.example.com you will get the addresses of both instances. The order of ips returned will change with each request. This will distribute load evenly between your two instances.

There are many more options depending on your needs: http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/routing-policy.html

Overall this is pretty easy to configure.

Few unrelated issues: You can also setup health checks and route traffic to the remaining healthy instance(s) if needed. If your running at capacity with two instances you might want to add a few more to able to cope with an instance failing.

Upvotes: 2

Related Questions