Hi, I am trying to use Wisej in a Docker Swarm context.
Basically I have created a Wisej application that prints out on a form the IP of the node where the application is running.
I added the “HealthCheck.json” file with the following content to the project:
{
“enabled”: true,
“maxSessions”: 0,
“maxMemory”: 70,
“maxCPU”: 100,
“returnCode”: 503,
“retryAfter”: 10,
“returnUrl”: null
}
To achieve this I have 3 hosts connected in a Docker Swarm (it is similar in Kubernetes) the my-stack.yml file is as follows
version: “3.8”
services:
myapp:
image: myWiseApp
ports:
– “8081:80”
networks:
– mylan
deploy:
mode: replicated
replicas: 3
networks:
mylan:
The command deploys 3 containers placed in the ‘mylan’ network:
docker stack deploy –compose-file my-stack.yml balancer
With the command starts 3 containers with a separate ip + an lb (load balancer) with its own ip will be added to the ‘mylan’ network.
Opening Firefox and calling up the address of the ‘Leader’ host opens the page but then it starts reloading uninterruptedly… while it reloads, you can see that the ip is rotating because the balancer is doing its job.
If I open another browser and do a refresh the reloading loop stops (not always), also if I go to
other applications on the desktip then return to the browser (focus) with the form displayed, I see that the page is reloaded
and the IP changes again.
I wanted to ask, can WiseJ work in multi-instance of an Application on a Docker system?
Clearly with a Razor application the problem does not exist.
Do I have to or can I configure anything to make it work?
Best Regards
Tiziano
So, if I understand correctly, on Docker Swarm it is not possible using its native load balancer, but one must create a load balancer (NGIX or other) in order to configure the correct Session Affinity… is this correct?
It possible to act on Docker Swarm’s load balancer configuration (although I haven’t understood where)?
The healthcheck doesn’t work like that. It’s for custom load balancing and requires that the load balancer supports failover. You can leave that out. The other issue is because you didn’t setup session affinity. Any session based system would not work if you switch the server randomly.
Please login first to submit.