Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998...

109
! CodeStars Whirlwind tour through the HTTP2 spec PHP UK 2016 — 19.02.2016 — Ole Michaelis (Jimdo)

Transcript of Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998...

Page 1: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

Whirlwind tour

through the HTTP2

specPHP UK 2016 — 19.02.2016 — Ole Michaelis (Jimdo)

Page 2: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

QUICK FAQ

Page 3: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

IS IT REALLY

DONE?

YES!

Page 4: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

IS SSL

MANDATORY?

No! But…

Page 5: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

IS HTTP/2 MADE

BY GOOGLE?

No!

Page 6: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

BUT WHAT’S

SPDY THEN?

Another Protocol!

Page 7: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

IS HTTP/2

PLAIN TEXT?

No!

Page 8: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

ARE HEADERS

COMPRESSED?

YES!

Page 9: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

WILL HTTP/1.1

STILL WORK?

YES!

Page 10: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

A BRIEF

HISTORY

Page 11: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

1991

1989Sir Tim Berners-Lee’s

World Wide Web

HTTP V0.9

Page 12: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

1996

1992HTTP V1.0 draft

HTTP V1.0

RFC 1945

1998

1997HTTP/1.1

RFC 2068

RFC 2326

Page 13: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! 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: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! 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

2014

HTTP/1.1

split

HTTP/2

RFC 7540

End of 2015:

22% of all Internet Traffic is HTTP/2

Page 15: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

HTTP BASICS

Page 16: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

PLAIN TEXT

Page 17: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

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: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

STATELESS

Page 19: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

SUPER FLEXIBLE

Page 20: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

HTTP/1.1

PROBLEMS

Page 21: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

THE WEB

MATURED

Page 22: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

http://httparchive.org/

Page 23: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

38CONNECTIONS

PER

PAGE

Page 24: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

REQUEST

BONANZA

Page 25: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

Page 26: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

LATENCY!

Page 27: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

Page 28: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

Page 29: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

Page 30: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

Page 31: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

HOL* BLOCKING!*Head of Line

Page 32: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

Page 33: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

Page 34: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

HOL* BLOCKING

RECAP

ORDER MATTERS!

Page 35: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

HOL* BLOCKING

RECAP

SLOWEST BLOCKS!

Page 36: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

HOL* BLOCKING

RECAP

NO WORKAROUND!

Page 37: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

HOL* BLOCKING

RECAP

OFTEN UNUSED!

Page 38: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

WE

ENDEAVORED

Page 39: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

SPRITING

Page 40: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

CONCATENATING

Page 41: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

DOMAIN

SHARDING

Page 42: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

INLINING

Page 43: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

PRELOADING

HACKS!

Page 44: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

COOKIE FREE

DOMAINS*

Page 45: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

SAVE ALL THE

REQUESTS!

Page 46: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

HTTP/2 TO THE

RESCUE

Page 47: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

COMPATIBLE

Page 48: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

UPGRADE FROM

HTTP/1.1

Page 49: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

Non Secure

HTTP

Page 50: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

UPGRADE

HEADER

Page 51: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

GET / HTTP/1.1

Host: server.example.com

Connection: Upgrade, HTTP2-Settings

Upgrade: h2c

HTTP2-Settings: <base64url encoding of HTTP/2 SETTINGS payload>

Page 52: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

HTTP/1.1 101 Switching Protocols

Connection: Upgrade

Upgrade: h2c

[ HTTP/2 connection ...

Page 53: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

HTTPS

Page 54: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

ALPN RFC 7301

TLS-ALPN

Page 55: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! 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 56: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

HEADSUP:

h2 vs. h2c

Page 57: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

MULTIPLEXED

Page 58: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

STREAM

STREAM

STREAM

CONNECTION

FRAMEFRAMEFRAME

FRAMEFRAMEFRAME

FRAMEFRAMEFRAME

HTTP/2 CONNECTIONS

Page 59: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

FRAMES

Page 60: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

BINARY

Page 61: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

+-----------------------------------------------+

| Length (24) |

+---------------+---------------+---------------+

| Type (8) | Flags (8) |

+-+-------------+---------------+-------------------------------+

|R| Stream Identifier (31) |

+=+=============================================================+

| Frame Payload (0...) ...

+---------------------------------------------------------------+

FRAME LAYOUT

Page 62: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

Page 63: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

TYPES

Page 64: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

+---------------+

|Pad Length? (8)|

+---------------+-----------------------------------------------+

| Data (*) ...

+---------------------------------------------------------------+

| Padding (*) ...

+---------------------------------------------------------------+

DATA 0x0

Page 65: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

+-+-------------------------------------------------------------+

|E| Stream Dependency (31) |

+-+-------------+-----------------------------------------------+

| Weight (8) |

+-+-------------+

PRIORITY 0x2

Page 66: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

+---------------------------------------------------------------+

| Error Code (32) |

+---------------------------------------------------------------+

RST_STREAM 0x3

Page 67: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

+-------------------------------+

| Identifier (16) |

+-------------------------------+-------------------------------+

| Value (32) |

+---------------------------------------------------------------+

SETTINGS 0x4

Page 68: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

a bunch more…

Page 69: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! 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 70: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

HTTP/2

FEATURES

Page 71: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

SERVER PUSH!

Page 72: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

+---------------+

|Pad Length? (8)|

+-+-------------+-----------------------------------------------+

|R| Promised Stream ID (31) |

+-+-----------------------------+-------------------------------+

| Header Block Fragment (*) ...

+---------------------------------------------------------------+

| Padding (*) ...

+---------------------------------------------------------------+

PUSH_PROMISE 0x5

Page 73: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

FLOW CONTROL

Page 74: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

WEIGHTED

DEPENDENCIES

Page 75: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! 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 76: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

FIREFOX DEPENDENCY TREE0

3201

5101

71

91

3332

3532

3732

2532

111

1532

2132

1732

1932

2332

1332

2722

2922

3122

Page 77: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

COMPRESSED

HEADERS

Page 78: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

+---------------+

|Pad Length? (8)|

+-+-------------+-----------------------------------------------+

|E| Stream Dependency? (31) |

+-+-------------+-----------------------------------------------+

| Weight? (8) |

+-+-------------+-----------------------------------------------+

| Header Block Fragment (*) ...

+---------------------------------------------------------------+

| Padding (*) ...

+---------------------------------------------------------------+

HEADERS 0x1

Page 79: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

HPACK RFC 7541

Page 80: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! 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

… … …

2

7

63

19 huffman(‘/resource’)

62

huffman(‘custom-hdr’)

huffman(‘some-value’)

request headers

static table

dynamic table

encoded headers

HEADER COMPRESSION TABLE

Page 81: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

IN 1 MINUTE

HUFFMAN

Page 82: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! 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 83: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

COMPRESSION

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

Page 84: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

HTTP/2 IN THE

REAL WORLD

Page 85: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

IT’S HERE

ALREADY

Page 86: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

demo time

Page 87: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

IMPLEMENTATIONS

Page 88: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

BROWSER

Page 89: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

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

Page 90: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

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

Why are you optimising

for this?!

Page 91: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

SERVER

Page 92: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

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 93: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

It is super easy!

Page 94: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! 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 95: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

NGINXserver {

listen 443 ssl http2 default_server;

ssl_certificate server.crt;

ssl_certificate_key server.key;

...

}

Page 96: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

YOU ARE

HOLDING IT

WRONG

Page 97: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

STOP

Page 98: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

STOPCONCATENATING

Page 99: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

STOPSPRITING

Page 100: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

STOPDOMAIN SHARDING

Page 101: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

TRASHTHE ASSET PIPELINE

Page 102: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

START USING

HTTP/2

Page 103: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

HHHHHH

HHHHHH

HHHHHH

Page 104: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

OLE MICHAELIS! CodeStars

" nesQuick

# codestars.eu

Page 105: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

THANKYOU! CodeStars

Page 106: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

⋆⋆⋆⋆⋆ https://joind.in/talk/dda32

Page 107: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326
Page 108: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

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 109: Whirlwind tour through the HTTP2 · CodeStars 1996 HTTP V1.0 draft 1992 HTTP V1.0 RFC 1945 1998 1997 HTTP/1.1 RFC 2068 RFC 2326

! CodeStars

Thanks to all the

people who helped

me with this deck!