Class HelixGroupLeastLoadedStrategy

  • All Implemented Interfaces:
    HelixGroupSelectionStrategy

    public class HelixGroupLeastLoadedStrategy
    extends java.lang.Object
    implements 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

      Fields 
      Modifier and Type Field Description
      static int MAX_ALLOWED_GROUP  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void finishRequest​(long requestId, int groupId)
      Notify the corresponding Helix Group that the request is completed, and the implementation will decide whether any cleanup is required or not.
      int getAvgGroupPendingRequest()
      Get the average of the pending requests among all the groups
      int getMaxGroupPendingRequest()
      Get the maximum of the pending requests among all the groups
      int getMinGroupPendingRequest()
      Get the minimum of the pending requests among all the groups
      int selectGroup​(long requestId, int groupCount)
      Select a Helix Group for the current request.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait