SlideShare uma empresa Scribd logo
1 de 37
Servlet 4.0
Manfred Riem (@mnriem)
Oracle
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Safe Harbor Statement
The following is intended to outline our general product direction.
It is intended for information purposes only, and may not be
incorporated into any contract. It is not a commitment to deliver
any material, code, or functionality, and should not be relied upon
in making purchasing decisions. The development, release, and
timing of any features or functionality described for Oracle’s
products remains at the sole discretion of Oracle.
2
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Agenda
Why HTTP/2?
HTTP/2 Big Features
How Servlet Might Expose These Features
Server Push and JSF/MVC
Summary and Current Status
1
2
3
4
5
3
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Why HTTP/2?
A Real Life Example
index.htm
l
style1.css
style2.css
.
.
.
script1.js
script9.js
pic1.jpg
pic8.jpg
.
.
.
photo1.p
ng
photo2.p
ng
.
.
.
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Why HTTP/2?
‱ HTTP Pipelining
‱ Head-of-Line
blocking
Problems in HTTP/1.1
style1.css
style2.css
Client Server
index.html
index.html
style1.css
style2.css
script1.js
.
.
.
script2.js
.
.
.
script1.js
script2.js
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Why HTTP/2?
‱ Inefficient use of TCP sockets
Problems in HTTP/1.1
Client ServerClient Server
Client Server
Client Server
Client Server
Client Server
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Why HTTP/2?
‱ Much of what we do in web-apps is a hack to work
around shortcomings in HTTP/1.1
– File concatenation and image sprites
– Domain sharding
– Inlined assets
What is an optimization?
7
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
File Concatenation and Image Sprites
TCP Efficiency Improves with Larger Files
8
‱ Modern web page now consists of more than 90
resources fetched from 15 distinct hosts
‱ Solution:
– Just work around it by shoving more than one logical file into
one physical file.
– Seminal article: A List Apart
http://alistapart.com/article/sprites
– Useful tool: SpritePad http://spritepad.wearekiss.com/
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
File Concatenation and Image Sprites
TCP Efficiency Improves with Larger Files
9
.ic-AerospaceAndDefense-wht-on-gray, .ic-
AerospaceAndDefense-wht-on-red, .ic-Airline-wht-on-
gray, .ic-Airline-wht-on-red{
background: url(sprites.png) no-repeat;
}
.ic-AerospaceAndDefense-wht-on-gray{
background-position: 0 0;
width: 80px;
height: 80px;
}
.ic-AerospaceAndDefense-wht-on-red{
background-position: -81px 0;
width: 80px;
height: 80px;
}
.ic-Airline-wht-on-gray{
background-position: 0 -80px ;
width: 80px;
height: 80px;
}
.ic-Airline-wht-on-red{
background-position: -81px -79px ;
width: 80px;
height: 80px;
}
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Domain Sharding
Split page resources across several hosts to work around browser
limits
10
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Inlined Assets
‱ data URLs
‱ <img
src="data:image/gif;base64,R0lGODlhEAAOALMAAOazT
oeHh0tLS/7LZv/0jvb29t/f3//Ub/
/ge8WSLf/rhf/3kdbW1mxsbP//mf///yH5BAAAAAAALAA
AAAAQAA4
" />
Base64 Encoding Will Never Die
11
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Our Plan for Your Time Investment
Why HTTP/2?
HTTP/2 Big Features
How Servlet Might Expose These Features
Server Push and JSF/MVC
Summary and Current Status
1
2
3
4
5
12
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
HTTP/2 is really just a new
transport layer underneath
HTTP/1.1
– same request/response
model
– no new methods
– no new headers
– no new usage patterns from
application layer
– no new usage of URL spec
and other lower level specs
Network Programming Review
13
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Network Programming Review
14
The Socket Angle
‱ It would be like if we took
the existing Servlet
specification
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Network Programming Review
15
The Socket Angle
‱ It would be like if we took
the existing Servlet
specification
and added a new layer
underneath it
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Network Programming Review
The Socket Angle
Client ServerClient Server
Client Server
Client Server
Client Server
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Network Programming Review
Solution in HTTP/2
Client Server
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
HTTP/2 Request Response Multiplexing
‱ Fully bi-directional
‱ Enabled by defining some terms
– Connection
A TCP socket
– Stream
A “channel” within a connection
– Message
A logical message, such as a request or a response
– Frame
The smallest unit of communication in HTTP/2.
18
Lets you do more things with a single TCP connection
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
HTTP/2 Request Response Multiplexing
19
Connections, Streams, Messages, Frames
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
HTTP/2 Request Response Multiplexing
‱ Once you break the communication down into frames,
you can interweave the logical streams over a single TCP
connection.
‱ Yet another idea from the 1960s is new again.
20
Connections, Streams, Messages, Frames
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'
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
HTTP/2 Stream Prioritization
‱ Stream Dependency in HEADERS
Frame
‱ PRIORITY frame type
‱ An additional 40 bytes
– Stream id (31)
– Weight (8): [1, 256]
– Exclusive bit (1)
‱ Only a suggestion
21
S
A
B C
4 12
A
B CD
4 16 12
exclusive = 0
A
B C
D
4 12
16
exclusive = 1
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
HTTP/2 Server Push
‱ Eliminates the need for resource inlining.
‱ Lets the server populate the browser’s cache in advance
of the browser asking for the resource to put in the
cache.
‱ No corresponding JavaScript API, but can be combined
with SSE
– Server pushes stuff into the browser’s cache.
– Server uses SSE to tell the browser to go fetch it (but we know
it’s already in the browser’s cache).
22
E
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
HTTP/2 Upgrade from HTTP/1.1
‱ Not secure
– We have to use port 80
– Use existing 101 Switching Protocols from HTTP/1.1
‱ Secure
– Next Protocol Negotiation (NPN)
– Application Layer Protocol Negotiation (ALPN)
23
Secure or not-secure?
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Agenda
Why HTTP/2?
HTTP/2 Big Features
How Servlet Might Expose These Features
Server Push and JSF/MVC
Summary and Current Status
1
2
3
4
5
24
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
‱ Existing API is 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.
‱ We must not simply bolt the “One or More Responses”
concept onto some convenient part of the existing API.
25
Challenges in Exposing HTTP/2 Features in Servlet API
Servlet 4.0 Big Ticket New Features
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
‱ Request/Response multiplexing
‱ Stream Prioritization
‱ Server Push
‱ Upgrade from HTTP/1.1
– 101 Switching Protocols
26
HTTP/2 Features Potentially Exposed in Servlet API
Servlet 4.0 Big Ticket New Features
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
‱ Add method HttpServletRequest and
HttpServletResponse
– int getStreamId()
27
Request/Response Multiplexing
Servlet 4.0 Big Ticket New Features
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
‱ Add a new class Priority
– boolean exclusive
– int streamId
– int weight
‱ Add method to HttpServletRequest
– Priority getPriority()
‱ Add methods to HttpServletResponse
– Priority getPriority()
– void setPriority(Priority p)
28
Stream Prioritization
Servlet 4.0 Big Ticket New Features
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
‱ Push resource to client for a given url and headers
‱ May add callback for completion or error of a push
‱ Not at all a replacement for WebSocket
‱ Really useful for frameworks that build on Servlet, such
as JSF
29
Server Push
Servlet 4.0 Big Ticket New Features
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | 30
Server Push
Servlet 4.0
Big Ticket
New Features
Browser
Server Thread A
servlet.service()
GET /index.html
Server
discovers
browser will
need style.css
and script.js
request.dispatchPushRequest("style.css")
request.dispatchPushRequest("script.js")
Server Thread B
servlet.service()
synthetic GET /style.css
synthetic GET /script.js
Server Thread C
servlet.service()
style.css
script.js
index.html
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Server Push
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);
}
}
}
Example of Potential Use from JSF
31
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Server Push
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);
}
Map attrs = getResourceAttrs();
((HttpServletRequest) request).dispatchPushRequest(
url, attrs);
return ((HttpServletResponse) response).encodeURL(url);
}
}
Example of Potential Use from JSF
32
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Server Push
‱ The MVC EG needs to see how this will be integrated
into the MVC specification so no example at the
moment.
Example for MVC
33
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Our Plan for Your Time Investment
Why HTTP/2?
HTTP/2 Big Features
How Servlet Might Expose These Features
Server Push and JSF/MVC
Summary and Current Status
1
2
3
4
5
34
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Summary and Current Status
‱ Servlet 4.0 brings HTTP/2 to Java EE
– 100% compliant implementation of HTTP/2
– Expose key features to the API
‱ Server Push
‱ Stream Prioritization
‱ Request/Response multiplexing
35
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Summary and Current Status
‱ JSR-369 just formed on 22 September
‱ Tentative Delivery Schedule
– Q3 2014: expert group formed
– Q2 2015: early draft
– Q3 2015: public review
– Q4 2015: proposed final draft
– Q3 2016: final release
36
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
How to Get Involved
‱ Adopt a JSR
– http://glassfish.org/adoptajsr/
‱ The Aquarium
– http://blogs.oracle.com/theaquarium/
‱ Java EE 8 Reference Implementation
– http://glassfish.org
37

