Very fast implementation of the token bucket algorithm.
Project description
The token-bucket package provides an implementation of the token bucket algorithm suitable for use in web applications for shaping or policing request rates. This implementation does not require the use of an independent timer thread to manage the bucket state.
Compared to other rate-limiting algorithms that use a simple counter, the token bucket algorithm provides the following advantages:
The thundering herd problem is avoided since bucket capacity is replenished gradually, rather than being immediately refilled at the beginning of each epoch as is common with simple fixed window counters.
Burst duration can be explicitly controlled
Moving window algorithms are resitant to bursting, but at the cost of additional processing and memory overhead vs. the token bucket algorithm which uses a simple, fast counter per key. The latter approach does allow for bursting, but only for a controlled duration.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file token_bucket-0.1.0.tar.gz
.
File metadata
- Download URL: token_bucket-0.1.0.tar.gz
- Upload date:
- Size: 6.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c24fd6cf5c6f77b001c91ca1a5b4c82e3ed9e3a80ddab4f10f52efe3e467f732 |
|
MD5 | add9e03bb26fa8f31a254e20ac2d3d40 |
|
BLAKE2b-256 | 048aafc91df7425533466c7a31fe0e83e4dc03c1f07a11c0bc7812cb7646255f |
File details
Details for the file token_bucket-0.1.0-py2.py3-none-any.whl
.
File metadata
- Download URL: token_bucket-0.1.0-py2.py3-none-any.whl
- Upload date:
- Size: 10.4 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c772654a90e07d0561bd3385e6e370a11330f014d8d18c44b2349cf113e042c6 |
|
MD5 | 83afa9e37d7364d73511f04ade3e31e0 |
|
BLAKE2b-256 | 3fcc942ee9bbc422dabdae4092273a24bb4375124b0c3cc9259c33aeb839610f |