+ All Categories
Home > Technology > HTTP/2 and What it Means for the Java EE Ecosystem

HTTP/2 and What it Means for the Java EE Ecosystem

Date post: 11-Jan-2017
Category:
Upload: reza-rahman
View: 17,501 times
Download: 2 times
Share this document with a friend
32
Others Talk, We Listen. HTTP/2 and What it Means for the Java EE Ecosystem Reza Rahman Senior Architect [email protected] @reza_rahman
Transcript
Page 1: HTTP/2 and What it Means for the Java EE Ecosystem

Others Talk, We Listen.

HTTP/2 and What it Means for the Java EE EcosystemReza RahmanSenior [email protected]@reza_rahman

Page 2: HTTP/2 and What it Means for the Java EE Ecosystem

CapTech

Full-service US national IT consulting firm that focuses on client best interests, trust, servant leadership, culture, professionalism and technical excellence.

#28 in Vault's Consulting Top 50#3 Best Consulting Internship#9 Best Overall Internship

#1 in Meeting Client’s Needs#7 Best Firm to Work For#1 in Career Development

Ranked for the 7th Consecutive Year

Copyright © 2015 CapTech Ventures, Inc. All rights reserved.

Page 3: HTTP/2 and What it Means for the Java EE Ecosystem

Why HTTP/2?

Copyright © 2015 CapTech Ventures, Inc. All rights reserved.

The Web of the Past

Page 4: HTTP/2 and What it Means for the Java EE Ecosystem

Why HTTP/2?

Copyright © 2015 CapTech Ventures, Inc. All rights reserved.

The Web Today

Page 5: HTTP/2 and What it Means for the Java EE Ecosystem

HTTP Pipelining/Head-of-Line Blocking

Copyright © 2015 CapTech Ventures, Inc. All rights reserved.

style1.cssstyle2.css

Client Server

index.html

index.html

style1.cssstyle2.cssscript1.js

.

.

.

script2.js

.

.

.

script1.jsscript2.js

Page 6: HTTP/2 and What it Means for the Java EE Ecosystem

Socket Abuse/Max Connections

Copyright © 2015 CapTech Ventures, Inc. All rights reserved.

Client Server

Client Server

Client Server

Client Server

Client Server

Client Server

Page 7: HTTP/2 and What it Means for the Java EE Ecosystem

HTTP 1.1 Hacks

• File concatenation and image sprites• Domain sharding• Inlined assets

Copyright © 2015 CapTech Ventures, Inc. All rights reserved.

Page 8: HTTP/2 and What it Means for the Java EE Ecosystem

HTTP/2

• HTTP/2 is new transport layer underneath HTTP/1.1• Same request/response model• No new methods• No new headers• No new URLs or ports

Copyright © 2015 CapTech Ventures, Inc. All rights reserved.

At the Network Layer

Page 9: HTTP/2 and What it Means for the Java EE Ecosystem

HTTP/2

• Sockets scarce resource• Only one open per server

Copyright © 2015 CapTech Ventures, Inc. All rights reserved.

At the Socket Layer

Page 10: HTTP/2 and What it Means for the Java EE Ecosystem

Socket Abuse/Max Connections

Copyright © 2015 CapTech Ventures, Inc. All rights reserved.

Client Server

Client Server

Client Server

Client Server

Client Server

Client Server

Page 11: HTTP/2 and What it Means for the Java EE Ecosystem

Sockets in HTTP/2

Copyright © 2015 CapTech Ventures, Inc. All rights reserved.

Client Server

Page 12: HTTP/2 and What it Means for the Java EE Ecosystem

HTTP/2 Big Ticket Features

• Request/response multiplexing• Binary framing• Stream prioritization• Server push• Header compression• HTTP/2 upgrade

• ALPN• 101 Switching Protocols

Copyright © 2015 CapTech Ventures, Inc. All rights reserved.

Page 13: HTTP/2 and What it Means for the Java EE Ecosystem

HTTP/2 Request/Response Multiplexing

Copyright © 2015 CapTech Ventures, Inc. All rights reserved.

Page 14: HTTP/2 and What it Means for the Java EE Ecosystem

HTTP/2 Request/Response Multiplexing

Copyright © 2015 CapTech Ventures, Inc. All rights reserved.

Page 15: HTTP/2 and What it Means for the Java EE Ecosystem

HTTP/2 Header Compression

Copyright © 2015 CapTech Ventures, Inc. All rights reserved.

Page 16: HTTP/2 and What it Means for the Java EE Ecosystem

HTTP/2 Stream Prioritization

Copyright © 2015 CapTech Ventures, Inc. All rights reserved.

A

B C

4 12

A

B CD

4 16 12

A

B C

D

4 12

16

Page 17: HTTP/2 and What it Means for the Java EE Ecosystem

