A year's worth of observations and experience of H2 performance with some advice to help address some common performance issues.
H2 in the real worldMichael Gooding@Michael_G_81Javier Garza@jjaviergarza
View Slide
©2016 AKAMAI | FASTER FORWARDTM18 Feb2015
©2016 AKAMAI | FASTER FORWARDTMConflict in Ukraine continuedPicture: AFP/Getty Images
©2016 AKAMAI | FASTER FORWARDTMHeavy snow in Istanbul causes airport closurePicture: AFP/Getty Images
©2016 AKAMAI | FASTER FORWARDTMRelatives of missing flight MH370 passengers protestin MalaysiaPicture: AFP/Getty Images
©2016 AKAMAI | FASTER FORWARDTMPeople in Finland celebrated Chinese New YearPicture: EPA
©2016 AKAMAI | FASTER FORWARDTMIn Russia a Car falls into a sink hole!Picture: Europics
©2016 AKAMAI | FASTER FORWARDTM
©2016 AKAMAI | FASTER FORWARDTMMichael Gooding: Performance SpecialistJavier Garza: ???1. H2 Performancei. Renderingii. Small filesiii. Sprites
©2016 AKAMAI | FASTER FORWARDTM1. Performance
300+ customers using H21100+ domains
©2016 AKAMAI | FASTER FORWARDTMAkamai RUM1. Billions beacons collected per day2. Some sites see good improvements3. Some sites don’t!4. 3rd Party content waters down benefit5. Network conditions vary results6. Browsers behave differently
©2016 AKAMAI | FASTER FORWARDTMAvoid data theft and downtime by extending thesecurity perimeter outside the data-center andprotect from increasing frequency, scale andsophistication of web attacks.H1 v H2 Demo
©2016 AKAMAI | FASTER FORWARDTMPerformancei. Renderingii. Small filesiii. Sprites
©2016 AKAMAI | FASTER FORWARDTMAvoid data theft and downtime by extending thesecurity perimeter outside the data-center andprotect from increasing frequency, scale andsophistication of web attacks.Performance - Renderingh1h2h1h24 sec
©2016 AKAMAI | FASTER FORWARDTMWhat’s the problem?Rendering with different prioritisation
©2016 AKAMAI | FASTER FORWARDTMAvoid data theft and downtime by extending thesecurity perimeter outside the data-center andprotect from increasing frequency, scale andsophistication of web attacks.Performance - Rendering: Shardingh1h21 DomainAll on same connection2nd connection opened
©2016 AKAMAI | FASTER FORWARDTMAvoid data theft and downtime by extending thesecurity perimeter outside the data-center andprotect from increasing frequency, scale andsophistication of web attacks.Performance - Rendering: Shardingh1h22 Domainsh21 Certificate2 Certificates
©2016 AKAMAI | FASTER FORWARDTMAvoid data theft and downtime by extending thesecurity perimeter outside the data-center andprotect from increasing frequency, scale andsophistication of web attacks.Performance - Rendering: Shardingh1h23 Domainsh21 Certificate3 Certificates
©2016 AKAMAI | FASTER FORWARDTMAvoid data theft and downtime by extending thesecurity perimeter outside the data-center andprotect from increasing frequency, scale andsophistication of web attacks.Performance – Rendering: Sharding exampleh2afterh2beforeSimple improvement by not making connection
©2016 AKAMAI | FASTER FORWARDTMAvoid data theft and downtime by extending thesecurity perimeter outside the data-center andprotect from increasing frequency, scale andsophistication of web attacks.Performance – Rendering: Sharding exampleh2afterh2before
©2016 AKAMAI | FASTER FORWARDTMAvoid data theft and downtime by extending thesecurity perimeter outside the data-center andprotect from increasing frequency, scale andsophistication of web attacks.Performance – Rendering: Progressive jpegsh2normal jpegprogressiveNormal jpegs just 60% loaded
©2016 AKAMAI | FASTER FORWARDTMAvoid data theft and downtime by extending thesecurity perimeter outside the data-center andprotect from increasing frequency, scale andsophistication of web attacks.Performance – Rendering: Progressive jpeg exampleh2afterh2before
©2016 AKAMAI | FASTER FORWARDTMAvoid data theft and downtime by extending thesecurity perimeter outside the data-center andprotect from increasing frequency, scale andsophistication of web attacks.Performance – Rendering: DIY prioritisation<br/>var img = document.createElement("img");<br/>img.src = "tshirt2.jpg";<br/>document.getElementById("imgholder").appendChild(img);<br/>Different order, but ultimately same outcome
©2016 AKAMAI | FASTER FORWARDTMAvoid data theft and downtime by extending thesecurity perimeter outside the data-center andprotect from increasing frequency, scale andsophistication of web attacks.Performance – Rendering: DIY prioritisation<br/>function addImages() {;<br/>var img = document.createElement("img");<br/>img.src = "tshirt2.jpg";<br/>document.getElementById("imgholder").appendChild(img);<br/>}<br/>Different order and loaded with dependency
©2016 AKAMAI | FASTER FORWARDTMAvoid data theft and downtime by extending thesecurity perimeter outside the data-center andprotect from increasing frequency, scale andsophistication of web attacks.Performance – Rendering: INITCWND10321064
©2016 AKAMAI | FASTER FORWARDTMAvoid data theft and downtime by extending thesecurity perimeter outside the data-center andprotect from increasing frequency, scale andsophistication of web attacks.Performance – Rendering exampleLarge image fills bandwidth
©2016 AKAMAI | FASTER FORWARDTMAvoid data theft and downtime by extending thesecurity perimeter outside the data-center andprotect from increasing frequency, scale andsophistication of web attacks.Performance – Rendering exampleprogjpgh2beforejspriority
©2016 AKAMAI | FASTER FORWARDTMAvoid data theft and downtime by extending thesecurity perimeter outside the data-center andprotect from increasing frequency, scale andsophistication of web attacks.Performance – Rendering example2 sec1 sec???progjpg
©2016 AKAMAI | FASTER FORWARDTMAvoid data theft and downtime by extending thesecurity perimeter outside the data-center andprotect from increasing frequency, scale andsophistication of web attacks.Server Push Demo
©2016 AKAMAI | FASTER FORWARDTMAvoid data theft and downtime by extending thesecurity perimeter outside the data-center andprotect from increasing frequency, scale andsophistication of web attacks.Performance – Rendering example2 sec1 sech2pushprogjpg
©2016 AKAMAI | FASTER FORWARDTMAvoid data theft and downtime by extending thesecurity perimeter outside the data-center andprotect from increasing frequency, scale andsophistication of web attacks.Performance – Rendering example Server Pushh2pushprogjpg
©2016 AKAMAI | FASTER FORWARDTMAvoid data theft and downtime by extending thesecurity perimeter outside the data-center andprotect from increasing frequency, scale andsophistication of web attacks.Performance – Rendering: Server push bad exampleh2pushh2before
©2016 AKAMAI | FASTER FORWARDTMRendering Summary1. Keep critical content on same domain2. If you need to shard to balance h1 use the same cert3. Progressive jpgs can help rendering4. Use JavaScript if you need to delay resources5. Don’t worry too much about congestion windows6. Use server push where you can
©2016 AKAMAI | FASTER FORWARDTMAvoid data theft and downtime by extending thesecurity perimeter outside the data-center andprotect from increasing frequency, scale andsophistication of web attacks.Performance – Small files: CSSTest Page: 1000 x coloured tags with 1000 CSS rules/* 1 CSS rule for each */#div1 {width:20px;height:20px;background-color:#000000;float:left;margin:1px;} …/* HTML */…For example 1 file with 1000 rules OR 500 files with 2 rules in each
©2016 AKAMAI | FASTER FORWARDTMAvoid data theft and downtime by extending thesecurity perimeter outside the data-center andprotect from increasing frequency, scale andsophistication of web attacks.Performance – Small files: CSSVisual experience of testH2 is faster to download, rendering is not progressive - (10 file example)h1h2
©2016 AKAMAI | FASTER FORWARDTMAvoid data theft and downtime by extending thesecurity perimeter outside the data-center andprotect from increasing frequency, scale andsophistication of web attacks.Performance – Small files: CSSCSS bytes downloaded02505000612180 250 500 750 1000H2 is smaller because of header compressionFile size grows because of less compression (gzip) and more headers *# of filesfile size (kB)visual complete (s)h1 h2
©2016 AKAMAI | FASTER FORWARDTMAvoid data theft and downtime by extending thesecurity perimeter outside the data-center andprotect from increasing frequency, scale andsophistication of web attacks.Performance – Small files: CSS02505000612180 250 500 750 1000h1 h2# of filesfile size (kB)visual complete (s)Chrome performance comparisonH2 is slower when you exceed 20 files!
©2016 AKAMAI | FASTER FORWARDTMAvoid data theft and downtime by extending thesecurity perimeter outside the data-center andprotect from increasing frequency, scale andsophistication of web attacks.Performance – Small files: CSSFirefox performance comparison02505000612180 250 500 750 1000# of filesfile size (kB)visual complete (s)h1 h2H2 is faster, especially as you increase the number of filesSmaller number of files is faster to load
©2016 AKAMAI | FASTER FORWARDTMAvoid data theft and downtime by extending thesecurity perimeter outside the data-center andprotect from increasing frequency, scale andsophistication of web attacks.00.40.81.21 2 3 4 5 6 7 8 9 10Chrome h2Chrome h1Performance – Small files: CSSZoomed to 7.5 files# of filesvisual complete (s)
©2016 AKAMAI | FASTER FORWARDTMAvoid data theft and downtime by extending thesecurity perimeter outside the data-center andprotect from increasing frequency, scale andsophistication of web attacks.00.40.81.21 2 3 4 5 6 7 8 9 10Chrome h2Chrome h1FF h2FF h1Performance – Small files: CSSZoomed to 7.5 files# of filesvisual complete (s)
©2016 AKAMAI | FASTER FORWARDTMAvoid data theft and downtime by extending thesecurity perimeter outside the data-center andprotect from increasing frequency, scale andsophistication of web attacks.Performance – Small files exampleNetwork not much differenth2afterh2before
©2016 AKAMAI | FASTER FORWARDTMAvoid data theft and downtime by extending thesecurity perimeter outside the data-center andprotect from increasing frequency, scale andsophistication of web attacks.Performance – Small files exampleh2afterh2beforeResult in browser is big
©2016 AKAMAI | FASTER FORWARDTMAvoid data theft and downtime by extending thesecurity perimeter outside the data-center andprotect from increasing frequency, scale andsophistication of web attacks.Performance – Small files: JSTest Page: 1000 x restyled tags with 1000 JS updates/* Example JS code for each block */document.getElementById('div1').style.backgroundColor = 'red';/* HTML */For example 1 file with 1000 updates OR 500 files with 2 updates in each
©2016 AKAMAI | FASTER FORWARDTMAvoid data theft and downtime by extending thesecurity perimeter outside the data-center andprotect from increasing frequency, scale andsophistication of web attacks.Performance – Small files: JSVisual experience of testWith h1 rendering is more progress but overall it’s slower - (20 file example)h1h2
©2016 AKAMAI | FASTER FORWARDTMAvoid data theft and downtime by extending thesecurity perimeter outside the data-center andprotect from increasing frequency, scale andsophistication of web attacks.Performance – Small files: JSJS bytes downloaded01503004500612180 250 500 750 1000file size (kb)visual complete (s)# of filesh1 h2H2 has smaller files because of header compressionFile size grows because of less compression (gzip) and more headers *
©2016 AKAMAI | FASTER FORWARDTMAvoid data theft and downtime by extending thesecurity perimeter outside the data-center andprotect from increasing frequency, scale andsophistication of web attacks.Performance – Small files: JSChrome performance comparison01503004500612180 250 500 750 1000file size (kb)visual complete (s)# of filesh1 h2Chrome a mixed bag as before
©2016 AKAMAI | FASTER FORWARDTMAvoid data theft and downtime by extending thesecurity perimeter outside the data-center andprotect from increasing frequency, scale andsophistication of web attacks.Performance – Small files: JSFirefox performance comparison01503004500612180 250 500 750 1000file size (kb)visual complete (s)# of filesh1 h2H2 is only slightly faster even as you increase the number of filesSmaller number of files is faster to load
©2016 AKAMAI | FASTER FORWARDTMAvoid data theft and downtime by extending thesecurity perimeter outside the data-center andprotect from increasing frequency, scale andsophistication of web attacks.Performance – Small files: JSZoomed to 22 files0121 6 11 16 21visual complete (s)# of filesChrome h2Chrome h1
©2016 AKAMAI | FASTER FORWARDTMAvoid data theft and downtime by extending thesecurity perimeter outside the data-center andprotect from increasing frequency, scale andsophistication of web attacks.Performance – Small files: JSZoomed to 22 files0121 6 11 16 21visual complete (s)# of filesChrome h2Chrome h1FF h2FF h1
©2016 AKAMAI | FASTER FORWARDTMAvoid data theft and downtime by extending thesecurity perimeter outside the data-center andprotect from increasing frequency, scale andsophistication of web attacks.Performance – Small files: JSVisual experience of loading the page03690 250 500 750 1000render start (s)# of filesh1 h2Rendering range in h1 is large
©2016 AKAMAI | FASTER FORWARDTMAvoid data theft and downtime by extending thesecurity perimeter outside the data-center andprotect from increasing frequency, scale andsophistication of web attacks.Performance – Small files: JS exampleNetwork results pretty similarh2afterh2before
©2016 AKAMAI | FASTER FORWARDTMAvoid data theft and downtime by extending thesecurity perimeter outside the data-center andprotect from increasing frequency, scale andsophistication of web attacks.Performance – Small files: JS exampleFaster rendering in browserh2afterh2before
©2016 AKAMAI | FASTER FORWARDTMSmall files Summary1. Keep combining files, same as h12. 2 or 3 is ok, based on frequency of change
©2016 AKAMAI | FASTER FORWARDTMPerformancei. Renderingii. Small filesiii. Image Sprites
©2016 AKAMAI | FASTER FORWARDTMAvoid data theft and downtime by extending thesecurity perimeter outside the data-center andprotect from increasing frequency, scale andsophistication of web attacks.Performance – Image SpritesTest Page: 1MB of images split into different sizes/* HTML for 1000 files*//* HTML for 10 files*//* HTML for 1 file*/
©2016 AKAMAI | FASTER FORWARDTMAvoid data theft and downtime by extending thesecurity perimeter outside the data-center andprotect from increasing frequency, scale andsophistication of web attacks.040080012001600025500 250 500 750 1000Performance – Image SpritesImage bytes downloaded h1 h2# of filesfile size (kB)visual complete (s)Improved file size is just down to headers
©2016 AKAMAI | FASTER FORWARDTMAvoid data theft and downtime by extending thesecurity perimeter outside the data-center andprotect from increasing frequency, scale andsophistication of web attacks.040080012001600025500 250 500 750 1000Performance – Image SpritesChrome performance comparison h1 h2# of filesfile size (kB)visual complete (s)Chrome a mixed bag as before
©2016 AKAMAI | FASTER FORWARDTMAvoid data theft and downtime by extending thesecurity perimeter outside the data-center andprotect from increasing frequency, scale andsophistication of web attacks.040080012001600025500 250 500 750 1000Performance – Image SpritesFirefox performance comparison h1 h2# of filesfile size (kB)visual complete (s)H2 is only slightly faster and only above 250 filesAnything under 250 is pretty similar
©2016 AKAMAI | FASTER FORWARDTMAvoid data theft and downtime by extending thesecurity perimeter outside the data-center andprotect from increasing frequency, scale andsophistication of web attacks.Performance – Image SpritesVisual experience of loading the page h1 h2# of filesRender start (s)05100 250 500 750 1000Rendering range in h1 is large
©2016 AKAMAI | FASTER FORWARDTMAvoid data theft and downtime by extending thesecurity perimeter outside the data-center andprotect from increasing frequency, scale andsophistication of web attacks.Performance – Image SpritesOther considerations1. Code complexity2. Caching3. Images used in sprite
©2016 AKAMAI | FASTER FORWARDTMAvoid data theft and downtime by extending thesecurity perimeter outside the data-center andprotect from increasing frequency, scale andsophistication of web attacks.Performance – Image Sprites example
©2016 AKAMAI | FASTER FORWARDTMAvoid data theft and downtime by extending thesecurity perimeter outside the data-center andprotect from increasing frequency, scale andsophistication of web attacks.Performance – Image Sprites exampleh2imagesh2spriteLoad difference much less with sprite
©2016 AKAMAI | FASTER FORWARDTMAvoid data theft and downtime by extending thesecurity perimeter outside the data-center andprotect from increasing frequency, scale andsophistication of web attacks.Performance – Image Sprites example# of images usedLoad time (ms)#sprite19 {background:url('images/sprite.png') no-repeat -17px 0;}#image19 {background:url('sprite/sprite19.png') no-repeat;}070140sprite 1 5 10 20 30 40codeimgused
©2016 AKAMAI | FASTER FORWARDTMSprite Summary1. Keep using sprites for performance2. If you are only using a few images files are ok3. Think about management4. Think about frequency of change5. Mobile decoding times can be slow
©2016 AKAMAI | FASTER FORWARDTMSummary:Anti-patterns aren’t anti-patterns1. Keep combining files2. Check rendering times carefully3. Keep using sprites (if you use enough images)4. If you have to shard reuse the same connection5. Make sure critical content is on the same domain
Questions?Michael Gooding@Michael_G_81uk.linkedin.com/in/mgooding1981Javier Garza@jjaviergarzawww.linkedin.com/in/jjgarza