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

Lets use HTTP2 #7794

Closed
wants to merge 1 commit into from
Closed

Lets use HTTP2 #7794

wants to merge 1 commit into from

Conversation

sabino
Copy link
Contributor

@sabino sabino commented Jun 4, 2018

For now metabase uses HTTP 1.1

This change makes HTTP 2 requests possible.

Before

% curl -vso /dev/null --http2 http://localhost:3000                                                                                  18-06-04 - 18:03:31
* Rebuilt URL to: http://localhost:3000/
*   Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 3000 (#0)
> GET / HTTP/1.1
> Host: localhost:3000
> User-Agent: curl/7.54.0
> Accept: */*
> Connection: Upgrade, HTTP2-Settings
> Upgrade: h2c
> HTTP2-Settings: AAMAAABkAARAAAAAAAIAAAAA
>
< HTTP/1.1 200 OK
< X-Frame-Options: DENY
< X-XSS-Protection: 1; mode=block
< Last-Modified: Mon, 04 Jun 2018 21:03:40 +0000
< Strict-Transport-Security: max-age=31536000
< X-Permitted-Cross-Domain-Policies: none
< Cache-Control: max-age=0, no-cache, must-revalidate, proxy-revalidate
< X-Content-Type-Options: nosniff
< Content-Security-Policy: default-src 'none'; script-src 'unsafe-inline' 'unsafe-eval' 'self' https://maps.google.com https://apis.google.com https://www.google-analytics.com https://*.googleapis.com *.gstatic.com https://js-agent.newrelic.com https://*.nr-data.net ; child-src 'self' https://accounts.google.com; style-src 'unsafe-inline' 'self' fonts.googleapis.com; font-src 'self' fonts.gstatic.com themes.googleusercontent.com ; img-src * 'self' data:; connect-src 'self' metabase.us10.list-manage.com https://*.nr-data.net ;
< Content-Type: text/html;charset=utf-8
< Expires: Tue, 03 Jul 2001 06:00:00 GMT
< Transfer-Encoding: chunked
< Server: Jetty(9.4.z-SNAPSHOT)
<
{ [15401 bytes data]
* Connection #0 to host localhost left intact

After

% curl -vso /dev/null --http2 http://localhost:3000                                                                                  18-06-04 - 18:03:40
* Rebuilt URL to: http://localhost:3000/
*   Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 3000 (#0)
> GET / HTTP/1.1
> Host: localhost:3000
> User-Agent: curl/7.54.0
> Accept: */*
> Connection: Upgrade, HTTP2-Settings
> Upgrade: h2c
> HTTP2-Settings: AAMAAABkAARAAAAAAAIAAAAA
>
< 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 updated)!
< HTTP/2 200
< server: Jetty(9.4.z-SNAPSHOT)
< x-frame-options: DENY
< x-xss-protection: 1; mode=block
< last-modified: Mon, 04 Jun 2018 21:10:23 +0000
< strict-transport-security: max-age=31536000
< x-permitted-cross-domain-policies: none
< cache-control: max-age=0, no-cache, must-revalidate, proxy-revalidate
< x-content-type-options: nosniff
< content-security-policy: default-src 'none'; script-src 'unsafe-inline' 'unsafe-eval' 'self' https://maps.google.com https://apis.google.com https://www.google-analytics.com https://*.googleapis.com *.gstatic.com https://js-agent.newrelic.com https://*.nr-data.net ; child-src 'self' https://accounts.google.com; style-src 'unsafe-inline' 'self' fonts.googleapis.com; font-src 'self' fonts.gstatic.com themes.googleusercontent.com ; img-src * 'self' data:; connect-src 'self' metabase.us10.list-manage.com https://*.nr-data.net ;
< content-type: text/html;charset=utf-8
< expires: Tue, 03 Jul 2001 06:00:00 GMT
<
{ [16384 bytes data]
* 16366 data bytes written
{ [16366 bytes data]
* Connection #0 to host localhost left intact

Possibly
Fixes #6385

Before submitting the PR, please make sure you do the following
  • If there are changes to the backend codebase, run the backend tests with lein test && lein eastwood && lein bikeshed && lein docstring-checker && ./bin/reflection-linter
  • Run the frontend and integration tests with yarn lint && yarn flow && yarn test)
  • Sign the Contributor License Agreement
    (unless it's a tiny documentation change).

@tlrobinson
Copy link
Contributor

@camsaul @senior thoughts on this?

@camsaul
Copy link
Member

camsaul commented Jun 7, 2018

Hey @sabino, thanks for this PR. We're looking forward to enabling HTTP 2 support, but we'd rather wait until it's supported upstream by Ring instead of switching to an unofficial fork.

Please feel free to open a new PR to enable HTTP 2 support when it's possible to do so using the official Ring dependency. Thanks again

@camsaul camsaul closed this Jun 7, 2018
@sabino
Copy link
Contributor Author

sabino commented Jun 11, 2018

Hey @camsaul
Looks like the official ring adapter doesn't support HTTP2 yet because that would require updating the jetty version, and would make it incompatible with older JVMs.

ring-clojure/ring#127

Since metabase already dropped support for Java 7, do you really think it's a problem to use a third-party library? This library has been around since 2013.

I've opened an issue myself:
ring-clojure/ring#331

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants