Interface RateLimiting


@Private @Unstable public interface RateLimiting
Minimal subset of google rate limiter class. Can be used to throttle use of object stores where excess load will trigger cluster-wide throttling, backoff etc. and so collapse performance. The time waited is returned as a Duration type. The google rate limiter implements this by allowing a caller to ask for more capacity than is available. This will be granted but the subsequent request will be blocked if the bucket of capacity hasn't let refilled to the point where there is capacity again.
  • Method Summary

    Modifier and Type
    Method
    Description
    acquire(int requestedCapacity)
    Acquire rate limiter capacity.
  • Method Details

    • acquire

      Duration acquire(int requestedCapacity)
      Acquire rate limiter capacity. If there is not enough space, the permits will be acquired, but the subsequent call will block until the capacity has been refilled.
      Parameters:
      requestedCapacity - capacity to acquire.
      Returns:
      time spent waiting for output.