HTTP/2

What
was wrong
with HTTP 1?

HTTP 1 💪

Plain text

Flexible

Stateless

HTTP/2 Features

Binary

Multiplexed

Header Compression

Stream Priority

HPACK

Server Push

HTTP/2 is binary

$ telnet google.com 80
Trying 216.58.206.206...
Connected to google.com.
Escape character is '^]'.

GET
HTTP/1.0 302 Found
Cache-Control: private
Content-Type: text/html; charset=UTF-8
Referrer-Policy: no-referrer
Location: http://www.google.gr/?gfe_rd=cr&ei=paI6WcyoFpDIXru7o4AH
Content-Length: 256
Date: Fri, 09 Jun 2017 13:29:09 GMT

<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>302 Moved</TITLE></HEAD><BODY>
<H1>302 Moved</H1>
The document has moved
<A HREF="http://www.google.gr/?gfe_rd=cr&ei=paI6WcyoFpDIXru7o4AH">here</A>.
</BODY></HTML>
Connection closed by foreign host.

This is HTTP/1.1, which is text based

Multiplexed

Head-of-line

blocking

Frames & Streams

* HTTP/2 req/res pairs are given unique stream IDs

* Messages passing through streams are called frames

* Frames have common headers across a stream
* There are various frame types:
HEADERS, DATA, RST_STREAM, SETTINGS, PRIORITY

Server Push

PUSH_PROMISE

FRAME TYPE

Stream Priority

Sum = 16

Stream B: 4/16 = 1/4

Stream C: 12/16 = 3/4

* Stream B Priority: 4

* Stream C Priority: 12

=> Stream C will get three times the resources allocated to Stream B

Header Compression

HPACK

Stateful

Static dictionary

Static Huffman encoding

Dynamic dictionary

Who uses it?

HTTP/2 is used by 14.6% of all the websites.

w3techs.com, June 2017

And as of April 13th, 2016, HTTP/2 traffic has now reached 68%. So in 6 months there has been a 17% increase in HTTP/2 traffic and adoption.

keycdn.com

Thank you.

Made with Slides.com