Details
Description
While using the patch in HBASE-11598 , I found that RateLimiter can't to limit the rate right.
/** * given the time interval, are there enough available resources to allow execution? * @param now the current timestamp * @param lastTs the timestamp of the last update * @param amount the number of required resources * @return true if there are enough available resources, otherwise false */ public synchronized boolean canExecute(final long now, final long lastTs, final long amount) { return avail >= amount ? true : refill(now, lastTs) >= amount; }
When avail >= amount, avail can't be refill. But in the next time to call canExecute, lastTs maybe update. So avail will waste some time to refill. Even we use smaller rate than the limit, the canExecute will return false.
Attachments
Attachments
Issue Links
- is related to
-
HBASE-11598 Add simple rpc throttling
- Closed