HTTP2 Configuration

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

HTTP2 Configuration

Harish S S

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

 

 


_______________________________________________
jetty-users mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users
Reply | Threaded
Open this post in threaded view
|

Re: HTTP2 Configuration

Joakim Erdfelt-8
h2c is a special protocol that allows for upgrading an HTTP/1.1 connection (even without security) to HTTP/2.
This is uncommon, and also not available to any compliant HTTP/2 client.
h2c exists mainly for specific intermediaries, such as a load balancer.

a normal HTTP/2 connection will start with TLS, negotiate with ALPN, and be connected to the binary HTTP/2 protocol from there on out (never using HTTP/1.1 or h2c in the process).

For starters, look at your setup.

You are likely using ...

HTTP2CServerConnectionFactory  (note the extra "C")

and not ...

HTTP2ServerConnectionFactory

on your ServerConnector.



Joakim Erdfelt / [hidden email]

On Mon, Jun 25, 2018 at 11:17 AM, Harish S S <[hidden email]> wrote:

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

 

 


_______________________________________________
jetty-users mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users


_______________________________________________
jetty-users mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users
Reply | Threaded
Open this post in threaded view
|

Re: HTTP2 Configuration

Harish S S

Hi Joakim,

 

Thanks a lot for your response.  I verified my jetty-http2.xml it has HTTP2ServerConnectionFactory without “C”.  May be I’m setting up the whole thing wrongly, could you please point me a suitable guide that helps in setting up project to support http2.

 

Regards,

Harish

 

From: <[hidden email]> on behalf of Joakim Erdfelt <[hidden email]>
Reply-To: JETTY user mailing list <[hidden email]>
Date: Monday, 25 June 2018 at 11:00 PM
To: JETTY user mailing list <[hidden email]>
Subject: Re: [jetty-users] HTTP2 Configuration

 

h2c is a special protocol that allows for upgrading an HTTP/1.1 connection (even without security) to HTTP/2.

This is uncommon, and also not available to any compliant HTTP/2 client.

h2c exists mainly for specific intermediaries, such as a load balancer.

 

a normal HTTP/2 connection will start with TLS, negotiate with ALPN, and be connected to the binary HTTP/2 protocol from there on out (never using HTTP/1.1 or h2c in the process).

 

For starters, look at your setup.

 

You are likely using ...

 

HTTP2CServerConnectionFactory  (note the extra "C")

 

and not ...

 

HTTP2ServerConnectionFactory

 

on your ServerConnector.

 

 


Joakim Erdfelt / [hidden email]

 

On Mon, Jun 25, 2018 at 11:17 AM, Harish S S <[hidden email]> wrote:

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

 

 


_______________________________________________
jetty-users mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users

 

_______________________________________________ jetty-users mailing list [hidden email] To change your delivery options, retrieve your password, or unsubscribe from this list, visit https://dev.eclipse.org/mailman/listinfo/jetty-users


_______________________________________________
jetty-users mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users