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

HTTP/2

 HTTP/2

HTTP/2: How we got here and what to do now.

Avatar for Ben Darfler

Ben Darfler

May 04, 2016
Tweet

More Decks by Ben Darfler

Other Decks in Technology

Transcript

  1. HTTP/1.0 - 1996 • A New Connection per Request ◦

    Huge overhead ◦ 3 packets for setup ◦ 4 packets for termination
  2. HTTP/1.1 - 1997 • Persistent Connections ◦ Reuse the connection

    for multiple requests ◦ However: One outstanding request at a time • Pipelined Connections ◦ Multiple outstanding requests at a time ◦ However: FIFO order, slow requests block others ◦ However: Never really works ▪ "it's recommended nobody uses pipelining” - Chromium Project
  3. Reduce the Number of Requests • Fewer Bigger Files ◦

    JS/CSS Concatenation ◦ Image Sprites / Fonts • Inline Assets ◦ Inline JS/CSS ◦ Data URI for Images / Fonts
  4. Increase Parallelism • Domain Sharding ◦ Browsers open ~6 connections

    per domain ◦ Shard assets across multiple domains for even more parallelism
  5. Reduce the Number of Requests • Fewer Bigger Files ◦

    Download and parse unnecessary content ◦ Increases cache churn • Inline Assets ◦ Prevents caching of assets
  6. Increase Parallelism • Domain Sharding ◦ Each connection has its

    own overhead ◦ Each connection competes with the others ◦ Many sites over shard ▪ After 2 shards performance degrades
  7. Fully Multiplexed • One connection per domain • Multiple outstanding

    requests • Fully async, out of order delivery ◦ Slow requests don’t block others
  8. Server Push • Server / CDN can “push” assets before

    the client requests • Example Strategy ◦ Server / CDN observes requests ◦ Builds dependency graph using referer header ◦ Server / CDN is able to push page dependencies
  9. Other Improvements • Efficient Binary Protocol ◦ Much faster to

    parse than test base protocols • Compressed Headers ◦ This includes cookies which can be huge
  10. Best Practices! • No more concatenation ◦ No more cache

    churn issues ◦ Only download what is needed • No more inlining ◦ Better caching • No more domain sharding ◦ Better resource utilization