net/http: HTTP2 pushing is suprisingly slow #51361
Labels
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
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 am trying to push multiple requests using HTTP2.
What did you expect to see?
From reading
pusher.Push
documentation, my expectation was that pushing negligibly impacts time the main request is served, as all pushing happens in separate goroutines.What did you see instead?
I am observing that this is not the case. I made a simple test and pushing 100 requests with 10 KB large responses takes 8 ms on my local machine, pushing 100 requests with 1 MB large responses takes 35 ms. So this is just additional time added to the main request handling to call
pusher.Push
in a loop. Not how long it takes for the pushed responses themselves to be delivered. This is a surprising amount to me.From looking at the code, I think the issue is that
pusher.Push
waits until it can send astartPushRequest
message toserveMsgCh
and with many push requests this can block for non-trivial amount of time.I made a small example here. See README for instructions how to run it.
The text was updated successfully, but these errors were encountered: