API loadbalancing
Support loadbalancing of API calls
When operating on a server group with more than one server, API calls should go into one of two modes:
- Send the call to each of the servers, then aggregate the results
- Send the command to only one server
In the latter case, the target server must be selected in such a way that it reaches the best server available for the current call. We should start by providing a general method, e.g. select_server
, which takes arbitrary keyword arguments and returns the "best" server. As a stub, we can start with returnign a random server, then later extend the logic (cf. separate issues).
The selection process should investigate each member server in the following way:
- Start with giving each server a ranking of 10 points.
- Apply each checkton each server, decreasing its ranking on the way (e.g. by takign ssytem load, etc., into account). A ranking of 0 means the server is unavailable.
- Return the server with the highest ranking. If multiple servers share the same highest ranking, fall back to round robin.
Edited by Nik | Klampfradler