Skip to content
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

Cp 351d144fa1fc0bd934e2408202be0c29f25e35a0 #1

Merged

Conversation

froodian
Copy link
Member

@froodian froodian commented Jan 7, 2019

Cherry pick golang@351d144 before golang 1.12 is released. This returns the http2 transport to golang 1.9's behavior and is slated for general release to the best of my understanding. See the original commit comment for more context.

…EAMS

And add the http2.Transport.StrictMaxConcurrentStreams bool knob to
behavior being reverted.

In CL 53250 for golang/go#13774 (for Go 1.10) we changed the HTTP/2
Transport's policy such that a server's advertisement of a
MAX_CONCURRENT_STREAMS value meant that it was a maximum for the
entire process, instead of just a single connection.

We thought that was a reasonable interpretation of the spec and
provided nice safety against slamming a server from a bunch of
goroutines doing concurrent requests, but it's been largely
unpopular (see golang/go#27044). It's also different behavior from
HTTP/1 and because you're usually not sure which protocol version
you're going to get, you need to limit your outbound HTTP requests
anyway in case you're hitting an HTTP/1 server.

And nowadays we have the Go 1.11 Transport.MaxConnsPerHost knob too
(CL 71272 for golang/go#13957). It doesn't yet work for HTTP/2, but it
will in either Go 1.12 or Go 1.13 (golang/go#27753)

After this is bundled into net/http's, the default HTTP client will
have this knob set false, restoring the old Go 1.9 behavior where new
TCP connections are created as necessary. Users wanting the strict
behavior and import golang.org/x/net/http2 themselves and make a
Transport with StrictMaxConcurrentStreams set to true. Or they can set
Transport.MaxConnsPerHost, once that works for HTTP/2.

Updates golang/go#27044 (fixes after bundle into std)

Change-Id: I4efdad7698feaf674ee8e01032d2dfa5c2f8a3a8
Reviewed-on: https://go-review.googlesource.com/c/151857
Reviewed-by: Andrew Bonventre <andybons@golang.org>
@froodian froodian changed the base branch from master to release-branch.go1.11 January 7, 2019 15:50
Copy link
Member

@zachmccormick zachmccormick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - is this the only thing that needs to be picked to get this functionality? I guess the main change is the new clause in canTakeNewRequest which makes sense

@froodian
Copy link
Member Author

froodian commented Jan 7, 2019

yeah the code isn't written entirely intuitively but I think this should be it

@froodian froodian merged commit 6ac2fe9 into release-branch.go1.11 Jan 9, 2019
@froodian froodian deleted the cp-351d144fa1fc0bd934e2408202be0c29f25e35a0 branch January 9, 2019 03:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants