3 ms·
Does anyone know if it’s possible to run multiple instances of an app via systemd that all listen on the same port and it does some kind of round robin load ba
by devmunchies 4y ago
Does anyone know if it’s possible to run multiple instances of an app via systemd that all listen on the same port and it does some kind of round robin load balancing to the services?
I could introduce my own load balancer proxy like Envoy but I want to reduce complexity as much as possible for systemd to be a viable alternative to k8s.
- tyingq 4y agoLooks like there's some support for that already in systemd, but it's not complete...see: https://github.com/systemd/systemd/issues/8096 https://github.com/systemd/systemd/issues/8096 Also iptables would be a simple option for a round-robin or random load balancer. No health checks or anything though. See: https://scalingo.com/blog/iptables https://scalingo.com/blog/iptables for an example.
- andrewstuart 4y agoStart point would be to search for socket based activation. http://0pointer.de/blog/projects/socket-activation.html http://0pointer.de/blog/projects/socket-activation.html I've done it with Python it's very easy. systemd listens on a port and when a connection request comes in it starts your service. You could spawn a new process and let systemd keep waiting for new inbound connections.
- CoolCold 4y agoSO_REUSEPORT ?