Class FixedIntervalRateLimiter

java.lang.Object
org.apache.hadoop.hbase.quotas.RateLimiter
org.apache.hadoop.hbase.quotas.FixedIntervalRateLimiter

@Private @Evolving public class FixedIntervalRateLimiter extends RateLimiter
With this limiter resources will be refilled only after a fixed interval of time.
  • Field Details

    • RATE_LIMITER_REFILL_INTERVAL_MS

      The FixedIntervalRateLimiter can be harsh from a latency/backoff perspective, which makes it difficult to fully and consistently utilize a quota allowance. By configuring the RATE_LIMITER_REFILL_INTERVAL_MS to a lower value you will encourage the rate limiter to throw smaller wait intervals for requests which may be fulfilled in timeframes shorter than the quota's full interval. For example, if you're saturating a 100MB/sec read IO quota with a ton of tiny gets, then configuring this to a value like 100ms will ensure that your retry backoffs approach ~100ms, rather than 1sec. Be careful not to configure this too low, or you may produce a dangerous amount of retry volume.
      See Also:
    • nextRefillTime

      private long nextRefillTime
    • refillInterval

      private final long refillInterval
  • Constructor Details

  • Method Details

    • refill

      public long refill(long limit)
      Description copied from class: RateLimiter
      Refill the available units w.r.t the elapsed time.
      Specified by:
      refill in class RateLimiter
      Parameters:
      limit - Maximum available resource units that can be refilled to.
      Returns:
      how many resource units may be refilled ?
    • getWaitInterval

      public long getWaitInterval(long limit, long available, long amount)
      Description copied from class: RateLimiter
      Time in milliseconds to wait for before requesting to consume 'amount' resource.
      Specified by:
      getWaitInterval in class RateLimiter
      Parameters:
      limit - Maximum available resource units that can be refilled to.
      available - Currently available resource units
      amount - Resources for which time interval to calculate for
      Returns:
      estimate of the ms required to wait before being able to provide 'amount' resources.
    • getRefillIntervalAdjustedLimit

      private long getRefillIntervalAdjustedLimit(long limit)
    • setNextRefillTime

      public void setNextRefillTime(long nextRefillTime)
      Specified by:
      setNextRefillTime in class RateLimiter
    • getNextRefillTime

      public long getNextRefillTime()
      Specified by:
      getNextRefillTime in class RateLimiter