Rotate connections sooner with symmetric lifetime jitter - #122
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
HTTP/2 长连接在高峰时段容易被中间盒限速,因此需要周期性轮换连接。原实现默认连接寿命 7 分钟、随机 jitter 为"只加 50%"(即
[base, 1.5×base]),存在两个问题:改动
DefaultConnLifetimeSec从 420s(7min)降至 360s(6min)。rotationLifetime由"只加 50%"改为"对称 ±30%",即[0.7×base, 1.3×base]。TestRotationLifetimeJitter校验上下界)与 README 文档。效果
测试
go test ./transport/...通过make lint0 issues