curl / Mailing Lists / curl-library / Single Mail

curl-library

Doubt Regarding the use of HTTP/2

From: Vipin P R via curl-library <curl-library_at_cool.haxx.se>
Date: Fri, 21 Sep 2018 11:38:19 +0530

Hi,
    This is my first mail to the Libcurl Community. As part of it , I
request a small clarification in the use of the Libcurl multi interface.
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.

    In this specific example, I have given number of connections as 3 and
num of requests as 15. These are the parameters I specified.

 634 curl_easy_setopt(handle,
 635 CURLOPT_HTTP_VERSION , CURL_HTTP_VERSION_2_0);

 962 if (res_cfg->ishttp2)
 963 curl_multi_setopt(session->cm_handle,
 964 CURLMOPT_PIPELINING, CURLPIPE_MULTIPLEX);

 977 curl_multi_setopt(session->cm_handle, CURLMOPT_MAXCONNECTS,
 978 session->num_connections);
 979 curl_multi_setopt(session->cm_handle,
CURLMOPT_MAX_TOTAL_CONNECTIONS,
 980 session->num_connections);
 981 curl_multi_setopt(session->cm_handle,
CURLMOPT_MAX_HOST_CONNECTIONS,
 982 session->num_connections);

session->num_connections = 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 !

<IIRC earlier , when I used Libcurl with 15 requests, 3 connections with
the HTTP/2 enabled multihandle , I could see that it would be around 4 - 5
requests pipelined on a single connection.>

