akka-http icon indicating copy to clipboard operation
akka-http copied to clipboard

Add support for quic,HTTP/3

Open He-Pin opened this issue 5 years ago • 21 comments

Hope we will get this soon Netty/Incubator/Codec/Quic 0.0.1.Final released https://netty.io/news/2020/12/09/quic-0-0-1-Final.html

update: https://www.rfc-editor.org/rfc/rfc9114.html HTTP/3 is released now.

He-Pin avatar Dec 05 '20 16:12 He-Pin

Note: there are a lot of implementations of Quic in Rust, probably because of its use by browser vendors. It seems to be implemented in most browsers now too (see state of Quick Sept 30 2020).

bblfish avatar Jan 18 '21 19:01 bblfish

yes, our internal implematation is in C.

He-Pin avatar Jan 19 '21 05:01 He-Pin

An interesting article on Quic adoption by Alibaba: Ali XQUIC: the road to self-research of standard QUIC.

bblfish avatar Jan 19 '21 20:01 bblfish

Some links from my research

bblfish avatar Jan 28 '21 10:01 bblfish

Security: Flood and reflection attack : https://www.cloudflare.com/learning/ddos/what-is-a-quic-flood/

He-Pin avatar Jan 29 '21 05:01 He-Pin

The 2020 Web Almanach has a very informed chapter on HTTP/2.0 and Quic deployment, usage, ...

bblfish avatar Jan 29 '21 11:01 bblfish

For clients code one could use or be inspired by the Quiche4j wrapper of the rust library. Perhaps one could do something similar for the server connection? (there is one other client lib in Java listed in the qwicWG implementations page).

bblfish avatar Jan 30 '21 17:01 bblfish

Btw. On a slightly related topic: the akka.http group should make a pull request to add itself to the http-wg's list of HTTP/2.0 implementations.

bblfish avatar Jan 30 '21 20:01 bblfish

Quic is not the end of improvements btw. I found Why Quic is not the Next Big Thing, but it is made from the point of view of a competing protocol Bolina inspired by QUIC that also works over UDP. But that has not gone through 5 years of IETF standardization process...

bblfish avatar Jan 31 '21 07:01 bblfish

Thanks for all these links!

I found that one interesting from the almanach:

image

(which to me means the evolution of web protocols is real, even if it is mainly driven by a few major players: browsers, reverse proxies, and "reverse proxy providers" like cloudflare)

jrudolph avatar Feb 01 '21 16:02 jrudolph

I created a QUIC/HTTP/3 client stub implementation a while ago (https://gist.github.com/jrudolph/680eb6ea93dcba6a1f07021949596975) using only simple JDK primitives.

The main problem for implementing QUIC is that it integrates with TLS in a way that is not supported by Java's TLS APIs (basically same for other TLS implementations). My guess is that it's somewhat unlikely that Java will provide a TLS implementation any time soon that would offer the features needed to implement QUIC from scratch.

So, alternatives would be to

  • reuse a QUIC implementation and only build HTTP/3 on top of it (what netty seems to have done on top of quiche)
  • or to wait / look for a mature enough TLS implementation that could be reused or get OpenJDK to provide the needed features
  • implement TLS 1.3 ourselves (what I did in that gist in a rudimentary way). For security reasons, that's something you usually want to avoid (even if TLS 1.3 is much less bloated than previous TLS versions).

jrudolph avatar Feb 01 '21 16:02 jrudolph

(If I had the skills) I would consider reducing my work by using a thin wrapper written in another language like Quiche4J above :-) That would allow me to see if any changes will need to be made to the client or server user visible http APIs ahead of time, allow people to try out QUIC and give feedback, wait for an official OpenJDK version of TLS to be ready, and with all that gained experience, if and when needed, do a pure Scala version (when Scala 3 is stable) knowing much better what the parts that need to be paid attention to are.

(Btw, I think there are other Rust implementations of Quic. None of these seem to be integrated in Rust web server framework yet. Neither could I find a Rust framework that has the high level of streaming abstractions as Akka has - as far as I can tell)

bblfish avatar Feb 01 '21 16:02 bblfish

@jrudolph How about make the TLS pluggable?

He-Pin avatar Feb 02 '21 12:02 He-Pin

I would consider reducing my work by using a thin wrapper written in another language like Quiche4J above

Yep, that's a good point and probably a good way to go. We have no work planned on this but if we or something else would want to have a go on this, a first POC should be built that way.

How about make the TLS pluggable?

Since akka-http is built in more-or-less cleanly stacked stream abstractions it's easy to swap out parts like this. The problem here is that QUIC itself is not a cleanly stacked QUIC on top of TLS 1.3 on top of UDP. If you look at https://quicwg.org/base-drafts/draft-ietf-quic-tls.html#name-protocol-overview you can see that QUIC isn't just using TLS but it is only using components of it. So, it's partly TLS on top of QUIC to execute the TLS handshake, then TLS provides just key material and settings for the encryption used in QUIC itself.

So, you need a TLS implementation that provides parts of its implementation as separate functions so you can recombine it to what QUIC requires.

jrudolph avatar Feb 03 '21 11:02 jrudolph

https://github.com/alibaba/xquic xquic is open source now.

He-Pin avatar Mar 18 '22 05:03 He-Pin

https://www.rfc-editor.org/rfc/rfc9114.html HTTP/3 is released now.

He-Pin avatar Jun 09 '22 06:06 He-Pin

rfc-editor.org/rfc/rfc9114.html HTTP/3 is released now.

:+1: And also the existing specs have been updated, so there's now

jrudolph avatar Jun 09 '22 06:06 jrudolph

Hi @jrudolph thanks for your work!

What's the latest thoughts along this? Also, is there any possibility overall throughput/latency performance will also improve relative to akka-http's current performance?

shafqatevo avatar Feb 06 '23 16:02 shafqatevo

We have not investigated this further, and no current plans to do so.

johanandren avatar Feb 07 '23 09:02 johanandren

Thanks for the update @johanandren!

shafqatevo avatar Feb 07 '23 14:02 shafqatevo