Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Http/2
Hadi Hariri
What is this?
The World Wide Web in 1996
Internet Users
1993 - 14M
Source http://www.internetlivestats.com/internet-users/
Users by Country
Source http://www.internetlivestats.com/internet-users/
Better User Experiences and Visuals
The World Wide Web Today
by Fantasy
It’s all good. Everything runs smooth
Everyone has more bandwidth
Nielsen’s Law of Bandwidth
Source http://www.nngroup.com/articles/law-of-bandwidth/
1984 - 300 bps
50% Growth per Year
Bandwidth by Country
Source Akamai 2014 Rankings - Wikipedia
Position Country Speed (Mbps)
1 South Korea 25.3
2 Hong Kong ...
Mobile Networks
Source Akamai State of the Internet Q1 2015
Region Average Speed (Mbps)
Europe 20.4
North America 9.6
Asia...
So why we dumping HTTP 1.1?
The problem is no longer bandwidth
It’s the Latency, Stupid
Source https://rescomp.stanford.edu/~cheshire/rants/Latency.html, Stuart Cheshire May 1996
• Bandwidth

In computing, bandwidth is the bit-rate of available or consumed information
capacity expressed typically in ...
Latency
Source Mike Belshe Study 2010
Latency
Source https://www.igvita.com/2012/07/19/latency-the-new-web-performance-bottleneck/
And latency is per connection
Typical Web Page
Loading
Waterfall
http://www.webpagetest.org/result/150917_HE_CE5/1/details/
The 7 OSI Layers
Application
Presentation
Session
Transport
Network
Data Link
Physical
HTTP
TCP, UDP
All runs on TCP
TCP’s 3-Way Handshake
Client Server
SYN
SYN ACK
ACK
0ms
95 ms
How TCP works
• Flow Control
• Slow Start
• Head of Line Blocking
HTTP 0.9 - 1991
GET /index.htm
<HTML>
<HEAD>
…
</HEAD>
<BODY>
…
</BODY>
</HTML>
HTTP 1.0 - 1996
GET /index.htm HTTP/1.0
User-Agent: Netscape
Accept: text/html
HTTP/1.0 200 OK
Content-Type: text/html
<HT...
HTTP 1.1 - 1999
GET /index.htm HTTP/1.0
User-Agent: Netscape
Accept: text/html
Connection: close*
HTTP/1.0 200 OK
Content-...
New Optimization Possibilities
Keep Alive
• Using a single connection to send multiple successive
requests
• Pipelining Requests
• Send several requests ...
Multiple Connections
• Use multiple TCP Connections to perform parallel requests
• Limited to 6 connections
• Domain Shard...
Other techniques to minimize requests
• Inlining resources
• No Cache usage
• Encoding overhead
• Concatenating and Spriti...
The culprit is HTTP on TCP
• Http 1.1 chatty
• TCP is not made for chatty protocols
• TCP has slow start and head of line ...
Http/2
It’s about performance!
In a few words
• Binary Communication
• Compression and optimization techniques
• No change in HTTP semantics
• Not compat...
Is it SPDY?
Binary Framing
Http/2
GET /index.htm HTTP/1.0
User-Agent: Netscape
Accept: text/html
<html>…</html>
HEADER FRAME
DATA FRAME
Http/2 Upgrade (h2c)
Client Server
Upgrade: h2c
HTTP-2 Settings: base64(setttings)
HTTP 1.1 101
Connection: Upgrade
Upgrad...
Http/2 TLS + ALPN (h2)
Client Server
SYN
SYN ACK
ACK
TLS Handshake
ALPN
Connection
Http/2
STREAM
HEADER FRAME DATA FRAMERequest Message
HEADER FRAME DATA FRAMEResponse Message
STREAM
HEADER FRAM...
A Frame
Type
Flags
Payload
Length
Response Message
ID
Frame Types
• DATA
• HEADER
• WINDOW_UPDATE
• SETTINGS
• PRIORITY
• RST_STREAM
• PUSH_PROMISE
• PING
• GOAWAY
• CONTINUATI...
In Action
In Action
Proper Multiplexing
• Allows interleaving of different requests and responses
• Bidirectional
• Each frame has a unique id...
Header Compression
• Uses HPACK
• Huffman code for encoding headers
• An index table is maintained between client and serv...
Priorities
• Define priorities of different streams
• Each stream has a weight and dependencies
Flow Control
• Multiplexing requires ability of flow control
• WINDOW_UPDATE
Server Push
• Replaces inlining of resources
• PUSH_PROMISE from server (even numbered streams)
• Allows for caching
• All...
Security
• Not forced
• TLS implemented by all supported browsers
Current Status
• May 2015 RFC 7540
• May 2015 RFC 7541 (HPACK)
Browser Support
Implementations
• Servers: H2O, Warp, Netty, Lucid, Jetty…
• Clients: Jetty, Netty, Curl, OkHttp…
• Tomcat planned for 9
Demo Sites
• https://http2.akamai.com/
• http://www.http2demo.io/
Tooling
• Curl
• Chrome Tools
• Wireshark
• WebPageTest
How does it affect our applications?
Mostly transparent
A process of un-optimization
Rollback…
• Multiple TCP Connections
• Domain Sharding
• Concatenation and Spriting
• Inlining
What about API’s?
• For our HTTP API’s, no more concerns about chatty API’s
• Library usage will expose some of the lower ...
Not all roses…
• Adding transport level complexity to application level
• TLS requirements
• How will Push really work?
• ...
More information
• Starting point: https://github.com/http2
• High Performance Browser Networking by Ilya Grigorik
Thank you
@hhariri - mail@hadihariri.com
Upcoming SlideShare
Loading in …5
×

