You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hbase.apache.org by "Bryan Beaudreault (Jira)" <ji...@apache.org> on 2024/02/13 13:23:00 UTC

[jira] [Created] (HBASE-28359) Improve quota RateLimiter synchronization

Bryan Beaudreault created HBASE-28359:
-----------------------------------------

             Summary: Improve quota RateLimiter synchronization
                 Key: HBASE-28359
                 URL: https://issues.apache.org/jira/browse/HBASE-28359
             Project: HBase
          Issue Type: Improvement
            Reporter: Bryan Beaudreault


We've been experiencing RpcThrottlingException with 0ms waitInterval. This seems odd and wasteful, since the client side will immediately retry without backoff. I think the problem is related to the synchronization of RateLimiter.

The TimeBasedLimiter checkQuota method does the following:
{code:java}
if (!reqSizeLimiter.canExecute(estimateWriteSize + estimateReadSize)) {
  RpcThrottlingException.throwRequestSizeExceeded(
    reqSizeLimiter.waitInterval(estimateWriteSize + estimateReadSize));
} {code}
Both canExecute and waitInterval are synchronized, but we're calling them independently. So it's possible under high concurrency for canExecute to return false, but then waitInterval returns 0 (would have been true)

I think we should simplify the API to have a single synchronized call:
{code:java}
long waitInterval = reqSizeLimiter.tryAcquire(estimateWriteSize + estimateReadSize);
if (waitInterval > 0) {
  RpcThrottlingException.throwRequestSizeExceeded(waitInterval);
}{code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)