/plushcap/analysis/cloudflare/http-2-for-web-developers

HTTP/2 For Web Developers

What's this blog post about?

The article discusses how web developers should optimize their websites for HTTP/2, which provides a 30% performance gain without requiring complex build and deploy processes. Unlike HTTP/1.1, where minimizing the number of HTTP requests was crucial, in HTTP/2, web developers should focus on tuning website caching behavior. The multiplexing feature of HTTP/2 allows multiple requests to share a single TCP connection, eliminating head-of-line blocking issues from HTTP/1.1. Header compression further reduces the overhead of multiple HTTP requests. Best practices for HTTP/2 web optimization include: 1. Stop concatenating files: Instead, focus on optimizing caching policy by isolating frequently changing files from rarely changed ones. 2. Stop inlining assets: Leverage HTTP/2's server push functionality instead of embedding CSS stylesheets, external JavaScript files, and images directly into HTML pages. 3. Stop sharding domains: Multiplexing allows multiple assets to download in parallel over a single connection, making domain sharding unnecessary. Some HTTP/1.1 best practices that still apply include minimizing DNS lookups, using content delivery networks (CDNs), leveraging browser caching, minimizing the size of HTTP requests and responses, eliminating unnecessary redirects, and keeping server-side redirects to a minimum.

Company
Cloudflare

Date published
Dec. 10, 2015

Author(s)
Ryan Hodson

Word count
1820

Language
English

Hacker News points
10


By Matt Makai. 2021-2024.