-
Notifications
You must be signed in to change notification settings - Fork 301
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
fix enable http/2 by default as intended by flags #2908
Conversation
At some point the agent HTTP client configuration was updated however this resulted in it falling back to HTTP/1.1. Ideally we would take advantage of HTTP/2 to improve overall performance, especially for agents who are connecting from locations outside the US. This will also lead to less TLS handshakes, and connections overall, which in turn should reduce the likehood of stalls uploading artifacts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice one!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice find!
Fascinating! Do we know what version we regressed back to HTTP 1.1 by default? Might be a good detail to flag with our support friends so they can keep an eye out for opportunities to suggest upgrading.
Do you suspect this is a cause of slow artifact uploads? Or is this a fix the you noticed while debugging, but slow artifact uploads still possible? |
Appears to have been this way since #1020 ...which used Go 1.12, and |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🌴😎🍹
|
||
// use the default transport as it is optimized and configured for http2 | ||
// and will avoid accidents in the future | ||
tr := http.DefaultTransport.(*http.Transport).Clone() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Making a note in case this is important later on - no changes needed.
The diff from the old transport to the default is:
- TLSHandshakeTimeout: 30 * time.Second,
+ ForceAttemptHTTP2: true,
+ TLSHandshakeTimeout: 10 * time.Second,
+ ExpectContinueTimeout: 1 * time.Second,
and the use of defaultTransportDialContext
wrapping net.Dialer
, but that is equivalent to .DialContext
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good callout, thanks!
Co-authored-by: Josh Deprez <[email protected]>
Description
At some point the agent HTTP client configuration was updated however this resulted in it falling back to HTTP/1.1. Ideally we would take advantage of HTTP/2 to improve overall performance, especially for agents who are connecting from locations outside the US.
This will also lead to less TLS handshakes, and connections overall, which in turn should reduce the likelyhood of stalls uploading artifacts.
Context
The defaulting to HTTP 1.1 was discovered while debugging higher than expected latency while uploading artifacts.
Changes
Use the default transport to ensure that the
ForceAttemptHTTP2
is set and we use HTTP/2.0. Cloning the default transport is the simplest approach to ensure you get the most up to date configuration.See golang/go#26013 for some background on the
Clone
method in the default transport.From https://github.com/golang/go/blob/master/src/net/http/transport.go#L50.
To disable HTTP/2.0 we need to update a few things, these are documented in this change as well.
Testing
Before.
After.