Package org.apache.hadoop.hbase.quotas
Class FixedIntervalRateLimiter
java.lang.Object
org.apache.hadoop.hbase.quotas.RateLimiter
org.apache.hadoop.hbase.quotas.FixedIntervalRateLimiter
With this limiter resources will be refilled only after a fixed interval of time.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final org.slf4j.Loggerprivate longstatic final StringThe FixedIntervalRateLimiter can be harsh from a latency/backoff perspective, which makes it difficult to fully and consistently utilize a quota allowance.private final longFields inherited from class org.apache.hadoop.hbase.quotas.RateLimiter
DEFAULT_TIME_UNIT, QUOTA_RATE_LIMITER_CONF_KEY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlongprivate longgetRefillIntervalAdjustedLimit(long limit) longgetWaitInterval(long limit, long available, long amount) Time in milliseconds to wait for before requesting to consume 'amount' resource.longrefill(long limit) Refill the available units w.r.t the elapsed time.voidsetNextRefillTime(long nextRefillTime) Methods inherited from class org.apache.hadoop.hbase.quotas.RateLimiter
consume, consume, getAvailable, getLimit, getTimeUnitInMillis, getWaitIntervalMs, getWaitIntervalMs, isAvailable, isBypass, set, toString, update, waitInterval, waitInterval
-
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 theRATE_LIMITER_REFILL_INTERVAL_MSto 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:
-
LOG
-
nextRefillTime
-
refillInterval
-
-
Constructor Details
-
FixedIntervalRateLimiter
public FixedIntervalRateLimiter() -
FixedIntervalRateLimiter
-
-
Method Details
-
refill
Description copied from class:RateLimiterRefill the available units w.r.t the elapsed time.- Specified by:
refillin classRateLimiter- Parameters:
limit- Maximum available resource units that can be refilled to.- Returns:
- how many resource units may be refilled ?
-
getWaitInterval
Description copied from class:RateLimiterTime in milliseconds to wait for before requesting to consume 'amount' resource.- Specified by:
getWaitIntervalin classRateLimiter- Parameters:
limit- Maximum available resource units that can be refilled to.available- Currently available resource unitsamount- Resources for which time interval to calculate for- Returns:
- estimate of the ms required to wait before being able to provide 'amount' resources.
-
getRefillIntervalAdjustedLimit
-
setNextRefillTime
- Specified by:
setNextRefillTimein classRateLimiter
-
getNextRefillTime
- Specified by:
getNextRefillTimein classRateLimiter
-