Slide 1

Slide 1 text

@brianclozel #Devoxx HTTP/2 for the web developer Brian Clozel Pivotal Software

Slide 2

Slide 2 text

@brianclozel #Devoxx • Spring Framework committer • https://spring.io lead developer

Slide 3

Slide 3 text

HTTP/2 is about solving latency issues

Slide 4

Slide 4 text

HTTP/2 basics in 6 steps

Slide 5

Slide 5 text

#1 - a single TCP connection

Slide 6

Slide 6 text

#2 - multiple Streams

Slide 7

Slide 7 text

#3 - binary framing

Slide 8

Slide 8 text

Client Server Stream: 3 HEADERS
 GET /java Stream: 5 DATA Stream: 5 HEADERS
 POST /devoxx Stream: 5 DATA Stream: 3 HEADERS Stream: 3 DATA Stream: 5 HEADERS Stream: 3 DATA

Slide 9

Slide 9 text

#4 - Flow Control

Slide 10

Slide 10 text

#5 - HPACK

Slide 11

Slide 11 text

#6 - TLS (not) required

Slide 12

Slide 12 text

Congratulations! https://github.com/bclozel/http2-experiments

Slide 13

Slide 13 text

How should we adapt? • What about « front-end optimizations »? • undo concatenation • keep gzipping content • use ETags, Cache-Control directives • use JS module loaders

Slide 14

Slide 14 text

HTTP/2 new,
 optional features?

Slide 15

Slide 15 text

HTTP/2 Server Push!

Slide 16

Slide 16 text

Client Server Stream: 3 HEADERS
 GET /index.html Stream: 8 RST_STREAM CANCEL Stream: 10 RST_STREAM CANCEL Stream: 3 PUSH_PROMISE Promised Stream: 8
 GET /main.css Stream: 8 HEADERS Stream: 3 PUSH_PROMISE Promised Stream: 10
 GET /script.js

Slide 17

Slide 17 text

Why not send the
 main response first?

Slide 18

Slide 18 text

« The server SHOULD send PUSH_PROMISE (Section 6.6) frames prior to sending any frames that reference the promised responses. This avoids a race where clients issue requests prior to receiving any PUSH_PROMISE frames. »

Slide 19

Slide 19 text

Client Server Stream: 3 HEADERS
 GET /index.html Stream: 3 PUSH_PROMISE Promised Stream: 8
 GET /main.css Stream: 3 HEADERS Stream: 3 DATA Stream: 5 HEADERS
 GET /main.css [Parsing HTML…] !!!

Slide 20

Slide 20 text

Who knows best, then? • Server-side application • HTML structure • number/size of resources • HTTP client • heuristics • state of cache • CPU, battery, local network • Us, developers?

Slide 21

Slide 21 text

HTTP/2
 Stream prioritization

Slide 22

Slide 22 text

Declaring Stream dependencies Stream: 8 HEADERS Dependency: 5 Weight: 55
 GET /image.png

Slide 23

Slide 23 text

Performance: use your
 browser developer tools

Slide 24

Slide 24 text

No content

Slide 25

Slide 25 text

Implementation checklist • IO & programming model? • serious TLS support? • Server Push support? • Stream prioritization support? • Bonus: reactive streams friendly?

Slide 26

Slide 26 text

@brianclozel #Devoxx Thanks!