Package com.yahoo.search.dispatch
Class LoadBalancer
java.lang.Object
com.yahoo.search.dispatch.LoadBalancer
LoadBalancer determines which group of content nodes should be accessed next for each search query when the
internal java dispatcher is used.
The implementation here is a simplistic least queries in flight + round-robin load balancer
- Author:
- ollivir
-
Nested Class Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
releaseGroup
(Group group, boolean success, com.yahoo.search.dispatch.RequestDuration searchTime) Release an allocation given bytakeGroup(java.util.Set<java.lang.Integer>)
.Select and allocate the search cluster group which is to be used for the next search query.
-
Constructor Details
-
LoadBalancer
-
-
Method Details
-
takeGroup
Select and allocate the search cluster group which is to be used for the next search query. Callers must callreleaseGroup(com.yahoo.search.dispatch.searchcluster.Group, boolean, com.yahoo.search.dispatch.RequestDuration)
symmetrically for each taken allocation.- Parameters:
rejectedGroups
- if not null, the load balancer will only return groups with IDs not in the set- Returns:
- the node group to target, or empty if the internal dispatch logic cannot be used
-
releaseGroup
public void releaseGroup(Group group, boolean success, com.yahoo.search.dispatch.RequestDuration searchTime) Release an allocation given bytakeGroup(java.util.Set<java.lang.Integer>)
. The release must be done exactly once for each allocation.- Parameters:
group
- previously allocated groupsuccess
- was the query successfulsearchTime
- query execution time, used for adaptive load balancing
-