Class TokenBucketSampler
java.lang.Object
com.apple.foundationdb.relational.util.TokenBucketSampler
- All Implemented Interfaces:
Sampler
A sampling engine which will pass a sample test according to a TokenBucket algorithm.
A Token-bucket algorithm allows a constant average throughput, but allows some burstiness by building up tokens over periods of idleness. For more information, see Wikipedia. You can control the burstiness by configuring the maximum number of tokens to allow in the sampler, and the average rate by adjusting the refresh interval. Note, however, that the refresh interval is typically sensitive to the clock used in computing the interval--the refresh interval typically cannot be smaller than the resolution of the system clock used.
-
Constructor Summary
ConstructorsConstructorDescriptionTokenBucketSampler
(int maxTokens, long refreshIntervalNanos, Clock clock) TokenBucketSampler
(int maxTokens, long refreshInterval, TimeUnit refreshTime, Clock clock) -
Method Summary