Hello,
I’m relatively new to Jetty, recently I started moving all our project to Jetty (we are using using 9.4.11.v20180605). The biggest motivation for us was the support for HTTP2. However while testing I notice the following in the verbose mode while using curl.
curl -X GET http://localhost:8080/clang/inert -H 'clang_key: echo' -H 'session_key: 2fe97dfca5cab0283a1d791253f5244' -w '@curl-wout.txt' --http2 -v
* Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 8080 (#0)
> GET /clang/inert HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/7.60.0
> Accept: */*
> Connection: Upgrade, HTTP2-Settings
> Upgrade: h2c
> HTTP2-Settings: AAMAAABkAARAAAAAAAIAAAAA
> clang_key: echo
> session_key: 2fe97dfca5cab0283a1d791253f5244
>
< HTTP/1.1 101 Switching Protocols
* 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=0
* Connection state changed (MAX_CONCURRENT_STREAMS == 1024)!
< HTTP/2 200
< server: Jetty(9.4.11.v20180605)
< content-type: text/plain
<
* Connection #0 to host localhost left intact
Following this output I think that first curl is doing a HTTP1.1 handshake and then changing to HTTP2. Is my understanding correct here? I’m basing my understanding based on repeat tests with just HTTP1.1 connection, I see that time_pretransfer actually increases when HTTP2 is used. Is this only an initial cost which gets compensated when client makes connection second time? Also, how do I measure the benefits of moving to HTTP2? Our setup offer only RESTful APIs and no static content.
Contents of curl-wout file is below
--> clang $ cat curl-wout.txt
time_namelookup: %{time_namelookup}\n
time_connect: %{time_connect}\n
time_appconnect: %{time_appconnect}\n
time_pretransfer: %{time_pretransfer}\n
time_redirect: %{time_redirect}\n
time_starttransfer: %{time_starttransfer}\n
----------\n
time_total: %{time_total}\n
Is there a way to configure Jetty to accept only HTTP2 connections?
Regards,
Harish