To avoid to iter over the worker nodes array to pick up the one matching, strategies can also propose to maintain or help to maintain a workers sorted list given the strategy algorithm. That should permit to make the worker choice O(nlog(n)) instead of O(n).
- The sorting is done given the current worker choice strategy algorithm
- The sorting can be done asynchronously
- Getting the chosen worker node key is peeking the sorted list
To avoid to iter over the worker nodes array to pick up the one matching, strategies can also propose to maintain or help to maintain a workers sorted list given the strategy algorithm. That should permit to make the worker choice
O(nlog(n))instead ofO(n).