Hi all
Is it possible to alter the loadbalancing algorithm used by swarm for containers/services? I believe it defaults to round-robin. I’d live to know how to change it to, for example, least connections or least busiest, if possible. I do hope it’s possible.
Thank you
As far as I know there are VIP and DNSRR.
Loadbalancing could mean two things:
- how the scheduler places tasks on nodes
- there is only one scheduling algorithm, which can be controlled by deployment mode global or replicated, and the target nodes can be restricted with placement constraints.
- how the network communication is forwarded to the service tasks.
- vip:
- the swarn service name resolves to the virtual IP of the service (based on LVS/IPVS) and loadbalances to the service task containers.
- has problems with long-lived connections - by default connections will be closed after 900 seconds.
- dnsrr:
- the swarm service name resolves to a multi-value response containing the ips of all service task containers of this service.
- suited for long-lived connections.
- will result in the opposite of load distribution, if the client application caches the resulting ip of a dns lookup, and re-uses it forever.
- vip:
So I am afraid what you are looking for does not exist in swarm.