x/net/http2: HTTP/2 slower than HTTP/1 #36440
Closed
Labels
Milestone
Comments
the times appear consistent with TLS requiring 1 RTT to negotiate a new stream per request. The speed benefits of HTTP/2 come from parallel streams and bulk data transfers, not the initial connection times. |
@seankhliao Thanks for the response. So what you are saying is, there is nothing wrong with the example I am using above. Is that correct? |
yes |
The difference between http1 and http2 clients doing 1000 serial requests on my netbook, using your code, is much less pronounced: ~90ms total for http 1, and ~104ms total for http2. I am not sure what this microbenchmark teaches me, though. /cc @bradfitz |
Closing this after carrying out more tests. Findings:
|
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I created a HTTP/2 client server app. When I use HTTP/1, it is average twice as fast as the HTTP/2 version! I am hoping that it is me (I bet it is me) doing something wrong but cannot be sure because the resources/examples I found seem to be doing things in same way as I do so I've run out of options.
What did you expect to see?
HTTP/2 request/response should be faster than the HTTP/1 version.
What did you see instead?
HTTP/1 request/response is faster than the HTTP/2 version.
702.225996ms
vs1.3265715s
Server app
Client app
I also tried with transport below instead of
golang.org/x/net/http2
as shown above but the result is same.The text was updated successfully, but these errors were encountered: