The best way to load balance multiple sock5 proxys on seperate VM’s in the same datacenter

haproxyload balancingload-balancePROXY

I am currently trying to figure out the best way to load balance multiple sock 5 proxy servers for my new project. I was looking into programs like HA proxy, but it seems to only load balance HTTP Proxy's and for this project i need Sock5's. I looked into DNS round robin, but i haven't found a way for it to instantly fail over to one of the other servers or remove them from the rotation. I also found that the TTL doesn't update fast enough for the seamless switch to another server when one goes offline. This has really been troubling me for a while and i find it really hard to explain my case as i have little experience with load-balancing and preventing failures for users as my projects have only recently been gaining traction. If What i just posted seems to make no sence i made a diagram below on what i am trying to configure.

So basically what i am looking for is a solution to effectivly loadbalance a sock5 proxy while removing servers that go offline.
http://puu.sh/3mLvL/6ef73d46d4.png

Best Answer

There are a few ways to go about this. Many providers will allow you to rent or buy a load balancing device like a F5 or something like that. These devices can load balance tcp connections and many level 7 connections to a set of machines. Now if you are unable to get a load balanacer on hardware there are other choices out there like nginx, haproxy, and apache all have load balancing tools to do this.

I recommend that you go with a hardware one if you can you have a project that needs something to be super fast. Dont get me wrong I use a lot of nginx proxying. Some times I have tcp proxy to ha proxy for level 7. Since the hardware load balancers wont need to use as much power and you can use a lot more nginx loads to handle the rest of the traffic, this is useful when you need to do a lot of SSL termantions, to get hardware load balancers to do a lot of ssl cost a lot but apache,haproxy,nginx can do it for fairly cheap.

Nginx: http://wiki.nginx.org/HttpProxyModule https://github.com/yaoweibin/nginx_tcp_proxy_module

Apache: https://httpd.apache.org/docs/2.2/mod/mod_proxy_balancer.html

HaProxy: http://tenfourty.com/2011/04/09/how-to-load-balance-tcp-connections-with-haproxy/

Related Topic