Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

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

38,271 views

Published on

HTTP is very easily the most important standard in server-side Java. The much awaited HTTP/2 standard is now complete, was fifteen years in the making and promises to radically speed up the entire web through a series of fundamental protocol optimizations.

In this session we will take a detailed look at the changes in HTTP/2 and discuss how it may change the Java EE ecosystem including the foundational Servlet 4 specification included in Java EE 8.

Published in: Technology
  • Be the first to comment

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

  1. 1. Others Talk, We Listen. HTTP/2 and What it Means for the Java EE Ecosystem Reza Rahman Senior Architect rrahman@captechconsulting.com @reza_rahman
  2. 2. 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.
  3. 3. Why HTTP/2? Copyright © 2015 CapTech Ventures, Inc. All rights reserved. The Web of the Past
  4. 4. Why HTTP/2? Copyright © 2015 CapTech Ventures, Inc. All rights reserved. The Web Today
  5. 5. HTTP Pipelining/Head-of-Line Blocking Copyright © 2015 CapTech Ventures, Inc. All rights reserved. style1.css style2.css Client Server index.html index.html style1.css style2.css script1.js . . . script2.js . . . script1.js script2.js
  6. 6. Socket Abuse/Max Connections Copyright © 2015 CapTech Ventures, Inc. All rights reserved. Client Server Client Server Client Server Client Server Client Server Client Server
  7. 7. HTTP 1.1 Hacks • File concatenation and image sprites • Domain sharding • Inlined assets Copyright © 2015 CapTech Ventures, Inc. All rights reserved.
  8. 8. 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
  9. 9. HTTP/2 • Sockets scarce resource • Only one open per server Copyright © 2015 CapTech Ventures, Inc. All rights reserved. At the Socket Layer
  10. 10. Socket Abuse/Max Connections Copyright © 2015 CapTech Ventures, Inc. All rights reserved. Client Server Client Server Client Server Client Server Client Server Client Server
  11. 11. Sockets in HTTP/2 Copyright © 2015 CapTech Ventures, Inc. All rights reserved. Client Server
  12. 12. 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.
  13. 13. HTTP/2 Request/Response Multiplexing Copyright © 2015 CapTech Ventures, Inc. All rights reserved.
  14. 14. HTTP/2 Request/Response Multiplexing Copyright © 2015 CapTech Ventures, Inc. All rights reserved. Browser ServerSingle TCP connection for HTTP 2 STREAM'4' HEADERS' STREAM'9' HEADERS' STREAM'7' DATA' STREAM'7' HEADERS' STREAM'2' HEADERS' STREAM'2' DATA'
  15. 15. HTTP/2 Header Compression Copyright © 2015 CapTech Ventures, Inc. All rights reserved.
  16. 16. 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
  17. 17. 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.
  18. 18. 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.
  19. 19. http://www.http2demo.io Copyright © 2015 CapTech Ventures, Inc. All rights reserved.
  20. 20. Servlet 4 Abstracts All This Copyright © 2015 CapTech Ventures, Inc. All rights reserved.
  21. 21. 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.
  22. 22. 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.
  23. 23. 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.
  24. 24. 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.
  25. 25. javax.servlet.http.PushBuilder Copyright © 2015 CapTech Ventures, Inc. All rights reserved.
  26. 26. Server Push via Builder API Copyright © 2015 CapTech Ventures, Inc. All rights reserved.
  27. 27. 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); } } }
  28. 28. 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); } //... }
  29. 29. Current Status Copyright © 2015 CapTech Ventures, Inc. All rights reserved. • Minimal early draft released, further progress basically stalled.
  30. 30. Java EE Guardians https://groups.google.com/group/javaee-guardians @javaee_guardian Copyright © 2015 CapTech Ventures, Inc. All rights reserved.
  31. 31. Resources • http2 explained • https://daniel.haxx.se/http2/ • Servlet 4 Specification • https://servlet-spec.java.net Copyright © 2015 CapTech Ventures, Inc. All rights reserved.
  32. 32. Copyright©2015CapTechVentures,Inc.Allrightsreserved.

×