I am considering building out a Docker Swarm cluster. For the purpose of keeping things both simple and relatively fault-tolerant, I thought about simply running 3 nodes as managers.
What are the trade-offs when not using any dedicated worker nodes? Is there anything I should be aware of that might not be obvious?
I found this Github issue which asks a similar question, but the answer is a bit ambiguous to me. It mentions the performance may be worse. It also mentions that it will take longer to reach consensus. In practice, what functionality would be slower? And what does "take longer to reach consensus" actually affect?
Docker recommends a maximum of seven manager nodes for a swarm.
You should maintain an odd number of managers in the swarm to support manager node failures.
Manager nodes elect a single leader to conduct orchestration tasks. Worker nodes receive and execute tasks dispatched from manager nodes. By default manager nodes also run services as worker nodes, but you can configure them to run manager tasks exclusively and be manager-only nodes.
Additional manager nodes reduce write performance because more nodes must acknowledge proposals to update the swarm state. This means more network round-trip traffic which causes performance issues on your services If your dockerized application messes with the the host system, this will affect manager services.
TL;DR pros and cons of all managers as workers in Swarm:
Pros:
Cons:
Full Answers to Your Questions
What are the trade-offs when not using any dedicated worker nodes? Is there anything I should be aware of that might not be obvious?
There are no hard requirements for using worker-only nodes. If you're deploying a solution where you know what resources you need, and the number of services/tasks are usually the same, there's nothing wrong with a Swarm of just three managers doing all the work, as long as you have considered these three areas that are affected:
Other questions:
In practice, what functionality would be slower? And what does "take longer to reach consensus" actually affect?
More managers = longer for managers to elect a new leader when one goes down. While there is no leader, the Swarm is in a read-only state and new replica tasks cannot be launched and service updates won't happen. Any container that fails won't auto-recover because the Swarm managers can't do work. You're running apps, ingress routing mesh, etc. all still function. A large part of the performance of manager health and leader election is tied to network latency between all manager nodes, as much as it is the number of managers. This is why Docker generally advises that a single Swarms managers all be in the same region so they get a low-latency round trip between each other. There is no hardset rule here. If you test 200ms latency between managers and test failures and are fine with the results and speed of leader election, cool.
Background info:
It all depends on the aim of building the cluster. For development purposes, you can use worker nodes as managers. Real concern is in scaling out, if you feel your microservices infrastructure will keep growing, then consider separating worker and manager nodes for easy scaling out.
The pros are of your setup are:
Ease of administrations
Setup is Highly available - 3 nodes means failure tolerance of 1
Cons are:
Not good for scaling out, container compute demands means adding more worker nodes.
Additional manager nodes reduce write performance because more nodes must acknowledge proposals to update the swarm state. This means more network round-trip traffic which causes performance issues on your services If your dockerized application messes with the the host system, this will affect manager services. Swarm tasks will continue to run but swarm nodes cannot be added, updated, or removed, and new or existing tasks cannot be started, stopped, moved, or updated. Isolation of manager and worker services is safer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With