SlideShare a Scribd company logo
Devoxx	
  UK	
  
June	
  2015	
  
David	
  Delabassee	
  -­‐	
  @delabassee	
  
Oracle	
  
Copyright	
  ©	
  2015,	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved.	
  	
  
HTTP/2	
  Comes	
  to	
  Java
1
Copyright	
  ©	
  2015,	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved. @delabassee#HTTP/2
Agenda
Why	
  HTTP/2?	
  
HTTP/2	
  
HTTP/2	
  and	
  Java	
  EE	
  
HTTP/2	
  and	
  Java	
  SE	
  
Summary
Copyright	
  ©	
  2015,	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved. @delabassee#HTTP/2
Agenda
Why	
  HTTP/2?	
  
HTTP/2	
  
HTTP/2	
  and	
  Java	
  SE	
  
HTTP/2	
  and	
  Java	
  EE	
  
Summary
Copyright	
  ©	
  2015,	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved. 4 @delabassee#HTTP/2
Data	
  Never	
  Sleeps	
  2.0
https://www.domo.com/learn/data-­‐never-­‐sleeps-­‐2
Copyright	
  ©	
  2015,	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved. 5 @delabassee#HTTP/2
HTTP	
  1.x
1991	
   1996	
   1999	
   2009	
   2015	
  
HTTP/0.9	
  
HTTP/1.0	
  
HTTP/1.1	
  
SPDY	
  
HTTP/2.0	
  
Copyright	
  ©	
  2015,	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved. 6 @delabassee#HTTP/2
Copyright	
  ©	
  2015,	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved. 7 @delabassee#HTTP/2
Copyright	
  ©	
  2015,	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved. 8 @delabassee#HTTP/2
Copyright	
  ©	
  2015,	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved. 9 @delabassee#HTTP/2
Copyright	
  ©	
  2015,	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved. 10 @delabassee#HTTP/2
Copyright	
  ©	
  2015,	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved. 11 @delabassee#HTTP/2
Today
index.html
style1.css
style2.css
.	
  
.	
  
.	
  
script1.js
script9.js
pic1.jpg
pic8.jpg
.	
  
.	
  
.	
  
photo1.png
photo2.png
.	
  
.	
  
.	
  
Copyright	
  ©	
  2015,	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved. 12 @delabassee#HTTP/2
google.fr	
  (1st)	
  
• 3	
  HTTP	
  Requests	
  
• 21.355	
  bytes	
  
- 1	
  HTML	
  
- 1	
  image	
  
- 1	
  .js
Top	
  .FR	
  examples
lefigaro.fr	
  (15th)	
  
• 140	
  HTTP	
  Requests	
  
• 2.736.562	
  bytes	
  
- 1	
  HTML	
  
- 130	
  images	
  
- 6	
  .js	
  
- 2	
  .css	
  
Copyright	
  ©	
  2015,	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved. 13 @delabassee#HTTP/2
• If	
  a	
  page	
  takes	
  longer	
  than	
  4	
  sec	
  to	
  load,	
  1/4	
  people	
  abandons	
  that	
  page	
  (1)	
  
• 57%	
  of	
  consumers	
  will	
  abandon	
  a	
  page	
  that	
  takes	
  longer	
  than	
  3	
  sec	
  to	
  load	
  (2)	
  
• Page	
  load	
  slowdown	
  of	
  1	
  sec	
  could	
  cost	
  Amazon	
  $1.6	
  billion	
  in	
  sales	
  a	
  year	
  (1)	
  
• Slowing	
  search	
  results	
  by	
  0.4	
  sec,	
  Google	
  could	
  lose	
  8	
  million	
  searches	
  per	
  day	
  (1)
Latency	
  Vs.	
  Conversion	
  Rate
Time	
  is	
  Money!
(1)	
  http://www.fastcompany.com/1825005/how-­‐one-­‐second-­‐could-­‐cost-­‐amazon-­‐16-­‐billion-­‐sales	
  
(2)	
  RadView	
  Spring	
  2015	
  State	
  of	
  the	
  Union:	
  Ecommerce	
  Page	
  Speed	
  &	
  Web	
  Performance
@delabassee#HTTP/2 Copyright	
  ©	
  2015,	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved.
HTTP	
  1.1
Head-­‐of-­‐Line	
  blocking
14
Client Server
index.html
index.html
style1.css	
  
style2.css	
  
script1.js	
  
...
style1.css	
  
style2.css	
  
script1.js	
  
...
Copyright	
  ©	
  2015,	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved. 15 @delabassee#HTTP/2
HTTP	
  1.1
Copyright	
  ©	
  2015,	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved. 16 @delabassee#HTTP/2
File	
  Concatenation	
  and	
  Image	
  Sprites
• Modern	
  web	
  page	
  consists	
  of	
  +90	
  resources	
  fetched	
  from	
  15	
  distinct	
  
hosts	
  (http://httparchive.org)	
  
• TCP	
  Efficiency	
  Improves	
  with	
  Larger	
  Files	
  
• Shoving	
  more	
  than	
  one	
  logical	
  file	
  into	
  one	
  physical	
  file
Copyright	
  ©	
  2015,	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved. 17 @delabassee#HTTP/2
File	
  Concatenation	
  and	
  Image	
  Sprites
Copyright	
  ©	
  2015,	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved. 18 @delabassee#HTTP/2
HTTP	
  1.1
Workaround	
  -­‐	
  Domain	
  Sharding
Copyright	
  ©	
  2015,	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved. 19 @delabassee#HTTP/2
Asset	
  inlining
…	
  
<img	
  src="data:image/gif;base64,R0lGODlhEAAOexs3eeALMAAOazToeHh0tLS/
7LZv0jvb29tf3Ubge8WSLrhf3kdbW1mxsjkhfkjfhGHhcjGDSHJUYgJvhgtyrHgfGfHy
t56HGfGH56ge8WSLf6GGHhfkjfhhfkjfhpBREzxvt6QAA4lsjkhfkjfhdxwqBnuIoYty
GhBKoOjJj6GGHvvhdsbxus38GV3pBREzxvt6QAA4lsjkhfkjfhdxwqBnuIoYtyGhBKoO
jJj6GGHvvhdsbxus38GV3vvhdsbxusbasbPmfyH5BAAAjAAAALAAfhGHhcjAAAAQAA4l
sjkhfkjfhGHhcjGDSHJUYgJvhgtyrHgfhfkjfhpBREzxvt6QAA4lsjkhfkjfhdxwqBnu
IoYtyGhBKoOjJj6GGHvvhdsbxus38GV3GfHyt56HGfGH56ge8WsjkhfkjfhGHhcjGDSH
JUYgJvhgtyrHgfGfHyt56HGfGH56gebxus38G8WSLf6GGHvvhdsbxusbaSLf6GGHvvhd
sbxusbaOiQA4lsjkhfkjf4lsjkhfkjf4lsjbxus38GkhfkjfhfkjfhpBREzxvt6QAA4l
sjkhfkjfhdxwqBnuIoYtyGhBKoOjJj6GGHvvhdsbxus38GV3DcPjjBceXsplojj…”	
  />	
  
…
Copyright	
  ©	
  2015,	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved. 20 @delabassee#HTTP/2
• HTTP	
  uses	
  TCP	
  poorly	
  
- HTTP:	
  short	
  and	
  bursty	
  flows	
  Vs.	
  TCP:	
  optimized	
  for	
  long-­‐lived	
  flows	
  
• Solutions	
  
- Sprites	
  
- Domain	
  sharding	
  
- Assets	
  Inlining	
  
- File	
  concatenations	
  
- …
HTTP/1.1	
  circa	
  1999
Problems	
  Vs	
  Solutions
1991	
   1996	
   1999	
   2009	
   2015	
  
HTTP/0.9	
  
HTTP/1.0	
  
HTTP/1.1	
  
SPDY	
  
HTTP/2.0	
  
Copyright	
  ©	
  2015,	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved. @delabassee#HTTP/2
Agenda
Why	
  HTTP/2?	
  
HTTP/2	
  
HTTP/2	
  and	
  Java	
  SE	
  
HTTP/2	
  and	
  Java	
  EE	
  
Summary
Copyright	
  ©	
  2015,	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved. @delabassee#HTTP/2
HTTP/2
• Jan	
  2015	
  
• Feb	
  2015	
  
• May	
  2015
22
Enabled	
  by	
  default	
  in	
  FireFox	
  (35)	
  and	
  Chrome	
  (40)	
  
IESG	
  approved	
  HTTP/2	
  
HTTP/2	
  in	
  10%	
  of	
  all	
  HTTP	
  responses	
  (FireFox)	
  
HTTP/2	
  used	
  in	
  18%	
  of	
  global	
  traffic	
  (Google)	
  
RFC	
  7540	
  	
  “Hypertext	
  Transfer	
  Protocol	
  Version	
  2”	
  
RFC	
  7541	
  	
  “HPACK:	
  Header	
  Compression	
  for	
  HTTP/2”	
  	
  
#HTTP/2
Copyright	
  ©	
  2015,	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved. 23 @delabassee#HTTP/2
Browsers	
  support
…	
  as	
  of	
  June	
  16	
  2015
http://caniuse.com/http2	
  
Copyright	
  ©	
  2015,	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved.	
   @delabassee#HTTP/2 24
HTTP/2	
  Features
• Binary	
  Framing	
  over	
  single	
  TCP	
  connection	
  
• Request/Response	
  multiplexing	
  
• Stream	
  Prioritization	
  
• Server	
  Push	
  
• Upgrade	
  from	
  HTTP	
  1.1	
  
• Header	
  Compression
Copyright	
  ©	
  2015,	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved. 25 @delabassee#HTTP/2
HTTP/2
• Fully	
  bi-­‐directional	
  
– Connection

A	
  TCP	
  socket	
  
– Message	
  

A	
  logical	
  HTTP	
  message,	
  such	
  as	
  a	
  request	
  or	
  a	
  response	
  	
  
– Stream

A	
  bi-­‐directional	
  “channel”	
  within	
  a	
  connection,	
  carry	
  one	
  or	
  more	
  message	
  
– Frame

The	
  smallest	
  unit	
  of	
  communication	
  in	
  HTTP/2
Lets	
  you	
  do	
  more	
  things	
  with	
  a	
  single	
  TCP	
  connection
Copyright	
  ©	
  2015,	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved. 26 @delabassee#HTTP/2
HTTP/2
Connections,	
  Streams,	
  Messages,	
  Frames
@delabassee#HTTP/2 Copyright	
  ©	
  2015,	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved.
Binary	
  Frames
• Frames	
  
- HEADERS,	
  DATA,	
  PRIORITY,	
  RST_STREAM,	
  SETTINGS,	
  PUSH_PROMISE,	
  PING,	
  
GOAWAY,	
  WINDOW_UPDATE,	
  CONTINUATION	
  
- Prioritisation,	
  Flow	
  Control,	
  Server	
  Push,	
  …	
  	
  
• Single	
  TCP	
  Connection
27
POST	
  /upload	
  HTTP/1.1	
  
Host:	
  www.test.com	
  
Content-­‐Type:	
  application/json	
  
Content-­‐Length:	
  15	
  
{“name”:“duke”}
HTTP	
  1.1 HTTP/2
HEADERS	
  frame
DATA	
  frame
Copyright	
  ©	
  2015,	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved. 28 @delabassee#HTTP/2
HTTP/2	
  Binary	
  Framing
GET	
  /index.html	
  HTTP/1.1

Host:	
  example.com

Accept:	
  text/html
Example	
  1
HEADERS

	
  	
  	
  	
  +	
  END_STREAM

	
  	
  	
  	
  +	
  END_HEADERS

	
  	
  	
  	
  	
  	
  	
  	
  :method:	
  GET

	
  	
  	
  	
  	
  	
  	
  	
  :scheme:	
  http

	
  	
  	
  	
  	
  	
  	
  	
  :path:	
  /index.html

	
  	
  	
  	
  	
  	
  	
  	
  :authority:	
  example.org

	
  	
  	
  	
  	
  	
  	
  	
  accept:	
  text/html
Copyright	
  ©	
  2015,	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved. 29 @delabassee#HTTP/2
HTTP/2	
  Binary	
  Framing
HTTP/1.1	
  200	
  OK

Content-­‐Length:	
  11

Content-­‐Type:	
  text/html



Hello	
  World
Example	
  2
HEADERS

	
  	
  	
  	
  -­‐	
  END_STREAM

	
  	
  	
  	
  +	
  END_HEADERS

	
  	
  	
  	
  	
  	
  	
  	
  :status:	
  200

	
  	
  	
  	
  	
  	
  	
  	
  content-­‐length:	
  11

	
  	
  	
  	
  	
  	
  	
  	
  content-­‐type:	
  text/html



DATA

	
  	
  	
  	
  +	
  END_STREAM

Hello	
  World
Copyright	
  ©	
  2015,	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved. 30 @delabassee#HTTP/2
Multiplexing
Copyright	
  ©	
  2015,	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved. 31 @delabassee#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	
  an	
  advice
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. @delabassee#HTTP/2
Server	
  Push
/index.html	
  	
  	
  stream	
  1	
  
/style.css	
  	
  	
  	
  	
  	
  	
  	
  stream	
  2	
  
/script.js	
  	
  	
  	
  	
  	
  	
  	
  	
  stream	
  4
Client Server
stream	
  1	
  
HEADERS
stream	
  1	
  
DATA
stream	
  2	
  	
  	
  	
  
PROMISE
stream	
  4	
  
PROMISE
• No	
  corresponding	
  JavaScript	
  API	
  
• Can	
  be	
  combined	
  with	
  SSE
Copyright	
  ©	
  2015,	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved. 33 @delabassee#HTTP/2
Header	
  Compression
HPack
Copyright	
  ©	
  2015,	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved. 34 @delabassee#HTTP/2
Upgrade	
  from	
  HTTP	
  1.1
• HTTP	
  
- Port	
  80	
  
- HTTP	
  Upgrade	
  to	
  “h2c”	
  (101	
  Switching	
  Protocol)	
  
• HTTPS	
  (*)	
  
- Application	
  Layer	
  Protocol	
  Negotiation	
  (ALPN)	
  
- Next	
  Protocol	
  Negotiation	
  (NPN)	
  
(*)	
  TLS	
  is	
  not	
  mandatory
Copyright	
  ©	
  2015,	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved. @delabassee#HTTP/2
Agenda
Why	
  HTTP/2?	
  
HTTP/2	
  
HTTP/2	
  and	
  Java	
  SE	
  
HTTP/2	
  and	
  Java	
  EE	
  
Summary
Copyright	
  ©	
  2015,	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved. @delabassee#HTTP/2
Java	
  9	
  Support	
  for	
  HTTP/2
• JEP	
  110	
  
- http://openjdk.java.net/jeps/110	
  
• Supports	
  both	
  HTTP	
  1.1	
  and	
  2	
  
• Easy	
  to	
  use	
  API	
  
• Covers	
  only	
  the	
  most	
  common	
  use	
  cases	
  
• Synchronous	
  &	
  Asynchronous
36#HTTP/2
Copyright	
  ©	
  2015,	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved. @delabassee#HTTP/2
Java	
  9
//	
  HttpRequest	
  builder	
  from	
  the	
  default	
  HttpClient	
  
HttpResponse	
  response	
  =	
  HttpRequest.create(new	
  URI("http://www.abc.be"))	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  .send(HttpRequest.noBody());	
  
String	
  responseBody	
  =	
  response.body(HttpResponse.asString());	
  
response	
  =	
  HttpRequest.create(new	
  URI("http://www.abc.be"))	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  .body(fromString("param1=Abc"))	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  .post()	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  .send();	
  
…
37
Copyright	
  ©	
  2015,	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved. @delabassee#HTTP/2
Java	
  9
HttpResponse	
  response	
  =	
  HttpRequest.create(new	
  URI("http://www.abc.be"))	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  .header("Foo-­‐header",	
  "Bar")	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  .body(noBody())	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  .get()	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  .send();	
  	
  	
  	
  	
  	
  	
  
int	
  responseCode	
  =	
  response.responseCode();	
  
SSLParameters	
  sslPar	
  =	
  response.sslParameters();	
  
String	
  responseBody	
  =	
  response.body(asString());
38
Copyright	
  ©	
  2015,	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved. @delabassee#HTTP/2
Java	
  9
String[]	
  myFiles	
  =	
  {"foo.txt",	
  "bar.txt",	
  "blah.txt"};	
  
CompletableFuture<Path>	
  futures[]	
  =	
  new	
  CompletableFuture[myFiles.length];	
  
URI	
  base	
  =	
  new	
  URI("http://abc.be/resources")	
  
for	
  (int	
  i=0;	
  i<myFiles.length;	
  i++)	
  {	
  
	
  	
  	
  	
  	
  	
  	
  	
  String	
  filename	
  =	
  filenames[i];	
  
	
  	
  	
  	
  	
  	
  	
  	
  URI	
  uri	
  =	
  base.resolve(filename);	
  
	
  	
  	
  	
  	
  	
  	
  	
  futures[i]	
  =	
  HttpRequest.create(uri)	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  .body(noBody())	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  .sendAsync()	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  .thenApply((HttpResponse	
  resp)	
  -­‐>	
  {	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  return	
  resp.body(asFile(“/tmp/"	
  +	
  filename));	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  });	
  
}	
  
…
39
Copyright	
  ©	
  2015,	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved. @delabassee#HTTP/2
Java	
  9
MultiResponseProcessor	
  multi;	
  
HttpRequest.create(new	
  URI(“http://abc.be/"))	
  
	
  	
  	
  	
  	
  .body(noBody())	
  
	
  	
  	
  	
  	
  .sendMulti(	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  (multi	
  =	
  HttpResponse.multi(	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  (HttpRequest	
  initiator,	
  HttpRequest	
  pushPromise)	
  -­‐>	
  {	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  if	
  (pushPromise	
  ==	
  null)	
  {	
  //	
  main	
  request	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  return	
  HttpResponse.asFile("/mainResponse");	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  }	
  else	
  {	
  //	
  Push	
  Promise(s)	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  String	
  path	
  =	
  pushPromise.uri().getPath();	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  return	
  HttpResponse.asFile("/extra/"	
  +	
  path);	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  }	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  })	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  )	
  
	
  	
  	
  	
  	
  );	
  
multi.allActivity().join();
40
Copyright	
  ©	
  2015,	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved. @delabassee#HTTP/2
Agenda
Why	
  HTTP/2?	
  
HTTP/2	
  
HTTP/2	
  and	
  Java	
  SE	
  
HTTP/2	
  and	
  Java	
  EE	
  
Summary
Copyright	
  ©	
  2015,	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved. 42 @delabassee#HTTP/2
• Request/Response	
  multiplexing	
  
• Binary	
  Framing	
  
• Stream	
  Prioritization	
  
• Server	
  Push	
  
• Header	
  Compression	
  
• Upgrade	
  from	
  HTTP	
  1.1	
  
– ALPN	
  or	
  (NPN)	
  
– 101	
  Switching	
  Protocols
HTTP/2
Copyright	
  ©	
  2015,	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved. 43 @delabassee#HTTP/2
• Request/Response	
  Multiplexing	
  
• Binary	
  Framing	
  
• Stream	
  Prioritization	
  
• Server	
  Push	
  
• Header	
  Compression	
  
• Upgrade	
  from	
  HTTP	
  1.1	
  
– ALPN	
  or	
  (NPN)	
  
– 101	
  Switching	
  Protocols
Features	
  to	
  be	
  Exposed	
  in	
  the	
  Servlet	
  API
HTTP/2
Copyright	
  ©	
  2015,	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved. 44 @delabassee#HTTP/2
• New	
  Priority	
  class	
  
– boolean	
  exclusive	
  
– int	
  streamId	
  
– int	
  weight	
  
• New	
  methods	
  to	
  HttpServletRequest	
  
– int	
  getStreamId()	
  
– Priority	
  getPriority()	
  
• New	
  methods	
  to	
  HttpServletResponse	
  
– int	
  getStreamId()	
  
– Priority	
  getPriority()	
  
– void	
  setPriority(Priority	
  p)	
  
• Dependency?
Servlet	
  4.0	
  -­‐	
  Stream	
  Prioritization
Copyright	
  ©	
  2015,	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved. 45 @delabassee#HTTP/2
• Push	
  resource	
  to	
  client	
  for	
  a	
  given	
  url	
  and	
  headers	
  
• May	
  add	
  callback	
  for	
  completion	
  or	
  error	
  of	
  a	
  push	
  
• Not	
  a	
  replacement	
  for	
  WebSocket
Servlet	
  4.0	
  -­‐	
  Server	
  Push
Copyright	
  ©	
  2015,	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved. 46 @delabassee#HTTP/2
Server	
  Push
private	
  void	
  pushResource(String	
  relativeResourcePath)	
  {	
  
final	
  Request	
  jettyRequest	
  =	
  (Request)	
  getRequest();	
  
final	
  PushBuilder	
  pushBuilder	
  =	
  jettyRequest.getPushBuilder();	
  
pushBuilder.setQueryString(…)	
  
	
  	
  	
  	
  	
  	
  	
  	
  .push(relativeResourcePath);	
  
	
  	
  	
  	
  	
  	
  
//…	
  
}

Jetty’s	
  PushBuilder	
  ?
Copyright	
  ©	
  2015,	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved. @delabassee#HTTP/2
Agenda
Why	
  HTTP/2?	
  
HTTP/2	
  
HTTP/2	
  and	
  Java	
  SE	
  
HTTP/2	
  and	
  Java	
  EE	
  
Summary
Copyright	
  ©	
  2015,	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved. @delabassee#HTTP/2
HTTP/2
• Address	
  the	
  Limitations	
  of	
  HTTP	
  1.x	
  
- Improve	
  ressources	
  utilization,	
  performance,	
  reduce	
  latency	
  
• “Compatible”	
  with	
  HTTP	
  1.1	
  
- Retain	
  semantics	
  of	
  HTTP	
  1.1	
  
- Define	
  interaction	
  with	
  HTTP	
  1.1	
  
- Undo	
  your	
  HTTP	
  1.1	
  tricks!!	
  
• “TLS	
  not	
  mandatory”
48
Hypertext	
  Transfer	
  Protocol	
  version	
  2	
  &	
  HPACK
Copyright	
  ©	
  2015,	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved. @delabassee#HTTP/2
HTTP/2	
  and	
  Java
• JEP	
  110	
  brings	
  HTTP/2	
  to	
  Java	
  SE	
  
• 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	
  
• HTTP	
  1.1	
  upgrade	
  
• TBC!
49
Plans
Copyright	
  ©	
  2015,	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved. @delabassee#HTTP/2
Resources	
  (and	
  credits)
• http://http2.github.io	
  
• http://chimera.labs.oreilly.com/books/1230000000545/ch12.html	
  
• https://java.net/projects/servlet-­‐spec/	
  
• http://glassfish.org/adoptajsr	
  
• http://openjdk.java.net/jeps/110
50
Safe	
  Harbor	
  Statement
The	
  preceding	
  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.
Copyright	
  ©	
  2015,	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved. 51
Copyright	
  ©	
  2015,	
  Oracle	
  and/or	
  its	
  affiliates.	
  All	
  rights	
  reserved. 52

More Related Content

What's hot

HTTP/2 standard for video streaming
HTTP/2 standard for video streamingHTTP/2 standard for video streaming
HTTP/2 standard for video streaming
Hung Thai Le
 
What's New in HTTP/2
What's New in HTTP/2What's New in HTTP/2
What's New in HTTP/2
NGINX, Inc.
 
HTML5, HTTP2, and You 1.1
HTML5, HTTP2, and You 1.1HTML5, HTTP2, and You 1.1
HTML5, HTTP2, and You 1.1
Daniel Austin
 
HTTP 2.0 – What do I need to know?
HTTP 2.0 – What do I need to know? HTTP 2.0 – What do I need to know?
HTTP 2.0 – What do I need to know?
Sigma Software
 
HTTP2 is Here!
HTTP2 is Here!HTTP2 is Here!
HTTP2 is Here!
Andy Davies
 
Nuts and Bolts of WebSocket Devoxx 2014
Nuts and Bolts of WebSocket Devoxx 2014Nuts and Bolts of WebSocket Devoxx 2014
Nuts and Bolts of WebSocket Devoxx 2014
Arun Gupta
 
Jetty 9 – The Next Generation Servlet Container
Jetty 9 – The Next Generation Servlet ContainerJetty 9 – The Next Generation Servlet Container
Jetty 9 – The Next Generation Servlet Container
Codemotion
 
Http2: why the web is upgrading? - bdx.io 2015
Http2: why the web is upgrading?   - bdx.io 2015Http2: why the web is upgrading?   - bdx.io 2015
Http2: why the web is upgrading? - bdx.io 2015
Quentin Adam
 
SPDY - or maybe HTTP2.0
SPDY - or maybe HTTP2.0SPDY - or maybe HTTP2.0
SPDY - or maybe HTTP2.0
Andreas Bjärlestam
 
Jetty Continuation - 이상민
Jetty Continuation - 이상민Jetty Continuation - 이상민
Jetty Continuation - 이상민
JavaCommunity.Org
 
Http/2
Http/2Http/2
HTML5 Real Time and WebSocket Code Lab (SFHTML5, GTUGSF)
HTML5 Real Time and WebSocket Code Lab (SFHTML5, GTUGSF)HTML5 Real Time and WebSocket Code Lab (SFHTML5, GTUGSF)
HTML5 Real Time and WebSocket Code Lab (SFHTML5, GTUGSF)
Peter Lubbers
 
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...
Edward Burns
 
Altitude San Francisco 2018: Programming the Edge
Altitude San Francisco 2018: Programming the EdgeAltitude San Francisco 2018: Programming the Edge
Altitude San Francisco 2018: Programming the Edge
Fastly
 
Websockets at tossug
Websockets at tossugWebsockets at tossug
Websockets at tossugclkao
 
Java EE 7 et ensuite pourquoi pas JavaScript sur le serveur!
Java EE 7 et ensuite pourquoi pas JavaScript sur le serveur! Java EE 7 et ensuite pourquoi pas JavaScript sur le serveur!
Java EE 7 et ensuite pourquoi pas JavaScript sur le serveur! David Delabassee
 
Improving performance by changing the rules from fast to SPDY
Improving performance by changing the rules   from fast to SPDYImproving performance by changing the rules   from fast to SPDY
Improving performance by changing the rules from fast to SPDY
Cotendo
 
HTML5 WebSocket Introduction
HTML5 WebSocket IntroductionHTML5 WebSocket Introduction
HTML5 WebSocket Introduction
Marcelo Jabali
 
JMS, WebSocket, and the Internet of Things - Controlling Physical Devices on ...
JMS, WebSocket, and the Internet of Things - Controlling Physical Devices on ...JMS, WebSocket, and the Internet of Things - Controlling Physical Devices on ...
JMS, WebSocket, and the Internet of Things - Controlling Physical Devices on ...
Peter Moskovits
 
Introduction to WebSockets
Introduction to WebSocketsIntroduction to WebSockets
Introduction to WebSockets
Gunnar Hillert
 

What's hot (20)

HTTP/2 standard for video streaming
HTTP/2 standard for video streamingHTTP/2 standard for video streaming
HTTP/2 standard for video streaming
 
What's New in HTTP/2
What's New in HTTP/2What's New in HTTP/2
What's New in HTTP/2
 
HTML5, HTTP2, and You 1.1
HTML5, HTTP2, and You 1.1HTML5, HTTP2, and You 1.1
HTML5, HTTP2, and You 1.1
 
HTTP 2.0 – What do I need to know?
HTTP 2.0 – What do I need to know? HTTP 2.0 – What do I need to know?
HTTP 2.0 – What do I need to know?
 
HTTP2 is Here!
HTTP2 is Here!HTTP2 is Here!
HTTP2 is Here!
 
Nuts and Bolts of WebSocket Devoxx 2014
Nuts and Bolts of WebSocket Devoxx 2014Nuts and Bolts of WebSocket Devoxx 2014
Nuts and Bolts of WebSocket Devoxx 2014
 
Jetty 9 – The Next Generation Servlet Container
Jetty 9 – The Next Generation Servlet ContainerJetty 9 – The Next Generation Servlet Container
Jetty 9 – The Next Generation Servlet Container
 
Http2: why the web is upgrading? - bdx.io 2015
Http2: why the web is upgrading?   - bdx.io 2015Http2: why the web is upgrading?   - bdx.io 2015
Http2: why the web is upgrading? - bdx.io 2015
 
SPDY - or maybe HTTP2.0
SPDY - or maybe HTTP2.0SPDY - or maybe HTTP2.0
SPDY - or maybe HTTP2.0
 
Jetty Continuation - 이상민
Jetty Continuation - 이상민Jetty Continuation - 이상민
Jetty Continuation - 이상민
 
Http/2
Http/2Http/2
Http/2
 
HTML5 Real Time and WebSocket Code Lab (SFHTML5, GTUGSF)
HTML5 Real Time and WebSocket Code Lab (SFHTML5, GTUGSF)HTML5 Real Time and WebSocket Code Lab (SFHTML5, GTUGSF)
HTML5 Real Time and WebSocket Code Lab (SFHTML5, GTUGSF)
 
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...
 
Altitude San Francisco 2018: Programming the Edge
Altitude San Francisco 2018: Programming the EdgeAltitude San Francisco 2018: Programming the Edge
Altitude San Francisco 2018: Programming the Edge
 
Websockets at tossug
Websockets at tossugWebsockets at tossug
Websockets at tossug
 
Java EE 7 et ensuite pourquoi pas JavaScript sur le serveur!
Java EE 7 et ensuite pourquoi pas JavaScript sur le serveur! Java EE 7 et ensuite pourquoi pas JavaScript sur le serveur!
Java EE 7 et ensuite pourquoi pas JavaScript sur le serveur!
 
Improving performance by changing the rules from fast to SPDY
Improving performance by changing the rules   from fast to SPDYImproving performance by changing the rules   from fast to SPDY
Improving performance by changing the rules from fast to SPDY
 
HTML5 WebSocket Introduction
HTML5 WebSocket IntroductionHTML5 WebSocket Introduction
HTML5 WebSocket Introduction
 
JMS, WebSocket, and the Internet of Things - Controlling Physical Devices on ...
JMS, WebSocket, and the Internet of Things - Controlling Physical Devices on ...JMS, WebSocket, and the Internet of Things - Controlling Physical Devices on ...
JMS, WebSocket, and the Internet of Things - Controlling Physical Devices on ...
 
Introduction to WebSockets
Introduction to WebSocketsIntroduction to WebSockets
Introduction to WebSockets
 

Similar to HTTP/2 Comes to Java

HTTP/2 Comes to Java
HTTP/2 Comes to JavaHTTP/2 Comes to Java
HTTP/2 Comes to Java
David Delabassee
 
Servlet 4.0 at GeekOut 2015
Servlet 4.0 at GeekOut 2015Servlet 4.0 at GeekOut 2015
Servlet 4.0 at GeekOut 2015
Edward Burns
 
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
Edward Burns
 
CON5898 What Servlet 4.0 Means To You
CON5898 What Servlet 4.0 Means To YouCON5898 What Servlet 4.0 Means To You
CON5898 What Servlet 4.0 Means To You
Edward Burns
 
HTTP/2 in the Java Platform -- Java Champions call February 2016
HTTP/2 in the Java Platform -- Java Champions call February 2016HTTP/2 in the Java Platform -- Java Champions call February 2016
HTTP/2 in the Java Platform -- Java Champions call February 2016
Ed Burns
 
Oracle REST Data Services
Oracle REST Data ServicesOracle REST Data Services
Oracle REST Data Services
Chris Muir
 
Web Performance in the Age of HTTP/2 - FEDay Conference, Guangzhou, China 19/...
Web Performance in the Age of HTTP/2 - FEDay Conference, Guangzhou, China 19/...Web Performance in the Age of HTTP/2 - FEDay Conference, Guangzhou, China 19/...
Web Performance in the Age of HTTP/2 - FEDay Conference, Guangzhou, China 19/...
Holger Bartel
 
Next generation web protocols
Next generation web protocolsNext generation web protocols
Next generation web protocols
Daniel Austin
 
2015 UJUG, Servlet 4.0 portion
2015 UJUG, Servlet 4.0 portion2015 UJUG, Servlet 4.0 portion
2015 UJUG, Servlet 4.0 portion
mnriem
 
WebSocket in Enterprise Applications 2015
WebSocket in Enterprise Applications 2015WebSocket in Enterprise Applications 2015
WebSocket in Enterprise Applications 2015
Pavel Bucek
 
HTTP/2 Introduction
HTTP/2 IntroductionHTTP/2 Introduction
HTTP/2 Introduction
Walter Liu
 
Introducing HTTP/2
Introducing HTTP/2Introducing HTTP/2
Introducing HTTP/2
Ido Flatow
 
Http2 right now
Http2 right nowHttp2 right now
Http2 right now
Daniel Stenberg
 
HTTP colon slash slash: the end of the road?
HTTP colon slash slash: the end of the road?HTTP colon slash slash: the end of the road?
HTTP colon slash slash: the end of the road?
Alessandro Nadalin
 
HTTP colon slash slash: end of the road? @ CakeFest 2013 in San Francisco
HTTP colon slash slash: end of the road? @ CakeFest 2013 in San FranciscoHTTP colon slash slash: end of the road? @ CakeFest 2013 in San Francisco
HTTP colon slash slash: end of the road? @ CakeFest 2013 in San Francisco
Alessandro Nadalin
 
Http 2
Http 2Http 2
HTTP/2: What no one is telling you
HTTP/2: What no one is telling youHTTP/2: What no one is telling you
HTTP/2: What no one is telling you
Fastly
 
Meetup Tech Talk on Web Performance
Meetup Tech Talk on Web PerformanceMeetup Tech Talk on Web Performance
Meetup Tech Talk on Web Performance
Jean Tunis
 
Http 2: Should I care?
Http 2: Should I care?Http 2: Should I care?
Http 2: Should I care?
LivePerson
 

Similar to HTTP/2 Comes to Java (20)

HTTP/2 Comes to Java
HTTP/2 Comes to JavaHTTP/2 Comes to Java
HTTP/2 Comes to Java
 
Servlet 4.0 at GeekOut 2015
Servlet 4.0 at GeekOut 2015Servlet 4.0 at GeekOut 2015
Servlet 4.0 at GeekOut 2015
 
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
 
CON5898 What Servlet 4.0 Means To You
CON5898 What Servlet 4.0 Means To YouCON5898 What Servlet 4.0 Means To You
CON5898 What Servlet 4.0 Means To You
 
HTTP/2 in the Java Platform -- Java Champions call February 2016
HTTP/2 in the Java Platform -- Java Champions call February 2016HTTP/2 in the Java Platform -- Java Champions call February 2016
HTTP/2 in the Java Platform -- Java Champions call February 2016
 
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
 
Oracle REST Data Services
Oracle REST Data ServicesOracle REST Data Services
Oracle REST Data Services
 
Web Performance in the Age of HTTP/2 - FEDay Conference, Guangzhou, China 19/...
Web Performance in the Age of HTTP/2 - FEDay Conference, Guangzhou, China 19/...Web Performance in the Age of HTTP/2 - FEDay Conference, Guangzhou, China 19/...
Web Performance in the Age of HTTP/2 - FEDay Conference, Guangzhou, China 19/...
 
Next generation web protocols
Next generation web protocolsNext generation web protocols
Next generation web protocols
 
2015 UJUG, Servlet 4.0 portion
2015 UJUG, Servlet 4.0 portion2015 UJUG, Servlet 4.0 portion
2015 UJUG, Servlet 4.0 portion
 
WebSocket in Enterprise Applications 2015
WebSocket in Enterprise Applications 2015WebSocket in Enterprise Applications 2015
WebSocket in Enterprise Applications 2015
 
HTTP/2 Introduction
HTTP/2 IntroductionHTTP/2 Introduction
HTTP/2 Introduction
 
Introducing HTTP/2
Introducing HTTP/2Introducing HTTP/2
Introducing HTTP/2
 
Http2 right now
Http2 right nowHttp2 right now
Http2 right now
 
HTTP colon slash slash: the end of the road?
HTTP colon slash slash: the end of the road?HTTP colon slash slash: the end of the road?
HTTP colon slash slash: the end of the road?
 
HTTP colon slash slash: end of the road? @ CakeFest 2013 in San Francisco
HTTP colon slash slash: end of the road? @ CakeFest 2013 in San FranciscoHTTP colon slash slash: end of the road? @ CakeFest 2013 in San Francisco
HTTP colon slash slash: end of the road? @ CakeFest 2013 in San Francisco
 
Http 2
Http 2Http 2
Http 2
 
HTTP/2: What no one is telling you
HTTP/2: What no one is telling youHTTP/2: What no one is telling you
HTTP/2: What no one is telling you
 
Meetup Tech Talk on Web Performance
Meetup Tech Talk on Web PerformanceMeetup Tech Talk on Web Performance
Meetup Tech Talk on Web Performance
 
Http 2: Should I care?
Http 2: Should I care?Http 2: Should I care?
Http 2: Should I care?
 

More from David Delabassee

JVMs in Containers - Best Practices
JVMs in Containers - Best PracticesJVMs in Containers - Best Practices
JVMs in Containers - Best Practices
David Delabassee
 
JVMs in Containers
JVMs in ContainersJVMs in Containers
JVMs in Containers
David Delabassee
 
Serverless Java Challenges & Triumphs
Serverless Java Challenges & TriumphsServerless Java Challenges & Triumphs
Serverless Java Challenges & Triumphs
David Delabassee
 
Serverless Java - Challenges and Triumphs
Serverless Java - Challenges and TriumphsServerless Java - Challenges and Triumphs
Serverless Java - Challenges and Triumphs
David Delabassee
 
Randstad Docker meetup - Serverless
Randstad Docker meetup - ServerlessRandstad Docker meetup - Serverless
Randstad Docker meetup - Serverless
David Delabassee
 
Java Serverless in Action - Voxxed Banff
Java Serverless in Action - Voxxed BanffJava Serverless in Action - Voxxed Banff
Java Serverless in Action - Voxxed Banff
David Delabassee
 
Serverless Kotlin
Serverless KotlinServerless Kotlin
Serverless Kotlin
David Delabassee
 
REST in an Async World
REST in an Async WorldREST in an Async World
REST in an Async World
David Delabassee
 
JAX-RS 2.1 Reloaded
JAX-RS 2.1 ReloadedJAX-RS 2.1 Reloaded
JAX-RS 2.1 Reloaded
David Delabassee
 
Java EE 8 - February 2017 update
Java EE 8 - February 2017 updateJava EE 8 - February 2017 update
Java EE 8 - February 2017 update
David Delabassee
 
Java EE Next
Java EE NextJava EE Next
Java EE Next
David Delabassee
 
Java EE Next - BeJUG JavaOne Afterglow 2016
Java EE Next - BeJUG JavaOne Afterglow 2016Java EE Next - BeJUG JavaOne Afterglow 2016
Java EE Next - BeJUG JavaOne Afterglow 2016
David Delabassee
 
HTTP/2 comes to Java
HTTP/2 comes to JavaHTTP/2 comes to Java
HTTP/2 comes to Java
David Delabassee
 
Java EE 8 - Work in progress
Java EE 8 - Work in progressJava EE 8 - Work in progress
Java EE 8 - Work in progress
David Delabassee
 
HTTP/2 comes to Java (Dec. 2015 version)
HTTP/2 comes to Java (Dec. 2015 version)HTTP/2 comes to Java (Dec. 2015 version)
HTTP/2 comes to Java (Dec. 2015 version)
David Delabassee
 
EJB and CDI - Alignment and Strategy
EJB and CDI - Alignment and StrategyEJB and CDI - Alignment and Strategy
EJB and CDI - Alignment and Strategy
David Delabassee
 
Java EE 8 - What’s new on the Web front
Java EE 8 - What’s new on the Web frontJava EE 8 - What’s new on the Web front
Java EE 8 - What’s new on the Web front
David Delabassee
 
What's coming in Java EE 8
What's coming in Java EE 8What's coming in Java EE 8
What's coming in Java EE 8
David Delabassee
 
Java EE 8 Adopt a JSR : JSON-P 1.1 & MVC 1.0
Java EE 8 Adopt a JSR : JSON-P 1.1 & MVC 1.0Java EE 8 Adopt a JSR : JSON-P 1.1 & MVC 1.0
Java EE 8 Adopt a JSR : JSON-P 1.1 & MVC 1.0
David Delabassee
 
MVC 1.0 / JSR 371
MVC 1.0 / JSR 371MVC 1.0 / JSR 371
MVC 1.0 / JSR 371
David Delabassee
 

More from David Delabassee (20)

JVMs in Containers - Best Practices
JVMs in Containers - Best PracticesJVMs in Containers - Best Practices
JVMs in Containers - Best Practices
 
JVMs in Containers
JVMs in ContainersJVMs in Containers
JVMs in Containers
 
Serverless Java Challenges & Triumphs
Serverless Java Challenges & TriumphsServerless Java Challenges & Triumphs
Serverless Java Challenges & Triumphs
 
Serverless Java - Challenges and Triumphs
Serverless Java - Challenges and TriumphsServerless Java - Challenges and Triumphs
Serverless Java - Challenges and Triumphs
 
Randstad Docker meetup - Serverless
Randstad Docker meetup - ServerlessRandstad Docker meetup - Serverless
Randstad Docker meetup - Serverless
 
Java Serverless in Action - Voxxed Banff
Java Serverless in Action - Voxxed BanffJava Serverless in Action - Voxxed Banff
Java Serverless in Action - Voxxed Banff
 
Serverless Kotlin
Serverless KotlinServerless Kotlin
Serverless Kotlin
 
REST in an Async World
REST in an Async WorldREST in an Async World
REST in an Async World
 
JAX-RS 2.1 Reloaded
JAX-RS 2.1 ReloadedJAX-RS 2.1 Reloaded
JAX-RS 2.1 Reloaded
 
Java EE 8 - February 2017 update
Java EE 8 - February 2017 updateJava EE 8 - February 2017 update
Java EE 8 - February 2017 update
 
Java EE Next
Java EE NextJava EE Next
Java EE Next
 
Java EE Next - BeJUG JavaOne Afterglow 2016
Java EE Next - BeJUG JavaOne Afterglow 2016Java EE Next - BeJUG JavaOne Afterglow 2016
Java EE Next - BeJUG JavaOne Afterglow 2016
 
HTTP/2 comes to Java
HTTP/2 comes to JavaHTTP/2 comes to Java
HTTP/2 comes to Java
 
Java EE 8 - Work in progress
Java EE 8 - Work in progressJava EE 8 - Work in progress
Java EE 8 - Work in progress
 
HTTP/2 comes to Java (Dec. 2015 version)
HTTP/2 comes to Java (Dec. 2015 version)HTTP/2 comes to Java (Dec. 2015 version)
HTTP/2 comes to Java (Dec. 2015 version)
 
EJB and CDI - Alignment and Strategy
EJB and CDI - Alignment and StrategyEJB and CDI - Alignment and Strategy
EJB and CDI - Alignment and Strategy
 
Java EE 8 - What’s new on the Web front
Java EE 8 - What’s new on the Web frontJava EE 8 - What’s new on the Web front
Java EE 8 - What’s new on the Web front
 
What's coming in Java EE 8
What's coming in Java EE 8What's coming in Java EE 8
What's coming in Java EE 8
 
Java EE 8 Adopt a JSR : JSON-P 1.1 & MVC 1.0
Java EE 8 Adopt a JSR : JSON-P 1.1 & MVC 1.0Java EE 8 Adopt a JSR : JSON-P 1.1 & MVC 1.0
Java EE 8 Adopt a JSR : JSON-P 1.1 & MVC 1.0
 
MVC 1.0 / JSR 371
MVC 1.0 / JSR 371MVC 1.0 / JSR 371
MVC 1.0 / JSR 371
 

Recently uploaded

Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
Aftab Hussain
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Neo4j
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
NYGGS Automation Suite
 
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
Alina Yurenko
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
Neo4j
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
Fermin Galan
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Mind IT Systems
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
rickgrimesss22
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
Philip Schwarz
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Crescat
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
Donna Lenk
 
Artificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension FunctionsArtificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension Functions
Octavian Nadolu
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Łukasz Chruściel
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke
 
Fundamentals of Programming and Language Processors
Fundamentals of Programming and Language ProcessorsFundamentals of Programming and Language Processors
Fundamentals of Programming and Language Processors
Rakesh Kumar R
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
AI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website CreatorAI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website Creator
Google
 
E-commerce Application Development Company.pdf
E-commerce Application Development Company.pdfE-commerce Application Development Company.pdf
E-commerce Application Development Company.pdf
Hornet Dynamics
 
Launch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in MinutesLaunch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in Minutes
Roshan Dwivedi
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
Adele Miller
 

Recently uploaded (20)

Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
 
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
 
Artificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension FunctionsArtificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension Functions
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
 
Fundamentals of Programming and Language Processors
Fundamentals of Programming and Language ProcessorsFundamentals of Programming and Language Processors
Fundamentals of Programming and Language Processors
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
AI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website CreatorAI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website Creator
 
E-commerce Application Development Company.pdf
E-commerce Application Development Company.pdfE-commerce Application Development Company.pdf
E-commerce Application Development Company.pdf
 
Launch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in MinutesLaunch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in Minutes
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
 

HTTP/2 Comes to Java

  • 1. Devoxx  UK   June  2015   David  Delabassee  -­‐  @delabassee   Oracle   Copyright  ©  2015,  Oracle  and/or  its  affiliates.  All  rights  reserved.     HTTP/2  Comes  to  Java 1
  • 2. Copyright  ©  2015,  Oracle  and/or  its  affiliates.  All  rights  reserved. @delabassee#HTTP/2 Agenda Why  HTTP/2?   HTTP/2   HTTP/2  and  Java  EE   HTTP/2  and  Java  SE   Summary
  • 3. Copyright  ©  2015,  Oracle  and/or  its  affiliates.  All  rights  reserved. @delabassee#HTTP/2 Agenda Why  HTTP/2?   HTTP/2   HTTP/2  and  Java  SE   HTTP/2  and  Java  EE   Summary
  • 4. Copyright  ©  2015,  Oracle  and/or  its  affiliates.  All  rights  reserved. 4 @delabassee#HTTP/2 Data  Never  Sleeps  2.0 https://www.domo.com/learn/data-­‐never-­‐sleeps-­‐2
  • 5. Copyright  ©  2015,  Oracle  and/or  its  affiliates.  All  rights  reserved. 5 @delabassee#HTTP/2 HTTP  1.x 1991   1996   1999   2009   2015   HTTP/0.9   HTTP/1.0   HTTP/1.1   SPDY   HTTP/2.0  
  • 6. Copyright  ©  2015,  Oracle  and/or  its  affiliates.  All  rights  reserved. 6 @delabassee#HTTP/2
  • 7. Copyright  ©  2015,  Oracle  and/or  its  affiliates.  All  rights  reserved. 7 @delabassee#HTTP/2
  • 8. Copyright  ©  2015,  Oracle  and/or  its  affiliates.  All  rights  reserved. 8 @delabassee#HTTP/2
  • 9. Copyright  ©  2015,  Oracle  and/or  its  affiliates.  All  rights  reserved. 9 @delabassee#HTTP/2
  • 10. Copyright  ©  2015,  Oracle  and/or  its  affiliates.  All  rights  reserved. 10 @delabassee#HTTP/2
  • 11. Copyright  ©  2015,  Oracle  and/or  its  affiliates.  All  rights  reserved. 11 @delabassee#HTTP/2 Today index.html style1.css style2.css .   .   .   script1.js script9.js pic1.jpg pic8.jpg .   .   .   photo1.png photo2.png .   .   .  
  • 12. Copyright  ©  2015,  Oracle  and/or  its  affiliates.  All  rights  reserved. 12 @delabassee#HTTP/2 google.fr  (1st)   • 3  HTTP  Requests   • 21.355  bytes   - 1  HTML   - 1  image   - 1  .js Top  .FR  examples lefigaro.fr  (15th)   • 140  HTTP  Requests   • 2.736.562  bytes   - 1  HTML   - 130  images   - 6  .js   - 2  .css  
  • 13. Copyright  ©  2015,  Oracle  and/or  its  affiliates.  All  rights  reserved. 13 @delabassee#HTTP/2 • If  a  page  takes  longer  than  4  sec  to  load,  1/4  people  abandons  that  page  (1)   • 57%  of  consumers  will  abandon  a  page  that  takes  longer  than  3  sec  to  load  (2)   • Page  load  slowdown  of  1  sec  could  cost  Amazon  $1.6  billion  in  sales  a  year  (1)   • Slowing  search  results  by  0.4  sec,  Google  could  lose  8  million  searches  per  day  (1) Latency  Vs.  Conversion  Rate Time  is  Money! (1)  http://www.fastcompany.com/1825005/how-­‐one-­‐second-­‐could-­‐cost-­‐amazon-­‐16-­‐billion-­‐sales   (2)  RadView  Spring  2015  State  of  the  Union:  Ecommerce  Page  Speed  &  Web  Performance
  • 14. @delabassee#HTTP/2 Copyright  ©  2015,  Oracle  and/or  its  affiliates.  All  rights  reserved. HTTP  1.1 Head-­‐of-­‐Line  blocking 14 Client Server index.html index.html style1.css   style2.css   script1.js   ... style1.css   style2.css   script1.js   ...
  • 15. Copyright  ©  2015,  Oracle  and/or  its  affiliates.  All  rights  reserved. 15 @delabassee#HTTP/2 HTTP  1.1
  • 16. Copyright  ©  2015,  Oracle  and/or  its  affiliates.  All  rights  reserved. 16 @delabassee#HTTP/2 File  Concatenation  and  Image  Sprites • Modern  web  page  consists  of  +90  resources  fetched  from  15  distinct   hosts  (http://httparchive.org)   • TCP  Efficiency  Improves  with  Larger  Files   • Shoving  more  than  one  logical  file  into  one  physical  file
  • 17. Copyright  ©  2015,  Oracle  and/or  its  affiliates.  All  rights  reserved. 17 @delabassee#HTTP/2 File  Concatenation  and  Image  Sprites
  • 18. Copyright  ©  2015,  Oracle  and/or  its  affiliates.  All  rights  reserved. 18 @delabassee#HTTP/2 HTTP  1.1 Workaround  -­‐  Domain  Sharding
  • 19. Copyright  ©  2015,  Oracle  and/or  its  affiliates.  All  rights  reserved. 19 @delabassee#HTTP/2 Asset  inlining …   <img  src="data:image/gif;base64,R0lGODlhEAAOexs3eeALMAAOazToeHh0tLS/ 7LZv0jvb29tf3Ubge8WSLrhf3kdbW1mxsjkhfkjfhGHhcjGDSHJUYgJvhgtyrHgfGfHy t56HGfGH56ge8WSLf6GGHhfkjfhhfkjfhpBREzxvt6QAA4lsjkhfkjfhdxwqBnuIoYty GhBKoOjJj6GGHvvhdsbxus38GV3pBREzxvt6QAA4lsjkhfkjfhdxwqBnuIoYtyGhBKoO jJj6GGHvvhdsbxus38GV3vvhdsbxusbasbPmfyH5BAAAjAAAALAAfhGHhcjAAAAQAA4l sjkhfkjfhGHhcjGDSHJUYgJvhgtyrHgfhfkjfhpBREzxvt6QAA4lsjkhfkjfhdxwqBnu IoYtyGhBKoOjJj6GGHvvhdsbxus38GV3GfHyt56HGfGH56ge8WsjkhfkjfhGHhcjGDSH JUYgJvhgtyrHgfGfHyt56HGfGH56gebxus38G8WSLf6GGHvvhdsbxusbaSLf6GGHvvhd sbxusbaOiQA4lsjkhfkjf4lsjkhfkjf4lsjbxus38GkhfkjfhfkjfhpBREzxvt6QAA4l sjkhfkjfhdxwqBnuIoYtyGhBKoOjJj6GGHvvhdsbxus38GV3DcPjjBceXsplojj…”  />   …
  • 20. Copyright  ©  2015,  Oracle  and/or  its  affiliates.  All  rights  reserved. 20 @delabassee#HTTP/2 • HTTP  uses  TCP  poorly   - HTTP:  short  and  bursty  flows  Vs.  TCP:  optimized  for  long-­‐lived  flows   • Solutions   - Sprites   - Domain  sharding   - Assets  Inlining   - File  concatenations   - … HTTP/1.1  circa  1999 Problems  Vs  Solutions 1991   1996   1999   2009   2015   HTTP/0.9   HTTP/1.0   HTTP/1.1   SPDY   HTTP/2.0  
  • 21. Copyright  ©  2015,  Oracle  and/or  its  affiliates.  All  rights  reserved. @delabassee#HTTP/2 Agenda Why  HTTP/2?   HTTP/2   HTTP/2  and  Java  SE   HTTP/2  and  Java  EE   Summary
  • 22. Copyright  ©  2015,  Oracle  and/or  its  affiliates.  All  rights  reserved. @delabassee#HTTP/2 HTTP/2 • Jan  2015   • Feb  2015   • May  2015 22 Enabled  by  default  in  FireFox  (35)  and  Chrome  (40)   IESG  approved  HTTP/2   HTTP/2  in  10%  of  all  HTTP  responses  (FireFox)   HTTP/2  used  in  18%  of  global  traffic  (Google)   RFC  7540    “Hypertext  Transfer  Protocol  Version  2”   RFC  7541    “HPACK:  Header  Compression  for  HTTP/2”     #HTTP/2
  • 23. Copyright  ©  2015,  Oracle  and/or  its  affiliates.  All  rights  reserved. 23 @delabassee#HTTP/2 Browsers  support …  as  of  June  16  2015 http://caniuse.com/http2  
  • 24. Copyright  ©  2015,  Oracle  and/or  its  affiliates.  All  rights  reserved.   @delabassee#HTTP/2 24 HTTP/2  Features • Binary  Framing  over  single  TCP  connection   • Request/Response  multiplexing   • Stream  Prioritization   • Server  Push   • Upgrade  from  HTTP  1.1   • Header  Compression
  • 25. Copyright  ©  2015,  Oracle  and/or  its  affiliates.  All  rights  reserved. 25 @delabassee#HTTP/2 HTTP/2 • Fully  bi-­‐directional   – Connection
 A  TCP  socket   – Message  
 A  logical  HTTP  message,  such  as  a  request  or  a  response     – Stream
 A  bi-­‐directional  “channel”  within  a  connection,  carry  one  or  more  message   – Frame
 The  smallest  unit  of  communication  in  HTTP/2 Lets  you  do  more  things  with  a  single  TCP  connection
  • 26. Copyright  ©  2015,  Oracle  and/or  its  affiliates.  All  rights  reserved. 26 @delabassee#HTTP/2 HTTP/2 Connections,  Streams,  Messages,  Frames
  • 27. @delabassee#HTTP/2 Copyright  ©  2015,  Oracle  and/or  its  affiliates.  All  rights  reserved. Binary  Frames • Frames   - HEADERS,  DATA,  PRIORITY,  RST_STREAM,  SETTINGS,  PUSH_PROMISE,  PING,   GOAWAY,  WINDOW_UPDATE,  CONTINUATION   - Prioritisation,  Flow  Control,  Server  Push,  …     • Single  TCP  Connection 27 POST  /upload  HTTP/1.1   Host:  www.test.com   Content-­‐Type:  application/json   Content-­‐Length:  15   {“name”:“duke”} HTTP  1.1 HTTP/2 HEADERS  frame DATA  frame
  • 28. Copyright  ©  2015,  Oracle  and/or  its  affiliates.  All  rights  reserved. 28 @delabassee#HTTP/2 HTTP/2  Binary  Framing GET  /index.html  HTTP/1.1
 Host:  example.com
 Accept:  text/html Example  1 HEADERS
        +  END_STREAM
        +  END_HEADERS
                :method:  GET
                :scheme:  http
                :path:  /index.html
                :authority:  example.org
                accept:  text/html
  • 29. Copyright  ©  2015,  Oracle  and/or  its  affiliates.  All  rights  reserved. 29 @delabassee#HTTP/2 HTTP/2  Binary  Framing HTTP/1.1  200  OK
 Content-­‐Length:  11
 Content-­‐Type:  text/html
 
 Hello  World Example  2 HEADERS
        -­‐  END_STREAM
        +  END_HEADERS
                :status:  200
                content-­‐length:  11
                content-­‐type:  text/html
 
 DATA
        +  END_STREAM
 Hello  World
  • 30. Copyright  ©  2015,  Oracle  and/or  its  affiliates.  All  rights  reserved. 30 @delabassee#HTTP/2 Multiplexing
  • 31. Copyright  ©  2015,  Oracle  and/or  its  affiliates.  All  rights  reserved. 31 @delabassee#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  an  advice A B C 4 12 A B CD 4 16 12 exclusive  =  0 A B C D 4 12 16 exclusive  =  1
  • 32. Copyright  ©  2015,  Oracle  and/or  its  affiliates.  All  rights  reserved. @delabassee#HTTP/2 Server  Push /index.html      stream  1   /style.css                stream  2   /script.js                  stream  4 Client Server stream  1   HEADERS stream  1   DATA stream  2         PROMISE stream  4   PROMISE • No  corresponding  JavaScript  API   • Can  be  combined  with  SSE
  • 33. Copyright  ©  2015,  Oracle  and/or  its  affiliates.  All  rights  reserved. 33 @delabassee#HTTP/2 Header  Compression HPack
  • 34. Copyright  ©  2015,  Oracle  and/or  its  affiliates.  All  rights  reserved. 34 @delabassee#HTTP/2 Upgrade  from  HTTP  1.1 • HTTP   - Port  80   - HTTP  Upgrade  to  “h2c”  (101  Switching  Protocol)   • HTTPS  (*)   - Application  Layer  Protocol  Negotiation  (ALPN)   - Next  Protocol  Negotiation  (NPN)   (*)  TLS  is  not  mandatory
  • 35. Copyright  ©  2015,  Oracle  and/or  its  affiliates.  All  rights  reserved. @delabassee#HTTP/2 Agenda Why  HTTP/2?   HTTP/2   HTTP/2  and  Java  SE   HTTP/2  and  Java  EE   Summary
  • 36. Copyright  ©  2015,  Oracle  and/or  its  affiliates.  All  rights  reserved. @delabassee#HTTP/2 Java  9  Support  for  HTTP/2 • JEP  110   - http://openjdk.java.net/jeps/110   • Supports  both  HTTP  1.1  and  2   • Easy  to  use  API   • Covers  only  the  most  common  use  cases   • Synchronous  &  Asynchronous 36#HTTP/2
  • 37. Copyright  ©  2015,  Oracle  and/or  its  affiliates.  All  rights  reserved. @delabassee#HTTP/2 Java  9 //  HttpRequest  builder  from  the  default  HttpClient   HttpResponse  response  =  HttpRequest.create(new  URI("http://www.abc.be"))                                                                        .send(HttpRequest.noBody());   String  responseBody  =  response.body(HttpResponse.asString());   response  =  HttpRequest.create(new  URI("http://www.abc.be"))                                              .body(fromString("param1=Abc"))                                              .post()                                              .send();   … 37
  • 38. Copyright  ©  2015,  Oracle  and/or  its  affiliates.  All  rights  reserved. @delabassee#HTTP/2 Java  9 HttpResponse  response  =  HttpRequest.create(new  URI("http://www.abc.be"))                                                                        .header("Foo-­‐header",  "Bar")                                                                        .body(noBody())                                                                        .get()                                                                        .send();               int  responseCode  =  response.responseCode();   SSLParameters  sslPar  =  response.sslParameters();   String  responseBody  =  response.body(asString()); 38
  • 39. Copyright  ©  2015,  Oracle  and/or  its  affiliates.  All  rights  reserved. @delabassee#HTTP/2 Java  9 String[]  myFiles  =  {"foo.txt",  "bar.txt",  "blah.txt"};   CompletableFuture<Path>  futures[]  =  new  CompletableFuture[myFiles.length];   URI  base  =  new  URI("http://abc.be/resources")   for  (int  i=0;  i<myFiles.length;  i++)  {                  String  filename  =  filenames[i];                  URI  uri  =  base.resolve(filename);                  futures[i]  =  HttpRequest.create(uri)                                                  .body(noBody())                                                  .sendAsync()                                                  .thenApply((HttpResponse  resp)  -­‐>  {                                                          return  resp.body(asFile(“/tmp/"  +  filename));                                                  });   }   … 39
  • 40. Copyright  ©  2015,  Oracle  and/or  its  affiliates.  All  rights  reserved. @delabassee#HTTP/2 Java  9 MultiResponseProcessor  multi;   HttpRequest.create(new  URI(“http://abc.be/"))            .body(noBody())            .sendMulti(                        (multi  =  HttpResponse.multi(                                  (HttpRequest  initiator,  HttpRequest  pushPromise)  -­‐>  {                                            if  (pushPromise  ==  null)  {  //  main  request                                                      return  HttpResponse.asFile("/mainResponse");                                            }  else  {  //  Push  Promise(s)                                                      String  path  =  pushPromise.uri().getPath();                                                      return  HttpResponse.asFile("/extra/"  +  path);                                            }                                  })                        )            );   multi.allActivity().join(); 40
  • 41. Copyright  ©  2015,  Oracle  and/or  its  affiliates.  All  rights  reserved. @delabassee#HTTP/2 Agenda Why  HTTP/2?   HTTP/2   HTTP/2  and  Java  SE   HTTP/2  and  Java  EE   Summary
  • 42. Copyright  ©  2015,  Oracle  and/or  its  affiliates.  All  rights  reserved. 42 @delabassee#HTTP/2 • Request/Response  multiplexing   • Binary  Framing   • Stream  Prioritization   • Server  Push   • Header  Compression   • Upgrade  from  HTTP  1.1   – ALPN  or  (NPN)   – 101  Switching  Protocols HTTP/2
  • 43. Copyright  ©  2015,  Oracle  and/or  its  affiliates.  All  rights  reserved. 43 @delabassee#HTTP/2 • Request/Response  Multiplexing   • Binary  Framing   • Stream  Prioritization   • Server  Push   • Header  Compression   • Upgrade  from  HTTP  1.1   – ALPN  or  (NPN)   – 101  Switching  Protocols Features  to  be  Exposed  in  the  Servlet  API HTTP/2
  • 44. Copyright  ©  2015,  Oracle  and/or  its  affiliates.  All  rights  reserved. 44 @delabassee#HTTP/2 • New  Priority  class   – boolean  exclusive   – int  streamId   – int  weight   • New  methods  to  HttpServletRequest   – int  getStreamId()   – Priority  getPriority()   • New  methods  to  HttpServletResponse   – int  getStreamId()   – Priority  getPriority()   – void  setPriority(Priority  p)   • Dependency? Servlet  4.0  -­‐  Stream  Prioritization
  • 45. Copyright  ©  2015,  Oracle  and/or  its  affiliates.  All  rights  reserved. 45 @delabassee#HTTP/2 • Push  resource  to  client  for  a  given  url  and  headers   • May  add  callback  for  completion  or  error  of  a  push   • Not  a  replacement  for  WebSocket Servlet  4.0  -­‐  Server  Push
  • 46. Copyright  ©  2015,  Oracle  and/or  its  affiliates.  All  rights  reserved. 46 @delabassee#HTTP/2 Server  Push private  void  pushResource(String  relativeResourcePath)  {   final  Request  jettyRequest  =  (Request)  getRequest();   final  PushBuilder  pushBuilder  =  jettyRequest.getPushBuilder();   pushBuilder.setQueryString(…)                  .push(relativeResourcePath);               //…   }
 Jetty’s  PushBuilder  ?
  • 47. Copyright  ©  2015,  Oracle  and/or  its  affiliates.  All  rights  reserved. @delabassee#HTTP/2 Agenda Why  HTTP/2?   HTTP/2   HTTP/2  and  Java  SE   HTTP/2  and  Java  EE   Summary
  • 48. Copyright  ©  2015,  Oracle  and/or  its  affiliates.  All  rights  reserved. @delabassee#HTTP/2 HTTP/2 • Address  the  Limitations  of  HTTP  1.x   - Improve  ressources  utilization,  performance,  reduce  latency   • “Compatible”  with  HTTP  1.1   - Retain  semantics  of  HTTP  1.1   - Define  interaction  with  HTTP  1.1   - Undo  your  HTTP  1.1  tricks!!   • “TLS  not  mandatory” 48 Hypertext  Transfer  Protocol  version  2  &  HPACK
  • 49. Copyright  ©  2015,  Oracle  and/or  its  affiliates.  All  rights  reserved. @delabassee#HTTP/2 HTTP/2  and  Java • JEP  110  brings  HTTP/2  to  Java  SE   • 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   • HTTP  1.1  upgrade   • TBC! 49 Plans
  • 50. Copyright  ©  2015,  Oracle  and/or  its  affiliates.  All  rights  reserved. @delabassee#HTTP/2 Resources  (and  credits) • http://http2.github.io   • http://chimera.labs.oreilly.com/books/1230000000545/ch12.html   • https://java.net/projects/servlet-­‐spec/   • http://glassfish.org/adoptajsr   • http://openjdk.java.net/jeps/110 50
  • 51. Safe  Harbor  Statement The  preceding  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. Copyright  ©  2015,  Oracle  and/or  its  affiliates.  All  rights  reserved. 51
  • 52. Copyright  ©  2015,  Oracle  and/or  its  affiliates.  All  rights  reserved. 52