feat(httpnet): opt-in HTTP/3 retrieval PoC#1178
Draft
lidel wants to merge 1 commit into
Draft
Conversation
Add WithHTTP3() to opportunistically upgrade HTTP block retrieval to HTTP/3 for hosts that advertise it via Alt-Svc, persisting the verdict in the peerstore and falling back to HTTP/2 (with a per-host back-off) when QUIC is unavailable. Off by default. The httpnet status metric gains a version label (h2/h3) so HTTP/2 and HTTP/3 traffic can be compared.
Codecov Report❌ Patch coverage is @@ Coverage Diff @@
## main #1178 +/- ##
==========================================
+ Coverage 63.58% 63.62% +0.04%
==========================================
Files 268 269 +1
Lines 26964 27072 +108
==========================================
+ Hits 17144 17225 +81
- Misses 8102 8124 +22
- Partials 1718 1723 +5
... and 8 files with indirect coverage changes 🚀 New features to boost your workflow:
|
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.
Important
We have no HTTP/3 providers, so parking this until we have anything to test against.
bitswap/network/httpnetfetches raw blocks over HTTP, but only over HTTP/1.1 and HTTP/2. This adds optional HTTP/3 (QUIC) so the client can use the faster transport when a provider supports it.How it works
You can't switch a live TCP connection to HTTP/3. The client has to learn that a host speaks HTTP/3, then open a separate QUIC connection. This PR uses
Alt-Svcfor that, which needs no change to provider records or multiaddrs:/tcp/443/tls/httpaddress.Alt-Svc: h3header, the client remembers it and sends later requests over HTTP/3.A
versionlabel (h2/h3) on thestatusmetric lets operators compare HTTP/2 and HTTP/3 traffic.Other ways to find HTTP/3 (future work)
We use
Alt-Svcfirst because httpnet already makes an HTTP/2 probe during connect, so reading the header costs nothing extra, and it needs no change to providers, DNS, or multiaddrs. It is not the only option, and later PRs can add others alongside it:alpn=h3): tells the client up front, before it connects, so it can skip the first HTTP/2 request. Works for DNS-named endpoints only, and needs HTTPS-record lookups./quic-v1/http): the provider announces HTTP-over-QUIC directly. Deterministic, but needs a multiaddr convention and providers that announce it.HTTP/3 in the ecosystem today
Few IPFS HTTP providers speak HTTP/3 yet.
Tested on 22026-06-18: of the providers currently announced for a sample CIDs through
delegated-ipfs.dev(bafy...4yeq), all serve HTTP/2 and none advertise HTTP/3:Alt-Svc: h3gateway-v1.devpinata.cloudalpn="h2"indexer.storacha.networka-fil-http.aur.luf010479.twinquasar.iop-fil-http.aur.lutrustless.filebase.ioThe gateways behind Cloudflare already do, though:
trustless-gateway.link,dweb.link, andipfs.ioall negotiate HTTP/3 and advertise it throughAlt-Svc.So the upgrade path already works against real infrastructure, even while dedicated content providers catch up.
Opt-in for now
HTTP/3 is off by default. Turn it on with the
WithHTTP3()option. It needs outbound UDP, and operators may need to raise the UDP buffer limits (net.core.rmem_maxandwmem_maxon Linux). This is an early prototype. We expect it to pay off as more HTTP providers start speaking HTTP/3, and feedback on how it behaves against real providers is welcome.TODO
WithHTTP3()on a canary and compare block-retrieval latency and throughput against an HTTP/2-only control. Theversionlabel confirms how much traffic actually went over HTTP/3. Compare the aggregateexchange_httpnet_request_duration_seconds, since that latency histogram can't carry aversionlabel with the current metrics interface.versionlabel onexchange_httpnet_status. Example queries: