Load balancing with same source port, but different target ports

August 16, 2017 1.6k views
Load Balancing


I want to explore the option to use DigitalOcean's load balancer to balance between different node instances on the same droplet (listening on different ports) - in order to utilize all the cores in a droplet. I guess it's possible to do this with something like nginx, but I want to offload the processing to the load balancer.

Here's a screenshot illustrating the issue:

It's not possible to set the same source port (https - 443) but different target ports in DigitalOcean's load balancer configuration.

Anyone knows if this is a known limitation? Or maybe there are plans to support it in the future? Or maybe some other idea?


3 Answers
jasonjpeters August 16, 2017
Accepted Answer

The DO load balancers are meant to distribute traffic across multiple droplets, not one droplet and multiple ports.

I would use a Ubuntu:16.04 droplet with NGINX or HAProxy as your reverse proxy/loadbalancer and LXC/LXD or Docker within a single instance.

Keep in mind your performance is limited by the droplet size.

True, but it's also limited by Node.js' JavaScript engine to utilize one core. I understand what DO's load balancers are meant for, but I guess my question is - is there any reason not to allow this? I mean, this could actually be useful - removing the need for a reverse proxy per machine in could potentially provide a nice performance boost.

I see. I would think that it would be possible.

If not with the DO loadbalancers, then with HAProxy or NGINX running in a separate instance or perhaps the smallest droplet.

Have another answer? Share your knowledge.