curl / Mailing Lists / curl-library / Single Mail

curl-library

Re: Doubt Regarding the use of HTTP/2

From: Daniel Stenberg via curl-library <curl-library_at_cool.haxx.se>
Date: Fri, 21 Sep 2018 08:59:35 +0200 (CEST)

On Fri, 21 Sep 2018, Vipin P R via curl-library wrote:

> When I set the Max connections to 3, and enable HTTP/2 with the multi
> interface, I still see that all requests are being pipelined on the very
> first connection.

When libcurl is about to start a new transfer there are several factors
involved that together are used to make the decision between an existing
connection or start a new one. It will generally prioritise using an existing
one if it (without delay) can, since that's typically the faster way and sort
of a lot of the point with HTTP/2.

> I have given number of connections as 3 and num of requests as 15.

"Maximum number of connections" doesn't mean that it will spread out over
three automatically. It just means that it won't use more than 3.

> I also add 15 easy handles to the HTTP/2 multi handle. But from my curl
> Verbose output, I can see that most of the requests are pipelined on a
> single connection. Am I missing something here. Please help !

That works exactly as intended. Except if you added all those handles at once
without CURLOPT_PIPEWAIT set, as then it is likely to create more connections
since then it deems creating a new connection is likely to be faster than
waiting for another transfer's connection to get ready.

> * Found bundle for host nghttp2.org: 0x16bbbd0 [serially]
> * Server doesn't support multi-use yet, wait

This implies CURLOPT_PIPEWAIT is set. You asked for it to wait for a
connection!

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html
Received on 2018-09-21