Mais conteĂșdo relacionado

Mais procurados

Mais procurados (20)

Oracle WebLogic Server 12c: Seamless Oracle Database Integration (with NEC, O...
Oracle WebLogic Server 12c: Seamless Oracle Database Integration (with NEC, O...Oracle WebLogic Server 12c: Seamless Oracle Database Integration (with NEC, O...
Oracle WebLogic Server 12c: Seamless Oracle Database Integration (with NEC, O...
 
Approaches for WebLogic Server in the Cloud (OpenWorld, September 2014)
Approaches for WebLogic Server in the Cloud (OpenWorld, September 2014)Approaches for WebLogic Server in the Cloud (OpenWorld, September 2014)
Approaches for WebLogic Server in the Cloud (OpenWorld, September 2014)
 
Hortonworks Hadoop summit 2011 keynote - eric14
Hortonworks Hadoop summit 2011 keynote - eric14Hortonworks Hadoop summit 2011 keynote - eric14
Hortonworks Hadoop summit 2011 keynote - eric14
 
Em13c features- HotSos 2016
Em13c features- HotSos 2016Em13c features- HotSos 2016
Em13c features- HotSos 2016
 
HTTP/2 comes to Java. What Servlet 4.0 means to you. DevNexus 2015
HTTP/2 comes to Java.  What Servlet 4.0 means to you. DevNexus 2015HTTP/2 comes to Java.  What Servlet 4.0 means to you. DevNexus 2015
HTTP/2 comes to Java. What Servlet 4.0 means to you. DevNexus 2015
 
Customer Case - Oracle B2B Critical Mission Hub
Customer Case - Oracle B2B Critical Mission HubCustomer Case - Oracle B2B Critical Mission Hub
Customer Case - Oracle B2B Critical Mission Hub
 
Oracle Autonomous Health Service- For Protecting Your On-Premise Databases- F...
Oracle Autonomous Health Service- For Protecting Your On-Premise Databases- F...Oracle Autonomous Health Service- For Protecting Your On-Premise Databases- F...
Oracle Autonomous Health Service- For Protecting Your On-Premise Databases- F...
 
Openfest15 MySQL Plugin Development
Openfest15 MySQL Plugin DevelopmentOpenfest15 MySQL Plugin Development
Openfest15 MySQL Plugin Development
 
MVC 1.0 / JSR 371
MVC 1.0 / JSR 371MVC 1.0 / JSR 371
MVC 1.0 / JSR 371
 
Oracle SOA Suite 11g Troubleshooting Methodology
Oracle SOA Suite 11g Troubleshooting MethodologyOracle SOA Suite 11g Troubleshooting Methodology
Oracle SOA Suite 11g Troubleshooting Methodology
 
Apache NiFi Toronto Meetup
Apache NiFi Toronto MeetupApache NiFi Toronto Meetup
Apache NiFi Toronto Meetup
 
Developing Oracle Fusion Middleware Applications in the Cloud
Developing Oracle Fusion Middleware Applications in the CloudDeveloping Oracle Fusion Middleware Applications in the Cloud
Developing Oracle Fusion Middleware Applications in the Cloud
 
Lightweight Java in the Cloud
Lightweight Java in the CloudLightweight Java in the Cloud
Lightweight Java in the Cloud
 
Upgrading to Oracle SOA 12.1 & 12.2 - Practical Steps and Project Experiences
Upgrading to Oracle SOA 12.1 & 12.2 - Practical Steps and Project ExperiencesUpgrading to Oracle SOA 12.1 & 12.2 - Practical Steps and Project Experiences
Upgrading to Oracle SOA 12.1 & 12.2 - Practical Steps and Project Experiences
 
Polyglot! A Lightweight Cloud Platform for Java SE, Node, and More
Polyglot! A Lightweight Cloud Platform for Java SE, Node, and MorePolyglot! A Lightweight Cloud Platform for Java SE, Node, and More
Polyglot! A Lightweight Cloud Platform for Java SE, Node, and More
 
Apache Hive 2.0; SQL, Speed, Scale
Apache Hive 2.0; SQL, Speed, ScaleApache Hive 2.0; SQL, Speed, Scale
Apache Hive 2.0; SQL, Speed, Scale
 
Fault Tolerance in Distributed Environment
Fault Tolerance in Distributed EnvironmentFault Tolerance in Distributed Environment
Fault Tolerance in Distributed Environment
 
Hadoop Operations - Past, Present, and Future
Hadoop Operations - Past, Present, and FutureHadoop Operations - Past, Present, and Future
Hadoop Operations - Past, Present, and Future
 
Leverage integration cloud_service_for_ebs_
Leverage integration cloud_service_for_ebs_Leverage integration cloud_service_for_ebs_
Leverage integration cloud_service_for_ebs_
 
Oracle IaaS Overview - AIOUG Hyderabad Chapter
Oracle IaaS Overview - AIOUG Hyderabad ChapterOracle IaaS Overview - AIOUG Hyderabad Chapter
Oracle IaaS Overview - AIOUG Hyderabad Chapter
 

Destaque

Destaque (14)

Servlet 4.0 Adopt-a-JSR 10 Minute Infodeck
Servlet 4.0 Adopt-a-JSR 10 Minute InfodeckServlet 4.0 Adopt-a-JSR 10 Minute Infodeck
Servlet 4.0 Adopt-a-JSR 10 Minute Infodeck
 
http2 æœ€é€ŸćźŸèŁ… v2
http2 æœ€é€ŸćźŸèŁ… v2 http2 æœ€é€ŸćźŸèŁ… v2
http2 æœ€é€ŸćźŸèŁ… v2
 
Java ee 8 + security overview
Java ee 8 + security overviewJava ee 8 + security overview
Java ee 8 + security overview
 
Java EE for the Cloud
Java EE for the CloudJava EE for the Cloud
Java EE for the Cloud
 
HTTP2 æœ€é€ŸćźŸèŁ… ă€œć…„é–€ç·šă€œ
HTTP2 æœ€é€ŸćźŸèŁ… ă€œć…„é–€ç·šă€œHTTP2 æœ€é€ŸćźŸèŁ… ă€œć…„é–€ç·šă€œ
HTTP2 æœ€é€ŸćźŸèŁ… ă€œć…„é–€ç·šă€œ
 
Adopt-a-JSR session (JSON-B/P)
Adopt-a-JSR session (JSON-B/P)Adopt-a-JSR session (JSON-B/P)
Adopt-a-JSR session (JSON-B/P)
 
HTTP/2 Comes to Java - What Servlet 4.0 Means to You
HTTP/2 Comes to Java - What Servlet 4.0 Means to YouHTTP/2 Comes to Java - What Servlet 4.0 Means to You
HTTP/2 Comes to Java - What Servlet 4.0 Means to You
 
Making Java REST with JAX-RS 2.0
Making Java REST with JAX-RS 2.0Making Java REST with JAX-RS 2.0
Making Java REST with JAX-RS 2.0
 
HTTP/2 ć…„é–€
HTTP/2 ć…„é–€HTTP/2 ć…„é–€
HTTP/2 ć…„é–€
 
Adopt-a-jsr Mar 1 2017 JAX-RS update
Adopt-a-jsr Mar 1 2017 JAX-RS updateAdopt-a-jsr Mar 1 2017 JAX-RS update
Adopt-a-jsr Mar 1 2017 JAX-RS update
 
Java EE 8: What Servlet 4 and HTTP2 Mean
Java EE 8: What Servlet 4 and HTTP2 MeanJava EE 8: What Servlet 4 and HTTP2 Mean
Java EE 8: What Servlet 4 and HTTP2 Mean
 
Java EE 8: What Servlet 4.0 and HTTP/2 mean to you
Java EE 8: What Servlet 4.0 and HTTP/2 mean to youJava EE 8: What Servlet 4.0 and HTTP/2 mean to you
Java EE 8: What Servlet 4.0 and HTTP/2 mean to you
 
What is tackled in the Java EE Security API (Java EE 8)
What is tackled in the Java EE Security API (Java EE 8)What is tackled in the Java EE Security API (Java EE 8)
What is tackled in the Java EE Security API (Java EE 8)
 
Finally, EE Security API JSR 375
Finally, EE Security API JSR 375Finally, EE Security API JSR 375
Finally, EE Security API JSR 375
 

Semelhante a 2015 UJUG, Servlet 4.0 portion

Semelhante a 2015 UJUG, Servlet 4.0 portion (20)

HTTP/2 Comes to Java
HTTP/2 Comes to JavaHTTP/2 Comes to Java
HTTP/2 Comes to Java
 
Oracle REST Data Services Best Practices/ Overview
Oracle REST Data Services Best Practices/ OverviewOracle REST Data Services Best Practices/ Overview
Oracle REST Data Services Best Practices/ Overview
 
Boost Your Content Strategy for REST APIs with Gururaj BS
Boost Your Content Strategy for REST APIs with Gururaj BSBoost Your Content Strategy for REST APIs with Gururaj BS
Boost Your Content Strategy for REST APIs with Gururaj BS
 
HTTP/2 Comes to Java: Servlet 4.0 and what it means for the Java/Jakarta EE e...
HTTP/2 Comes to Java: Servlet 4.0 and what it means for the Java/Jakarta EE e...HTTP/2 Comes to Java: Servlet 4.0 and what it means for the Java/Jakarta EE e...
HTTP/2 Comes to Java: Servlet 4.0 and what it means for the Java/Jakarta EE e...
 
Explore Advanced CA Release Automation Configuration Topics
Explore Advanced CA Release Automation Configuration TopicsExplore Advanced CA Release Automation Configuration Topics
Explore Advanced CA Release Automation Configuration Topics
 
Openstack Summit Vancouver 2015 - Maintaining and Operating Swift at Public C...
Openstack Summit Vancouver 2015 - Maintaining and Operating Swift at Public C...Openstack Summit Vancouver 2015 - Maintaining and Operating Swift at Public C...
Openstack Summit Vancouver 2015 - Maintaining and Operating Swift at Public C...
 
Oracle REST Data Services
Oracle REST Data ServicesOracle REST Data Services
Oracle REST Data Services
 
MySQL Tech Tour 2015 - 5.7 Connector/J/Net
MySQL Tech Tour 2015 - 5.7 Connector/J/NetMySQL Tech Tour 2015 - 5.7 Connector/J/Net
MySQL Tech Tour 2015 - 5.7 Connector/J/Net
 
JavaCro'15 - HTTP2 Comes to Java! - David Delabassee
JavaCro'15 - HTTP2 Comes to Java! - David DelabasseeJavaCro'15 - HTTP2 Comes to Java! - David Delabassee
JavaCro'15 - HTTP2 Comes to Java! - David Delabassee
 
How to add stuff to MySQL
How to add stuff to MySQLHow to add stuff to MySQL
How to add stuff to MySQL
 
PLNOG15: The Power of the Open Standards SDN API’s - Mikael Holmberg
PLNOG15: The Power of the Open Standards SDN API’s - Mikael Holmberg PLNOG15: The Power of the Open Standards SDN API’s - Mikael Holmberg
PLNOG15: The Power of the Open Standards SDN API’s - Mikael Holmberg
 
MySQL Manchester TT - Performance Tuning
MySQL Manchester TT  - Performance TuningMySQL Manchester TT  - Performance Tuning
MySQL Manchester TT - Performance Tuning
 
What's next for Java API for WebSocket (JSR 356)
What's next for Java API for WebSocket (JSR 356)What's next for Java API for WebSocket (JSR 356)
What's next for Java API for WebSocket (JSR 356)
 
WebRTC with Java
WebRTC with JavaWebRTC with Java
WebRTC with Java
 
JAX-RS.next
JAX-RS.nextJAX-RS.next
JAX-RS.next
 
OOW15 - Installation, Cloning, and Configuration of Oracle E-Business Suite 12.2
OOW15 - Installation, Cloning, and Configuration of Oracle E-Business Suite 12.2OOW15 - Installation, Cloning, and Configuration of Oracle E-Business Suite 12.2
OOW15 - Installation, Cloning, and Configuration of Oracle E-Business Suite 12.2
 
Marcin SzaƂowicz - MySQL Workbench
Marcin SzaƂowicz - MySQL WorkbenchMarcin SzaƂowicz - MySQL Workbench
Marcin SzaƂowicz - MySQL Workbench
 
Ebr the key_to_online_application_upgrade at amis25
Ebr the key_to_online_application_upgrade at amis25Ebr the key_to_online_application_upgrade at amis25
Ebr the key_to_online_application_upgrade at amis25
 
Alta Disponibilidade no MySQL 5.7
Alta Disponibilidade no MySQL 5.7Alta Disponibilidade no MySQL 5.7
Alta Disponibilidade no MySQL 5.7
 
MySQL London Tech Tour March 2015 - MySQL Fabric
MySQL London Tech Tour March 2015 - MySQL FabricMySQL London Tech Tour March 2015 - MySQL Fabric
MySQL London Tech Tour March 2015 - MySQL Fabric
 

Último

Último (20)

🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 

2015 UJUG, Servlet 4.0 portion

  • 1. Servlet 4.0 Manfred Riem (@mnriem) Oracle Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
  • 2. Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Safe Harbor Statement The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle. 2
  • 3. Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Agenda Why HTTP/2? HTTP/2 Big Features How Servlet Might Expose These Features Server Push and JSF/MVC Summary and Current Status 1 2 3 4 5 3
  • 4. Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Why HTTP/2? A Real Life Example index.htm l style1.css style2.css . . . script1.js script9.js pic1.jpg pic8.jpg . . . photo1.p ng photo2.p ng . . .
  • 5. Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Why HTTP/2? ‱ HTTP Pipelining ‱ Head-of-Line blocking Problems in HTTP/1.1 style1.css style2.css Client Server index.html index.html style1.css style2.css script1.js . . . script2.js . . . script1.js script2.js
  • 6. Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Why HTTP/2? ‱ Inefficient use of TCP sockets Problems in HTTP/1.1 Client ServerClient Server Client Server Client Server Client Server Client Server
  • 7. Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Why HTTP/2? ‱ Much of what we do in web-apps is a hack to work around shortcomings in HTTP/1.1 – File concatenation and image sprites – Domain sharding – Inlined assets What is an optimization? 7
  • 8. Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | File Concatenation and Image Sprites TCP Efficiency Improves with Larger Files 8 ‱ Modern web page now consists of more than 90 resources fetched from 15 distinct hosts ‱ Solution: – Just work around it by shoving more than one logical file into one physical file. – Seminal article: A List Apart http://alistapart.com/article/sprites – Useful tool: SpritePad http://spritepad.wearekiss.com/
  • 9. Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | File Concatenation and Image Sprites TCP Efficiency Improves with Larger Files 9 .ic-AerospaceAndDefense-wht-on-gray, .ic- AerospaceAndDefense-wht-on-red, .ic-Airline-wht-on- gray, .ic-Airline-wht-on-red{ background: url(sprites.png) no-repeat; } .ic-AerospaceAndDefense-wht-on-gray{ background-position: 0 0; width: 80px; height: 80px; } .ic-AerospaceAndDefense-wht-on-red{ background-position: -81px 0; width: 80px; height: 80px; } .ic-Airline-wht-on-gray{ background-position: 0 -80px ; width: 80px; height: 80px; } .ic-Airline-wht-on-red{ background-position: -81px -79px ; width: 80px; height: 80px; }
  • 10. Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Domain Sharding Split page resources across several hosts to work around browser limits 10
  • 11. Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Inlined Assets ‱ data URLs ‱ <img src="data:image/gif;base64,R0lGODlhEAAOALMAAOazT oeHh0tLS/7LZv/0jvb29t/f3//Ub/ /ge8WSLf/rhf/3kdbW1mxsbP//mf///yH5BAAAAAAALAA AAAAQAA4
" /> Base64 Encoding Will Never Die 11
  • 12. Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Our Plan for Your Time Investment Why HTTP/2? HTTP/2 Big Features How Servlet Might Expose These Features Server Push and JSF/MVC Summary and Current Status 1 2 3 4 5 12
  • 13. Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | HTTP/2 is really just a new transport layer underneath HTTP/1.1 – same request/response model – no new methods – no new headers – no new usage patterns from application layer – no new usage of URL spec and other lower level specs Network Programming Review 13
  • 14. Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Network Programming Review 14 The Socket Angle ‱ It would be like if we took the existing Servlet specification
  • 15. Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Network Programming Review 15 The Socket Angle ‱ It would be like if we took the existing Servlet specification and added a new layer underneath it
  • 16. Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Network Programming Review The Socket Angle Client ServerClient Server Client Server Client Server Client Server
  • 17. Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Network Programming Review Solution in HTTP/2 Client Server
  • 18. Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | HTTP/2 Request Response Multiplexing ‱ Fully bi-directional ‱ Enabled by defining some terms – Connection A TCP socket – Stream A “channel” within a connection – Message A logical message, such as a request or a response – Frame The smallest unit of communication in HTTP/2. 18 Lets you do more things with a single TCP connection
  • 19. Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | HTTP/2 Request Response Multiplexing 19 Connections, Streams, Messages, Frames
  • 20. Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | HTTP/2 Request Response Multiplexing ‱ Once you break the communication down into frames, you can interweave the logical streams over a single TCP connection. ‱ Yet another idea from the 1960s is new again. 20 Connections, Streams, Messages, Frames 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'
  • 21. Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | HTTP/2 Stream Prioritization ‱ Stream Dependency in HEADERS Frame ‱ PRIORITY frame type ‱ An additional 40 bytes – Stream id (31) – Weight (8): [1, 256] – Exclusive bit (1) ‱ Only a suggestion 21 S A B C 4 12 A B CD 4 16 12 exclusive = 0 A B C D 4 12 16 exclusive = 1
  • 22. Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | HTTP/2 Server Push ‱ Eliminates the need for resource inlining. ‱ Lets the server populate the browser’s cache in advance of the browser asking for the resource to put in the cache. ‱ No corresponding JavaScript API, but can be combined with SSE – Server pushes stuff into the browser’s cache. – Server uses SSE to tell the browser to go fetch it (but we know it’s already in the browser’s cache). 22 E
  • 23. Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | HTTP/2 Upgrade from HTTP/1.1 ‱ Not secure – We have to use port 80 – Use existing 101 Switching Protocols from HTTP/1.1 ‱ Secure – Next Protocol Negotiation (NPN) – Application Layer Protocol Negotiation (ALPN) 23 Secure or not-secure?
  • 24. Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Agenda Why HTTP/2? HTTP/2 Big Features How Servlet Might Expose These Features Server Push and JSF/MVC Summary and Current Status 1 2 3 4 5 24
  • 25. Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | ‱ Existing API is 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. ‱ We must not simply bolt the “One or More Responses” concept onto some convenient part of the existing API. 25 Challenges in Exposing HTTP/2 Features in Servlet API Servlet 4.0 Big Ticket New Features
  • 26. Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | ‱ Request/Response multiplexing ‱ Stream Prioritization ‱ Server Push ‱ Upgrade from HTTP/1.1 – 101 Switching Protocols 26 HTTP/2 Features Potentially Exposed in Servlet API Servlet 4.0 Big Ticket New Features
  • 27. Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | ‱ Add method HttpServletRequest and HttpServletResponse – int getStreamId() 27 Request/Response Multiplexing Servlet 4.0 Big Ticket New Features
  • 28. Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | ‱ Add a new class Priority – boolean exclusive – int streamId – int weight ‱ Add method to HttpServletRequest – Priority getPriority() ‱ Add methods to HttpServletResponse – Priority getPriority() – void setPriority(Priority p) 28 Stream Prioritization Servlet 4.0 Big Ticket New Features
  • 29. Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | ‱ Push resource to client for a given url and headers ‱ May add callback for completion or error of a push ‱ Not at all a replacement for WebSocket ‱ Really useful for frameworks that build on Servlet, such as JSF 29 Server Push Servlet 4.0 Big Ticket New Features
  • 30. Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | 30 Server Push Servlet 4.0 Big Ticket New Features Browser Server Thread A servlet.service() GET /index.html Server discovers browser will need style.css and script.js request.dispatchPushRequest("style.css") request.dispatchPushRequest("script.js") Server Thread B servlet.service() synthetic GET /style.css synthetic GET /script.js Server Thread C servlet.service() style.css script.js index.html
  • 31. Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Server Push 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); } } } Example of Potential Use from JSF 31
  • 32. Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Server Push 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); } Map attrs = getResourceAttrs(); ((HttpServletRequest) request).dispatchPushRequest( url, attrs); return ((HttpServletResponse) response).encodeURL(url); } } Example of Potential Use from JSF 32
  • 33. Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Server Push ‱ The MVC EG needs to see how this will be integrated into the MVC specification so no example at the moment. Example for MVC 33
  • 34. Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Our Plan for Your Time Investment Why HTTP/2? HTTP/2 Big Features How Servlet Might Expose These Features Server Push and JSF/MVC Summary and Current Status 1 2 3 4 5 34
  • 35. Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Summary and Current Status ‱ Servlet 4.0 brings HTTP/2 to Java EE – 100% compliant implementation of HTTP/2 – Expose key features to the API ‱ Server Push ‱ Stream Prioritization ‱ Request/Response multiplexing 35
  • 36. Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Summary and Current Status ‱ JSR-369 just formed on 22 September ‱ Tentative Delivery Schedule – Q3 2014: expert group formed – Q2 2015: early draft – Q3 2015: public review – Q4 2015: proposed final draft – Q3 2016: final release 36
  • 37. Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | How to Get Involved ‱ Adopt a JSR – http://glassfish.org/adoptajsr/ ‱ The Aquarium – http://blogs.oracle.com/theaquarium/ ‱ Java EE 8 Reference Implementation – http://glassfish.org 37

