Uploaded image for project: 'HBase'
  1. HBase
  2. HBASE-28359

Improve quota RateLimiter synchronization

    XMLWordPrintableJSON

Details

    Description

      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:

      if (!reqSizeLimiter.canExecute(estimateWriteSize + estimateReadSize)) {
        RpcThrottlingException.throwRequestSizeExceeded(
          reqSizeLimiter.waitInterval(estimateWriteSize + estimateReadSize));
      } 

      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:

      long waitInterval = reqSizeLimiter.tryAcquire(estimateWriteSize + estimateReadSize);
      if (waitInterval > 0) {
        RpcThrottlingException.throwRequestSizeExceeded(waitInterval);
      }

      Attachments

        Issue Links

          Activity

            People

              rmdmattingly Ray Mattingly
              bbeaudreault Bryan Beaudreault
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: