On 2020-04-21 10:52 a.m., Dominique Devienne via Boost-users wrote:
I didn't equate routing traffic from 1 server to another as Load Balancing, but I guess it makes sense. My server is already multi-user and multi-threaded, and not expected to have traffic that justifies a Load Balancer. Other people in the company are going crazy with Kubernetes and Docker, but I'm trying to keep things simple and make a good server fast and robust enough to avoid all that complexity.
Well, your premise seems to be that you want to upgrade a service. From a programming perspective, you have a few choices: a) as someone else has mentioned, make use of the SO_REUSEPORT socket option: write your own little packet forwarder, and encapsulate your code in a reloadable module of some sort, and when you want upgrade, load the module, and migrate the socket. Taking care of what ever state management is necessary for migrating traffic. b) use an external service (call it a load balancer or whatever), yes it needs to 'know' the old and new service. Send a signal that new traffic goes to the new instance. It should be smart enough to forward packets of old sessions to the old instance. When no sessions need the old instance, the old instance can be removed. This can be scaled as necessary. The least cost could be done with iptables/nftables: existing connections remain in place until torn down.