108
! CodeStars Whirlwind tour through the HTTP2 spec VOXXED Days Thessaloniki 2016 — 21.10.2016 — Ole Michaelis (Jimdo)

Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

Embed Size (px)

Citation preview

Page 1: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

Whirlwind tour through the HTTP2

specVOXXED Days Thessaloniki 2016 — 21.10.2016 — Ole Michaelis (Jimdo)

Page 2: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

QUICK FAQ

Page 3: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

IS IT REALLY DONE?

YES!

Page 4: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

IS SSL MANDATORY?

No! But…

Page 5: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

IS HTTP/2 MADE BY GOOGLE?

No!

Page 6: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

BUT WHAT’S SPDY THEN?

Another Protocol!

Page 7: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

IS HTTP/2 PLAIN TEXT?

No!

Page 8: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

ARE HEADERS COMPRESSED?

YES!

Page 9: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

WILL HTTP/1.1 STILL WORK?

YES!

Page 10: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

A BRIEF HISTORY

Page 11: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

1991

1989Sir Tim Berners-Lee’s

World Wide Web

HTTP V0.9

Page 12: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

1996

1992HTTP V1.0 draft

HTTP V1.0 RFC 1945

1998

1997HTTP/1.1

RFC 2068

RFC 2326

Page 13: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

2007

1999HTTP/1.1 RFC 2616

IETF forms HTTPbis WG

Nov. 2012

early 2012

Call for Proposals for HTTP/2

First HTTP/2 draft based on Google’s SPDY

Page 14: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

RFC 7230 Message Syntax & Routing

RFC 7231 Semantics and Content

RFC 7232 Conditional Requests

RFC 7233 Range Requests

RFC 7234 Caching

RFC 7235 Authentication

May 2015

2014HTTP/1.1

split

HTTP/2 RFC 7540

End of 2015: 22% of all Internet Traffic is HTTP/2

Page 15: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

HTTP BASICS

Page 16: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

PLAIN TEXT

Page 17: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

HTTP/1.1 302 Found Cache-Control: private Content-Type: text/html; charset=UTF-8 Location: http://www.google.de/?gfe_rd=cr&ei=aDf7VYD5N-il8wfQkpHwAw

GET / HTTP/1.1 Host: google.com

" ~ telnet google.com 80Trying 173.194.39.2... Connected to google.com. Escape character is '^]'.

Page 18: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

STATELESS

Page 19: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

SUPER FLEXIBLE

Page 20: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

HTTP/1.1 PROBLEMS

Page 21: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

THE WEB MATURED

Page 22: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

http://httparchive.org/

Page 23: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

38CONNECTIONS

PER PAGE

Page 24: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

REQUEST BONANZA

Page 25: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

Page 26: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

LATENCY!

Page 27: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

Page 28: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

Page 29: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

Page 30: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

😮💩

Page 31: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

HOL* BLOCKING!*Head of Line

Page 32: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

Page 33: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

Page 34: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

HOL* BLOCKING RECAP

ORDER MATTERS!

Page 35: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

HOL* BLOCKING RECAP

SLOWEST BLOCKS!

Page 36: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

HOL* BLOCKING RECAP

NO WORKAROUND!

Page 37: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

HOL* BLOCKING RECAP

OFTEN UNUSED!

Page 38: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

WE ENDEAVORED

Page 39: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

SPRITING

Page 40: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

CONCATENATING

Page 41: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

DOMAIN SHARDING

Page 42: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

INLINING

Page 43: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

PRELOADING HACKS!

Page 44: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

COOKIE FREE DOMAINS*

Page 45: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

SAVE ALL THE REQUESTS!

Page 46: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

HTTP/2 TO THE RESCUE

Page 47: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

COMPATIBLE

Page 48: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

UPGRADE FROM HTTP/1.1

Page 49: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

Non Secure HTTP

Page 50: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

HTTPS

Page 51: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

ALPN RFC 7301

TLS-ALPN

Page 52: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

Client Server

ClientHello --------> ServerHello (ALPN extension & (ALPN extension & list of protocols) selected protocol) Certificate* ServerKeyExchange* CertificateRequest* <-------- ServerHelloDone Certificate* ClientKeyExchange CertificateVerify* [ChangeCipherSpec] Finished --------> [ChangeCipherSpec] <-------- Finished Application Data <-------> Application Data

Page 53: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

HEADSUP: h2 vs. h2c

Page 54: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

MULTIPLEXED

Page 55: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

STREAM

STREAM

STREAM

CONNECTION

HTTP/2 CONNECTIONS

FRAME

FRAME

FRAME

Page 56: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

FRAMES

Page 57: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

BINARY

Page 58: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

+-----------------------------------------------+ | Length (24) | +---------------+---------------+---------------+ | Type (8) | Flags (8) | +-+-------------+---------------+-------------------------------+ |R| Stream Identifier (31) | +=+=============================================================+ | Frame Payload (0...) ... +---------------------------------------------------------------+

FRAME LAYOUT

Page 59: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

Page 60: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

TYPES

Page 61: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

+---------------+ |Pad Length? (8)| +---------------+-----------------------------------------------+ | Data (*) ... +---------------------------------------------------------------+ | Padding (*) ... +---------------------------------------------------------------+

DATA 0x0

Page 62: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

+-+-------------------------------------------------------------+ |E| Stream Dependency (31) | +-+-------------+-----------------------------------------------+ | Weight (8) | +-+-------------+

PRIORITY 0x2

Page 63: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

+---------------------------------------------------------------+ | Error Code (32) | +---------------------------------------------------------------+

RST_STREAM 0x3

Page 64: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

+-------------------------------+ | Identifier (16) | +-------------------------------+-------------------------------+ | Value (32) | +---------------------------------------------------------------+

SETTINGS 0x4

Page 65: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

a bunch more…

Page 66: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

+-----------------------------------------------+ | 0000 0000 0000 0000 0100 0000 | +---------------+---------------+---------------+ | 00000110 | 00000001 | +-+-------------+---------------+-------------------------------+ |0| 010 0001 1100 0000 1111 1111 1110 1110 | +=+=============================================================+ | 10010000 11010100 00001100 11110100 | | 10100000 11011011 10100010 00110100 | +---------------------------------------------------------------+

PING 0x6 /w ACKlength (64)

type: PING (0x6 )flags: ACK (0x1)stream id

opaque data (64)

Page 67: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

HTTP/2 FEATURES

Page 68: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

SERVER PUSH!

Page 69: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

+---------------+ |Pad Length? (8)| +-+-------------+-----------------------------------------------+ |R| Promised Stream ID (31) | +-+-----------------------------+-------------------------------+ | Header Block Fragment (*) ... +---------------------------------------------------------------+ | Padding (*) ... +---------------------------------------------------------------+

PUSH_PROMISE 0x5

Page 70: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

FLOW CONTROL

Page 71: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

WEIGHTED DEPENDENCIES

Page 72: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

0

3 5

97

128 64

16 16

PRIORITY TREE

dependency stream id

weight

from “Understanding HTTP/2 prioritization” by Moto Ishizawa https://speakerdeck.com/summerwind/2-prioritization

Page 73: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

FIREFOX DEPENDENCY TREE0

3201

5101

71

91

3332

3532

3732

2532

111

1532

2132

1732

1932

2332

1332

2722

2922

3122

Page 74: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

COMPRESSED HEADERS

Page 75: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

+---------------+ |Pad Length? (8)| +-+-------------+-----------------------------------------------+ |E| Stream Dependency? (31) | +-+-------------+-----------------------------------------------+ | Weight? (8) | +-+-------------+-----------------------------------------------+ | Header Block Fragment (*) ... +---------------------------------------------------------------+ | Padding (*) ... +---------------------------------------------------------------+

HEADERS 0x1

Page 76: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

HPACK RFC 7541

Page 77: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

:method GET

:scheme https

:host jimdo.com:path /resource

user-agent Mozilla/5.0

custom-hdr some-value

1 :authority

2 :method GET

… … …

51 referer

… … …

62 user-agent Mozilla/5.0

63 :host jimdo.com

… … …

276319 huffman(‘/resource’)62huffman(‘custom-hdr’)huffman(‘some-value’)

request headers

static table

dynamic table

encoded headers

HEADER COMPRESSION TABLE

Page 78: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

IN 1 MINUTEHUFFMAN

Page 79: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

MISSISSIPPI RIVER = 17 chars * 8 bit = 136 bits

M I S P R V E _

1 5 4 2 2 1 1 1 I5 S4 P2 R2 M1 V1 E1 _1

00 01 100 101 1100 1101 1110 1111

IS9 PR4 MV2 E_2

MVE_4

PRMVE_8

ISPRMVE_17

0 1 0 1 0 1 0 1

0 1

0

1

0

1

https://www.youtube.com/watch?v=ZdooBTdW5bM

Page 80: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

COMPRESSION TABLE

I5 S4 P2 R2 M1 V1 E1 _100 01 100 101 1100 1101 1110 1111

Page 81: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

HTTP/2 IN THE REAL WORLD

Page 82: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

IT’S HERE ALREADY

Page 83: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

demo timenghttp -vnu https://http2.golang.org/reqinfo https://http2.golang.org/ https://http2.akamai.com/demo

Page 84: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

IMPLEMENTATIONS

Page 85: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

BROWSER

Page 86: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

http://caniuse.com/#search=http2

Page 87: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

http://caniuse.com/#search=http2

Why are you optimising for this?!

Page 88: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

SERVER

Page 89: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

others 16%

GWS (Google) 2%

nginx 15%

IIS (Microsoft) 28%

Apache 39%

GWS unknown — Chrome dropped SPDY in Feb 2015

Apache since 2.4.12 — Jul 2015

nginx since 1.9.5 — 22 Sep 2015

IIS Win 10 / Server 2016

MARKET SHARE & HTTP/2 SUPPORT

http://netcraft.com/

Page 90: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

It is super easy!

Page 91: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

Apache# this needs to be somewhere LoadModule http2_module modules/mod_http2.so

# this is already optional <IfModule http2_module> LogLevel http2:info </IfModule>

Page 92: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

NGINXserver { listen 443 ssl http2 default_server;

ssl_certificate server.crt; ssl_certificate_key server.key; ... }

Page 93: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

3rd Party

Page 94: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

The Future

Page 95: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

Cache digests

https://tools.ietf.org/html/draft-kazuho-h2-cache-digest-00

Page 96: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

QUIC**TCP/2

https://tools.ietf.org/html/draft-tsvwg-quic-protocol-00

Page 97: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

YOU ARE HOLDING IT

WRONG

Page 98: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

STOP

Page 99: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

STOPCONCATENATING

Page 100: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

STOPSPRITING

Page 101: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

STOPDOMAIN SHARDING

Page 102: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

TRASHTHE ASSET PIPELINE

Page 103: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

START USING HTTP/2

Page 104: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

OLE MICHAELIS! CodeStars " nesQuick # codestars.eu

Page 105: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

THANKYOU! CodeStars

Page 106: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec
Page 107: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

RESSOURCES! @bagder @igrigorik @tatsuhiro_t @mnot https://http2.github.io/http2-spec/ http://daniel.haxx.se/http2/ http://daniel.haxx.se/blog/2015/05/07/http2-for-tcpip-geeks/ http://www.slideshare.net/peychevi/http2-and-quick-protocols-optimizing-the-web-stack https://ma.ttias.be/architecting-websites-http2-era/ https://benramsey.com/talks/2015/05/phptek-http2/ https://speakerdeck.com/summerwind/2-prioritization http://chimera.labs.oreilly.com/books/1230000000545/ch12.html#HTTP2_HEADER_COMPRESSION http://tools.ietf.org/html/rfc6585 http://httparchive.org https://http2.golang.org/ https://github.com/igrigorik/http-2 https://aprescott.com/posts/spdy-colon-headers https://tools.ietf.org/html/draft-ietf-httpbis-header-compression-12 https://www.youtube.com/watch?v=ZdooBTdW5bM https://github.com/supertinou/huffman http://daniel.haxx.se/blog/2015/03/06/tls-in-http2/ http://news.netcraft.com/archives/2015/06/25/june-2015-web-server-survey.html http://isthewebhttp2yet.com/

Page 108: Voxxed Days Thesaloniki 2016 - Whirlwind tour through the HTTP2 spec

! CodeStars

Thanks to all the people who helped me with this deck!