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
net/http: do not query HTTP_PROXY on every request #7020
Labels
Milestone
Comments
I've never seen HTTP_PROXY stuff show up in benchmarks, but I've also never used HTTP_PROXY in my life. Is the problem that your machine actually uses HTTP_PROXY and then the BenchmarkClientServer ends up load testing itself through a real proxy, non-hermetically? Please explain what's happening. |
No, this happens even with empty env vars. On windows just querying env var creates at least 2 copies of the env var name string (one to append 0, and another to convert to []uint16). And we query both HTTP_PROXY and http_proxy. This accounts for 15% of allocations and 10% of garbage on end-to-end http client/server benchmark. Look at the difference between linux and windows: http://goperfd.appspot.com/perfgraph?builder=linux-amd64&builder=windows-amd64&benchmark=http&procs=1&metric=allocs&absolute=1&startcommit=1422&commitnum=2000&refresh=Refresh What do you think if we query HTTP_PROXY once lazily (so that user has a chance to set it in main) and provide updateProxyEnvVars() for tests? I think the advice for other cases is to use programmatic interface. Env vars are not "composable" anyway, if 2 subsystems alter HTTP_PROXY one of them won't work. |
How about this? diff -r 9d0f388bbe40 src/pkg/net/http/transport.go --- a/src/pkg/net/http/transport.go Mon Jan 06 01:34:56 2014 +1100 +++ b/src/pkg/net/http/transport.go Tue Jan 07 20:28:49 2014 +0900 @@ -261,6 +261,9 @@ if err != nil { return nil, err } + if cm.proxyURL == nil { + t.Proxy = nil + } } return cm, nil } |
This issue was closed by revision 4deead7. Status changed to Fixed. |
This issue was closed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The text was updated successfully, but these errors were encountered: