What is the best way to load balance multiple sock5 proxys on seperate VM's in the same datacenter?

Solution 1:

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/