Class HelixGroupRoutingStrategy

java.lang.Object
com.linkedin.venice.fastclient.meta.AbstractClientRoutingStrategy
com.linkedin.venice.fastclient.meta.HelixGroupRoutingStrategy
Direct Known Subclasses:
HelixLatencyAdaptiveGroupRoutingStrategy, HelixLeastLoadedGroupRoutingStrategy

public class HelixGroupRoutingStrategy extends AbstractClientRoutingStrategy
This strategy will assign an ordering of helix groups via round-robin for even distribution. The fanout in multi-get will be performed using instances belonging to the assigned groups. If no instance belonging to the selected group is found for a given partition, the instance with the next group in the assigned ordering will be used
  • Field Details

  • Constructor Details

    • HelixGroupRoutingStrategy

      public HelixGroupRoutingStrategy(InstanceHealthMonitor instanceHealthMonitor, io.tehuti.metrics.MetricsRepository metricsRepository, String storeName)
  • Method Details

    • getReplicas

      public String getReplicas(long requestId, int groupId, List<String> replicas)
      Overrides:
      getReplicas in class AbstractClientRoutingStrategy
    • getGroupCount

      public int getGroupCount()
    • updateHelixGroupInfo

      public void updateHelixGroupInfo(Map<String,Integer> instanceToHelixGroupIdMap)
      Overrides:
      updateHelixGroupInfo in class AbstractClientRoutingStrategy
    • getHelixGroupId

      public int getHelixGroupId(long requestId, int groupIdForOriginalRequest)
      Overrides:
      getHelixGroupId in class AbstractClientRoutingStrategy
    • trackRequest

      public boolean trackRequest(RequestContext requestContext)
      Description copied from class: AbstractClientRoutingStrategy
      This method is used to track the request for any custom logic that needs to be executed when a request is sent.
      Overrides:
      trackRequest in class AbstractClientRoutingStrategy
      Returns:
      boolean to indicate whether the request is tracked or not.
    • shouldRecordLatency

      protected boolean shouldRecordLatency(RequestContext requestContext, Throwable throwable)
      Whether a completed request feeds the group latency signal. Every completion counts here, preserving the least-loaded behavior where slow failures raise a group's average; the latency-adaptive strategy narrows this.
    • recordLatencySample

      protected void recordLatencySample(int groupId, int keyCount, double latency)
      Records a group's measured latency. The base strategy feeds the shared response-waiting-time metric (also consumed by least-loaded routing); the latency-adaptive strategy overrides this to record into its dedicated per-(group, bucket) routing metric when it is configured size-aware.