HTTP/2 Server Push

• Eliminates need for resource in-lining.• Lets server populate browser’s cache in advance.

Copyright © 2015 CapTech Ventures, Inc. All rights reserved.

Page 18: HTTP/2 and What it Means for the Java EE Ecosystem

HTTP/2 Upgrade from HTTP/1.1

• Not secure• Use port 80• Use existing 101 Switching Protocols from HTTP/1.1

• Secure• Application Layer Protocol Negotiation (ALPN)

Copyright © 2015 CapTech Ventures, Inc. All rights reserved.

Page 19: HTTP/2 and What it Means for the Java EE Ecosystem

http://www.http2demo.io

Copyright © 2015 CapTech Ventures, Inc. All rights reserved.

Page 20: HTTP/2 and What it Means for the Java EE Ecosystem

Servlet 4 Abstracts All This

Copyright © 2015 CapTech Ventures, Inc. All rights reserved.

Page 21: HTTP/2 and What it Means for the Java EE Ecosystem

Servlet 4

• Servlet well positioned to enable HTTP/2• Low-level protocol changes absorbed transparently• Allow frameworks to effectively leverage server push

Copyright © 2015 CapTech Ventures, Inc. All rights reserved.

Page 22: HTTP/2 and What it Means for the Java EE Ecosystem

Challenges Exposing HTTP/2 Features in Servlet

• Existing API designed for one request == one response.• HTTP/2 destroys this assumption.• It will be challenging to do justice to the new reality of one request == one or more responses.

Copyright © 2015 CapTech Ventures, Inc. All rights reserved.

Page 23: HTTP/2 and What it Means for the Java EE Ecosystem

HTTP/2 Features Exposed in Servlet

• Request/response multiplexing• Binary framing• Stream prioritization• Server push• Header compression• HTTP/2 upgrade

• ALPN• 101 Switching Protocols

Copyright © 2015 CapTech Ventures, Inc. All rights reserved.

Page 24: HTTP/2 and What it Means for the Java EE Ecosystem

Servlet 4 New Features

• HTTP/2 required• Server push

• Push resource to client for a given URL and headers.• Really useful for frameworks that build on Servlet, such as JSF• Builder API

Copyright © 2015 CapTech Ventures, Inc. All rights reserved.

Page 25: HTTP/2 and What it Means for the Java EE Ecosystem

javax.servlet.http.PushBuilder

Copyright © 2015 CapTech Ventures, Inc. All rights reserved.

Page 26: HTTP/2 and What it Means for the Java EE Ecosystem

Server Push via Builder API

Copyright © 2015 CapTech Ventures, Inc. All rights reserved.

Page 27: HTTP/2 and What it Means for the Java EE Ecosystem

Server Push in JSF

Copyright © 2015 CapTech Ventures, Inc. All rights reserved.

public class FacesServlet implements Servlet { public void service(ServletRequest req, ServletResponse resp) throws IOException, ServletException { //... HttpServletRequest request = (HttpServletRequest) req; try { ResourceHandler handler = context.getApplication().getResourceHandler(); if (handler.isResourceRequest(context)) { handler.handleResourceRequest(context); } else { lifecycle.attachWindow(context); lifecycle.execute(context); lifecycle.render(context); } } }

Page 28: HTTP/2 and What it Means for the Java EE Ecosystem

Server Push in JSF

Copyright © 2015 CapTech Ventures, Inc. All rights reserved.

public class ExternalContextImpl extends ExternalContext { //... public String encodeResourceURL(String url) { if (null == url) { String message = MessageUtils.getExceptionMessageString (MessageUtils.NULL_PARAMETERS_ERROR_MESSAGE_ID, "url"); throw new NullPointerException(message); } ((HttpServletRequest) request).getPushBuilder().path(url).push(); return ((HttpServletResponse) response).encodeURL(url); } //...}

Page 29: HTTP/2 and What it Means for the Java EE Ecosystem

Current Status

Copyright © 2015 CapTech Ventures, Inc. All rights reserved.

• Minimal early draft released, further progress basically stalled.

Page 30: HTTP/2 and What it Means for the Java EE Ecosystem

Java EE Guardians

https://groups.google.com/group/javaee-guardians@javaee_guardian

Copyright © 2015 CapTech Ventures, Inc. All rights reserved.

Page 31: HTTP/2 and What it Means for the Java EE Ecosystem

Resources

• http2 explained• https://daniel.haxx.se/http2/

• Servlet 4 Specification• https://servlet-spec.java.net

Copyright © 2015 CapTech Ventures, Inc. All rights reserved.

Page 32: HTTP/2 and What it Means for the Java EE Ecosystem

Copyright © 2015 CapTech Ventures, Inc. All rights reserved.


Recommended