Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Token bucket algorithm implementation for Python web apps.

License

NotificationsYou must be signed in to change notification settings

falconry/token-bucket

Repository files navigation

Build StatusPyPicodecov.iocode style: blue

A Token Bucket Implementation for Python Web Apps

Thetoken-bucket package provides an implementation of thetoken bucket algorithmsuitable for use in web applications for shaping or policing requestrates. This implementation does not require the use of an independenttimer 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 isreplenished gradually, rather than being immediately refilled at thebeginning of each epoch as is common with simple fixed windowcounters.
  • Burst duration can be explicitly controlled.

Moving window algorithms are resistant to bursting, but at the cost ofadditional processing and memory overhead vs. the token bucketalgorithm which uses a simple, fast counter per key. The latter approachdoes allow for bursting, but only for a controlled duration.

About

Token bucket algorithm implementation for Python web apps.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp