Slide 1

Slide 1 text

A FASTER FUTURE WITH HTTP/2 By / Engineer @ , Heroku alum Blake Gentry @blakegentry Opendoor GoSF, April 2015

Slide 2

Slide 2 text

HTTP/2 A QUICK INTRO

Slide 3

Slide 3 text

WHY HTTP/2? Performance. End-user perceived latency Network and server resource usage More effective use of bandwidth

Slide 4

Slide 4 text

WHAT DOES HTTP/2 CHANGE?

Slide 5

Slide 5 text

What does HTTP/2 change? WHAT DOES HTTP/2 NOT CHANGE?

Slide 6

Slide 6 text

HTTP/2 IS JUST LIKE HTTP/1.1* *SEMANTICALLY

Slide 7

Slide 7 text

STUFF THAT DOESNT CHANGE Request methods Status codes URLs Other HTTP paradigms

Slide 8

Slide 8 text

HTTP/2 == A NEW BINARY FRAMING LAYER FOR HTTP

Slide 9

Slide 9 text

HTTP/2: MAIN IMPROVEMENTS Multiplexed streams (requests & responses) Header compression (HPACK) Secure TLS required-ish Less optional parts

Slide 10

Slide 10 text

DOES IT MATTER?

Slide 11

Slide 11 text

HTTP/2: ALL-NEW FEATURES

Slide 12

Slide 12 text

GRACEFUL SHUTDOWN Peer can stop accepting new streams, yet finish old ones Enabled by the G O A W A Y frame Peer can stop accepting new streams, yet finish old ones Can be sent by either client or server Includes ID of last processed stream

Slide 13

Slide 13 text

SERVER PUSH “Here, you'll need this too”

Slide 14

Slide 14 text

STREAM PRIORITY Prioritize more important data streams DEPENDENCIES “B depends on A” WEIGHT “C is ½ as important as A”

Slide 15

Slide 15 text

FLOW CONTROL Permission to send more data Credit-based scheme, 65k default Per-connection, and per-stream Applies only to DATA frames (message bodies)

Slide 16

Slide 16 text

STREAM RESET “j/k, I don't need that” Cancel requests or pushes

Slide 17

Slide 17 text

CHALLENGES

Slide 18

Slide 18 text

HTTP/1.1 OPTIMIZATIONS HARMFUL TO HTTP/2 PERF Domain sharding Image sprites Inlining Asset concatenation

Slide 19

Slide 19 text

OPTIMIZE FOR HTTP/1.1 OR HTTP/2? Decide when to switch OR optimize for both at the same time

Slide 20

Slide 20 text

HTTP/2 IS ALREADY HERE! >9% usage in Firefox ( ) source Browser adoption will be extremely rapid.

Slide 21

Slide 21 text

PUSH IS AWESOME, I'M GOING TO USE IT FOR EVERYTHING!

Slide 22

Slide 22 text

SERVER PUSH NOT AS SIMPLE AS IT SEEMS When do we push? Which resources are needed? Does the client already have it cached? How to combine with resource hints?

Slide 23

Slide 23 text

SERVER PUSH WHAT ELSE CAN WE PUSH? On 3XX, push the new resource Push additional API responses Push API dependencies for front-end apps ?

Slide 24

Slide 24 text

STREAM PRIORITY What combination of weights and dependencies is optimal?

Slide 25

Slide 25 text

HOW CAN WE MAKE THIS EASIER?

Slide 26

Slide 26 text

WEB PERFORMANCE IS ALREADY COMPLICATED.

Slide 27

Slide 27 text

THE GOOD NEWS: HTTP/2 GIVES US A LOT FOR FREE

Slide 28

Slide 28 text

THE BAD NEWS: GETTING THE MOST OUT OF HTTP/2 WON'T BE EASY

Slide 29

Slide 29 text

IF PERFORMANCE MATTERS, YOU CAN'T IGNORE HTTP/2

Slide 30

Slide 30 text

LET'S MAKE IT EASIER.

Slide 31

Slide 31 text

CDNs or reverse proxies that make these decisions for you Packages to figure out which resources should be pushed …or track which have already been pushed Perf. testing to determine optimal priorities …or which other optimizations are worthwhile

Slide 32

Slide 32 text

GO IS THE PERFECT LANGUAGE FOR THIS

Slide 33

Slide 33 text

WE'RE HIRING: Front-end Engineers (Angular) Data Engineers Data Scientists

Slide 34

Slide 34 text

THANKS! Blake Gentry / @blakegentry

Slide 35

Slide 35 text

REFERENCES , HTTP/2 Draft 17 HPACK Draft 11 HTTP/2 home page SPDY Whitepaper HTTP/2 Explained bradfitz/http2