Round Robin Load Balancing not working as expected
- Dominant language
- C#
- Stars
- 9.6k
- Forks
- 933
- Avg merge
- 12d 18h
- Merged PRs (30d)
- 2
Description
### Background
I am attempting to deploy 2 replicas of a simple MyTestWebApp in a Docker Swarm envinroment using the Round Robin config. The purpose is to gain experience before deploying in production and testing the Round Robin config. (Each deployment of MyTestWepApp generates a unique app ID and when a request hits the controller it is logged in the console)
### Expected Behavior
For each request to the end point, my YARP implementation will hit one instatiation of MyTestWebApp, then the second instantiation, then back to the first, and so on, in a Round Robin fashion.
### The (Possible) Bug
For each request to the end point, my YARP implementation hits one instatiation only of MyTestWebApp, but no requests hit the second instantiation. If I pause making requests for a period of time (maybe 5 minutes or so), the second instantiation may be hit but then the first will not be hit.
### My Config
```javascript
"ReverseProxy": {
"Routes": {
"route1": {
"ClusterId": "mytestwebapp",
"Match": {
"Path": "{**catch-all}",
"Hosts": [ "mytestwebapp.dev" ]
}
}
},
"Clusters": {
"mytestwebapp": {
"LoadBalancingPolicy": "RoundRobin",
"Destinations": {
"destination1": {
"Address": "http://mytestwebapp:5023/"
}
}
}
}
```
Here is my docker compose file:
```yaml
version: '3.8'
services:
tempwebapp:
image: localstore/tempwebapp:1.3
environment:
- ASPNETCORE_URLS=http://*:5023
- ASPNETCORE_ENVIRONMENT=Production
ports:
- 5023:5023
deploy:
replicas: 2
restart_policy:
condition: on-failure
placement:
constraints: [node.role == manager]
networks:
- localnet
yarpreverseproxydev:
image: localstore/yarpreverseproxydev:1.0
ports:
- 80:80
- 443:443
environment:
- ASPNETCORE_ENVIRONMENT=Production
deploy:
replicas: 1
restart_policy:
condition: on-failure
placement:
constraints: [node.role == manager]
networks:
- localnet
networks:
localnet:
driver: overlay
attachable: true
name: localnet
```
### Console Logs from each instantiation
From tempwebapp in Containter 1:

From tempwebapp in Containter 2:

Contributor guide
Assessment
This issue has not been assessed yet.