Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explore HTTP/2 codec for Netty #98

Closed
spericas opened this issue Oct 4, 2018 · 2 comments
Closed

Explore HTTP/2 codec for Netty #98

spericas opened this issue Oct 4, 2018 · 2 comments
Assignees
Labels
task To do

Comments

@spericas
Copy link
Member

spericas commented Oct 4, 2018

We need to understand how to use the codec to provide HTTP/2 support in Helidon:

https://github.com/netty/netty/blob/4.1/codec-http2

@spericas spericas added the task To do label Oct 4, 2018
@spericas spericas self-assigned this Oct 4, 2018
@spericas spericas added this to To do in Web Server via automation Oct 4, 2018
@barchetta barchetta added this to In progress in Team Board Oct 9, 2018
@spericas
Copy link
Member Author

I have a Helidon prototype (on a fork) that implements basic support for HTTP/2. In particular, it supports the following use cases:

  • Upgrading a connection from HTTP to HTTP/2
  • Establishing an HTTP/2 connection with prior knowledge (client knows server supports it)
  • Handling regular HTTP connections on same endpoint

The implementation uses some new Helidon classes and some HTTP/2 codecs and utility classes available in Netty. The approach used in the prototype is to convert HTTP/2 traffic (streams) into HTTP requests before they hit the Helidon handlers (certain HTTP/2 specific information such as the stream ID are carried over as HTTP headers in order to correlate request and responses). All of our unit tests pass with the prototyped code since regular HTTP connections are supported as before.

One significant disadvantage of this approach is that payload streaming is lost: the entire HTTP/2 request is cached in memory before passing it to the existing handlers. This is how the Netty utility classes were designed; Helidon continues to use publishers and subscribers, but the payload, if originated from an HTTP/2 stream, is always made available as a single chunk (and if the max size of that payload is fixed now). Restoring streaming support would require some internal changes in Helidon.

Another disadvantage of the prototype is that HTTP/2 upgrade is always enabled, so there's an overhead of always inspecting incoming traffic looking for upgrade headers. This should probably be configurable for those applications where HTTP/2 is not required.

I'm closing this issue since the use of Netty codecs (and more) is covered by the prototype.

Web Server automation moved this from To do to Done Oct 11, 2018
@spericas spericas moved this from In progress to Done in Team Board Oct 11, 2018
@spericas
Copy link
Member Author

Forgot to mention that as part of this exercise, I also wrote some simple HTTP/2 clients using the new JDK 11 client API, and have verified compatibility with the HTTP/2 support in Helidon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
task To do
Projects
No open projects
Team Board
  
Done
Web Server
  
Done
Development

No branches or pull requests

1 participant