Preface |
|
xv | |
Acknowledgments |
|
xvii | |
About this book |
|
xx | |
About the author |
|
xxiii | |
About the cover illustration |
|
xxiv | |
|
|
1 | (90) |
|
1 Web technologies and HTTP |
|
|
3 | (32) |
|
|
3 | (6) |
|
The internet versus the World Wide Web |
|
|
4 | (1) |
|
What happens when you browse the web? |
|
|
4 | (5) |
|
|
9 | (6) |
|
1.3 The syntax and history of HTTP |
|
|
15 | (13) |
|
|
15 | (1) |
|
|
16 | (6) |
|
|
22 | (6) |
|
1.4 Introduction to HTTPS |
|
|
28 | (3) |
|
1.5 Tools for viewing, sending, and receiving HTTP messages |
|
|
31 | (4) |
|
Using developer tools in web browsers |
|
|
31 | (2) |
|
|
33 | (1) |
|
Other tools for viewing and sending HTTP requests |
|
|
34 | (1) |
|
|
35 | (34) |
|
2.1 HTTP/1.1 and the current World Wide Web |
|
|
36 | (7) |
|
HTTP/1.1's fundamental performance problem |
|
|
38 | (2) |
|
|
40 | (1) |
|
Waterfall diagrams for web performance measurement |
|
|
41 | (2) |
|
2.2 Workarounds for HTTP/1.1 performance issues |
|
|
43 | (5) |
|
Use multiple HTTP connections |
|
|
44 | (2) |
|
|
46 | (2) |
|
HTTP/1 performance optimizations summary |
|
|
48 | (1) |
|
2.3 Other issues with HTTP/1.1 |
|
|
48 | (1) |
|
|
49 | (7) |
|
Example website 1: amazon.com |
|
|
49 | (5) |
|
Example website 2: imgur.com |
|
|
54 | (1) |
|
How much of a problem is this really? |
|
|
55 | (1) |
|
2.5 Moving from HTTP/1.1 to HTTP/2 |
|
|
56 | (3) |
|
|
56 | (2) |
|
|
58 | (1) |
|
2.6 What HTTP/2 means for web performance |
|
|
59 | (10) |
|
Extreme example of the power of HTTP/2 |
|
|
59 | (3) |
|
Setting expectations of HTTP/2 performance gains |
|
|
62 | (5) |
|
Performance workarounds for HTTP/1.1 as potential antipatterns |
|
|
67 | (2) |
|
|
69 | (22) |
|
|
69 | (9) |
|
HTTP/2 support on the browser side |
|
|
70 | (5) |
|
HTTP/2 support for servers |
|
|
75 | (2) |
|
Fallback when HTTP/2 isn't supported |
|
|
77 | (1) |
|
3.2 Ways to enable HTTP/2 for your website |
|
|
78 | (7) |
|
HTTP/2 on your web server |
|
|
78 | (2) |
|
HTTP/2 with a reverse proxy |
|
|
80 | (4) |
|
|
84 | (1) |
|
Implementing HTTP/2 summary |
|
|
85 | (1) |
|
3.3 Troubleshooting HTTP/2 setup |
|
|
85 | (6) |
|
|
91 | (132) |
|
|
93 | (49) |
|
4.1 Why HTTP/2 instead of HTTP/1.2? |
|
|
94 | (7) |
|
Binary rather than textual |
|
|
95 | (1) |
|
Multiplexed rather than synchronous |
|
|
96 | (3) |
|
Stream prioritization and flow control |
|
|
99 | (1) |
|
|
100 | (1) |
|
|
101 | (1) |
|
4.2 How an HTTP/2 connection is established |
|
|
101 | (13) |
|
|
102 | (7) |
|
Using the HTTP upgrade header |
|
|
109 | (3) |
|
|
112 | (1) |
|
HTTP Alternative Services |
|
|
112 | (1) |
|
The HTTP/2 preface message |
|
|
113 | (1) |
|
|
114 | (28) |
|
|
114 | (7) |
|
|
121 | (1) |
|
Examining HTTP/2 message flow by example |
|
|
122 | (15) |
|
|
137 | (5) |
|
5 Implementing HTTP/2 push |
|
|
142 | (40) |
|
5.1 What is HTTP/2 server push? |
|
|
142 | (4) |
|
|
146 | (17) |
|
Using HTTP link headers to push |
|
|
146 | (2) |
|
|
148 | (3) |
|
Pushing from downstream systems by using link headers |
|
|
151 | (4) |
|
|
155 | (6) |
|
|
161 | (2) |
|
5.3 How HTTP/2 push works in the browser |
|
|
163 | (4) |
|
Seeing how the push cache works |
|
|
163 | (3) |
|
Refusing pushes with RST_STREAM |
|
|
166 | (1) |
|
5.4 How to push conditionally |
|
|
167 | (3) |
|
Tracking pushes on the server side |
|
|
167 | (1) |
|
Using HTTP conditional requests |
|
|
168 | (1) |
|
Using cookie-based pushes |
|
|
168 | (1) |
|
|
169 | (1) |
|
|
170 | (3) |
|
|
170 | (1) |
|
|
171 | (1) |
|
|
172 | (1) |
|
5.6 Troubleshooting HTTP/2 push |
|
|
173 | (2) |
|
5.7 The performance impact of HTTP/2 push |
|
|
175 | (1) |
|
|
176 | (3) |
|
5.9 Other use cases for HTTP/2 push |
|
|
179 | (3) |
|
|
182 | (41) |
|
6.1 What HTTP/2 means for web developers |
|
|
183 | (1) |
|
6.2 Are some HTTP/1.1 optimizations now antipatterns? |
|
|
184 | (10) |
|
HTTP/2 requests still have a cost |
|
|
184 | (3) |
|
|
187 | (2) |
|
Compression is more efficient for larger resources |
|
|
189 | (2) |
|
Bandwidth limitations and resource contention |
|
|
191 | (1) |
|
|
192 | (1) |
|
|
193 | (1) |
|
|
193 | (1) |
|
6.3 Web performance techniques still relevant under HTTP/2 |
|
|
194 | (18) |
|
Minimizing the amount of data transferred |
|
|
194 | (8) |
|
Using caching to prevent resending data |
|
|
202 | (4) |
|
Service workers can further reduce load on the network |
|
|
206 | (1) |
|
Don't send what you don't need |
|
|
206 | (1) |
|
|
207 | (2) |
|
|
209 | (1) |
|
|
209 | (3) |
|
Non-HTTP-related web performance techniques |
|
|
212 | (1) |
|
6.4 Optimizing for both HTTP/1.1 and HTTP/2 |
|
|
212 | (11) |
|
|
213 | (1) |
|
Detecting HTTP/2 support on the server side |
|
|
214 | (3) |
|
Detecting HTTP/2 support on the client side |
|
|
217 | (1) |
|
|
218 | (2) |
|
How long to optimize for HTTP/1.1 users |
|
|
220 | (3) |
|
|
223 | (56) |
|
7 Advanced HTTP/2 concepts |
|
|
225 | (24) |
|
|
226 | (3) |
|
|
229 | (5) |
|
|
230 | (4) |
|
Setting flow control on the server |
|
|
234 | (1) |
|
|
234 | (11) |
|
|
235 | (3) |
|
|
238 | (3) |
|
Why does prioritization need to be so complicated? |
|
|
241 | (1) |
|
Prioritization in web servers and browsers |
|
|
241 | (4) |
|
7.4 HTTP/2 conformance testing |
|
|
245 | (4) |
|
Server conformance testing |
|
|
245 | (2) |
|
Client conformance testing |
|
|
247 | (2) |
|
8 HPACK header compression |
|
|
249 | (30) |
|
8.1 Why is header compression needed? |
|
|
249 | (2) |
|
8.2 How compression works |
|
|
251 | (4) |
|
|
252 | (1) |
|
More-efficient encoding techniques |
|
|
252 | (2) |
|
|
254 | (1) |
|
8.3 HTTP body compression |
|
|
255 | (2) |
|
8.4 HPACK header compression for HTTP/2 |
|
|
257 | (11) |
|
|
258 | (1) |
|
|
259 | (1) |
|
|
259 | (6) |
|
|
265 | (1) |
|
|
266 | (2) |
|
Why Huffman encoding isn't always optimal |
|
|
268 | (1) |
|
8.5 Real-world examples of HPACK compression |
|
|
268 | (7) |
|
8.6 HPACK in client and server implementations |
|
|
275 | (2) |
|
|
277 | (2) |
|
Part 4 The future of HTTP |
|
|
279 | (67) |
|
|
281 | (36) |
|
9.1 TCP inefficiencies and HTTP |
|
|
282 | (21) |
|
Setup delay in creating an HTTP connection |
|
|
283 | (1) |
|
Congestion control inefficiencies in TCP |
|
|
284 | (9) |
|
Effect of TCP inefficiencies on HTTP/2 |
|
|
293 | (4) |
|
|
297 | (5) |
|
The future of TCP and HTTP |
|
|
302 | (1) |
|
|
303 | (1) |
|
Performance benefits of QUIC |
|
|
304 | (1) |
|
QUIC and the internet stack |
|
|
304 | (2) |
|
What UDP is and why QUIC is built on it |
|
|
306 | (3) |
|
|
309 | (2) |
|
Differences between HTTP/2 and QUIC |
|
|
311 | (2) |
|
|
313 | (1) |
|
|
314 | (1) |
|
|
315 | (2) |
|
10 Where HTTP goes from here |
|
|
317 | (29) |
|
10.1 Controversies of HTTP/2 and what it didn't fix |
|
|
318 | (15) |
|
|
318 | (2) |
|
Privacy issues and state in HTTP |
|
|
320 | (4) |
|
|
324 | (3) |
|
Transport protocol issues |
|
|
327 | (4) |
|
HTTP/2 is far too complicated |
|
|
331 | (1) |
|
|
332 | (1) |
|
10.2 HTTP/2 in the real world |
|
|
333 | (1) |
|
10.3 Future versions of HTTP/2 and what HTTP/3 or HTTP/4 may bring |
|
|
334 | (5) |
|
|
334 | (1) |
|
Evolving the HTTP binary protocol further |
|
|
335 | (1) |
|
Evolving HTTP above the transport layer |
|
|
335 | (3) |
|
What would require a new HTTP version? |
|
|
338 | (1) |
|
How future versions of HTTP might be introduced |
|
|
339 | (1) |
|
10.4 HTTP as a more generic transport protocol |
|
|
339 | (7) |
|
Using HTTP semantics and messages to deliver nonweb traffic |
|
|
339 | (2) |
|
Using the HTTP/2 binary framing layer |
|
|
341 | (1) |
|
Using HTTP to start another protocol |
|
|
341 | (5) |
Appendix Upgrading common web servers to HTTP/2 |
|
346 | (28) |
Index |
|
374 | |