Http/2

29
HTTP/2 The (not so) new Language of the Web

Transcript of Http/2

Page 1: Http/2

HTTP/2

The (not so) new Language of the Web

Page 2: Http/2

Software EngineerAll around nerdSystems Administrator for 7

years@aramonc in all the places

About Me

Page 3: Http/2

Slight History of HTTP 1.x● World Wide Web first proposed by Tim Berners-Lee & team in 1989● First documented in 1991 in HTTP 0.9

○ Request only GET○ Response only HTML

● Officially documented in RFC 1945 as HTTP 1.0 in 1996○ HTTP 1.1 was already in draft○ Documented common use cases from existing web browsers○ Not a standard

● HTTP 1.1 became official standard in 1997○ Defined in RFC 2068○ Additions & Disambiguations added in 1999 as RFC 2616○ Supported by most browsers and tools since early drafts○ Re-written into multiple proposed RFCs between 2007 & 2014

Page 4: Http/2

Then Came SPDY● Binary protocol worked on by Mike Belshe &

Roberto Peon at Google● Implemented on Chrome & GFE servers

between 2009 & 2014● Introduced to Mark Nottingham of the IETF

HTTPBIS working group in 2012● Became the basis of HTTP/2

Page 5: Http/2

Binary Protocol Features● Binary framing● Streams● Request & response multiplexing● Stream prioritization● Single connection per origin● Flow control● Server Push● Header Compression

Page 6: Http/2

The Final HTTP / 2 RFC(s)● Hypertext Transfer Protocol version 2 - RFC7540

○ Describes the new internals of the protocol○ Designed for low latency

● HPACK - Header Compression for HTTP/2 - RFC7541

● Published in May 2015

Page 7: Http/2

ImplementationsApache 2.4.17

F5 (upcoming release)

Jetty ~7.6.13

IIS Server 2016

Nginx 1.9.5

Akamai ~2015

cURL 7.38.0

WireShark 1.11

IE 11 (Windows 10 only)

Edge 2

Chrome 41

Firefox 36

Safari 9 (OSX 10.11+)

Opera 28

Page 8: Http/2

Current Browser Implementation

Page 9: Http/2

Binary Framing● Similar to TCP packets● Frames contain distinct

data (headers, payload, etc)

● Frames are indexed● Fixed length

Length

Flags

Identifier

Payload

Page 10: Http/2

Streams● Bidirectional flow of bytes within a connection● May carry one or more messages● Single TCP connection can carry several streams● Have identifiers● Can be prioritized

Page 12: Http/2

Capable of Multiplexing● Frames in different streams can be interleaved● Solves Head-of-Line blocking

by Ilya Grigorik

Page 13: Http/2

Header Compression● Original SPDY compression was vulnerable● HPACK used in HTTP/2● HPACK uses 2 compression techniques

○ Huffman compression○ Client & Server must keep indexed list of

previously seen headers

Page 15: Http/2

Server Push● Server knows content needed● Server sends a PUSH_PROMISE frame● Client can decide to accept frame or reset it● Currently still experimental

Page 16: Http/2

TLS Only● Not mandated by the standard● Chrome & Firefox stated they will not support

without TLS● Performance issues balanced in single

connection scenario● http://letsencrypt.org

Page 17: Http/2

Connection Upgrade● ALPN during TLS hand-shake

○ Recommended

● Connection & Upgrade headers

Page 18: Http/2

DoS Vectors● Single connection reduces many vectors● TCP is still point of failure● HPACK & required buffering can be memory

intensive● HPACK can be used to increase payload● Header frames cannot be interrupted

Page 19: Http/2

What does this Mean for you?● Increased performance

○ Conservative measure of 5% to 15% ● Decreased resource use● New tools for debugging & monitoring ● Happier customers● Time to switch

Page 20: Http/2

It’s for Everyone● Reduces battery use in mobile devices

● Reduces CPU use in the server level

● Overall fewer costs

Page 21: Http/2

Transition Plan● Know your application as it is● Which strategy is best for your customers● Optimizations you might need to change● Benchmark before & after every change● Deploy

Page 22: Http/2

Transition Plan

1. Internal / Backend APIs2. Public APIs3. CDNs4. Front end applications5. Load balancers & other proxies

Page 23: Http/2

Transition Strategies● Sit and wait

● Adopt HTTP/2 completely

● Hybrid approach

Page 24: Http/2

Optimize, Fine Tune● Applications currently compensate for

shortcomings in HTTP 1.1● Most optimizations still ok

○ Maybe different● Re-optimize assets to take advantage of new

features● No changes to use of CDNs

Page 25: Http/2

Detrimental Optimizations● Domain sharding

● Inline assets

● Image sprites

● Concatenated resources

Page 26: Http/2

Hybrid Approach● For front-end servers● HTTP/2 capable proxy● Proxy terminates TLS● Forwards requests to servers with appropriate

optimizations● More costly approach

Page 27: Http/2

Benchmarks, Benchmarks, Benchmarks● Load Impact comparison tool

○ http://http2.loadimpact.com/entry/● Plugin for JMeter● h2load● Test all optimizations

Page 28: Http/2

Resources● http://http2.github.io● High Performance Browser Networking -

http://bit.ly/1PWhBQ3● Google HTTP/2 podcasts - http://bit.ly/1QgUrUP● http://caniuse.com/#feat=http2● HTTP/2 is here, let’s optimize -

http://bit.ly/20KJq5I

Page 29: Http/2

Thank You!http://bit.ly/1nvOOLV