Class IncompleteResultsThrottler

java.lang.Object
com.yahoo.vespa.http.client.core.operationProcessor.IncompleteResultsThrottler

public class IncompleteResultsThrottler extends Object
Adjusts in-flight operations based on throughput. It will walk the graph and try to find local optimum. It looks at the throughput, adjust max in-flight based on the previous throughput and settings. In the beginning it moves faster, and then stabilizes. It will wait a bit after adjusting before it starts to sample, since there is a latency between adjustment and result. There are several mechanisms to reduce impact of several clients running in parallel. The window size has a random part, and the wait time before sampling after adjustment has a random part as well. To avoid running wild with large values of max-in flight, it is tuned to stay on the smaller part, and rather reduce max-in flight than to have a too large value. In case the where the queue is moved to minimum size, it will now and then increase queue size to get more sample data and possibly grow size. Class is fully thread safe, i.e. all public methods are thread safe.
Author:
dybis
  • Field Details

    • phaseSizeMs

      public final long phaseSizeMs
    • INITIAL_MAX_IN_FLIGHT_VALUE

      protected static int INITIAL_MAX_IN_FLIGHT_VALUE
    • SECOND_MAX_IN_FLIGHT_VALUE

      protected static int SECOND_MAX_IN_FLIGHT_VALUE
  • Constructor Details

    • IncompleteResultsThrottler

      public IncompleteResultsThrottler(int minInFlightValue, int maxInFlightValue, Clock clock, ThrottlePolicy policy)
      Creates the throttler.
      Parameters:
      minInFlightValue - the throttler will never throttle beyond this limit.
      maxInFlightValue - the throttler will never throttle above this limit. If zero, no limit.
      clock - use to calculate window size. Can be null if minWindowSize and maxInFlightValue are equal.
      policy - is the algorithm for finding next value of the number of in-flight documents operations.
  • Method Details

    • availableCapacity

      public int availableCapacity()
    • operationStart

      public void operationStart()
    • getDebugMessage

      public String getDebugMessage()
    • resultReady

      public void resultReady(boolean success)
    • waitingThreads

      protected int waitingThreads()