akka / akka-http

The Streaming-first HTTP server/module of Akka
https://doc.akka.io/libraries/akka-http/current/
Other
1.34k stars 594 forks source link

HTTP/2 client: integrate into shared pool API #3231

Open jrudolph opened 4 years ago

jrudolph commented 4 years ago

An HTTP2 outgoingConnection already has almost the needed semantics to be used as a pool. The main challenge here would be how to detect that a server supports HTTP/2 before even instantiating the connection.

That's needed because, while we could do negotiation between HTTP/1 and HTTP/2 in Http2.outgoingConnection the semantics would be so different (1 vs. multiple concurrent requests) that it wouldn't help. So, in the PoolInterface we need some probing when a pool is created and either create a pool for an HTTP/1.1 endpoint or create "just" an HTTP2 outgoing connection if that is supported.

Make sure to add documentation and examples for public APIs.

Features the pool would provide for HTTP/2 over a single plain connection:

jrudolph commented 3 years ago

Part of the discussion is also about doing load-balancing as discussed in #3505. There we discussed the idea that an HTTP/2 pool would only care for reconnection and request/response management and load-balancing would be built on top of that.