Comments (1)
token
与window
代表什么?
dfget里实现里一个简单的令牌桶算法(token-bucket)来限流,关于限流的一些文章可以参考这里。
关于令牌桶算法,下面节选自Wikipedia:
The token bucket algorithm can be conceptually understood as follows:
1. A token is added to the bucket every 1/r seconds.
2. The bucket can hold at the most b tokens. If a token arrives when the bucket is full, it is discarded.
3. When a packet (network layer PDU) of n bytes arrives, n tokens are removed from the bucket, and the packet is sent to the network.
4. If fewer than n tokens are available, no tokens are removed from the bucket, and the packet is considered to be non-conformant.
代码里的token
跟这里的token
完全一致。window
是维基里说的1/r seconds
,表示产生令牌的间隔,window
期间产生的令牌数由rate
指定。
主机限速的逻辑
同一台机器上,第一个dfget进程启动时,会同时启动一个server
进程用来做p2p里的上传服务,端口会保存在本地的meta文件里;当其他dfget启动时,会检查是否有server
已经启动了,有的话,上报自己的限速参数,由server
计算出各个dfget任务的速率比例,再按此比例重新分配totallimit值,各个dfget任务按此新值来限速。
from dragonfly.
Related Issues (20)
- dfget server endpoint does not support TLS
- It can be installed to kubernetes through helm?
- level=error msg="unknown shorthand flag: 's' in -supernode.advertiseIp=127.0.0.1" HOT 4
- Test failed: http_util_test.go:95: HTTPUtilTestSuite.TestGet
- 关于Dragonfly缓存没有生效的问题 HOT 1
- Does Dragonfly support DADI?
- Replace the Qr code of DingTalk Group
- Change README link font size.
- HTTPUtilTestSuite.TestGet HOT 1
- Unit tests failed: HTTPSuite.SetUpTest
- dfget may leak credentials (via --header flag) when called by dfdaemon
- Even with cdnPattern: source, dfget connects to the downloadPort
- supernode writes debug logs even if configured with debug: false
- Upgrading to golang 1.16.1+
- Harbor配置P2P预热失败
- OOM in containerized dfget in Kubernetes
- dfget变僵尸进程
- knative pull image by Dragonfly is error
- daemon support identifier
- ipv6 support HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dragonfly.