Load balancing for several ports in the same server

June 10, 2017 100 views
Load Balancing Ubuntu 16.04

It is possible to create a load balancer to balance the requests to the same server that is listening in different ports?

I have a server that runs several instances of a daemon that offer data to some clients using a range of ports (e.g: 9000, 9001, 9002 and 9003). I would like a load balancer that using the same external port (e.g: 9000) connects to any of the ports of the same server. Is it possible?

2 Answers

Hi @jorpiell

Just to see if I understand you correctly.

Are you talking about the DigitalOcean service called Load Balancer or just generally?

But when reading your second section, it seems like you want to be able to host a service on 1 port, which has a backend of multiple ports (maybe on the same server, maybe on different servers).

So you could setup Nginx as a reverse proxy. This means your visitor see the Nginx on one port, which then connects with different backend services (which could be on different ports or different servers).
You can also use HAproxy - Nginx might just be a little easier, but HAproxy is really advanced and can definitely do whatever you want.


Yes, I was talking about the service "Load Balancer". It seems that I can't use this service for my purpose and I have to do it using other solution as Nginx or HAproxy as you commented in your post.

Thanks a lot for your help.

Have another answer? Share your knowledge.