Closed danwkennedy closed 8 years ago
This should be fixed in version 0.3.4
. Feel free to update your dependency tree.
Moreover, 2 minor features were added to resilient
.
You can enable the random balancer simply enabling the option, such as:
var client = Resilient({
balancer: {
random: true
}
})
Additionally, if you want to use a custom balancer strategy, you can use it via balanceStrategy
option:
var client = Resilient({
balancer: {
balanceStrategy: servers => {
return servers.sort(myCustomSorter)
}
}
})
For more details, take a look the docs: https://github.com/resilient-http/resilient.js#balancer
Works like a charm now. Thanks for the quick turnaround!
Either I'm not configuring it right or the balancer doesn't actually balance the load between the servers.
My setup is the following:
When I start the 3 consumers, they each latch onto one of the two service servers and never let go. In the case below, two consumers latch onto one node in the service while the third latches onto the second (which I guess is a bit better than all three on one but theoretically worse than a simple randomization strategy).
Consumer 1:
Consumer 2:
Consumer 3:
The configuration used is as follows:
The behavior is the same for the default balancer options as well. Since basic client-side load balancing was the goal of importing this project, this is a deal breaker for me.