by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks. Adoption Source: http://isthewebhttp2yet.com/measurements/adoption.html
by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks. Adoption – Single h2 objects
by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks. Adoption – h2 error pages shouldn’t count! http https
by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks. Adoption – File pages
2. Introduced head of line blocking H/2 uses binary framing 1. Allows streaming of content 2. Interleaving of streams 3. Prioritisation of streams Multiplexing
plain text 2. 80-90% repetition 3. Long cookies added to weight H/2 uses HPACK 1. Client/Server Index table used 2. Compression applied Header Compression
requests 2. 1:1 relationship 3. Browser discovery delay 4. In-lining provided cache issues H/2 can push resources 1. 1:many relationship 2. Separate resource = new stream 3. Can be cached & re-used 4. Can be declined Server Push
1. Optimised for many small connections 2. Packet loss has a bigger impact on one connection H/2 can free up resources 1. 1 connection per client 2. The server has less to manage Other Considerations
collected per day 2. Some sites see good improvements 3. Some sites don’t! 4. 3rd Party content waters down benefit 5. Network conditions vary results 6. Browsers behave differently
by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks. H1 v H2 Demo
by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks. How to test h2 v h1 --disable-http2
by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks. How to test h2 v h1 firefoxPref network.https.spdy.enabled false firefoxPref network.https.spdy.enabled.https2 false navigate https://www.website.com
by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks. How to test h2 v h1
by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks. How do I know it’s h2? h1 h2
by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks. How do I know it’s h2? h1 h2
by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks. How do I know it’s h2? h1 h2
by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks. H2 – Chrome Net Internals chrome://net-internals/#http2
by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks. Performance - Rendering h1 h2 h1 h2 4 sec
by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks. Performance - Rendering h1 h2 h1 h2 4 sec
by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks. Performance - Rendering: Sharding h1 h2 1 Domain All on same connection 2nd connection opened /js /css www.website.com /js /css www.website.com dns connection ssl ttfb d/load
by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks. Performance – Rendering: Sharding example h2 after h2 before Simple improvement by not making connection
by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks. Performance – Rendering: Sharding example h2 after h2 before
by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks. Performance – Rendering: Progressive jpegs h2 normal jpeg progressive Normal jpegs just 60% loaded
by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks. Performance – Rendering: Progressive jpeg example h2 after h2 before
by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks. Performance – Rendering: DIY prioritisation <script> var img = document.createElement("img"); img.src = "tshirt2.jpg"; document.getElementById("imgholder").appendChild(img); </script> Different order, but ultimately same outcome
by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks. Performance – Rendering: DIY prioritisation <img onload="addImages();" src="tshirt12_thumb.jpg"> <script> function addImages() {; var img = document.createElement("img"); img.src = "tshirt2.jpg"; document.getElementById("imgholder").appendChild(img); } </script> Different order and loaded with dependency
by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks. Performance – Rendering: INITCWND 10 32 10 64
by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks. Performance – Rendering example Large image fills bandwidth
by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks. Performance – Rendering example prog jpg h2 before js priority
by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks. Performance – Rendering example 2 sec 1 sec ??? prog jpg
by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks. Server Push Update
by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks. Performance – Rendering example 2 sec 1 sec h2 push prog jpg
by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks. Performance – Rendering example Server Push h2 push prog jpg
by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks. Performance – Rendering: Server push bad example h2 push h2 before
content on same domain 2. If you need to shard to balance h1 use the same cert 3. Progressive jpgs can help rendering 4. Use JavaScript if you need to delay resources 5. Don’t worry too much about congestion windows 6. Use server push where you can
by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks. Performance – Small files: CSS Test Page: 1000 x coloured <div> tags with 1000 CSS rules /* 1 CSS rule for each <div>*/ #div1 { width:20px; height:20px; background-color:#000000; float:left; margin:1px; } … /* HTML */ <div id=“div1"></div> … <div id=“div1000"></div> For example 1 file with 1000 rules OR 500 files with 2 rules in each
by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks. Performance – Small files: CSS Visual experience of test H2 is faster to download, rendering is not progressive - (10 file example) h1 h2
by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks. Performance – Small files: CSS CSS bytes downloaded 0 250 500 0 6 12 18 0 250 500 750 1000 H2 is smaller because of header compression File size grows because of less compression (gzip) and more headers * # of files file size (kB) visual complete (s) h1 h2
by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks. Performance – Small files: CSS 0 250 500 0 6 12 18 0 250 500 750 1000 h1 h2 # of files file size (kB) visual complete (s) Chrome performance comparison H2 is slower when you exceed 20 files!
by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks. Performance – Small files: CSS Firefox performance comparison 0 250 500 0 6 12 18 0 250 500 750 1000 # of files file size (kB) visual complete (s) h1 h2 H2 is faster, especially as you increase the number of files Smaller number of files is faster to load
by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks. 0 0.4 0.8 1.2 1 2 3 4 5 6 7 8 9 10 Chrome h2 Chrome h1 Performance – Small files: CSS Zoomed to 7.5 files # of files visual complete (s)
by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks. 0 0.4 0.8 1.2 1 2 3 4 5 6 7 8 9 10 Chrome h2 Chrome h1 FF h2 FF h1 Performance – Small files: CSS Zoomed to 7.5 files # of files visual complete (s)
by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks. Performance – Small files example Network not much different h2 after h2 before
by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks. Performance – Small files example h2 after h2 before Result in browser is big
by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks. Performance – Small files: JS Test Page: 1000 x restyled <div> tags with 1000 JS updates /* Example JS code for each block */ document.getElementById('div1').style.backgroundColor = 'red'; /* HTML */ <div id=“div1"></div> For example 1 file with 1000 updates OR 500 files with 2 updates in each
by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks. Performance – Small files: JS Visual experience of test With h1 rendering is more progress but overall it’s slower - (20 file example) h1 h2
by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks. Performance – Small files: JS JS bytes downloaded 0 150 300 450 0 6 12 18 0 250 500 750 1000 file size (kb) visual complete (s) # of files h1 h2 H2 has smaller files because of header compression File size grows because of less compression (gzip) and more headers *
by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks. Performance – Small files: JS Chrome performance comparison 0 150 300 450 0 6 12 18 0 250 500 750 1000 file size (kb) visual complete (s) # of files h1 h2 Chrome a mixed bag as before
by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks. Performance – Small files: JS Firefox performance comparison 0 150 300 450 0 6 12 18 0 250 500 750 1000 file size (kb) visual complete (s) # of files h1 h2 H2 is only slightly faster even as you increase the number of files Smaller number of files is faster to load
by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks. Performance – Small files: JS Zoomed to 22 files 0 1 2 1 6 11 16 21 visual complete (s) # of files Chrome h2 Chrome h1
by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks. Performance – Small files: JS Zoomed to 22 files 0 1 2 1 6 11 16 21 visual complete (s) # of files Chrome h2 Chrome h1 FF h2 FF h1
by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks. Performance – Small files: JS Visual experience of loading the page 0 3 6 9 0 250 500 750 1000 render start (s) # of files h1 h2 Rendering range in h1 is large
by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks. Performance – Small files: JS Visual experience of loading the page 0 3 6 9 0 250 500 750 1000 render start (s) # of files h1 h2 Rendering range in h1 is large
by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks. Performance – Small files: JS example Network results pretty similar h2 after h2 before
by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks. Performance – Small files: JS example Faster rendering in browser h2 after h2 before
by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks. Performance – Image Sprites Test Page: 1MB of images split into different sizes /* HTML for 1000 files*/ <img onload="imgMark();" src="1kb_Image?1000"> /* HTML for 10 files*/ <img onload="imgMark();" src="100kb_Image?10"> /* HTML for 1 file*/ <img onload="imgMark();" src="1000kb_Image?1">
by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks. 0 400 800 1200 1600 0 25 50 0 250 500 750 1000 Performance – Image Sprites Image bytes downloaded h1 h2 # of files file size (kB) visual complete (s) Improved file size is just down to headers
by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks. 0 400 800 1200 1600 0 25 50 0 250 500 750 1000 Performance – Image Sprites Chrome performance comparison h1 h2 # of files file size (kB) visual complete (s) Chrome a mixed bag as before
by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks. 0 400 800 1200 1600 0 25 50 0 250 500 750 1000 Performance – Image Sprites Firefox performance comparison h1 h2 # of files file size (kB) visual complete (s) H2 is only slightly faster and only above 250 files Anything under 250 is pretty similar
by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks. Performance – Image Sprites Visual experience of loading the page h1 h2 # of files Render start (s) 0 5 10 0 250 500 750 1000 Rendering range in h1 is large
by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks. Performance – Image Sprites Visual experience of loading the page h1 h2 # of files Render start (s) 0 5 10 0 250 500 750 1000 Rendering range in h1 is large
by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks. Performance – Image Sprites Other considerations 1. Code complexity 2. Caching 3. Images used in sprite
by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks. Performance – Image Sprites example
by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks. Performance – Image Sprites example h2 images h2 sprite Load difference much less with sprite
by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks. Performance – Image Sprites example # of images used Load time (ms) #sprite19 {background:url('images/sprite.png') no-repeat -17px 0;} #image19 {background:url('sprite/sprite19.png') no-repeat;} 0 70 140 sprite 1 5 10 20 30 40 code img used
sprites for performance 2. If you are only using a few images files are ok 3. Think about management 4. Think about frequency of change 5. Mobile decoding times can be slow
combining files 2. Check rendering times carefully 3. Keep using sprites (if you use enough images) 4. If you have to shard reuse the same connection 5. Make sure critical content is on the same domain