http2 POST delay #169

Closed
icing opened this Issue Mar 17, 2015 · 8 comments

Projects

None yet

2 participants

@icing
icing commented Mar 17, 2015

When using curl --form file=@xxx .... against my server, there is a 1-2 second delay before curl actually sends the request body. Using the nghttp2 client does not show this behavior.

Might it be that this is some effect of Expect header handling, that just will not trigger in HTTP/2?

@bagder bagder self-assigned this Mar 17, 2015
@bagder bagder added the HTTP label Mar 17, 2015
@bagder
Member
bagder commented Mar 17, 2015

Thanks. Does it show with a mere -d "fooo" (instead lf --form) as well ? I've not done a lot of posts over HTTP/2 so it is probably something like that lingering...

@bagder bagder added a commit that referenced this issue Mar 17, 2015
@bagder bagder HTTP: don't use Expect: headers when on HTTP/2
Reported-by: Stefan Eissing
Bug: #169
ef1c3b4
@bagder
Member
bagder commented Mar 17, 2015

Just pushed commit ef1c3b4 which I believe fixes this.

@icing
icing commented Mar 18, 2015

Yes, that fixes it for the "h2" case (TLS). The "h2c" case, where no upgrade is triggered because of request content, it still seems unchanged slow. I see no delay, but the upload takes longer than in the TLS case. Some fallback code when nghttp2 does not kick in perhaps?

@bagder
Member
bagder commented Mar 18, 2015

Isn't that just the ordinary Expect: 100-continue delay then? Try with -H Expect: and see if it changes anything!

@icing
icing commented Mar 18, 2015

As you can see below, the initial wait is gone in all cases, but the upload itself shows poor performance when --http2 is given. ('w. Expect' means -H Expect:)

Timings with curl from github (this morning):

curl https://test.example.org:12346/upload.py: 100k file upload default...
        0.22 real         0.01 user         0.00 sys
        0.03 real         0.01 user         0.00 sys
curl https://test.example.org:12346/upload.py: 100k file upload via http/2...
        0.22 real         0.01 user         0.00 sys
        0.03 real         0.01 user         0.00 sys
curl https://test.example.org:12346/upload.py: 100k file upload default w. Expect...
        0.22 real         0.01 user         0.00 sys
        0.03 real         0.01 user         0.00 sys
curl https://test.example.org:12346/upload.py: 100k file upload via http/2 w. Expect...
        0.22 real         0.01 user         0.00 sys
        0.03 real         0.01 user         0.00 sys
curl http://test.example.org:12345/upload.py: 100k file upload default...
        0.07 real         0.00 user         0.00 sys
        0.01 real         0.00 user         0.00 sys
curl http://test.example.org:12345/upload.py: 100k file upload via http/2...
        7.24 real         0.00 user         0.00 sys
        0.01 real         0.00 user         0.00 sys
curl http://test.example.org:12345/upload.py: 100k file upload default w. Expect...
        0.07 real         0.00 user         0.00 sys
        0.01 real         0.00 user         0.00 sys
curl http://test.example.org:12345/upload.py: 100k file upload via http/2 w. Expect...
        7.24 real         0.00 user         0.00 sys
        0.19 real         0.00 user         0.00 sys

Timings with curl 7.41.0:

curl https://test.example.org:12346/upload.py: 100k file upload default...
        0.09 real         0.01 user         0.00 sys
        0.03 real         0.01 user         0.00 sys
curl https://test.example.org:12346/upload.py: 100k file upload via http/2...
        4.05 real         0.01 user         0.00 sys
        0.03 real         0.01 user         0.00 sys
curl https://test.example.org:12346/upload.py: 100k file upload default w. Expect...
        0.09 real         0.01 user         0.00 sys
        0.03 real         0.01 user         0.00 sys
curl https://test.example.org:12346/upload.py: 100k file upload via http/2 w. Expect...
        0.22 real         0.01 user         0.00 sys
        0.03 real         0.01 user         0.00 sys
curl http://test.example.org:12345/upload.py: 100k file upload default...
        0.07 real         0.00 user         0.00 sys
        0.01 real         0.00 user         0.00 sys
curl http://test.example.org:12345/upload.py: 100k file upload via http/2...
        8.05 real         0.00 user         0.00 sys
        0.01 real         0.00 user         0.00 sys
curl http://test.example.org:12345/upload.py: 100k file upload default w. Expect...
        0.07 real         0.00 user         0.00 sys
        0.01 real         0.00 user         0.00 sys
curl http://test.example.org:12345/upload.py: 100k file upload via http/2 w. Expect...
        7.24 real         0.00 user         0.00 sys
        0.01 real         0.00 user         0.00 sys.
@bagder
Member
bagder commented Mar 18, 2015

All right. Thanks a bunch for all the details. I guess I need to roll up my sleeves and check it out closer.

@bagder bagder added a commit that referenced this issue Mar 19, 2015
@bagder bagder HTTP: don't switch to HTTP/2 from 1.1 until we get the 101
We prematurely changed protocol handler to HTTP/2 which made things very
slow (and wrong).

Reported-by: Stefan Eissing
Bug: #169
abfab17
@bagder
Member
bagder commented Mar 19, 2015

commit abfab17 fixes this problem for me at least.

Thanks again!

@icing
icing commented Mar 19, 2015

Yep. Works flawlessly. Thanks!

@icing icing closed this Mar 19, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment