Interface HelixGroupSelectionStrategy
- All Known Implementing Classes:
HelixGroupLatencyAdaptiveStrategy,HelixGroupLeastLoadedStrategy,HelixGroupRoundRobinStrategy,HelixGroupSelector
public interface HelixGroupSelectionStrategy
-
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.default 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.default 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.intselectGroup(long requestId, int groupCount) Select a Helix Group for the current request.default intselectGroup(long requestId, int groupCount, int keyCount) Size-aware group selection:keyCountis the number of keys in the request, letting a strategy route by request size.
-
Method Details
-
selectGroup
int selectGroup(long requestId, int groupCount) Select a Helix Group for the current request. -
finishRequest
void 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. -
selectGroup
default int selectGroup(long requestId, int groupCount, int keyCount) Size-aware group selection:keyCountis the number of keys in the request, letting a strategy route by request size. Defaults to the size-agnosticselectGroup(long, int)so strategies that do not care about request size (round-robin, least-loaded) need no change. -
finishRequest
default void finishRequest(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. Defaults to the size-agnosticfinishRequest(long, int, double). -
finishRequest
default void finishRequest(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. Group bookkeeping still happens regardless. Defaults to the success-agnosticfinishRequest(long, int, int, double).
-