Class HelixGroupLeastLoadedStrategy
java.lang.Object
com.linkedin.venice.router.api.routing.helix.HelixGroupLeastLoadedStrategy
- All Implemented Interfaces:
HelixGroupSelectionStrategy
This strategy is tried to distribute more load to Helix Groups with more capacity.
Since the qps to a specific Router is not that high, so it is acceptable to use synchronized method
here.
TODO: if we notice a performance issue with the synchronized implementation, we could tune it better
to use Atomic data structures by sacrificing the accuracy.
This class is also leveraging
TimeoutProcessor
to handle potential group counter leaking issue.-
Field Summary
-
Constructor Summary
ConstructorDescriptionHelixGroupLeastLoadedStrategy
(TimeoutProcessor timeoutProcessor, long timeoutInMS, HelixGroupStats helixGroupStats) -
Method Summary
Modifier and TypeMethodDescriptionvoid
finishRequest
(long requestId, int groupId, double latency) Notify the corresponding Helix Group that the request is completed, and the implementation will decide whether any cleanup is required or not.int
selectGroup
(long requestId, int groupCount) Select a Helix Group for the current request.
-
Field Details
-
MAX_ALLOWED_GROUP
public static final int MAX_ALLOWED_GROUP- See Also:
-
-
Constructor Details
-
HelixGroupLeastLoadedStrategy
public HelixGroupLeastLoadedStrategy(TimeoutProcessor timeoutProcessor, long timeoutInMS, HelixGroupStats helixGroupStats)
-
-
Method Details
-
selectGroup
public int selectGroup(long requestId, int groupCount) Description copied from interface:HelixGroupSelectionStrategy
Select a Helix Group for the current request.- Specified by:
selectGroup
in interfaceHelixGroupSelectionStrategy
-
finishRequest
public void finishRequest(long requestId, int groupId, double latency) Description copied from interface:HelixGroupSelectionStrategy
Notify the corresponding Helix Group that the request is completed, and the implementation will decide whether any cleanup is required or not.- Specified by:
finishRequest
in interfaceHelixGroupSelectionStrategy
-