Notas do Editor

  1. out additional information/disclaimers required depending on your audience.
  2. Those are the big problems that are out there in the world.
  3. This is important because HTTP/2 is essentially a new transport layer underneath the existing HTTP/1.1 semantics + a header compression specification. Same request/response model No new HTTP methods (except for PRI but that's just for the protocol) No new headers (but new names/concepts for old headers) No new usage pattern from application level Same usage of URL spec and TCP ports
  4. Another illustration of the socket angle.
  5. what can we do at the application level to work around them?
  6. Fully bi-directional at the protocol level, no HOL blocking. Message, not just request and response, there are also control messages.
  7. Headers must precede data.
  8. Two ways to specify priority: in headers or in a separate frame. Make sure people understand that this is not just an integer. It's not just like, "a bigger integer means it is more important." B and C depend on A. This information is included as a header in the HEADERS frame. These numbers are weights that correspond to the priority. If A is stuck, you can't do anything on A, you would like to do the things that are lower priority, which is B and C in this case. You would distribute the resources in the ratio of 4 to 12. An exclusive flag allows for the insertion of a new level of dependencies. The exclusive flag causes the stream to become the sole dependency of its parent stream, causing other dependencies to become dependent on the prioritized stream.
  9. Patterns: Foreshadow use of Server Push with JSF later It's a facility to allow the server to pre-populate the browser's cache with data it knows the browser will need anyway. Here is where you mention that this is not a replacement for WebSocket. It can be used in concert with SSE
  10. ----- Meeting Notes (3/11/15 17:16) ----- page speed chrome plugibn