feat: confirm slot degradation with active probe over the slot connection - #108
Merged
Conversation
…tion Passive throughput sampling alone misjudges slow origins and stalled streams as degraded connections. The server now serves a pre-generated random payload at /v3/probe (token-gated via the master key); the client downloads it through the suspected slot's own HTTP/2 connection and only marks the slot degraded after consecutive slow probe verdicts. Older servers keep the legacy passive-only behavior.
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.
背景
当前 slot degraded 判定依赖被动采样(每 5s 统计 slot 下载吞吐),存在三类误判:
方案
服务端新增
GET /v3/probe端点:返回启动时预生成的 128KB 随机数据(x-es头携带 master key 派生的能力令牌校验,错误 token 返回 fallback 伪装页,per-IP 限流)。客户端健康循环中,被动采样只负责「怀疑」:低吞吐持续 3 个周期后对该 slot 发起主动探测——通过该 slot 自己的 HTTP/2 连接下载 128KB 随机数据并计算速度(排除 TTFB,3s 超时):
链路健康门控(RTT)
degraded 检测(怀疑累积、主动探测、空闲 retire)只在链路健康时运行,拥塞时冻结,避免全链路变慢时反复标记→重拨的空转:
变更
server/handler/probe.go:/v3/probe 端点(token 校验 + 限流 + 分块下发)transport/http2/probe.go:slotProber 主动探测(同连接测量,四态判定);探测 TTFB 记入路径 RTTtransport/http2/lifecycle.go:怀疑→探测确认流程、链路参考规则、回退逻辑、RTT 门控transport/http2/stream.go:bootstrap 往返计时(MarkBootstrapSent + 响应头到达打点),每个请求产生一个纯路径 RTT 样本client/proxy/stream.go:握手记录 flush 后打点;移除混入源站时间的旧 RTT 记录crypto/kdf.go:ProbeToken 派生(HKDF)兼容性