Third Party Performance (Velocity, 2014)
Upcoming SlideShare
Loading in...5

Third Party Performance (Velocity, 2014)



Third party components are a part of any modern site: JS libs, analytics, trackers, share buttons, ads. Many components, each adding its performance cost, cause render delays or can effectively take ...

Third party components are a part of any modern site: JS libs, analytics, trackers, share buttons, ads. Many components, each adding its performance cost, cause render delays or can effectively take your site down. This isn’t your code nor your servers, so what can you do about it?

This presentation will answer this question with strategies and tactics for keeping 3rd parties from taking you down.

This talk was given at Velocity Santa Clara, 2014: The presentation from Velocity Santa Clara, 2014 (



Total Views
Views on SlideShare
Embed Views



2 Embeds 156 155 1


Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
Post Comment
Edit your comment
  • <br />

Third Party Performance (Velocity, 2014) Third Party Performance (Velocity, 2014) Presentation Transcript

  • ©2014 AkamaiFaster ForwardTM THIRD PARTY PERFORMANCE Guy Podjarny (@guypod) CTO, Web Experience, Akamai
  • ©2014 AkamaiFaster ForwardTM What’s a third party? - Infrastructure & code managed by someone else - What’s not a 3rd party: - Reused Software (e.g. jQuery, Apache) – premium or free - Commercial Hardware (e.g. ADC, WAF) - IaaS Cloud Provider (e.g. EC2) - CDN (e.g. Akamai) Not a 1st Party?
  • ©2014 AkamaiFaster ForwardTM (Web) Third Party Types Tracker Beacons Ex: ad networks image beacons Analytics Ex: Google Analytics, Comscore Non-Critical Page Components Ex: Social sharing buttons Critical Page Components Ex: Privacy prompts, p13n, ads(?) Inline Cloud Proxies Ex: Mobile Transcoders, MotionPoint, SiteSpect
  • ©2014 AkamaiFaster ForwardTM # Domains Per Page May 2014 Percentiles: - 25th : 5 domains - 50th : 11 domains - 75th : 21 domains - 90th : 35 domains
  • ©2014 AkamaiFaster ForwardTM Ghostery Data - Media
  • ©2014 AkamaiFaster ForwardTM Ghostery Data - Retail
  • ©2014 AkamaiFaster ForwardTM 3rd Party Extravaganza!
  • ©2014 AkamaiFaster ForwardTM 3rd Parties Have Outages Too
  • ©2014 AkamaiFaster ForwardTM Solution: Remove 3rd Party Tag
  • ©2014 AkamaiFaster ForwardTM No Silver Bullet… We need to do this the hard way: - Understand each 3rd Party type - Understand their problems - Choose a solution - Understand the gotcha’s
  • ©2014 AkamaiFaster ForwardTM CRITICAL PAGE COMPONENTS
  • ©2014 AkamaiFaster ForwardTM Example: UK Weather Privacy Policy
  • ©2014 AkamaiFaster ForwardTM SPOF – Single Point Of Failure Home Page, Truste Down 22 SecsBusiness Week, Truste Down 22 Secs
  • ©2014 AkamaiFaster ForwardTM SPOF-O-Matic, by Pat Meenan
  • ©2014 AkamaiFaster ForwardTM Recommendation Critical 3rd Party Components Strategy: Async - Reduces risk/delays to visual & functional content
  • ©2014 AkamaiFaster ForwardTM Catch: document.write() • Script-generated content fed directly into parser • Processed like static HTML • Popular with Ads • Doesn’t work with “Async” • Parser has already moved on • May WIPE your page! • When used in async script
  • ©2014 AkamaiFaster ForwardTM Enhancement: Nullify document.write() - Built into browsers (at least IE 9+, Safari, Chrome & Firefox) - Firefox even gives a nice console error…
  • ©2014 AkamaiFaster ForwardTM TRACKERS & ANALYTICS
  • ©2014 AkamaiFaster ForwardTM Example: Quantcast Image Beacon <!-- Quantcast Tag --> <div style="display:none;"> <img src="//" border="0" height="1" width="1" alt="Quantcast"/> </div> <!-- End Quantcast tag --> Simple 1px Image Beacon: - 35 bytes – minimal bandwidth impact - Doesn’t block other resource downloads - Doesn’t block rendering
  • ©2014 AkamaiFaster ForwardTM Image Beacon Resource Contention
  • ©2014 AkamaiFaster ForwardTM Onload SPOF (Single Point Of Failure) Quantcast Down Quantcast Up
  • ©2014 AkamaiFaster ForwardTM Q: Do Script-Inserted Beacon Images Delay Onload?
  • ©2014 AkamaiFaster ForwardTM Yes – Beacons delay onload (on most browsers) Beacons didn’t block onload on: - IE 7 - IE 8
  • ©2014 AkamaiFaster ForwardTM Example: Quantcast Full HTML Snippet Async Event Logging Async Event Logging Async Script Image Beacon Fallback
  • ©2014 AkamaiFaster ForwardTM Analytics Example: Google Analytics Async Event Logging Async Event Logging Async Script
  • ©2014 AkamaiFaster ForwardTM Onload SPOF (Single Point Of Failure) GA Up GA Down Onload-triggered visual changes
  • ©2014 AkamaiFaster ForwardTM Why Async? Why Not Defer? If you Defer, some Users may not make it…
  • ©2014 AkamaiFaster ForwardTM Recommendation Trackers & Analytics Strategy: Async without delaying onload - Invisible beacons shouldn’t delay visible content - Deferring beacons likely to miss users
  • ©2014 AkamaiFaster ForwardTM Beacons that don’t delay onload
  • ©2014 AkamaiFaster ForwardTM Beacons that don’t delay onload
  • ©2014 AkamaiFaster ForwardTM Works for Images Too!
  • ©2014 AkamaiFaster ForwardTM Catch: No Access to Parent Page <html><head> <title>Purchase Complete</title> </head><body> <script> var iframeDoc = createIFrame(); '<body onload="'+ 'var js = document.createElement('script');'+ 'js.src = '//';'+ 'document.body.appendChild(js);">'); iframeDoc.close(); </script> </body></html> (new Image()).src = "//" + document.title; Tracker.js urchase%20Complete
  • ©2014 AkamaiFaster ForwardTM Beacon API – Draft W3C Web Perf Spec
  • ©2014 AkamaiFaster ForwardTM Resource Priorities – Draft W3C Web Perf Spec - Marks low priority resources - A hint to the browser that this resource is less urgent - Doesn’t delay onload - Supports <link> tags - Lazyload-ed CSS do not block rendering - Works for even more tags - img, audio, video, script, link, embed, iframe, object, svg feImage, svg image, svg use, svg script, and svg tref.
  • ©2014 AkamaiFaster ForwardTM NON CRITICAL PAGE COMPONENTS
  • ©2014 AkamaiFaster ForwardTM Sync Example: AddThis Sync Script…
  • ©2014 AkamaiFaster ForwardTM Async Example: Share & Follow Buttons AsyncAsync Marker Marker
  • ©2014 AkamaiFaster ForwardTM Better – But Not Quite There… - Onload SPOF Risk - Resource Contention - Bad user communication - Page not considered “complete” until widget is loaded
  • ©2014 AkamaiFaster ForwardTM Recommendation Non Critical Page Components Strategy: Defer Download to onload - They shouldn’t delay/risk real content - Don’t wait for them before telling users the page is complete
  • ©2014 AkamaiFaster ForwardTM Defer Download Example <div id="fb-root"></div> <script> window.deferred_fb = function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); = id; js.src = "// sdk.js#xfbml=1&version=v2.0"; fjs.parentNode.insertBefore(js, fjs); }; window.addEventListener("load", function() { window.deferred_fb(document, 'script', 'facebook-jssdk')} ); </script> <div class="fb-share-button" data-href= "" data-type="button_count"></div> Generic
  • ©2014 AkamaiFaster ForwardTM Cringe… External Script Dependent Inline Script Further Dependent External Script Further down dependent inline script
  • ©2014 AkamaiFaster ForwardTM Run “inline” script at script’s onload Slight Snag… But you catch my drift… Don’t forget this one! (combine all dependents to avoid race condition bugs)
  • ©2014 AkamaiFaster ForwardTM Async scripts with Execution Order
  • ©2014 AkamaiFaster ForwardTM Protip: Merge 3rd party SDKs with 1st Party Content Facebook SDK ( Cache-Control: public, max-age=1200 Google Analytics ( Cache-Control: public, max-age=43200 Twitter SDK ( Cache-Control: public, max-age=1800 Public Cache = Not Personalized ~= Can Serve From Your Domain But you need to constantly track changes…
  • ©2014 AkamaiFaster ForwardTM THIRD PARTY RESPONSIBILITY
  • ©2014 AkamaiFaster ForwardTM - Work in Progress… @triblondon @bbinto Kyle Kinnaman @bentlegen @igrigorik @guypod
  • ©2014 AkamaiFaster ForwardTM (by Zoompf)
  • ©2014 AkamaiFaster ForwardTM Resource Timing Opt-In Ask Require All your 3rd Party Vendors to add this header! • Unless they give you a REALLY good privacy reason not to. Resource Timing Lets you track 3rd party performance! • At least send/receive timing…
  • ©2014 AkamaiFaster ForwardTM SUMMARY
  • ©2014 AkamaiFaster ForwardTM Tag Managers • “Master” Tag loads other 3rd Parties • “Child” tags often loaded async/deferred • Intended to easily add/remove/manage tags • Track beacon data once, send via APIs • Keep in mind: • An indirection before 3rd party is loaded • Makes it easy to add too many tags • It’s a tool – the strategy & decisions are still yours
  • ©2014 AkamaiFaster ForwardTM Summary - 3rd Party tags impact performance - SPOF, Onload SPOF, Resource Contention, Battery Consumption… - Pick your strategies: - Critical Widgets – Async with delaying onload - Analytics/Trackers – Async without delaying onload - Non-Critical Widgets – Defer Download (and Execution) - Consider Removing the Tag! - Track the Beacon & Resource Priorities Specs - Challenge your 3rd party vendors on their perf & availability
  • ©2014 AkamaiFaster ForwardTM Grow revenue opportunities with fast, personalized web experiences and manage complexity from peak demand, mobile devices and data collection. Visit Akamai at booth #608 Get a FREE copy of the new O’Reilly book Book signing by author Guy Podjarny: Wednesday & Thursday 3:00pm to 4:00pm
  • ©2014 AkamaiFaster ForwardTM THIRD PARTY PERFORMANCE Guy Podjarny (@guypod) CTO, Web Experience, Akamai Questions?