We help IT Professionals succeed at work.

Load balance session to same server

I have a scenario where I need a load balancer
When a new tcp connection is initiated from the client, the load balancer much assign a server, and always route all traffic from that that to the server it initially picked

When I netstat, I see and ipaddress and port for the client. (connection) so it makes sense to use this as the identifier for that client

Is there any software in exisitance to do this? Or do. I need to write my own?
Watch Question

Software Engineer
Distinguished Expert 2019
Session affinity/persistence/stickyness  can be done in various ways depending on data to be transported.
haproxy should be able to do this for you.
See below article. (Load balancing + getting the the same backend is not limited to HTTP though, you can do more (even encrypted SSL traffic)  as there almost always is some kind of key-id/ session-id inside packets.


If you're using Windows server, just install the feature Network Load Balancer.

It's free and you can add as many additional servers in there (you'll need to install NLB on each server you want to be part of the load balance)

You can allow specific ports (80,443) to load balance.  You can set it up to go to a specific server or load balance to the best server available and so on.

Here's a walkthrough on how to get it installed and configured:

nociSoftware Engineer
Distinguished Expert 2019

@coolie: Topics are: "Linux networking"...    
haproxy is free & opensource.  and gratis as well.  without any requirement for Clustering or transforming your LAN into a broadcast network wrt. to NLB systems.  Or even a windows server license...
(effectively there are quite a few "hardware" loadbalancer's which actually run haproxy.)