Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker swarm load balancing

Do we need to balance load via ngnix with swarm mode?

If so, why do we need to do that. Docker swarm balances load. I tested for simple application. It has several strategies for load balancing.

Even docker swarm balances load, why are there so many articles about load balancing with ngnix in swarm mode?

like image 686
Gibbs Avatar asked Jul 10 '26 06:07

Gibbs


1 Answers

Do we need to balance load via ngnix with swarm mode?

Yes and no. It depends ... :)
Application load balancing is doing the swarm for you. E.g. when deploying a service with a replica of 10, the swarm mode will perform a round robin load balancing around your 10 applications everytime you call it. It doen't matter which manager or worker you're calling.

But on host level, you need an external classic load balancer. E.g. when your swarm runs on 4 digital ocean machines, you need a load balancer which covers all 4 ip adresses.

Even docker swarm balances load, why are there so many articles about load balancing with ngnix in swarm mode?

a) Because nginx wants to earn money
b) Because there was a time before docker swarm mode exists and where everything was complicated
c) Because it's still good to know how to do it yourself d) Because you're very familar with nginx

like image 50
Markus Avatar answered Jul 11 '26 20:07

Markus