I read swarm routing mesh
I create a simple service which uses tomcat server and listens at 8080.
docker swarm init
I created a node manager at node1.
docker swarm join /tokens
I used the token provided by the manager at node 2 and node 3 to create workers.
docker node ls
shows 5 instances of my service, 3 running at node 1, 1 running at node 2, another one is at node 3.
docker service create image
I created the service.
docker service scale imageid=5
scaled it.
My application uses atomic number which is maintained at JVM level.
If I hit http://node1:8080/service
25 times, all requests goes to node1. How dose it balance node?
If I hit http://node2:8080/service
, it goes to node 2.
Why is it not using round-robin?
Doubts:
- Is anything wrong in the above steps?
- Did I miss something?
- I feel I am missing something. Like common service name
http://domain:8080/service
, then swarm will work in round robin fashion.
I would like to understand only swarm mode. I am not interested external load balancer as of now.
How do I see swarm load balance in action?