aviuser_at_vipin-dev2:~/te_dp_bugs/avi-dev/test/TrafficEngine/te_dp$ tp
te_dp listening_on:0.0.0.0, port:43184 with pid:7129
* Found bundle for host nghttp2.org: 0x16bbbd0 [serially]
* Server doesn't support multi-use yet, wait
* No connections available.
* Found bundle for host nghttp2.org: 0x16bbbd0 [serially]
* Server doesn't support multi-use yet, wait
* No connections available.
* Found bundle for host nghttp2.org: 0x16bbbd0 [serially]
* Server doesn't support multi-use yet, wait
* No connections available.
* Found bundle for host nghttp2.org: 0x16bbbd0 [serially]
* Server doesn't support multi-use yet, wait
* No connections available.
* Found bundle for host nghttp2.org: 0x16bbbd0 [serially]
* Server doesn't support multi-use yet, wait
* No connections available.
* Found bundle for host nghttp2.org: 0x16bbbd0 [serially]
* Server doesn't support multi-use yet, wait
* No connections available.
* Found bundle for host nghttp2.org: 0x16bbbd0 [serially]
* Server doesn't support multi-use yet, wait
* No connections available.
* Found bundle for host nghttp2.org: 0x16bbbd0 [serially]
* Server doesn't support multi-use yet, wait
* No connections available.
* Found bundle for host nghttp2.org: 0x16bbbd0 [serially]
* Server doesn't support multi-use yet, wait
* No connections available.
* Found bundle for host nghttp2.org: 0x16bbbd0 [serially]
* Server doesn't support multi-use yet, wait
* No connections available.
* Found bundle for host nghttp2.org: 0x16bbbd0 [serially]
* Server doesn't support multi-use yet, wait
* No connections available.
* Found bundle for host nghttp2.org: 0x16bbbd0 [serially]
* Server doesn't support multi-use yet, wait
* No connections available.
* Found bundle for host nghttp2.org: 0x16bbbd0 [serially]
* Server doesn't support multi-use yet, wait
* No connections available.
* Found bundle for host nghttp2.org: 0x16bbbd0 [serially]
* Server doesn't support multi-use yet, wait
* No connections available.
* Trying 139.162.123.134...
* TCP_NODELAY set
* Connected to nghttp2.org (139.162.123.134) port 80 (#0)
> GET / HTTP/1.1
Host: nghttp2.org
Accept: */*
Connection: Upgrade, HTTP2-Settings
Upgrade: h2c
HTTP2-Settings: AAMAAABkAARAAAAAAAIAAAAA

< HTTP/1.1 101 Switching Protocols
< Connection: Upgrade
< Upgrade: h2c
* Received 101
* Using HTTP2, server supports multi-use
* Connection state changed (HTTP/2 confirmed)
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade:
len=27
* Connection state changed (MAX_CONCURRENT_STREAMS == 100)!
* Found bundle for host nghttp2.org: 0x16bbbd0 [can multiplex]
* Conn: 0 (0x1759110) Receive pipe weight: (-1/0), penalized: FALSE
* Multiplexed connection found!
* Found connection 0, with requests in the pipe (1)
* We can reuse, but we want a new connection anyway
* Hostname nghttp2.org was found in DNS cache
* Trying 139.162.123.134...
* TCP_NODELAY set
< HTTP/2 200
< date: Fri, 21 Sep 2018 06:04:34 GMT
< content-type: text/html
< last-modified: Sun, 02 Sep 2018 06:50:48 GMT
< etag: "5b8b8848-19d8"
< accept-ranges: bytes
< content-length: 6616
< x-backend-header-rtt: 0.00144
< server: nghttpx
< via: 2 nghttpx
< x-frame-options: SAMEORIGIN
< x-xss-protection: 1; mode=block
< x-content-type-options: nosniff
<
* Connection #0 to host nghttp2.org left intact
* Found bundle for host nghttp2.org: 0x16bbbd0 [can multiplex]
* Re-using existing connection! (#0) with host nghttp2.org
* Connected to nghttp2.org (139.162.123.134) port 80 (#0)
* Using Stream ID: 3 (easy handle 0x16e1ae0)
> GET / HTTP/2
Host: nghttp2.org
Accept: */*

* Found bundle for host nghttp2.org: 0x16bbbd0 [can multiplex]
* Conn: 0 (0x1759110) Receive pipe weight: (-1/0), penalized: FALSE
* Multiplexed connection found!
* Found connection 0, with requests in the pipe (1)
* We can reuse, but we want a new connection anyway
* Hostname nghttp2.org was found in DNS cache
* Trying 139.162.123.134...
* TCP_NODELAY set
* Found bundle for host nghttp2.org: 0x16bbbd0 [can multiplex]
* Conn: 0 (0x1759110) Receive pipe weight: (-1/0), penalized: FALSE
* Multiplexed connection found!
* Found connection 0, with requests in the pipe (1)
* Re-using existing connection! (#0) with host nghttp2.org
* Using Stream ID: 5 (easy handle 0x16f40c0)
> GET / HTTP/2
Host: nghttp2.org
Accept: */*

* Found bundle for host nghttp2.org: 0x16bbbd0 [can multiplex]
* Conn: 0 (0x1759110) Receive pipe weight: (-1/0), penalized: FALSE
* Multiplexed connection found!
* Found connection 0, with requests in the pipe (2)
* Re-using existing connection! (#0) with host nghttp2.org
* Using Stream ID: 7 (easy handle 0x16fd3b0)
> GET / HTTP/2
Host: nghttp2.org
Accept: */*

* Found bundle for host nghttp2.org: 0x16bbbd0 [can multiplex]
* Conn: 0 (0x1759110) Receive pipe weight: (-1/0), penalized: FALSE
* Multiplexed connection found!
* Found connection 0, with requests in the pipe (3)
* Re-using existing connection! (#0) with host nghttp2.org
* Using Stream ID: 9 (easy handle 0x17066a0)
> GET / HTTP/2
Host: nghttp2.org
Accept: */*

* Found bundle for host nghttp2.org: 0x16bbbd0 [can multiplex]
* Conn: 0 (0x1759110) Receive pipe weight: (-1/0), penalized: FALSE
* Multiplexed connection found!
* Found connection 0, with requests in the pipe (4)
* Re-using existing connection! (#0) with host nghttp2.org
* Using Stream ID: b (easy handle 0x170f990)
> GET / HTTP/2
Host: nghttp2.org
Accept: */*

* Found bundle for host nghttp2.org: 0x16bbbd0 [can multiplex]
* Conn: 0 (0x1759110) Receive pipe weight: (-1/0), penalized: FALSE
* Multiplexed connection found!
* Found connection 0, with requests in the pipe (5)
* Re-using existing connection! (#0) with host nghttp2.org
* Using Stream ID: d (easy handle 0x1718c80)
> GET / HTTP/2
Host: nghttp2.org
Accept: */*

* Found bundle for host nghttp2.org: 0x16bbbd0 [can multiplex]
* Conn: 0 (0x1759110) Receive pipe weight: (-1/0), penalized: FALSE
* Multiplexed connection found!
* Found connection 0, with requests in the pipe (6)
* Re-using existing connection! (#0) with host nghttp2.org
* Using Stream ID: f (easy handle 0x1721f70)
> GET / HTTP/2
Host: nghttp2.org
Accept: */*

* Found bundle for host nghttp2.org: 0x16bbbd0 [can multiplex]
* Conn: 0 (0x1759110) Receive pipe weight: (-1/0), penalized: FALSE
* Multiplexed connection found!
* Found connection 0, with requests in the pipe (7)
* Re-using existing connection! (#0) with host nghttp2.org
* Using Stream ID: 11 (easy handle 0x172b260)
> GET / HTTP/2
Host: nghttp2.org
Accept: */*

* Found bundle for host nghttp2.org: 0x16bbbd0 [can multiplex]
* Conn: 0 (0x1759110) Receive pipe weight: (-1/0), penalized: FALSE
* Multiplexed connection found!
* Found connection 0, with requests in the pipe (8)
* Re-using existing connection! (#0) with host nghttp2.org
* Using Stream ID: 13 (easy handle 0x1734550)
> GET / HTTP/2
Host: nghttp2.org
Accept: */*

* Found bundle for host nghttp2.org: 0x16bbbd0 [can multiplex]
* Conn: 0 (0x1759110) Receive pipe weight: (-1/0), penalized: FALSE
* Multiplexed connection found!
* Found connection 0, with requests in the pipe (9)
* Re-using existing connection! (#0) with host nghttp2.org
* Using Stream ID: 15 (easy handle 0x173d840)
> GET / HTTP/2
Host: nghttp2.org
Accept: */*

* Found bundle for host nghttp2.org: 0x16bbbd0 [can multiplex]
* Conn: 0 (0x1759110) Receive pipe weight: (-1/0), penalized: FALSE
* Multiplexed connection found!
* Found connection 0, with requests in the pipe (10)
* Re-using existing connection! (#0) with host nghttp2.org
* Using Stream ID: 17 (easy handle 0x1746b30)
> GET / HTTP/2
Host: nghttp2.org
Accept: */*

* Found bundle for host nghttp2.org: 0x16bbbd0 [can multiplex]
* Conn: 0 (0x1759110) Receive pipe weight: (-1/0), penalized: FALSE
* Multiplexed connection found!
* Found connection 0, with requests in the pipe (11)
* Re-using existing connection! (#0) with host nghttp2.org
* Using Stream ID: 19 (easy handle 0x174fe20)
> GET / HTTP/2
Host: nghttp2.org
Accept: */*

* Connected to nghttp2.org (139.162.123.134) port 80 (#1)
> GET / HTTP/1.1
Host: nghttp2.org
Accept: */*
Connection: Upgrade, HTTP2-Settings
Upgrade: h2c
HTTP2-Settings: AAMAAABkAARAAAAAAAIAAAAA

* Connected to nghttp2.org (139.162.123.134) port 80 (#2)
> GET / HTTP/1.1
Host: nghttp2.org
Accept: */*
Connection: Upgrade, HTTP2-Settings
Upgrade: h2c
HTTP2-Settings: AAMAAABkAARAAAAAAAIAAAAA

< HTTP/2 200
< date: Fri, 21 Sep 2018 06:04:34 GMT
< content-type: text/html
< last-modified: Sun, 02 Sep 2018 06:50:48 GMT
< etag: "5b8b8848-19d8"
< accept-ranges: bytes
< content-length: 6616
< x-backend-header-rtt: 0.001984
< server: nghttpx
< via: 2 nghttpx
< x-frame-options: SAMEORIGIN
< x-xss-protection: 1; mode=block
< x-content-type-options: nosniff
<
< HTTP/2 200
< date: Fri, 21 Sep 2018 06:04:34 GMT
< content-type: text/html
< last-modified: Sun, 02 Sep 2018 06:50:48 GMT
< etag: "5b8b8848-19d8"
< accept-ranges: bytes
< content-length: 6616
< x-backend-header-rtt: 0.001813
< server: nghttpx
< via: 2 nghttpx
< x-frame-options: SAMEORIGIN
< x-xss-protection: 1; mode=block
< x-content-type-options: nosniff
<
< HTTP/2 200
< date: Fri, 21 Sep 2018 06:04:34 GMT
< content-type: text/html
< last-modified: Sun, 02 Sep 2018 06:50:48 GMT
< etag: "5b8b8848-19d8"
< accept-ranges: bytes
< content-length: 6616
< x-backend-header-rtt: 0.001757
< server: nghttpx
< via: 2 nghttpx
< x-frame-options: SAMEORIGIN
< x-xss-protection: 1; mode=block
< x-content-type-options: nosniff
<
< HTTP/2 200
< date: Fri, 21 Sep 2018 06:04:34 GMT
< content-type: text/html
< last-modified: Sun, 02 Sep 2018 06:50:48 GMT
< etag: "5b8b8848-19d8"
< accept-ranges: bytes
< content-length: 6616
< x-backend-header-rtt: 0.001696
< server: nghttpx
< via: 2 nghttpx
< x-frame-options: SAMEORIGIN
< x-xss-protection: 1; mode=block
< x-content-type-options: nosniff
<
< HTTP/2 200
< date: Fri, 21 Sep 2018 06:04:34 GMT
< content-type: text/html
< last-modified: Sun, 02 Sep 2018 06:50:48 GMT
< etag: "5b8b8848-19d8"
< accept-ranges: bytes
< content-length: 6616
< x-backend-header-rtt: 0.001651
< server: nghttpx
< via: 2 nghttpx
< x-frame-options: SAMEORIGIN
< x-xss-protection: 1; mode=block
< x-content-type-options: nosniff
<
< HTTP/2 200
< date: Fri, 21 Sep 2018 06:04:34 GMT
< content-type: text/html
< last-modified: Sun, 02 Sep 2018 06:50:48 GMT
< etag: "5b8b8848-19d8"
< accept-ranges: bytes
< content-length: 6616
< x-backend-header-rtt: 0.001602
< server: nghttpx
< via: 2 nghttpx
< x-frame-options: SAMEORIGIN
< x-xss-protection: 1; mode=block
< x-content-type-options: nosniff
<
< HTTP/2 200
< date: Fri, 21 Sep 2018 06:04:34 GMT
< content-type: text/html
< last-modified: Sun, 02 Sep 2018 06:50:48 GMT
< etag: "5b8b8848-19d8"
< accept-ranges: bytes
< content-length: 6616
< x-backend-header-rtt: 0.001443
< server: nghttpx
< via: 2 nghttpx
< x-frame-options: SAMEORIGIN
< x-xss-protection: 1; mode=block
< x-content-type-options: nosniff
<
< HTTP/1.1 101 Switching Protocols
< Connection: Upgrade
< Upgrade: h2c
* Received 101
* Using HTTP2, server supports multi-use
* Connection state changed (HTTP/2 confirmed)
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade:
len=27
* Connection state changed (MAX_CONCURRENT_STREAMS == 100)!
< HTTP/2 200
< date: Fri, 21 Sep 2018 06:04:34 GMT
< content-type: text/html
< last-modified: Sun, 02 Sep 2018 06:50:48 GMT
< etag: "5b8b8848-19d8"
< accept-ranges: bytes
< content-length: 6616
< x-backend-header-rtt: 0.001054
< server: nghttpx
< via: 2 nghttpx
< x-frame-options: SAMEORIGIN
< x-xss-protection: 1; mode=block
< x-content-type-options: nosniff
<
* Connection #1 to host nghttp2.org left intact
< HTTP/1.1 101 Switching Protocols
< Connection: Upgrade
< Upgrade: h2c
* Received 101
* Using HTTP2, server supports multi-use
* Connection state changed (HTTP/2 confirmed)
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade:
len=27
* Connection state changed (MAX_CONCURRENT_STREAMS == 100)!
< HTTP/2 200
< date: Fri, 21 Sep 2018 06:04:34 GMT
< content-type: text/html
< last-modified: Sun, 02 Sep 2018 06:50:48 GMT
< etag: "5b8b8848-19d8"
< accept-ranges: bytes
< content-length: 6616
< x-backend-header-rtt: 0.000543
< server: nghttpx
< via: 2 nghttpx
< x-frame-options: SAMEORIGIN
< x-xss-protection: 1; mode=block
< x-content-type-options: nosniff
<
* Connection #2 to host nghttp2.org left intact
< HTTP/2 200
< date: Fri, 21 Sep 2018 06:04:34 GMT
< content-type: text/html
< last-modified: Sun, 02 Sep 2018 06:50:48 GMT
< etag: "5b8b8848-19d8"
< accept-ranges: bytes
< content-length: 6616
< x-backend-header-rtt: 0.001678
< server: nghttpx
< via: 2 nghttpx
< x-frame-options: SAMEORIGIN
< x-xss-protection: 1; mode=block
< x-content-type-options: nosniff
<
< HTTP/2 200
< date: Fri, 21 Sep 2018 06:04:34 GMT
< content-type: text/html
< last-modified: Sun, 02 Sep 2018 06:50:48 GMT
< etag: "5b8b8848-19d8"
< accept-ranges: bytes
< content-length: 6616
< x-backend-header-rtt: 0.001557
< server: nghttpx
< via: 2 nghttpx
< x-frame-options: SAMEORIGIN
< x-xss-protection: 1; mode=block
< x-content-type-options: nosniff
<
< HTTP/2 200
< date: Fri, 21 Sep 2018 06:04:34 GMT
< content-type: text/html
< last-modified: Sun, 02 Sep 2018 06:50:48 GMT
< etag: "5b8b8848-19d8"
< accept-ranges: bytes
< content-length: 6616
< x-backend-header-rtt: 0.00152
< server: nghttpx
< via: 2 nghttpx
< x-frame-options: SAMEORIGIN
< x-xss-protection: 1; mode=block
< x-content-type-options: nosniff
<
< HTTP/2 200
< date: Fri, 21 Sep 2018 06:04:34 GMT
< content-type: text/html
< last-modified: Sun, 02 Sep 2018 06:50:48 GMT
< etag: "5b8b8848-19d8"
< accept-ranges: bytes
< content-length: 6616
< x-backend-header-rtt: 0.00145
< server: nghttpx
< via: 2 nghttpx
< x-frame-options: SAMEORIGIN
< x-xss-protection: 1; mode=block
< x-content-type-options: nosniff
<
< HTTP/2 200
< date: Fri, 21 Sep 2018 06:04:34 GMT
< content-type: text/html
< last-modified: Sun, 02 Sep 2018 06:50:48 GMT
< etag: "5b8b8848-19d8"
< accept-ranges: bytes
< content-length: 6616
< x-backend-header-rtt: 0.001839
< server: nghttpx
< via: 2 nghttpx
< x-frame-options: SAMEORIGIN
< x-xss-protection: 1; mode=block
< x-content-type-options: nosniff
<
* Connection #0 to host nghttp2.org left intact
^Caviuser_at_vipin-dev2:~/te_dp_bugs/avi-dev/test/TrafficEngine/te_dp$

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