cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: HTTP 2.0 performance is slower than HTTP 1.1 in libcurl

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Sat, 21 May 2016 19:49:56 +0200 (CEST)

On Thu, 19 May 2016, Ganesh Nikam wrote:

> are there any configuration changes that can improve HTTP 2.0 performance in
> above scenarios ?

It reminded me that we talked about HTTP/2 window handling a while ago (like
here https://curl.haxx.se/mail/lib-2016-03/0126.html) and I can measure a
notable speed difference when we send much fewer window updates. (I could
immediately cut off 13% spent time from my tests over localhost)

I've also figure out that by shrinking H2_BUFSIZE to 16K, at least single
stream downloads get an additional extra kick, taking me down to 71% of the
original times I measured.

Even with these improvements, I see my tests take about 19% longer time to
download 512MB over HTTP/2 than HTTP/1.1. This said, I run the HTTP/1 tests
over stunnel+apache and the HTTP/2 tests with nghttpd, so they're far from
identical and that may also explain some of the differences. I even think they
use different TLS ciphers right now.

None of those changes are really certain yet, but shows there are improvements
to do and probably more experiments to run. The window size thing makes us
disable nhttp2's auto handling so we need to add our own since we can't bump
up the initial value large enough. The buffer size needs more tests,
especially when a really large amount of parallel streams.

I made my http2 test program use CURLOPT_DEBUGFUNCTION and in the callback I
made the 'info' type output the string, including a "delta time": number of
microseconds since previous invoke. I hoped it would show instances where the
value would be unusually large and hence indicate waiting or pausing.

Transferring 512MB and then sorting the verbose log based on the delta times
show that sometimes the time is fairly long (hundreds of microseconds,
sometimes even more). It would indicate that there's something fishy. But
what? More and deeper research is required.

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:  https://curl.haxx.se/mail/etiquette.html
Received on 2016-05-21