trinodb / trino

Official repository of Trino, the distributed SQL query engine for big data, formerly known as PrestoSQL (https://trino.io)
https://trino.io
Apache License 2.0
10.54k stars 3.03k forks source link

Support and enable HTTP/2 #21793

Closed mosabua closed 1 month ago

mosabua commented 7 months ago

As discussed in numerous contributor and maintainer meetings, we plan to move Trino towards HTTP/2. Patches to support that and use it in production exist already in the user and contributor community. Experience in terms of performance gains is very promising and a desire to have this feature in Trino itself is shared across numerous stakeholders.

This issue aims to pull the various efforts together and serve as communication tool.

Following are a couple of tasks and aspects to consider:

wendigo commented 7 months ago

Jetty 12 is done but some changes in the airlift would be still needed (ALPN, HTTP/3?)

wendigo commented 7 months ago

https://github.com/airlift/airlift/pull/1156

mosabua commented 7 months ago

Related NPE fix in Airlift - https://github.com/airlift/airlift/pull/1154

mosabua commented 7 months ago

Related issue in Jetty https://github.com/jetty/jetty.project/issues/11631

Fix will be out with 12.0.9

mosabua commented 7 months ago

Related Trino isssue - https://github.com/trinodb/trino/issues/21735

wendigo commented 7 months ago

@mosabua I'd say that 21735 is unrelated to HTTP/2 itself - it applies to HTTP/1 and any other protocol as well

wendigo commented 6 months ago

I've experimented with HTTP/2 support in the Airlift and I came to the following conclusions that I'd like to discuss and seek approval from @dain @electrum.

Let's start with the features that we have implemented and knobs and switches that we expose right now:

1) Airlift's http-server supports:

2) Airlift's http-client supports:

If the default configuration is used for both server and client:

If the http-client.http2.enabled is enabled:

In order to introduce HTTP/2 support I'd like to introduce following changes:

Does it sound reasonable @dain @electrum @martint ?

cc @mosabua for visibility

electrum commented 6 months ago

This sounds reasonable to me -- summarized as remove H2C and make HTTP/2 the default on both client and server.

My only comment is that for the server side, we should also have an enable flag for HTTP/2 rather than a binder, since this something an administrator would control -- not something that the application code would depend on.

mosabua commented 6 months ago

Related to that I need some input and review on https://github.com/trinodb/trino/pull/22166

Once that is in place we can also expand to add the http/2 config stuff in there.. and the existing http-client page. And probably also stuff in the internal communication page.

mosabua commented 6 months ago

Questions -

how do we enable http/2 by default for internal communication? do we want it to be on default? do we need a fallback switch? do we want this as as separate config from server and client also ... if we enable http/2 for http-client as default.. how do we test this for the various usages of client .. (I assume we will be able to disable per prefix) How does this affect the cert stuff?

dain commented 6 months ago

how do we enable http/2 by default for internal communication? do we want it to be on default? do we need a fallback switch?

Good questions. @wendigo I assume we would want to use this by default when internal-communication.https.required is set. Basically we would always use http/2 when https is enabled, or do we still want the internal-communication.http2.enabled flag? In general, I'd like move to always using http/2 internally because the multiplexed nature means we can use long polling everywhere without worrying about running out of sockets. That would mean we move to always using https internally. I'm less concerned about this now that we have the auto-keying feature.

wendigo commented 5 months ago

@dain with the implementation that I've added in airlift we can have HTTP/2 always on for both secure and insecure internal communication. We don't need https always on for that.

mosabua commented 5 months ago

So are we plunging right into using it without a switch to disable @wendigo @dain ? And this is for internal communication.. what about other HTTP usage

mosabua commented 5 months ago

This will definitely need a release notes entry @colebow for 451

wendigo commented 1 month ago

Merged to master.