Requester-Responder Round-Robin Load-Balancing Doesn't Work
See original GitHub issueI tried running 1 Requester and 2 Responders on the same machine on 3 terminals. I sent 5 requests, but all 5 requests were handled by one Responder, instead of being split evenly among all Responders.
I modified the example scripts as shown below:
Requester in time-client.js
:
const cote = require("cote");
const client = new cote.Requester({ name: "Client" });
function send_request() {
client.send({ type: "time" }, (time) => {
console.log(time);
});
}
for (let i = 0; i < 5; i++) {
send_request();
}
Responder in time-service.js
:
const cote = require("cote");
const timeService = new cote.Responder({ name: "Time Service" });
timeService.on("time", (req, cb) => {
console.log("Generating time...");
cb(new Date());
});
I start the 2 Responders first. It looks like the 2 Responders have discovered each other.
In Terminal 1 (Responder 1):
~/cote-example$ node time-service.js
Hello! I'm Time Service#649b3d77-3968-4ba4-9a49-aa923cf66166 on 8000
========================
Time Service > service.online Time Service#43b19797-2563-42fe-bae2-0a5662cbe366 on 8000
In Terminal 2 (Responder 2):
~/cote-example$ node time-service.js
Hello! I'm Time Service#43b19797-2563-42fe-bae2-0a5662cbe366 on 8000
========================
Time Service > service.online Time Service#649b3d77-3968-4ba4-9a49-aa923cf66166 on 8000
Now I run the Requester, sending 5 requests.
In Terminal 1 (Responder 1):
~/cote-example$ node time-service.js
Hello! I'm Time Service#649b3d77-3968-4ba4-9a49-aa923cf66166 on 8000
========================
Time Service > service.online Time Service#43b19797-2563-42fe-bae2-0a5662cbe366 on 8000
Time Service > service.online Client#da873605-dfc2-430f-a3e1-398011ab5105
Generating time...
Generating time...
Generating time...
Generating time...
Generating time...
This Responder handled all 5 requests.
In Terminal 2 (Responder 2):
~/cote-example$ node time-service.js
Hello! I'm Time Service#43b19797-2563-42fe-bae2-0a5662cbe366 on 8000
========================
Time Service > service.online Time Service#649b3d77-3968-4ba4-9a49-aa923cf66166 on 8000
Time Service > service.online Client#da873605-dfc2-430f-a3e1-398011ab5105
This Responder handled no requests.
In Terminal 3 (Requester):
~/cote-example$ node time-client.js
Hello! I'm Client#da873605-dfc2-430f-a3e1-398011ab5105
========================
Client > service.online Time Service#43b19797-2563-42fe-bae2-0a5662cbe366 on 8000
2020-06-06T20:23:17.044Z
2020-06-06T20:23:17.045Z
2020-06-06T20:23:17.046Z
2020-06-06T20:23:17.046Z
2020-06-06T20:23:17.047Z
Client > service.online Time Service#649b3d77-3968-4ba4-9a49-aa923cf66166 on 8000
Please let me know if this is really an issue, or I misunderstood something.
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
why istio Round robin load balance not work as expect #23752
when Round robin load balance set a pod responsed many requests then turn the next pod . it should not be a pod...
Read more >ARR Load Balance Algorithm - Weighted Round Robin not ...
I used Least Response Time on my ARR implementation. The problem it's that the response time reduces when have more connections (maybe more ......
Read more >What is the round-robin load balancing technique?
Note: Round-robin is a static load balancer, because it does not modify the state of the servers while distributing incoming traffic.
Read more >Load balancing: Round robin may not be the right choice
Based on our experience, we believe Round robin may not be an effective load balancing algorithm, because it doesn't equally distribute ...
Read more >Load Balancing Algorithms, Types and Techniques - Kemp
Round robin load balancing is most appropriate for predictable client request streams that are being spread across a server farm whose members have ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes! I got the 2 Responders to share the workload now after I did these 2 things:
time-client.js
, before sending all requests.Thanks for the help, everyone!
glad that you got it working. this shouldn’t be an issue in production.