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
Currently the load balancer is implemented (on the Model level) at `model.NodeList.best()'.
It works like this:
def best(cls, n=3):
all_nodes = cls.get()
candidates = [a for a in all_nodes if a.alive and a.enabled]
by_score = sorted(candidates, key=lambda a: a.score)[:n]
random.shuffle(by_score)
return cls(by_score)
This is then exposed through two calls, POST /node?filter=best (requiers authentication and gives full info on the nodes) and GET /lokun/loadbalancer?count=n (exposes IP and name).
What happens to this if there are only 0, 1 or 2 nodes alive and enabled?
This has one minor problem. The best n nodes are picked and then shuffled around. I would like to pick the best nodes, even though the score varies by maybe 1-2, then shuffle them and return the n best ones. Something like this (in pythonic psuedo code):
def best(cls, n=3):
all_nodes = cls.get()
candidates = [a for a in all_nodes if a.alive and a.enabled]
min_score = min(a.score for a in candidates)
by_score = [a for a in candidates if a.score.within_logscale(min_score)]
random.shuffle(by_score)
return by_score
This would be less exclusive of nodes that are very close in score.
The text was updated successfully, but these errors were encountered:
Currently the load balancer is implemented (on the Model level) at `model.NodeList.best()'.
It works like this:
This is then exposed through two calls,
POST /node?filter=best
(requiers authentication and gives full info on the nodes) andGET /lokun/loadbalancer?count=n
(exposes IP and name).This has one minor problem. The best
n
nodes are picked and then shuffled around. I would like to pick the best nodes, even though thescore
varies by maybe 1-2, then shuffle them and return then
best ones. Something like this (in pythonic psuedo code):This would be less exclusive of nodes that are very close in score.
The text was updated successfully, but these errors were encountered: