Very fast implementation of the token bucket algorithm.
Project description
A Token Bucket Implementation for Python Web Apps
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 resistant 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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file token_bucket-0.3.0.tar.gz.
File metadata
- Download URL: token_bucket-0.3.0.tar.gz
- Upload date:
- Size: 6.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.5.0.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
979571c99db2ff9e651f2b2146a62b2ebadf7de6c217a8781698282976cb675f
|
|
| MD5 |
111c6213775be10e01196b75d862e3ae
|
|
| BLAKE2b-256 |
b76d386ed0cfb7f3c2e0311a96b3884a2ba98a7b958344f51c7cce0b1c7bbb0f
|
File details
Details for the file token_bucket-0.3.0-py2.py3-none-any.whl.
File metadata
- Download URL: token_bucket-0.3.0-py2.py3-none-any.whl
- Upload date:
- Size: 9.5 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.5.0.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6df24309e3cf5b808ae5ef714a3191ec5b54f48c34ef959e4882eef140703369
|
|
| MD5 |
e242207ee93a8ff65b8dbd1a2a4af891
|
|
| BLAKE2b-256 |
4bce61ee52521766059d2c2537e85ba5f9773313e74b86df14652a61dd2e990e
|