Repository navigation
grid: Use the alternate protocols cache in the grid - #16347
Conversation
and use that for deciding if HTTP/3 should be enabled. Signed-off-by: Ryan Hamilton <[email protected]>
Signed-off-by: Ryan Hamilton <[email protected]>
Signed-off-by: Ryan Hamilton <[email protected]>
Signed-off-by: Ryan Hamilton <[email protected]>
Signed-off-by: Ryan Hamilton <[email protected]>
Signed-off-by: Ryan Hamilton <[email protected]>
|
/assign @DavidSchinazi |
|
/assign @DavidSchinazi |
| return false; | ||
| } | ||
| if (!alternate_protocols_.has_value()) { | ||
| // TODO(RyanTheOptimist): Make the alternate protocols cache required. |
There was a problem hiding this comment.
nit: how about this? // TODO(RyanTheOptimist): Do not attempt HTTP/3 when the alternate protocols cache is missing.
There was a problem hiding this comment.
Well, I could do that but that's not the goal of this TODO :) The goal of the TODO is that the Grid is always constructed with an AlternateProtocolsCache. I can't easily do that as part of this PR (I'll be doing in 2 PRs down the road) because in order to do this, we need to construct per-config AlternateProtocolCaches which requires a bunch of plumbing. I have that queued up, but it's a lot of unrelated work.
There was a problem hiding this comment.
Ah I see, in that case how about // TODO(RyanTheOptimist): Make the alternate_protocols_ member non-optional. Additionally, maybe move the TODO to the definition of that member variable?
Signed-off-by: Ryan Hamilton <[email protected]>
Signed-off-by: Ryan Hamilton <[email protected]>
RyanTheOptimist
left a comment
There was a problem hiding this comment.
Thanks for the great review!
| return false; | ||
| } | ||
| if (!alternate_protocols_.has_value()) { | ||
| // TODO(RyanTheOptimist): Make the alternate protocols cache required. |
There was a problem hiding this comment.
Well, I could do that but that's not the goal of this TODO :) The goal of the TODO is that the Grid is always constructed with an AlternateProtocolsCache. I can't easily do that as part of this PR (I'll be doing in 2 PRs down the road) because in order to do this, we need to construct per-config AlternateProtocolCaches which requires a bunch of plumbing. I have that queued up, but it's a lot of unrelated work.
| // changing dynamically. | ||
| for (const quic::ParsedQuicVersion& version : quic::CurrentSupportedVersions()) { | ||
| if (quic::AlpnForVersion(version) == protocol.alpn_) { | ||
| ENVOY_LOG(trace, "HTTP/3 advertised for host '{}'", host_->hostname()); |
There was a problem hiding this comment.
Nope, but that's on my queue to address. I suspect it's going to be an "exciting" prospect because the newStream() method doesn't have an obvious way to pass metadata down into the connection pool. I'll definitely get it sorted out, but not yet.
|
/assign @alyssawilk |
Signed-off-by: Ryan Hamilton <[email protected]>
alyssawilk
left a comment
There was a problem hiding this comment.
LG modulo nits.
Normally I'd ask these get fixed before merging but given I know you've already got follow-up PRs in this space and it's not used in prod and I'm out tomorrow, if you wan to address them in a follow-up I'm game. LMK
| } | ||
| uint32_t port = host_->address()->ip()->port(); | ||
| // TODO(RyanTheOptimist): Figure out how scheme gets plumbed in here. | ||
| AlternateProtocolsCache::Origin origin("https", host_->hostname(), port); |
There was a problem hiding this comment.
nit: Headers::get().SchemeValues.Https
| return false; | ||
| } | ||
| uint32_t port = host_->address()->ip()->port(); | ||
| // TODO(RyanTheOptimist): Figure out how scheme gets plumbed in here. |
There was a problem hiding this comment.
I think commenting that we only support secure QUIC regardless of url scheme would be fine.
| } | ||
|
|
||
| ENVOY_LOG(trace, "HTTP/3 is not available to host '{}', skipping.", host_->hostname()); | ||
| return false; |
There was a problem hiding this comment.
seems like a good place to start adding stats, WDYT? Can defer to a follow up but let's make sure we have stats as we wire this all up.
| EXPECT_LOG_CONTAINS("trace", | ||
| "No alternate protocols available for host 'hostname', skipping HTTP/3.", | ||
| EXPECT_NE(grid_.newStream(decoder_, callbacks_), nullptr)); | ||
| EXPECT_NE(grid_.first(), nullptr); |
There was a problem hiding this comment.
To your point about having explicit h2 and h3 pools I think we should be skipping creating the H3 pool if we're not going to attempt H3.
Allow the ConnectivityGrid to take an optional AlternateProtocolsCache and use that for deciding if HTTP/3 should be enabled.
Rename AlternateProtocols to AlternateProtocolsCache.
Use uint32_t instead of int for ports in AlternateProtocolsCache to match other code in Envoy.
Follow up PRs will make the AlternateProtocolsCache mandatory and will plumb it in from the ClusterManager, based on the config.
Risk Level: Low
Testing: new unit tests
Docs Changes: N/A
Release Notes: N/A
Platform Specific Features: N/A