DEV Community

Discussion on: Round Robin implementation in C#

Collapse
 
cyberhck profile image
Nishchal Gautam

I like this implementation of round robin, it just does one thing and that's round robin (I've seen implementations of RR where assumption is always load balancing and http is baked right in :D )

I do however suggest a few features:

  • Weighted Round Robin (you can already do that by adding multiple instance of data), but it'd be good to maintain this internally
  • Ability to reset a instance's weight and decrement the weight

The second one would be good when let's say I have 5 endpoints and I've 5 clients with weight of 10 each (and maybe one of the machine is more reliable and has more resources, so maybe I want to set weight of 15)

Now when my app is running, if a machine goes down or fails somehow, I'd like to decrement the weight by 1, and if a machine goes down for a long time, it'd be taken off of our round robin, but before it reaches 0 and it comes back online, then we could reset it back to original value.

Basically requirement would be weighted round robin with the ability to change the weight of current instance.

Collapse
 
alialp profile image
Ali Alp

hi there , happy to hear that you liked my algorithm :) , I have added the feature that you have requested. I hope it will be useful for you :)