Question

Load balancing for several ports in the same server

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?


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hi.

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.

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.