Interface HelixGroupSelectionStrategy

All Known Implementing Classes:
HelixGroupLatencyAdaptiveStrategy, HelixGroupLeastLoadedStrategy, HelixGroupRoundRobinStrategy, HelixGroupSelector

public interface HelixGroupSelectionStrategy
  • Method Summary

    Modifier and Type
    Method
    Description
    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.
    default void
    finishRequest(long requestId, int groupId, int keyCount, double latency)
    Size-aware request completion: records the latency under the request's keyCount so a size-aware strategy can attribute it to the matching bucket.
    default void
    finishRequest(long requestId, int groupId, int keyCount, double latency, boolean success)
    Success-aware request completion: success is false when 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.
    int
    selectGroup(long requestId, int groupCount)
    Select a Helix Group for the current request.
    default int
    selectGroup(long requestId, int groupCount, int keyCount)
    Size-aware group selection: keyCount is 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: keyCount is the number of keys in the request, letting a strategy route by request size. Defaults to the size-agnostic selectGroup(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's keyCount so a size-aware strategy can attribute it to the matching bucket. Defaults to the size-agnostic finishRequest(long, int, double).
    • finishRequest

      default void finishRequest(long requestId, int groupId, int keyCount, double latency, boolean success)
      Success-aware request completion: success is false when 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-agnostic finishRequest(long, int, int, double).