Join 40 million developers who use GitHub
issues to help identify, assign, and keep track of the features and
bug fixes your projects need.
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?
to your account
go version go1.12.7 linux/amd64
Using a http.Transport with http.Client and multiple concurrent outgoing http(s) connections. Basically load testing an http(s) endpoint.
Set http.Transport.DisableKeepAlives to true to enforce a single connection for each request.
I was expecting to see n connections for n requests. This is true for http(s)/1.1 but http2 is re-using connections even though http.Transport.DisableKeepAlives is true.
I understand that this is not strictly a http2 feature but gets translated to http2 in func (t *http2Transport) disableKeepAlives() bool and thus should have the same meaning.
func (t *http2Transport) disableKeepAlives() bool
Works for http(s)/1.1 but http2 connections get re-used. In a test with n requests and a concurrency of c only ~c connections where used (instead of expected n connections).
See here: golang/net#48
I remember @rsc looked into something similar.
Can I help with something?
Change https://golang.org/cl/187958 mentions this issue: http2: make Transport.NewClientConn respect Transport.DisableKeepAlives
http2: make Transport.NewClientConn respect Transport.DisableKeepAlives
Successfully merging a pull request may close this issue.