HTTP/2 in Action
Barry Pollard
  • March 2019
  • ISBN 9781617295164
  • 416 pages
  • printed in black & white
ePub + Kindle available Mar 26, 2019

An excellent introduction to the new HTTP/2 standard, with insightful explanations and very good examples.

Alain Couniot, STIB-MIVB
HTTP/2 in Action is a complete guide to HTTP/2, one of the core protocols of the web. Because HTTP/2 has been designed to be easy to transition to, including keeping it backwards compatible, adoption is rapid and expected to increase over the next few years. Concentrating on practical matters, this interesting book presents key HTTP/2 concepts such as frames, streams, and multiplexing and explores how they affect the performance and behavior of your websites.
Table of Contents detailed table of contents

Part 1: Moving to HTTP/2

1 Web Technologies and HTTP

1.1 How the web works

1.1.1 The Internet versus the World Wide Web

1.1.2 What happens when you browse the web?

1.2 What is HTTP?

1.2.1 Basic HTTP Request Syntax

1.3 The Syntax and History of HTTP

1.3.1 HTTP/0.9

1.3.2 HTTP/1.0

1.3.3 HTTP/1.1

1.4 Introduction to HTTPS

1.5 Tools for viewing, sending and receiving HTTP messages

1.5.1 Using Developer tools in Web Browsers

1.5.2 Sending HTTP Requests

1.5.3 Other tools for to view and send HTTP Requests

Summary

2 Road to HTTP/2

2.1 HTTP/1.1 and the current World Wide Web

2.1.1 HTTP/1.1 has a fundamental performance problem.

2.1.2 Pipelining for HTTP/1.1

2.1.3 Waterfall Diagrams for Web Performance Measurement

2.2 Workarounds for HTTP/1.1 Performance issues

2.2.1 Use Multiple HTTP Connections

2.2.2 Make Fewer Requests

2.2.3 HTTP/1 Performance Optimizations Summary

2.3 Other issues with HTTP/1.1

2.4 Real World Examples

2.4.1 Example Website 1 - Amazon.com

2.4.2 Example Website 2 - Imgur.com

2.4.3 How much of a problem is this really?

2.5 Moving on from HTTP/1.1 to HTTP/2

2.5.1 SPDY

2.5.2 HTTP/2

2.6 What HTTP/2 means for Web Performance

2.6.1 Extreme Example of the Power of HTTP/2

2.6.2 Setting Expectations of HTTP/2 Performance Gains

2.6.3 Performance Workarounds for HTTP/1.1 are potentially Anti-Patterns.

Summary

3 Upgrading to HTTP/2

3.1 HTTP/2 Support

3.1.1 HTTP/2 Support on Browser Side.

3.1.2 HTTP/2 Support for Servers

3.1.3 Fallback when HTTP/2 is not supported

3.2 Ways to enable HTTP/2 for your website

3.2.1 HTTP/2 on your Web Server

3.2.2 HTTP/2 with a Reverse Proxy

3.2.3 HTTP/2 through a CDN

3.2.4 Implementing HTTP/2 Summary

3.3 Troubleshooting HTTP/2 setup

Summary

Part 2: Using HTTP/2

4 HTTP/2 Protocol Basics

4.1 Why HTTP/2 instead of HTTP/1.2?

4.1.1 Binary rather than textual

4.1.2 Multiplexed, rather than synchronous

4.1.3 Stream Prioritization and Flow Control

4.1.4 Header Compression

4.1.5 Server Push

4.2 How an HTTP/2 Connection is Established

4.2.1 Using HTTPS Negotiation

4.2.2 Using the HTTP Upgrade header

4.2.3 Using prior knowledge

4.2.4 Alternative Services

4.2.5 The HTTP/2 Preface Message

4.3 HTTP/2 Frames

4.3.1 Viewing HTTP/2 Frames

4.3.2 HTTP/2 Frame Format

4.3.3 Examining HTTP/2 Message Flow by Example

4.3.4 Other Frames

Summary

5 Implementing HTTP/2 Push

5.1 What is HTTP/2 Server Push?

5.2 How to push

5.2.2 Viewing HTTP/2 pushes

5.2.4 Pushing earlier

5.2.5 Other ways to Push

5.3 How HTTP/2 push works in the browser

5.3.1 More details on how the push cache works

5.3.2 Refusing pushes with RST_STREAM

5.4 How to push conditionally

5.4.1 Tracking pushes on the server side

5.4.2 Use of HTTP conditional requests

5.4.4 Cache Digests

5.5 What to Push?

5.5.1 What can you Push?

5.5.2 What should you Push?

5.5.3 Automating Push

5.6 Troubleshooting HTTP/2 Push

5.7 The Performance impact of HTTP/2 push

5.8 Push versus preload

5.9 Other use cases for HTTP/2 Push

Summary

6 Optimizing for HTTP/2

6.1 What HTTP/2 means for web developers

6.2 Are some HTTP/1.1 optimizations now anti-patterns?

6.2.1 HTTP/2 requests still have a cost

6.2.2 HTTP/2 is not limitless

6.2.3 Compression is more efficient for larger resources

6.2.4 Bandwidth limitations and resource contention.

6.2.5 Sharding

6.2.6 Inlining

6.2.7 Conclusion on whether some HTTP/1.1 optimizations are anti-patterns.

6.3 Web Performance techniques still relevant under HTTP/2

6.3.1 Minimizing the amount of Data Transferred

6.3.2 Use Caching to prevent resending data

6.3.3 Service Workers can further reduce load on the Network

6.3.4 Don’t send what you don’t need

6.3.5 HTTP Resource Hints

6.3.6 Reduce last mile latency

6.3.7 Optimize HTTPS

6.4 Optimizing for both HTTP/1.1 and HTTP/2

6.4.1 Measuring HTTP/2 traffic

6.4.2 Detecting HTTP/2 support on the server side

6.4.3 Detecting HTTP/2 Support on the client side

6.4.4 Connection Coalescing

6.4.5 How long to optimize for HTTP/1.1 users?

Summary

Part 3: Moving to HTTP/2

7 Advanced HTTP/2 Concepts

7.1 Stream States

7.2 Flow control

7.2.1 Example of flow control

7.2.2 Setting flow control on the server

7.3 stream priorities

7.3.1 Stream dependencies

7.3.2 Stream weighting

7.3.3 Why does it need to be so complicated?

7.3.4 Prioritization in web servers and browsers

7.4 HTTP/2 Conformance Testing

7.4.1 Client conformance testing

Summary

8 HPACK Header Compression

8.1 Why is header compression needed?

8.2 How compression works

8.2.1 Lookup tables

8.2.2 More efficient encoding techniques

8.2.3 Lookback compression

8.3 HTTP Body compression

8.3.1 Why we cannot use http body compression techniques for header compression

8.4 HPACK header compression for HTTP/2

8.4.1 HPACK static table

8.4.2 HPACK dynamic table

8.4.3 HPACK header types

8.4.4 Huffman encoding table

8.4.5 Huffman encoding script

8.4.6 Huffman encoding is not always optimal

8.5 Real-world examples of HPACK compression

8.6 HPACK in client and server implementations

8.7 The value of HPACK

Summary

Part 4: The future of HTTP

9 TCP, QUIC, and HTTP/3

9.1 TCP inefficiencies and HTTP

9.1.1 Setup delay in creating an HTTP connection

9.1.2 Congestion control inefficiencies in TCP

9.1.3 Impact of TCP inefficiencies for HTTP/2.

9.1.4 Optimizing TCP

9.1.5 The future of TCP and HTTP

9.2 QUIC

9.2.1 The performance benefits of QUIC

9.2.2 QUIC and the internet stack

9.2.3 What UDP is and why QUIC is built on it

9.2.4 Standardizing QUIC

9.2.5 Differences between HTTP/2 and QUIC

9.2.6 QUIC tools

9.2.7 Should you use QUIC?

Summary

10 Where HTTP goes from here

10.1 Controversies of HTTP/2 and what it didn’t fix

10.1.1 Arguments against SPDY

10.1.2 Privacy issues and State in HTTP

10.1.3 HTTP and Encryption

10.1.4 Transport Protocol issues

10.1.5 It’s all too complicated!

10.1.6 It’s a stop gap

10.2 HTTP/2 in the real world

10.3 Future versions of HTTP/2 and what HTTP/3 or HTTP/4 might bring

10.3.1 Is QUIC HTTP/3?

10.3.2 Evolving the HTTP binary protocol further

10.3.3 Evolving HTTP above the Transport Layer

10.3.4 What would require a new HTTP version?

10.3.5 How future versions of HTTP might be introduced?

10.4 HTTP as a more generic transport protocol

10.4.1 Use HTTP semantics and messages to deliver non-web traffic

10.4.2 Use the HTTP/2 binary framing layer

10.4.3 Use HTTP as a way of starting another protocol

Summary

Appendixes

Appendix A: Upgrading common web servers to HTTP/2

A.1 Upgrading your web server to support HTTP/2

A.1.1 Apache

A.1.2 nginx

A.1.3 Microsoft Internet Information Services (IIS)

A.1.4 Other servers

A.2 Setting up HTTP/2 via a reverse proxy server

A.2.1 Apache

A.2.2 Nginx

About the Technology

HTTP—Hypertext Transfer Protocol—is the standard for exchanging messages between websites and browsers. And after 20 years, it's gotten a much-needed upgrade. With support for streams, server push, header compression, and prioritization, HTTP/2 delivers vast improvements in speed, security, and efficiency.

About the book

HTTP/2 in Action teaches you everything you need to know to use HTTP/2 effectively. You'll learn how to optimize web performance with new features like frames, multiplexing, and push. You'll also explore real-world examples on advanced topics like flow control and dependencies. With ready-to-implement tips and best practices, this practical guide is sure to get you—and your websites—up to speed!

What's inside

  • HTTP/2 for web developers
  • Upgrading and troubleshooting
  • Real-world examples and case studies
  • QUIC and HTTP/3

About the reader

Written for web developers and site administrators.

About the author

Barry Pollard is a professional developer with two decades of experience developing, supporting, and tuning software and infrastructure.

combo $49.99 pBook + eBook + liveBook
eBook $39.99 pdf + ePub + kindle + liveBook

placing your order...

Don't refresh or navigate away from the page.

FREE domestic shipping on three or more pBooks