Upgrade to Pro — share decks privately, control downloads, hide ads and more …

HTTP 2.0 and QUIC - Protocols of the (near) future

Iliyan Peychev
September 14, 2014

HTTP 2.0 and QUIC - Protocols of the (near) future

HTTP 1.1 forced both developers and browser vendors to invent different tricks in order to make sites to load and run faster. HTTP 2.0 and QUIC will provide many significant improvements overt HTTP 1.1.

In this talk I will give an introduction to both protocols and emphasize why are they so important for the Web development workflow and performance.

Iliyan Peychev

September 14, 2014
Tweet

More Decks by Iliyan Peychev

Other Decks in Programming

Transcript

  1. HTTP is used by the World-Wide Web since 1990 Browser

    sends request to the server Server responds GET /index.html HTTP/1.1 HTTP/1.1 200 OK
  2. The number of requests per page increases HTTP Archive Top

    100 sites data for 15.11.2010 - 1.10.2014
  3. Optional parts, like HTTP Pipelining It is very latency sensitive

    The specification is huge HTTP 1.1 issues and more...
  4. Why not HTTP Pipelining? The server must send its responses

    in the same order that requests were received So the entire connection remains first-in-first-out (FIFO) and Head-of-line (HOL) blocking can occur and more, like buggy proxy servers
  5. In most browsers HTTP pipelining is disabled Or not implemented

    at all Browsers achieve multiplexing by opening multiple connections to servers As a result...
  6. Reducing cookie size 7 Using cookie-free domains 8 Using <link>

    instead of @import 9 Developers invented workarounds
  7. Using HTTP Upgrade mechanism HTTP How browser switches to HTTP

    2.0 GET / HTTP/1.1 Host: server.example.com Connection: Upgrade, HTTP2-Settings Upgrade: h2c HTTP2-Settings: <base64url encoding of HTTP/2 SETTINGS payload>
  8. HTTP 2.0 Features It is a binary protocol, not text

    one Browser and server exchange frames Each frame belongs to stream Streams are multiplexed, with priorities Server push
  9. ONE connection to the server should be enough (not six

    connections per domain as most browsers do now) HTTP 2.0 Features
  10. Frame format 0 1 2 3 0 1 2 3

    4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Length (24) | +---------------+---------------+---------------+ | Type (8) | Flags (8) | +-+-+-----------+---------------+-------------------------------+ |R| Stream Identifier (31) | +=+=============================================================+ | Frame Payload (0...) ... +---------------------------------------------------------------+
  11. Frame types DATA Convey arbitrary data associated with a stream

    HEADERS Used to open a stream and carries name-value pairs PRIORITY Specifies the sender-advised priority of a stream RST_STREAM Allows abnormal termination of a stream SETTINGS Conveys configuration parameters that affect how endpoints communicate
  12. Frame types PUSH_PROMISE Used to notify the peer endpoint in

    advance of streams the sender intends to initiate PING Measuring a minimal round-trip time from the sender; checks if a connection is still alive GOAWAY Informs the remote peer to stop creating streams on this connection WINDOW_UPDATE Used to implement flow control on each individual stream or on the entire connection. CONTNUATION Used to continue a sequence of header block fragments
  13. Stream priority Each stream has priority Specified by the client

    (browser) Priority can be changed runtime
  14. Header compression HTTP 2.0 is stateless protocol too The client

    still has to send data to the server The headers in HTTP 2.0 are compressed
  15. Header compression Stateful Using a single compression context for the

    entire connection The algorithm is called HPACK (Header Compression for HTTP/2)
  16. Server push Server pre-emptively sends resources to a client, in

    association with a previous client-initiated request
  17. Why not SCTP over DTLS? After all, SCTP provides (among

    other things) stream multiplexing And DTLS provides SSL quality encryption and authentication over a UDP stream
  18. Why not SCTP over DTLS? Mainly because roughly 4 round

    trips are needed to establish an SCTP over DTLS connection In contrast, the goal of QUIC is to perform a connection establishment with zero RTT overhead
  19. QUIC Features Delay of only one packet causes the entire

    set of SPDY (aka HTTP/2) streams to pause. (Since TCP only provides a single serialized stream interface) In QUIC, when a single packet is lost, only one stream is being delayed
  20. QUIC Features 100 ms 0 ms RTT Repeat connection New

    connection QUIC TCP + TLS 300 ms 200 ms RTT Repeat connection New connection
  21. QUIC Internet connections persistence Communication channels are not defined by

    IP +Port but by an ID You leave a WiFi zone and entering a mobile one but the connection continues
  22. https://http2rulez.com Open Source platform for testing different optimization strategies for

    HTTP 2.0 Same content, served via HTTP, HTTPS, SPDY and HTTP/2 (No QUIC endpoint yet) View Page Load Time for each page
  23. Wrap up How HTTP 2.0 will affect the way YOU

    develop and optimize Web applications?