HTTP 2.0 – What do I need to know?

1,267 views

Published on

HTTP 1.1, which is the backbone of pretty much everything we’ve been using on the Internet, has been around for over 15 years. Recently the HTTP 2.0 specification has been completed and gradually application servers will start supporting it. It does make one wonder though: why change if something has been working for so long. In this talk we’ll examine the shortcomings of HTTP 1.1 and how 2.0 intends to address those. We’ll see what we need to know and how it’s going to affect our existing applications, and future ones.

Published in: Software
  • Be the first to comment

HTTP 2.0 – What do I need to know?

  1. 1. Http/2 Hadi Hariri
  2. 2. What is this?
  3. 3. The World Wide Web in 1996
  4. 4. Internet Users 1993 - 14M Source http://www.internetlivestats.com/internet-users/
  5. 5. Users by Country Source http://www.internetlivestats.com/internet-users/
  6. 6. Better User Experiences and Visuals
  7. 7. The World Wide Web Today
  8. 8. by Fantasy
  9. 9. It’s all good. Everything runs smooth
  10. 10. Everyone has more bandwidth
  11. 11. Nielsen’s Law of Bandwidth Source http://www.nngroup.com/articles/law-of-bandwidth/ 1984 - 300 bps 50% Growth per Year
  12. 12. Bandwidth by Country Source Akamai 2014 Rankings - Wikipedia Position Country Speed (Mbps) 1 South Korea 25.3 2 Hong Kong 16.3 3 Japan 15 4 Switzerland 14.5 … … … 12 United States 11.5 13 Belgium 11.4 … … … 24 Germany 8.7 … … … 28 Spain 7.8 … … … 30 Australia 6.9 31 France 6.9 … … … 55 Bolivia 1.1
  13. 13. Mobile Networks Source Akamai State of the Internet Q1 2015 Region Average Speed (Mbps) Europe 20.4 North America 9.6 Asia Pacific 8.8 South America 7.0 Africa 4.8
  14. 14. So why we dumping HTTP 1.1?
  15. 15. The problem is no longer bandwidth
  16. 16. It’s the Latency, Stupid Source https://rescomp.stanford.edu/~cheshire/rants/Latency.html, Stuart Cheshire May 1996
  17. 17. • Bandwidth
 In computing, bandwidth is the bit-rate of available or consumed information capacity expressed typically in metric multiples of bits per second. Variously, bandwidth may be characterized as network bandwidth, data bandwidth, or digital bandwidth. • Latency
 Latency is a time interval between the stimulation and response, or, from a more general point of view, as a time delay between the cause and the effect of some physical change in the system being observed.
  18. 18. Latency Source Mike Belshe Study 2010
  19. 19. Latency Source https://www.igvita.com/2012/07/19/latency-the-new-web-performance-bottleneck/
  20. 20. And latency is per connection
  21. 21. Typical Web Page
  22. 22. Loading
  23. 23. Waterfall http://www.webpagetest.org/result/150917_HE_CE5/1/details/
  24. 24. The 7 OSI Layers Application Presentation Session Transport Network Data Link Physical HTTP TCP, UDP
  25. 25. All runs on TCP
  26. 26. TCP’s 3-Way Handshake Client Server SYN SYN ACK ACK 0ms 95 ms
  27. 27. How TCP works • Flow Control • Slow Start • Head of Line Blocking
  28. 28. HTTP 0.9 - 1991 GET /index.htm <HTML> <HEAD> … </HEAD> <BODY> … </BODY> </HTML>
  29. 29. HTTP 1.0 - 1996 GET /index.htm HTTP/1.0 User-Agent: Netscape Accept: text/html HTTP/1.0 200 OK Content-Type: text/html <HTML> <HEAD> … </HEAD> <BODY> … </BODY> </HTML>
  30. 30. HTTP 1.1 - 1999 GET /index.htm HTTP/1.0 User-Agent: Netscape Accept: text/html Connection: close* HTTP/1.0 200 OK Content-Type: text/html <HTML> <HEAD> … </HEAD> <BODY> … </BODY> </HTML> *Connection default: keep-alive
  31. 31. New Optimization Possibilities
  32. 32. Keep Alive • Using a single connection to send multiple successive requests • Pipelining Requests • Send several requests together • Head of line blocking issues • Mostly abandoned by browsers
  33. 33. Multiple Connections • Use multiple TCP Connections to perform parallel requests • Limited to 6 connections • Domain Sharding • More DNS lookups • Still creates overhead on client/server with many open connections
  34. 34. Other techniques to minimize requests • Inlining resources • No Cache usage • Encoding overhead • Concatenating and Spriting resources • Cache Issues • Delay in processing
  35. 35. The culprit is HTTP on TCP • Http 1.1 chatty • TCP is not made for chatty protocols • TCP has slow start and head of line blocking
  36. 36. Http/2
  37. 37. It’s about performance!
  38. 38. In a few words • Binary Communication • Compression and optimization techniques • No change in HTTP semantics • Not compatible with HTTP 1.x but can be used on top of it
  39. 39. Is it SPDY?
  40. 40. Binary Framing Http/2 GET /index.htm HTTP/1.0 User-Agent: Netscape Accept: text/html <html>…</html> HEADER FRAME DATA FRAME
  41. 41. Http/2 Upgrade (h2c) Client Server Upgrade: h2c HTTP-2 Settings: base64(setttings) HTTP 1.1 101 Connection: Upgrade Upgrade: h2c
  42. 42. Http/2 TLS + ALPN (h2) Client Server SYN SYN ACK ACK TLS Handshake ALPN
  43. 43. Connection Http/2 STREAM HEADER FRAME DATA FRAMERequest Message HEADER FRAME DATA FRAMEResponse Message STREAM HEADER FRAME DATA FRAME HEADER FRAME DATA FRAME Request Message Response Message
  44. 44. A Frame Type Flags Payload Length Response Message ID
  45. 45. Frame Types • DATA • HEADER • WINDOW_UPDATE • SETTINGS • PRIORITY • RST_STREAM • PUSH_PROMISE • PING • GOAWAY • CONTINUATION
  46. 46. In Action
  47. 47. In Action
  48. 48. Proper Multiplexing • Allows interleaving of different requests and responses • Bidirectional • Each frame has a unique identifier • Eliminates head-of-line blocking • Single connection for parallel processing HEADER 3 DATA 3HEADER 1 DATA 1
  49. 49. Header Compression • Uses HPACK • Huffman code for encoding headers • An index table is maintained between client and server • CRIME prevented use of zlib
  50. 50. Priorities • Define priorities of different streams • Each stream has a weight and dependencies
  51. 51. Flow Control • Multiplexing requires ability of flow control • WINDOW_UPDATE
  52. 52. Server Push • Replaces inlining of resources • PUSH_PROMISE from server (even numbered streams) • Allows for caching • Allows for cancelation by client
  53. 53. Security • Not forced • TLS implemented by all supported browsers
  54. 54. Current Status • May 2015 RFC 7540 • May 2015 RFC 7541 (HPACK)
  55. 55. Browser Support
  56. 56. Implementations • Servers: H2O, Warp, Netty, Lucid, Jetty… • Clients: Jetty, Netty, Curl, OkHttp… • Tomcat planned for 9
  57. 57. Demo Sites • https://http2.akamai.com/ • http://www.http2demo.io/
  58. 58. Tooling • Curl • Chrome Tools • Wireshark • WebPageTest
  59. 59. How does it affect our applications?
  60. 60. Mostly transparent
  61. 61. A process of un-optimization
  62. 62. Rollback… • Multiple TCP Connections • Domain Sharding • Concatenation and Spriting • Inlining
  63. 63. What about API’s? • For our HTTP API’s, no more concerns about chatty API’s • Library usage will expose some of the lower level aspects
  64. 64. Not all roses… • Adding transport level complexity to application level • TLS requirements • How will Push really work? • What about Priorities?
  65. 65. More information • Starting point: https://github.com/http2 • High Performance Browser Networking by Ilya Grigorik
  66. 66. Thank you @hhariri - mail@hadihariri.com

×