All Projects → titan-web → rate-limit

titan-web / rate-limit

Licence: MIT license
用于限流的令牌桶算法,漏桶算法(Python实现)

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to rate-limit

spillway
A simple, distributed and flexible rate limiter
Stars: ✭ 29 (-72.12%)
Mutual labels:  rate-limit
polaris-go
Lightweight Go SDK as Data Plane of Proxyless Service Governance Solution
Stars: ✭ 35 (-66.35%)
Mutual labels:  rate-limit
polaris
Service Governance Center for Distributed and Microservice Architecture
Stars: ✭ 1,062 (+921.15%)
Mutual labels:  rate-limit
fastapi-framework
A FastAPI Framework for things like Database, Redis, Logging, JWT Authentication, Rate Limits and Sessions
Stars: ✭ 26 (-75%)
Mutual labels:  rate-limit
freebind
IPv4 and IPv6 address rate limiting evasion tool
Stars: ✭ 88 (-15.38%)
Mutual labels:  rate-limit
FireflySoft.RateLimit
It is a rate limiting library based on .Net standard.
Stars: ✭ 76 (-26.92%)
Mutual labels:  rate-limit
adaptive throttler
manages multiple throttlers with ability to ramp up and down
Stars: ✭ 31 (-70.19%)
Mutual labels:  rate-limit
polaris-cpp
Lightweight C/C++ SDK used as Proxyless Service Governance Solution
Stars: ✭ 14 (-86.54%)
Mutual labels:  rate-limit
nestjs-throttler-storage-redis
Redis storage provider for the nestjs-throttler package.
Stars: ✭ 56 (-46.15%)
Mutual labels:  rate-limit
polaris-java
Lightweight Java SDK used as Proxyless Service Governance Solution
Stars: ✭ 84 (-19.23%)
Mutual labels:  rate-limit
gentle-force
Brute-force, error and request rate limiting
Stars: ✭ 45 (-56.73%)
Mutual labels:  rate-limit

Rate Limiter

降级和限流是面对大流量必不可少的神兵利器. 流量控制算法就是通过网络整形或者速率控制来解决此类问题.

流量控制算法

  • 令牌桶算法
  • 漏桶算法

令牌桶算法

  1. 每秒会有 r 个令牌放入桶中,或者说,每过 1/r 秒桶中增加一个令牌
  2. 桶中最多存放 b 个令牌,如果桶满了,新放入的令牌会被丢弃
  3. 当一个 n 字节的数据包到达时,消耗 n 个令牌,然后发送该数据包
  4. 如果桶中可用令牌小于 n,则该数据包将被缓存或丢弃

漏桶算法

  1. 数据被填充到桶中,并以固定速率注入网络中,而不管数据流的突发性
  2. 如果桶是空的,不做任何事情
  3. 主机在每一个时间片向网络注入一个数据包,因此产生一致的数据流

漏桶算法

这两个算法是有区别的: 漏桶算法能够强行限制数据的传输速率,而令牌桶算法在能够限制数据的平均传输速率外,还允许某种程度的突发传输.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].