-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
XHTTP Client: Race Dialer #4320
base: main
Are you sure you want to change the base?
Conversation
看起来不错 不过有点点小问题 对不同的host进行了等待防止多次race 这很好 但是xhttp中的单个client不会有其他目标 所以对不同的host等待是没有必要的 这样复杂的功能最好有个test(好像有点难写) 最后有俩 type switch 虽然知道是安全的但还是写了panic 一个小建议改成 |
You are right that each
The race wait does happen for |
我的表达可能有点问题 stream up的两个请求和packet up的多个请求确实会在一个客户端 这个等待部分有用 但是假如有多个请求同时进入核心会涉及多个client 这个仍会多次race 不过如果觉得这是正常倒也说得过去 |
Multiple clients will create multiple connections. Since they don't share connection, we should let them start race together - otherwise we would waste 1-RTT for all but one connections just to know the race winner. And Chrome's default parameters are really trying to avoid real racing. H3 handshake uses only 1-RTT, so > 300ms means
The |
感谢 PR,为了防止损坏现有功能,我倾向于这个 PR 放下个版本之后 |
9006e3b
to
07ba7c9
Compare
07ba7c9
to
90a4155
Compare
Fixed a bug that request being raced would fail, due to failed roundtrip attempts closing the request body. I also observed some special Firewall behavior against HTTP3: the QUIC handshake packets can pass through, but data packets with h3 payload are dropped. I'm trying to detect and mark h3 as broken for this situation.
@RPRX Do you plan to give this feature a try in the next release after v25.1.30, or some release in further future? |
首先我不确定服务端能否很好地处理这种情况,不过如果用不同的 sessionId 应该可以 其次就是我不太确定这个东西是否实用,因为对于 XHTTP 首包延迟是无关紧要的,运营商有没有 Q UDP 才是最重要的 就是说后面的请求都是 0-RTT,延迟都差不多,而带宽能跑到多少更影响使用体验,这个目前由用户自己的体感决定 |
My main motivation to implement this is not to select the better connection, but to mimic the normal client behavior when connecting to an H3 enabled site.
Therefore, advanced firewalls can temporarily block UDP QUIC traffic and see if a TCP TLS connection to the same endpoint will be established soon. If not then the firewall can quite confidently say this is not normal traffic. |
我觉得在这方面确实会更像,但也会导致带宽不可控,因为有些运营商 Q UDP,或许本就想用 QUIC 的更适合用这个? |
The current logic really prefers QUIC such that I don't expect H2 to be even attempted, let along selected, for a network that allows QUIC to properly function. (H2 will only be attempted if QUIC handshake is not finished in 1.5x the past average, or 300ms for the first time.) Therefore I don't worry about "bandwidth being uncontrollable" because you'll get H3 if H3 works. And if you don't want H3, don't enable H3. Instead, the choices are: for UDP-blocked network, do you want, A. no connection, or B. some connection? Only if the user want choice A should they choose H3 only. And based on my previous comment, this incurs the risk to be detected by some proactive firewall. I would instead argue that enabling race dialer with |
|
我又想了一下,如果代码里判断的是谁先完成 TLS 握手,则不涉及 XHTTP session id 的问题,但我直觉是代码似乎写得过于复杂?如果我要写这个的话分别挂个 http trace 即可 还有现在比较大的问题是 quic-go 并非 Chrome 指纹,这个 PR 只能起到类似 balancer leastPing 的效果 |
There are some subtleties that cannot be implemented with httptrace context:
Hope uQuic or similar mitigation could land in foreseeable future.
At least for users that frequently switch between different networks and prefers H3, this would use H3 whenever possible while automatically fallback to H2 - So I no longer need to switch between configurations manually. Though being "race", please note that |
我是觉得如果预期就是使用 H3,能更像 Chrome 当然更好,但是现在 quic-go 非 Chrome 指纹,现在合的话反而会比较奇怪 所以应该会等到我们有 Chrome 指纹的 QUIC 后再考虑这个,如果有针对 XHTTP 其它方面的想法,欢迎 PR |
Add Race dialer for XHTTP:
h3
andh2
in ALPN.h3
as ALPN.h3
andh2
connection. The first connection that succeed dialing is used.