Class HelixGroupSelector
java.lang.Object
com.linkedin.venice.router.api.routing.helix.HelixGroupSelector
- All Implemented Interfaces:
HelixGroupSelectionStrategy
This class is a thin wrapper of
HelixInstanceConfigRepository and HelixGroupSelectionStrategy, and it
will delegate all the related API calls to the corresponding objects.
Besides that, this class is also in charge of emitting metrics for each Helix Group.-
Constructor Summary
ConstructorsConstructorDescriptionHelixGroupSelector(io.tehuti.metrics.MetricsRepository metricsRepository, HelixInstanceConfigRepository instanceConfigRepository, HelixGroupSelectionStrategyEnum strategyEnum, TimeoutProcessor timeoutProcessor, double skewRampExponent, NavigableMap<Integer, Integer> latencyAdaptiveBatchGetThresholdMs, double evenUntilFraction, long minSampleCount) -
Method Summary
Modifier and TypeMethodDescriptionvoidfinishRequest(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.voidfinishRequest(long requestId, int groupId, int keyCount, double latency) Size-aware request completion: records the latency under the request'skeyCountso a size-aware strategy can attribute it to the matching bucket.voidfinishRequest(long requestId, int groupId, int keyCount, double latency, boolean success) Success-aware request completion:successisfalsewhen the request failed (error or throttled) response, letting a latency-adaptive strategy keep the latency sample out of its routing signal so a fast-failing group is not mistaken for a fast-serving one.intintgetInstanceGroupId(String instanceId) intselectGroup(long requestId, int groupNum) Select a Helix Group for the current request.intselectGroup(long requestId, int groupNum, int keyCount) Size-aware group selection:keyCountis the number of keys in the request, letting a strategy route by request size.
-
Constructor Details
-
Method Details
-
getInstanceGroupId
-
getGroupCount
public int getGroupCount() -
selectGroup
public int selectGroup(long requestId, int groupNum) Description copied from interface:HelixGroupSelectionStrategySelect a Helix Group for the current request.- Specified by:
selectGroupin interfaceHelixGroupSelectionStrategy
-
selectGroup
public int selectGroup(long requestId, int groupNum, int keyCount) Description copied from interface:HelixGroupSelectionStrategySize-aware group selection:keyCountis the number of keys in the request, letting a strategy route by request size. Defaults to the size-agnosticHelixGroupSelectionStrategy.selectGroup(long, int)so strategies that do not care about request size (round-robin, least-loaded) need no change.- Specified by:
selectGroupin interfaceHelixGroupSelectionStrategy
-
finishRequest
public void finishRequest(long requestId, int groupId, double latency) Description copied from interface:HelixGroupSelectionStrategyNotify the corresponding Helix Group that the request is completed, and the implementation will decide whether any cleanup is required or not.- Specified by:
finishRequestin interfaceHelixGroupSelectionStrategy
-
finishRequest
public void finishRequest(long requestId, int groupId, int keyCount, double latency) Description copied from interface:HelixGroupSelectionStrategySize-aware request completion: records the latency under the request'skeyCountso a size-aware strategy can attribute it to the matching bucket. Defaults to the size-agnosticHelixGroupSelectionStrategy.finishRequest(long, int, double).- Specified by:
finishRequestin interfaceHelixGroupSelectionStrategy
-
finishRequest
public void finishRequest(long requestId, int groupId, int keyCount, double latency, boolean success) Description copied from interface:HelixGroupSelectionStrategySuccess-aware request completion:successisfalsewhen the request failed (error or throttled) response, letting a latency-adaptive strategy keep the latency sample out of its routing signal so a fast-failing group is not mistaken for a fast-serving one. Group bookkeeping still happens regardless. Defaults to the success-agnosticHelixGroupSelectionStrategy.finishRequest(long, int, int, double).- Specified by:
finishRequestin interfaceHelixGroupSelectionStrategy
-