http/1.1 vs. http/2: a performance analysis
TRANSCRIPT
![Page 1: HTTP/1.1 vs. HTTP/2: A Performance Analysis](https://reader035.vdocuments.net/reader035/viewer/2022070512/58899b5a1a28ab330e8b71d5/html5/thumbnails/1.jpg)
HTTP/1.1 vs HTTP/2
Ragnar Lönn, Load Impact
@ragnarlonn
- a performance analysis
Daniel Stenberg, Mozilla
@bagder
![Page 2: HTTP/1.1 vs. HTTP/2: A Performance Analysis](https://reader035.vdocuments.net/reader035/viewer/2022070512/58899b5a1a28ab330e8b71d5/html5/thumbnails/2.jpg)
Part 2: The Experiment
Objective:
Try to get a sense of real-world performance impact of going from HTTP/1.1 to HTTP/2
@loadimpact
![Page 3: HTTP/1.1 vs. HTTP/2: A Performance Analysis](https://reader035.vdocuments.net/reader035/viewer/2022070512/58899b5a1a28ab330e8b71d5/html5/thumbnails/3.jpg)
Approach
● Choose a well-known site
● Download all resources used by main page
● Host everything locally, in controlled environment
● Measure load times while simulating different network characteristics
![Page 4: HTTP/1.1 vs. HTTP/2: A Performance Analysis](https://reader035.vdocuments.net/reader035/viewer/2022070512/58899b5a1a28ab330e8b71d5/html5/thumbnails/4.jpg)
Site: www.amazon.com
● ~230-240 resources to get to onload()
● ...but “only” ~10 javascript files
● ~10 unique source hosts
● ~7 Mbyte data
![Page 5: HTTP/1.1 vs. HTTP/2: A Performance Analysis](https://reader035.vdocuments.net/reader035/viewer/2022070512/58899b5a1a28ab330e8b71d5/html5/thumbnails/5.jpg)
MacOS X 10.10.3 (4 CPU cores, 16G RAM)
VMware Fusion
Linux 3.19.0-25 (Ubuntu)2 CPU cores, 2G RAM
● Nginx 1.9.5/http2
● Shimmer Cat 0.1
● Linux Netem
eth0:1……...eth0:n
Chrome
The Setup
![Page 6: HTTP/1.1 vs. HTTP/2: A Performance Analysis](https://reader035.vdocuments.net/reader035/viewer/2022070512/58899b5a1a28ab330e8b71d5/html5/thumbnails/6.jpg)
Test results
![Page 7: HTTP/1.1 vs. HTTP/2: A Performance Analysis](https://reader035.vdocuments.net/reader035/viewer/2022070512/58899b5a1a28ab330e8b71d5/html5/thumbnails/7.jpg)
Test results
50-70% reduced load time
-66%
![Page 8: HTTP/1.1 vs. HTTP/2: A Performance Analysis](https://reader035.vdocuments.net/reader035/viewer/2022070512/58899b5a1a28ab330e8b71d5/html5/thumbnails/8.jpg)
Remember that:
● HTTP/2 implementations still in their infancy
● Sites are optimized for HTTP/1.1
● Our lab setup is not 100% realistic
So who knows… But still, hey - 60%!
![Page 9: HTTP/1.1 vs. HTTP/2: A Performance Analysis](https://reader035.vdocuments.net/reader035/viewer/2022070512/58899b5a1a28ab330e8b71d5/html5/thumbnails/9.jpg)
Interesting observations
Relative speed change is flat
![Page 10: HTTP/1.1 vs. HTTP/2: A Performance Analysis](https://reader035.vdocuments.net/reader035/viewer/2022070512/58899b5a1a28ab330e8b71d5/html5/thumbnails/10.jpg)
Dependencies
![Page 11: HTTP/1.1 vs. HTTP/2: A Performance Analysis](https://reader035.vdocuments.net/reader035/viewer/2022070512/58899b5a1a28ab330e8b71d5/html5/thumbnails/11.jpg)
The dependency tree
index.html
style.css
script1.js
image1.png
image2.png
image3.png
script2.js
image4.png
image5.png
image6.png
image7.png
![Page 12: HTTP/1.1 vs. HTTP/2: A Performance Analysis](https://reader035.vdocuments.net/reader035/viewer/2022070512/58899b5a1a28ab330e8b71d5/html5/thumbnails/12.jpg)
Dependency chains
index.html
style.css
script1.js
image1.png
image2.png
image3.png
script2.js
image4.png
image5.png
image6.png
image7.png
![Page 13: HTTP/1.1 vs. HTTP/2: A Performance Analysis](https://reader035.vdocuments.net/reader035/viewer/2022070512/58899b5a1a28ab330e8b71d5/html5/thumbnails/13.jpg)
A dependency chain
index.html
script1.js
script2.js
image6.png
1
2
3
4
![Page 14: HTTP/1.1 vs. HTTP/2: A Performance Analysis](https://reader035.vdocuments.net/reader035/viewer/2022070512/58899b5a1a28ab330e8b71d5/html5/thumbnails/14.jpg)
Dependency chain load time
Host1/index.html
Host1/script1.js
Host2/script2.js
Host3/image6.png
Conn Req
Req
Conn Req
Conn Req
![Page 15: HTTP/1.1 vs. HTTP/2: A Performance Analysis](https://reader035.vdocuments.net/reader035/viewer/2022070512/58899b5a1a28ab330e8b71d5/html5/thumbnails/15.jpg)
The sum of all latencies
Host1/index.html
Host1/script1.js
Host2/script2.js
Host1 RTT Host2 RTT
Conn Req
Conn
Req
Host3 RTT
Host3/image6.png
Req
Conn Req
![Page 16: HTTP/1.1 vs. HTTP/2: A Performance Analysis](https://reader035.vdocuments.net/reader035/viewer/2022070512/58899b5a1a28ab330e8b71d5/html5/thumbnails/16.jpg)
The largest sum of all latencies
index.html
style.css
script1.js
image1.png
image2.png
image3.png
script2.js
image4.png
image5.png
image6.png
image7.png
![Page 17: HTTP/1.1 vs. HTTP/2: A Performance Analysis](https://reader035.vdocuments.net/reader035/viewer/2022070512/58899b5a1a28ab330e8b71d5/html5/thumbnails/17.jpg)
Minimum load time
Minimum theoretical load time =
● The largest “sum of all latencies” value of all dependency chains
![Page 18: HTTP/1.1 vs. HTTP/2: A Performance Analysis](https://reader035.vdocuments.net/reader035/viewer/2022070512/58899b5a1a28ab330e8b71d5/html5/thumbnails/18.jpg)
Dependency chains
● # of resources loaded in one dependency chain step exceeds # of TCP channels that can be used concurrently
HTTP/1.1 is much disadvantaged when:
This happens quite often
![Page 19: HTTP/1.1 vs. HTTP/2: A Performance Analysis](https://reader035.vdocuments.net/reader035/viewer/2022070512/58899b5a1a28ab330e8b71d5/html5/thumbnails/19.jpg)
Dependency chains
● The client needs to open new connections
HTTP/2 is disadvantaged when:
This happens more often than strictly necessary today, as it often benefits HTTP/1.1 performance
![Page 20: HTTP/1.1 vs. HTTP/2: A Performance Analysis](https://reader035.vdocuments.net/reader035/viewer/2022070512/58899b5a1a28ab330e8b71d5/html5/thumbnails/20.jpg)
Test @ http2.loadimpact.com