Skip to content

Bucket capacity with multiple bandwidths #350

Discussion options

You must be logged in to vote

Answer 1

Bandwidth limit = Bandwidth.simple(1000, Duration.ofHours(1));

According to source code the code above equals to following:

int capacity = 1000;
Refill.greedy(1000, Duration.ofHours(1))
Bandwidth limit = Bandwidth.classic(capacity, refill)
  • capacity specifies the maximim amount of tokens
  • refill specifies the speed(and style) in which consumed tokens are returned back.

Answer 2

Capacity, currently available tokens, and last refill date are maintended independently for each bandwidth.
Aggregated acapacity for whole bucket is useless and never used. Aggregated available tokens is taken as minimum from all bandwidths. If first bandwidth has 3 available tokens, second bandwidth has 1…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@alantonica
Comment options

@vladimir-bukhtoyarov
Comment options

@alantonica
Comment options

Answer selected by alantonica
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants