際際滷

際際滷Share a Scribd company logo
Gooddevelopersknowhowthingswork.
Greatdevelopersknowwhythingswork.
HTTP 2.0
the future of WWW
@tkaczmarzyk
blog.kaczmarzyk.net
Tomek Kosior Kaczmarzyk
HTTP 2.0
the future of WWW
@tkaczmarzyk
blog.kaczmarzyk.net
Tomek Kosior Kaczmarzyk
HTTP/2
About me
Just wandering around
the world, developing software :)
I co-organize
FB/konferencjaboilingfrogs
The plan
1. Introductioo0000oo00on
2. HTTP/2 in a nutshell
3. Performance of browser
networking
4. Questions
c = 299 792 458 m/s
Achievement unlocked!
Tribute
HTTP/2 -- the future of WWW
Achievement unlocked!
Ba-dum-tss Level 2
HTTP/2 -- the future of WWW
=======================================
=======================================
0100110101011001011
client server
[ 0%]
=======================================
=======================================
client server
HTTP/2 -- the future of WWW
HTTP/2 -- the future of WWW
SYN
SYN-ACK
ACK
HTTP/2 -- the future of WWW
=======================================
=======================================
client server
HTTP/2 -- the future of WWW
1 bandwidth
[Mbps]
2 3 4 5 6 7 8 9
2500
2000
1000
1500
3000
page
load time
[ms]
page load time
vs increasing bandwidth
page load time
vs decreasing latency
180 latency
[ms]
140 100 60 20
2500
2000
1000
1500
3000
page
load time
[ms]
Have you ever?
Achievement unlocked!
Tribute
Server
Client
HTTP/0.9
Server
Client
HTTP/0.9
starting a TCP/IP
connection
GET /resource HTTP/0.9
Host: example.org
Accept: image/jpeg
Server
Client
HTTP/0.9
HTTP/0.9 304 Not Modified
ETag: "xyzzy"
Expires: Thu, 23 Jan ...
Server
Client
HTTP/0.9
Server
Client
HTTP/0.9
closing the TCP/IP
connection
Server
Client
HTTP/1.0
GET /resource HTTP/1.0
Host: example.org
Accept: image/jpeg
Server
Client
HTTP/1.0
HTTP/1.0 304 Not Modified
ETag: "xyzzy"
Expires: Thu, 23 Jan ...
Server
Client
HTTP/1.0
GET /resource2 HTTP/1.0
Host: example.org
Accept: image/jpeg
Server
Client
HTTP/1.0
HTTP/1.0 200 OK
ETag: "xyzzy"
...
Server
Client
HTTP/1.0
Server
Client
HTTP/1.0
request1
response1
request2
request3
response2
response3
Server
Client
HTTP/1.1request1
request2
request3
Server
Client
HTTP/1.1request1
request2
request3
!!! head of line
blocking
Server
Client
multiple connections
per browser session
Server
Client
Server
Client
WTF!?
WTF!?
Server
Client
HTTP/2 -- the future of WWW
HTTP/2 -- the future of WWW
HTTP/2 -- the future of WWW
SPDY
RFC 7540  HTTP/2
RFC 7541  HPACK
1. Introductioo0000oo00on
2. HTTP/2 in a nutshell
3. Performance of browser
networking
4. Questions
The plan
Achievement unlocked!
Ba-dum-tss Level 3
HTTP/2 -- the future of WWW
HTTP/2 -- the future of WWW
Server
Client
single
connection!
Server
Client
single
connection!
Server
Client
single
connection!
stream 1
HEADERS
stream 1
DATA
stream 1
HEADERS
Server
Client
single
connection!
stream 1
HEADERS
stream 3
DATA
stream 1
DATA
stream 3
HEADERS stream 1
HEADERS
stream 3
HEADERS
Server
Client
single
connection!
stream 1
HEADERS
stream 3
DATA
stream 1
DATA
stream 3
HEADERS
stream 5
HEADERS
stream 5
DATA
stream 5
DATA
stream 7
HEADERS
stream 1
HEADERS
stream 3
HEADERS
Server
Client
single
connection!
Server
Client
single
connection!
GO AWAY
Server
Client
single
connection!
GO AWAY
Server
Client
new
connection!
GET /resource HTTP/1.1
Host: example.org
Accept: image/jpeg
GET /resource HTTP/1.1
Host: example.org
Accept: image/jpeg
HTTP/2
GET /resource HTTP/1.1
Host: example.org
Accept: image/jpeg
HEADERS
HTTP/2
GET /resource HTTP/1.1
Host: example.org
Accept: image/jpeg
HEADERS
HTTP/2
+END_STREAM
+END_HEADERS
GET /resource HTTP/1.1
Host: example.org
Accept: image/jpeg
HEADERS
HTTP/2
+END_STREAM
+END_HEADERS
flags
(binary header)
GET /resource HTTP/1.1
Host: example.org
Accept: image/jpeg
HEADERS
HTTP/2
+END_STREAM
+END_HEADERS
flags
(binary header)
host = example.org
accept = image/jpeg
GET /resource HTTP/1.1
Host: example.org
Accept: image/jpeg
HEADERS
HTTP/2
+END_STREAM
+END_HEADERS
flags
(binary header)
:method = GET
:scheme = https
:path = /resource
host = example.org
accept = image/jpeg
GET /resource HTTP/1.1
Host: example.org
Accept: image/jpeg
HEADERS
HTTP/2
+END_STREAM
+END_HEADERS
:method = GET
:scheme = https
:path = /resource
host = example.org
accept = image/jpeg
flags
(binary header)
pseudo headers
GET /resource HTTP/1.1
Host: example.org
Accept: image/jpeg

foo: bar
cookie: a=b; e=f
GET /resource HTTP/1.1
Host: example.org
Accept: image/jpeg

foo: bar
cookie: a=b; e=f
HEADERS
CONTINUATION
-END_STREAM
-END_HEADERS
+END_STREAM
+END_HEADERS
:method = GET
:scheme = https
:path = /resource
host = example.org
accept = image/jpeg

foo = bar
cookie = a=b
cookie = e=f
HTTP/2
GET /resource HTTP/1.1
Host: example.org
Accept: image/jpeg

foo: bar
cookie: a=b; e=f
HTTP/2
HEADERS
CONTINUATION
-END_STREAM
-END_HEADERS
+END_STREAM
+END_HEADERS
:method = GET
:scheme = https
:path = /resource
host = example.org
accept = image/jpeg

foo = bar
cookie = a=b
cookie = e=f
mind the
flags!
GET /resource HTTP/1.1
Host: example.org
Accept: image/jpeg

foo: bar
cookie: a=b; e=f
HTTP/2
HEADERS
CONTINUATION
-END_STREAM
-END_HEADERS
+END_STREAM
+END_HEADERS
:method = GET
:scheme = https
:path = /resource
host = example.org
accept = image/jpeg

foo = bar
cookie = a=b
cookie = e=f
mind the
flags!
decomposed for
cacheability
POST /resource HTTP/1.1
Host: example.org
Accept: application/json

foo: bar
cookie: a=b; e=f
{
name: Homer
}
POST /resource HTTP/1.1
Host: example.org
Accept: application/json

foo: bar
cookie: a=b; e=f
{
name: Homer
}
HTTP/2
HEADERS
DATA
-END_STREAM
+END_HEADERS
+END_STREAM
:method = POST
:scheme = https
:path = /resource
host = example.org
accept = app./json
{
name: Homer
}
HPACK
:method = GET
:scheme = HTTPS
:host = example.org
:path = /resource
user-agent = Chrome...
cookie = JSESSIONID...
:method = GET
:scheme = HTTPS
:host = example.org
:path = /resource
user-agent = Chrome...
cookie = JSESSIONID...
Static table
1
2
9
...
...
usr-agent
method
scheme
Chrome
GET
HTTPS
:method = GET
:scheme = HTTPS
:host = example.org
:path = /resource
user-agent = Chrome...
cookie = JSESSIONID...
Static table
1
2
9
...
...
usr-agent
method
scheme
Chrome
GET
HTTPS
:method = GET
:scheme = HTTPS
:host = example.org
:path = /resource
user-agent = Chrome...
cookie = JSESSIONID...
Static table
1
2
9
...
...
usr-agent
method
scheme
Chrome
GET
HTTPS
2
9
:host = example.org
:path = /resource
1
cookie = JSESSION...
:method = GET
:scheme = HTTPS
:host = example.org
:path = /resource
user-agent = Chrome...
cookie = JSESSIONID...
Static table
1
2
9
...
...
usr-agent
method
scheme
Chrome
GET
HTTPS
2
9
:host = example.org
:path = /resource
1
cookie = JSESSION...
:method = GET
:scheme = HTTPS
:host = example.org
:path = /resource
user-agent = Chrome...
cookie = JSESSIONID...
Static table
1
2
9
...
...
usr-agent
method
scheme
Chrome
GET
HTTPS
2
9
:host = example.org
:path = /resource
1
cookie = JSESSION...
Dynamic table
21
...
cookie JSESSION...
:method = GET
:scheme = HTTPS
:host = example.org
:path = /resource
user-agent = Chrome...
cookie = JSESSIONID...
Static table
1
2
9
...
...
usr-agent
method
scheme
Chrome
GET
HTTPS
2
9
:host = example.org
:path = /resource
1
21
Dynamic table
21
...
cookie JSESSION...
Static table
Dynamic table
:method = GET
:scheme = HTTPS
:host = example.org
:path = /resource
user-agent = Chrome...
cookie = JSESSIONID...
1
2
9
...
...
21
...
2
9
:host = example.org
:path = /resource
1
21
usr-agent
method
scheme
Chrome
GET
HTTPS
cookie JSESSION...
+Huffman
server push
<html>
<head>
...
<link rel=stylesheet
type=text/css href=... />
</head>
<body>
...
<img src=/slideshow/http2-the-future-of-www/58726706/.../>
...
</body>
</html>
HTTP/2 -- the future of WWW
Server
Client
Server
Client
stream
1
GET
index.html
Server
Client
stream
1
GET
index.html
Server
Client
stream 2
PUSH_PROMISE
(stylesheet)
stream 4
PUSH_PROMISE
(image)
local cache
stream
1
GET
index.html
Server
Client
stream 2
PUSH_PROMISE
(stylesheet)
stream 4
PUSH_PROMISE
(image)
stream 1
HEADERS
(index.html)
stream 1
DATA
(index.html)
local cache
stream
1
GET
index.html
Server
Client
stream 2
PUSH_PROMISE
(stylesheet)
stream 4
PUSH_PROMISE
(image)
local cache
Server
Client
stream 2
PUSH_PROMISE
(stylesheet)
stream 4
PUSH_PROMISE
(image)
local cache
GET
stylesheet
Server
Client
stream 2
PUSH_PROMISE
(stylesheet)
stream 4
PUSH_PROMISE
(image)
local cache
GET
stylesheet
Jetty  smart push
GET index.html
GET style.css
GET script.js
Jetty  smart push
GET index.html
GET style.css {Referer: /index.html}
GET script.js {Referer: /index.html}
Jetty  smart push
GET index.html
GET style.css {Referer: /index.html}
GET script.js {Referer: /index.html}
Jetty  smart push
GET index.html
GET style.css {Referer: /index.html}
GET script.js {Referer: /index.html}
GET index.html
push: script.js, style.css, index.html
* flow control
* prioritization
* stream dependencies
Even more sexy stuff...
Flow control
client
server
client
server
client
server
client
server
1010011010110101110101101
client
server
1010011010110101110101101
Achievement unlocked!
Awwww...
client
server
1010011010110101110101101
client
server
1010011010110101110101101
101001101
client
server
1010011010110101110101101
101001101
011011111
client
server
1010011010110101110101101
101001101
011011111
00001101
client
server
1010011010110101110101101
101001101
011011111
00001101
011011111
client
server
1010011010110101110101101
101001101
011011111
00001101
011011111
011011110100110111
110011101111101001
001110111001000011
client
server
with HTTP/2
flow control!
SETTINGS
(initial
window size)
65,535
client
server
with HTTP/2
flow control!
65,535
DATA
client
server
with HTTP/2
flow control!
41,003
DATA
client
server
with HTTP/2
flow control!
2^31 - 1
WINDOW
UPDATE
client
server
with HTTP/2
flow control!
2^31 - 1
WINDOW
UPDATE
WINDOW
UPDATE
131070
Prioritization
& stream dependencies
B
1
B
1
stream
weight
A
3
B
1
stream
weight
A
3
B
1
stream
weight
* implicit
root stream
A
3
B
1
C
2
*
D
1
1. Introductioo0000oo00on
2. HTTP/2 in a nutshell
3. Performance of browser
networking
4. Questions
The plan
HTTP/2 -- the future of WWW
意鞄艶油敬艶恢油庄壊油糸艶温糸油温稼糸油鴛油鞄温厩艶油一庄鉛鉛艶糸油庄岳.
HTTP/2 -- the future of WWW
HTTP/2 -- the future of WWW
what'sweb?
webisdead,baby,
webisdead...
Achievement unlocked!
Tribute
HTTP/2 vs
network performance patterns
* domain sharding
* asset concatenation
* domain sharding
* asset concatenation
it's a single connection with HTTP/2
* resource inlining
* resource inlining
server push is better!
Content Delivery Networks
HTTP/2 -- the future of WWW
HTTP/2 -- the future of WWW
* compression
* reducing HTTP redirects
* reducing DNS lookups
* caching on the client
1. Introductioo0000oo00on
2. HTTP/2 in a nutshell
3. Performance of browser
networking
4. Questions
The plan
HTTP/2 -- the future of WWW
caniuse.com
意鞄艶油韓顎岳顎姻艶油庄壊油稼看敬(!?)
HTTP 2.0
the future of WWW
@tkaczmarzyk
blog.kaczmarzyk.net
HTTP/2
thanks!
?
Tomek Kosior Kaczmarzyk
(not only)
FAQ
Where can I find more
information about HTTP/2?
Where can I find more
information about HTTP/2?
* RFC 7540 (really!)
* High Performance Browser
Networking By Ilya Grigorik
The future is now? Really?
HTTP/1.1 will be around
for at least another decade 
1. Negotiating HTTP/2
with TLS handshake
2. Upgrading a plaintext
connection to HTTP/2
3. Initiating a plaintext HTTP/2
connection
GET /resource HTTP/1.1
Host: boilingfrogs.pl
Connection: Upgrade, HTTP2-Settings
Upgrade: h2c
HTTP2-Settings: (... SETTINGS payload )
-----------------------------------------------------------
GET /resource HTTP/1.1
Host: boilingfrogs.pl
Connection: Upgrade, HTTP2-Settings
Upgrade: h2c
HTTP2-Settings: (... SETTINGS payload )
-----------------------------------------------------------
GET /resource HTTP/1.1
Host: boilingfrogs.pl
Connection: Upgrade, HTTP2-Settings
Upgrade: h2c
HTTP2-Settings: (... SETTINGS payload )
-----------------------------------------------------------
GET /resource HTTP/1.1
Host: boilingfrogs.pl
Connection: Upgrade, HTTP2-Settings
Upgrade: h2c
HTTP2-Settings: (... SETTINGS payload )
-----------------------------------------------------------
HTTP/1.1 101 Switching Protocols
Connection: Upgrade
Upgrade: h2c
(... HTTP/2 response )
GET /resource HTTP/1.1
Host: boilingfrogs.pl
Connection: Upgrade, HTTP2-Settings
Upgrade: h2c
HTTP2-Settings: (... SETTINGS payload )
-----------------------------------------------------------
HTTP/1.1 101 Switching Protocols
Connection: Upgrade
Upgrade: h2c
(... HTTP/2 response )
GET /resource HTTP/1.1
Host: boilingfrogs.pl
Connection: Upgrade, HTTP2-Settings
Upgrade: h2c
HTTP2-Settings: (... SETTINGS payload )
-----------------------------------------------------------
HTTP/1.1 101 Switching Protocols
Connection: Upgrade
Upgrade: h2c
(... HTTP/2 response )
-----------------------------------------------------------
HTTP/1.1 200 OK
Content-length: 243
Content-type: text/html
(... HTTP/1.1 response ...)
GET /resource HTTP/1.1
Host: boilingfrogs.pl
Connection: Upgrade, HTTP2-Settings
Upgrade: h2c
HTTP2-Settings: (... SETTINGS payload )
-----------------------------------------------------------
HTTP/1.1 101 Switching Protocols
Connection: Upgrade
Upgrade: h2c
(... HTTP/2 response )
-----------------------------------------------------------
HTTP/1.1 200 OK
Content-length: 243
Content-type: text/html
(... HTTP/1.1 response ...)
Are there any downsides
of one connection per origin?
server
client
server
client
1
3
2
server
client
1
3
2
server
client
1
3
2
server
client
1
3
2
TCP buffer: 1 3
server
client
1
3
TCP buffer: 1 3
2
server
client
1
3
TCP buffer: 1 3
2
2x ACK
server
client
1
3
TCP buffer: 1 3
2
2x ACK
retran
sm
it
server
client
1
3
TCP buffer: 1 3
2
2x ACK
retran
sm
it
2
server
client
TCP buffer:
1
3
2
2x ACK
retran
sm
it
1 32
ACK
In tests so far, the negative effects of
head-of-line blocking (especially in
the presence of packet loss) is
outweighed by the benefits of
compression and prioritization.

-- Hypertext Transfer Protocol version 2
Server push
vs
SSE & web sockets
Why do we need
header compression?
Why HPACK?
More
questions? :)
HTTP 2.0
the future of WWW
@tkaczmarzyk
blog.kaczmarzyk.net
HTTP/2
thanks!
?
Tomek Kosior Kaczmarzyk
(not only)
Acknowledgements
https://www.flickr.com/photos/eldelinux/15041976222/
Ilya Grigorik (@igrigorik)
High performance browser networking
https://www.flickr.com/photos/cblue98/5115058146
Photo Credit

More Related Content

HTTP/2 -- the future of WWW