You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Assuming I have X servers for a given service - and I want all the parameters (vnodes, weight) to be the same, is there any way to just say...
var correct_server_number = ring.getresult(number_of_servers,"foo bar")
Right now I'm doing something that seems ridiculous, but it may be the most efficient way.. supports up to 10 servers...
var ring = [ new HashRing(["1"]),
new HashRing(["1","2"])
new HashRing(["1","2","3"])
new HashRing(["1","2","3","4"])
new HashRing(["1","2","3","4","5"])
new HashRing(["1","2","3","4","5","6"])
new HashRing(["1","2","3","4","5","6","7"])
new HashRing(["1","2","3","4","5","6","7","8"])
new HashRing(["1","2","3","4","5","6","7","8","9"])
new HashRing(["1","2","3","4","5","6","7","8","9","10"])
]
var correct_server_number = ring[number_of_servers].get("foo bar");
The text was updated successfully, but these errors were encountered:
3rd-eden: Thanks - with the range function, the hashring needs to already have been defined (if I'm reading it correctly).
I've got half a dozen different server types and for each server type, I'll be scaling up and down instances dynamically based on load. I'll make a db query to find out how many instances there currently are for a given server type and then I'd like to know which instance to assign a user to based on their userid.
I want a function that generates a hashring with (X) "servers" with the "servers" simply being named ("1" through "X")
My code above works by generating 10 hashrings (supporting services for up to 10 servers) allowing me to say "tell me the appropriate server for a service that has 4 instances".
Assuming I have X servers for a given service - and I want all the parameters (vnodes, weight) to be the same, is there any way to just say...
var correct_server_number = ring.getresult(number_of_servers,"foo bar")
Right now I'm doing something that seems ridiculous, but it may be the most efficient way.. supports up to 10 servers...
The text was updated successfully, but these errors were encountered: