HTTP/2 is here but why do we need it, and how is it different to HTTP/1.1?
Video - https://www.youtube.com/watch?v=ob-CnA9YmiI
These are the slides from my talk at Front-End London's one day conference, EpicFEL
7. and we’ve been hacking around some of the limitations
https://www.flickr.com/photos/rocketnumber9/13695281
8. Each TCP connection only supports one request at a time*
https://www.flickr.com/photos/39551170@N02/5621408218
*HTTP Pipelining is broken in practice
9. So browsers allowed us to make more requests in parallel
Very Old browsers - 2 parallel connections
Today’s browsers - 4 plus connections
10. To make even more parallel requests we split resources across hosts
www.bbc.co.uk
static.bbci.co.uk
news.bbcimg.co.uk
node1.bbcimg.co.uk
11. Increasing the risk of network congestion and packet loss
https://www.flickr.com/photos/dcmaster/4585119705
12. Every request has an overhead
https://www.flickr.com/photos/tholub/9488778040
15. And small responses may not fill the TCP Congestion Window
Could have sent more segments in this round-trip
Small response
16. So we follow recipes e.g. Reduce Requests
https://www.flickr.com/photos/nonny/116902484
17. Create CSS and JavaScript bundles
++++
= =More to download
and parse
x+
Whole bundle is
invalidated if a
single file changes
18. and mush images together as sprites
Browser must download and
decode the whole image
To get just one sprite …
19. We override the browser’s priorities
https://www.flickr.com/photos/skoupidiaris/5025176923
20. Embed binary* data using DataURIs
url(data:image/
png;base64,iVBORw0KGgoAA
AANSUhEUgAAABkAAAAZCAMAA
ADzN3VRAAAAGXRFWHRTb2Z0d
2FyZQBBZG9iZSBJbWFnZVJlY
WR5ccllPAAAAAZQTFRF/
wAAAAAAQaMSAwAAABJJREFUe
NpiYBgFo2AwAIAAAwACigABt
nCV2AAAAABJRU5ErkJggg==)
=
*dataURIs can be text too e.g. SVG
46. Many opportunities for server push
HTML
CSS
DOM
CSSOM
Render
Tree
Layout PaintJavaScript
Fonts and background
images discovered
when render tree builds
Could we push them?
55. Choose your server carefully…
Does it respect stream and connection flow?
Does it support dependencies and weights?
Does it support server-push?
How does it help optimisation?
56. No content until DNS, TCP and TLS negotiation complete
Efficient TLS is Important
Session Resumption, Certificate Stapling and improvements in TLS v1.3 all help
57. Efficient TLS is Important
istlsfastyet.com www.ssllabs.com/ssltestBulletproof SSL and TLS
Ivan Ristic