The Case for HTTP/2 - Internetdagarna 2015 - Stockholm
Nov. 24, 2015•0 likes
11 likes
Be the first to like this
Show More
•2,716 views
views
Total views
0
On Slideshare
0
From embeds
0
Number of embeds
0
Download to read offline
Report
Technology
HTTP/2 is here but why do we need it, how is it different to HTTP/1.1 and what does the mean for developers?
Slides from my talk at Internetdagarna 2015, Stockholm
and mush images together as sprites
Browser must download and
decode the whole image
To get just one sprite …
We override the browser’s priorities
https://www.flickr.com/photos/skoupidiaris/5025176923
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
Does it make any difference?
Host: Ireland, Test Agent: Singapore, Cable
Does it make any difference?
Host: Ireland, Test Agent: Singapore, Cable
Does it make any difference?
Host: Ireland, Test Agent: Singapore, Cable
Does it make any difference?
Host: Ireland, Test Agent: Singapore, Cable
What about when server and client are close?
Host: Ireland, Test Agent: Ireland, Cable
HTTP/1.1
HTTP/2
and evenly matched when server and client are close
Host: Ireland, Test Agent: Ireland, Cable
HTTP/1.1
HTTP/2
and evenly matched when server and client are close
Host: Ireland, Test Agent: Ireland, Cable
HTTP/1.1
HTTP/2
h2 capable
h2 enabled
h2 unsupported 7,200 ms
5,325 ms
6,160 ms
Time to mobile load event
Sample is 1 month
of data on
https://next.ft.com
https://speakerdeck.com/surma/2-101
Opportunities for new kinds of optimisations
https://www.flickr.com/photos/inucara/14981917985
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?
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?
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
Efficient TLS is Important
istlsfastyet.com www.ssllabs.com/ssltestBulletproof SSL and TLS
Ivan Ristic
Some good practices remain constant across HTTP/1.1 and HTTP/2
Shrinking content - compression, minification, image optimisation
Reducing re-redirects
Effective caching
Reducing latency e.g. using a CDN
Reducing DNS lookups and TCP connections
Others need to vary to make the most of each
Replace inlining with server push
Reduce CSS/JS concatenation and image spriting
Avoiding sharding
HTTP/2 combines connections for shards
When:
Refer to same IP address
Use same certificate (wildcard, or SAN)
(Can also check in Network Tab in Chrome DevTools)
HTTP/2 combines connections for shards
When:
Refer to same IP address
Use same certificate (wildcard, or SAN) DNS lookup, but
no new TCP connection
or TLS negotiation
(Can also check in Network Tab in Chrome DevTools)
Will the complexity be the end of hand crafted optimisations?
http://www.flickr.com/photos/simeon_barkas/2557059247
Will automation be the only sane way to manage this?
https://www.flickr.com/photos/skynoir/12342499794