DevEX - reference for building teams, processes, and platforms
High Performance Web Sites, With Ads: Don't let third parties make you slow
1. HIGH PERFORMANCE
WEB SITES, WITH ADS
– Don't let third parties make you slow
Tobias Järlund
tobias.jarlund@aftonbladet.se
@jarlund
2.
3. Aftonbladet.se
”The primary news source of the Swedish people”
The largest website in Sweden
5.6 million visitors/week, 2.4 million visitors/day
Loooong pages, with a lot of ad positions
5. THE USUAL STUFF
-Make Fewer HTTP Requests -Reduce the Number of DOM Elements
-Use a Content Delivery Network (CDN) -Split Components Across Domains
-Add Expires or Cache-Control Header -Minimize Number of Iframes
-Gzip Components -Avoid 404s
-Put Stylesheets at Top -Reduce Cookie Size
-Put Scripts at Bottom -Use Cookie-Free Domains for Components
-Avoid CSS Expressions -Minimize DOM Access
-Make JavaScript and CSS External -Develop Smart Event Handlers
-Reduce DNS Lookups -Choose <link> Over @import
-Minify JavaScript and CSS -Avoid Filters
-Avoid Redirects -Optimize Images
-Remove Duplicate Scripts -Optimize CSS Sprites
-Configure ETags -Do Not Scale Images in HTML
-Make Ajax Cacheable -Make favicon.ico Small and Cacheable
-Flush Buffer Early -Keep Components Under 25 KB
-Use GET for Ajax Requests -Pack Components Into a Multipart
-Postload Components Document
-Preload Components -Avoid Empty Image src
http://developer.yahoo.com/performance/rules.html
6. THE USUAL STUFF
-Make Fewer HTTP Requests -Reduce the Number of DOM Elements
-Use a Content Delivery Network (CDN) -Split Components Across Domains
-Add Expires or Cache-Control Header -Minimize Number of Iframes
-Gzip Components -Avoid 404s
-Put Stylesheets at Top -Reduce Cookie Size
-Put Scripts at Bottom -Use Cookie-Free Domains for Components
-Avoid CSS Expressions -Minimize DOM Access
-Make JavaScript and CSS External -Develop Smart Event Handlers
-Reduce DNS Lookups -Choose <link> Over @import
-Minify JavaScript and CSS -Avoid Filters
-Avoid Redirects -Optimize Images
-Remove Duplicate Scripts -Optimize CSS Sprites
-Configure ETags -Do Not Scale Images in HTML
-Make Ajax Cacheable -Make favicon.ico Small and Cacheable
-Flush Buffer Early -Keep Components Under 25 KB
-Use GET for Ajax Requests -Pack Components Into a Multipart
-Postload Components Document
-Preload Components -Avoid Empty Image src
http://developer.yahoo.com/performance/rules.html
12. IFRAMES OR JAVASCRIPT
-May load in parallel
-Possible to late-load
-Browser sandbox
-Fixed width/height
-Adds overhead
-No access to the DOM
13. IFRAMES OR JAVASCRIPT
-May load in parallel -Full access to the DOM
-Possible to late-load -Supports all types of ads
-Browser sandbox -Blocks rendering/download
-Fixed width/height -Not possible to late-load
-Adds overhead -Full access to the DOM
-No access to the DOM
14. IFRAMES OR JAVASCRIPT
-May load in parallel -Full access to the DOM
-Possible to late-load -Supports all types of ads
-Browser sandbox -Blocks rendering/download
-Fixed width/height -Not possible to late-load
-Adds overhead -Full access to the DOM
-No access to the DOM
43. IFRAMES OR JAVASCRIPT
-May load in parallel -Full access to the DOM
-Possible to late-load -Supports all types of ads
-Browser sandbox -Blocks rendering/download
-Fixed width/height -Not possible to late-load
-Adds overhead -Full access to the DOM
-No access to the DOM
44. FRIENDLY IFRAME
-May load in parallel
-Possible to late-load
-Browser sandbox
-Full access to the DOM
-Supports all types of ads
45. 1 Create an iframe.
Set the source to a small
static html page from the
same domain.
46. 2 Inside the iframe, set the =
JavaScript variable inDapIF
true to tell the ad it is loaded
inside a friendly iframe.
47. 3 Inside element withcreateadaurl
script
the iframe,
the
as the source.
Load the ad just like a normal
JavaScript ad.
48. 4 When theresize the iframe to fit
loading,
ad has finished
the dimensions of the ad.
49. Video of Aftonbladet.se loaded with
and without Friendly Iframes
http://mittklipp.aftonbladet.se/app/viewMovie.action?id=36013
http://www.webpagetest.org/