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
Modifier and TypeFieldDescriptionprivate long
static final String
The FixedIntervalRateLimiter can be harsh from a latency/backoff perspective, which makes it difficult to fully and consistently utilize a quota allowance.private final long
Fields inherited from class org.apache.hadoop.hbase.quotas.RateLimiter
DEFAULT_TIME_UNIT, QUOTA_RATE_LIMITER_CONF_KEY
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionlong
private long
getRefillIntervalAdjustedLimit
(long limit) long
getWaitInterval
(long limit, long available, long amount) Time in milliseconds to wait for before requesting to consume 'amount' resource.long
refill
(long limit) Refill the available units w.r.t the elapsed time.void
setNextRefillTime
(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_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
-
refillInterval
-
-
Constructor Details
-
FixedIntervalRateLimiter
public FixedIntervalRateLimiter() -
FixedIntervalRateLimiter
-
-
Method Details
-
refill
Description copied from class:RateLimiter
Refill the available units w.r.t the elapsed time.- Specified by:
refill
in 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:RateLimiter
Time in milliseconds to wait for before requesting to consume 'amount' resource.- Specified by:
getWaitInterval
in 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:
setNextRefillTime
in classRateLimiter
-
getNextRefillTime
- Specified by:
getNextRefillTime
in classRateLimiter
-