the canadian public broadcaster on a diet: slimming down for a whole nation

162
The Canadian Public Broadcaster on a Diet Slimming down for a whole nation Barbara Bermes and Blake Crosby

Upload: blakecrosby

Post on 21-Jun-2015

3.085 views

Category:

Technology


2 download

TRANSCRIPT

Page 1: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

The Canadian Public Broadcaster on a Diet

Slimming down for a whole nationBarbara Bermes and Blake Crosby

Page 2: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

The Canadian Public Broadcaster on a DietSlimming down for a whole nation

Velocity 2013

Page 3: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Barbara // bbintoSenior Architect, Mobile Web

Digital Operations, CBC

Blake // blakecrosbyTeam Lead, Media Production SupportMO&T, CBC

Page 4: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Today’s workout

Page 5: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Before we get started

#velocityconf

Page 6: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Canada? Who? What?

#velocityconf

Page 7: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Page 8: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Page 9: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Canadian Broadcasting Corporation

Page 10: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Canadian Broadcasting Corporation

National public radio and television broadcaster

Page 11: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Canadian Broadcasting Corporation

National public radio and television broadcaster

Kind of like the NPR

Page 12: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Canadian Broadcasting Corporation

National public radio and television broadcaster

Kind of like the NPR but not really - the CBC employs commercial advertising to supplement its federal funding

Page 13: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Canadian Broadcasting Corporation

National public radio and television broadcaster

Kind of like the NPR but not really - the CBC employs commercial advertising to supplement its federal funding

Large internal and external digital ecosystem

Page 14: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Canadian Broadcasting Corporation

National public radio and television broadcaster

Kind of like the NPR but not really - the CBC employs commercial advertising to supplement its federal funding

Large internal and external digital ecosystem

3 mobile websites

Page 15: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Canadian Broadcasting Corporation

National public radio and television broadcaster

Kind of like the NPR but not really - the CBC employs commercial advertising to supplement its federal funding

Large internal and external digital ecosystem

3 mobile websites11 iOS, 3 Android, 5 Blackberry, 3 Windows apps

Page 16: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Canadian Broadcasting Corporation

National public radio and television broadcaster

Kind of like the NPR but not really - the CBC employs commercial advertising to supplement its federal funding

Desktop site page views ~5Mio/day

Large internal and external digital ecosystem

3 mobile websites11 iOS, 3 Android, 5 Blackberry, 3 Windows apps

Page 17: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Canadian Broadcasting Corporation

National public radio and television broadcaster

Kind of like the NPR but not really - the CBC employs commercial advertising to supplement its federal funding

Desktop site page views ~5Mio/day

Mobile Touch site page views ~ 500K/day

Large internal and external digital ecosystem

3 mobile websites11 iOS, 3 Android, 5 Blackberry, 3 Windows apps

Page 18: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Canadian Broadcasting Corporation

National public radio and television broadcaster

Kind of like the NPR but not really - the CBC employs commercial advertising to supplement its federal funding

Desktop site page views ~5Mio/day

Mobile Touch site page views ~ 500K/day

News app page views ~1Mio/day

Large internal and external digital ecosystem

3 mobile websites11 iOS, 3 Android, 5 Blackberry, 3 Windows apps

Page 19: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Mandate: The 1991 Broadcasting Acts states that...

...the programming provided by the Corporation should:vi. be made available throughout Canada by the most appropriate and efficient means and as resources become available for the purpose, andvii. reflect the multicultural and multiracial nature of Canada.”

Page 20: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

PerformanceWhy the need for speed?

Page 21: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf#velocityconf

Page 22: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

“Ultimately performance is about respect”

Brad Frost

Page 23: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Mobile & performanceWhy is performance for mobile so crucial?

Page 24: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

It’s a Mobile (Browser) World

0

500

1000

1500

2000

2007 2008 2009 2010 2011 2012 2013 2014 2015

Desktop Internet UsersMobile Internet Users

Source: Morgan Stanley

Num

ber

of g

loba

l use

rs in

milli

ons

Page 25: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Performance on Mobile

Page 26: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Performance on Mobile

Battery-driven

Page 27: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Performance on Mobile

Battery-driven Small CPU/GPU

Page 28: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Performance on Mobile

Battery-driven Small CPU/GPU

Network connectivity and latency

Page 29: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Performance on Mobile

Battery-driven Small CPU/GPU

Network connectivity and latency Data usage

Page 30: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

You’re dealing with impatient users

“74% of mobile web users expect a page

to load in 5 seconds or less”

Gomez

Page 31: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

“Start with Metrics”Creating A Performance Culture

Steve Souders

Page 32: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Anatomy of a CBC page: Tell a story

Page 33: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Anatomy of a CBC page: Tell a story

Page 34: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Anatomy of a CBC page: Tell a story

Page 35: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Anatomy of a CBC page: Tell a story

Page 36: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Anatomy of a CBC page: Tell a story

Page 37: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Quick weight assessment for desktop and mobile

Page 38: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

A typical CBC story

Page 39: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Put them on the scale!

Page 40: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

www.cbc.cab.scorecardresearch.commetrics.cbc.cagscounters.us1.gigya.comcdn.gigya.compagead2.googlesyndication.com

3%3%3%

6%

8%

78%

Domain breakdown: HTTP requests

Page 41: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

www.cbc.cab.scorecardresearch.commetrics.cbc.cagscounters.us1.gigya.comcdn.gigya.compagead2.googlesyndication.com

4%

11%0%1%1%

83%

Domain breakdown: Bytes

Page 42: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Page 43: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Fully loaded

247kBHTTP requests

36

Page 44: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

www.cbc.capagead2.googlesyndication.comcdn.gigya.comthumbnails.cbc.caplusone.google.comsitelife.cbc.cagoogleads.g.doubleclick.netgscounters.us1.gigya.comb.scorecardresearch.comib.adnxs.comcdn.clicktale.netad.doubleclick.netcm.g.doubleclick.netmetrics.cbc.cacm.eyedemand.comapis.google.comfeed.theplatform.comvoken.eyereturn.comd.adgear.comcdn.adgear.comfast.fonts.comssl.gstatic.comwww.gstatic.comwww.google.coma.visualrevenue.comt.visualrevenue.comgraph.facebook.comresources.eyereturn.comeyereact.eyereturn.comadxhm.d.chango.comcdn.api.twitter.coms.clicktale.net

1%1%1%1%1%1%1%1%1%1%1%1%1%

1%1%

1%1%

1%1%

2%

2%

2%

2%

2%

2%

2%

4%

4%

4%

5%5%

48%

Domain breakdown: HTTP requests

Page 45: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

www.cbc.capagead2.googlesyndication.comcdn.gigya.comthumbnails.cbc.caplusone.google.comsitelife.cbc.cagoogleads.g.doubleclick.netgscounters.us1.gigya.comb.scorecardresearch.comib.adnxs.comcdn.clicktale.netad.doubleclick.netcm.g.doubleclick.netmetrics.cbc.cacm.eyedemand.comapis.google.comfeed.theplatform.comvoken.eyereturn.comd.adgear.comcdn.adgear.comfast.fonts.comssl.gstatic.comwww.gstatic.comwww.google.coma.visualrevenue.comt.visualrevenue.comgraph.facebook.comresources.eyereturn.comeyereact.eyereturn.comadxhm.d.chango.comcdn.api.twitter.coms.clicktale.net

0%0%0%0%1%0%0%0%0%0%1%0%4%1%1%0%

2%0%0%0%0%1%0%0%0%1%

2%

9%

28% 4%5%

36%

Domain breakdown: Bytes

Page 46: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Page 47: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Fully loaded

1,539kBHTTP requests

164

Page 48: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Result of assessment: Too heavy? Unhealthy, compared to what?

Page 49: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Steve Souders and httparchive.org to the rescueRepository of web performance information and to track web trends

Page 50: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Content breakdown

Page Size (kB)

0 200 400 600 800

765

247

CBC HTTP Archive Mobile

HTTP Requests

0 18 35 53 70

60

36

Data from June 2013

Page 51: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Content breakdown

Page Size (kB)

0 800 1600

1462

1539

CBC HTTP Archive

HTTP Requests

0 45 90 135 180

92

164

Data from June 2013

Page 52: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

What are our options for successful weight measuring?

Page 53: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Synthetic Testing Real User Monitoring

You run the test User runs the test

Measures experience of exact one selected configuration

Measures experience of “actual user”(peace of mind). You get to know your user better

Establish baseline performance levelGet concrete information about user’s latency,

bandwidth, page load time

Toolsprivate/public WebPagetest (API), PageSpeed (API),

phantomJS, commercial products etc.

Toolsboomerang.js, Google Analytics, commercial

products etc.

Page 54: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Collecting measurements - Synthetic

Page 55: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Create your own performance dashboard

Page 56: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Setup your own HTTP Archive to track and monitor trends

Page 57: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

• MySQL and PHP

• WebPagetest API key (or private instance)

• Check out latest source code and DB schema (even dump)

• Run batches e.g. daily via cronjob

Setup HTTP Archive

Page 58: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

• ~ 44 CBC URLs (cbc.ca/news, cbc.ca/sports, cbc.ca/video, regular story page etc.)

• Crawl and compute daily

• Measure and monitor trends

• Compare directly to Top Alexa HTTP archive

• Run queries against database to find bottlenecks

• Extend provided graphs

Start collecting

Page 59: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Query the database directly

Page 60: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

40% of selected URLs use Google hosted jQuery version

select count(distinct(pageid)) as count, (100* count(distinct(pageid))/[NumberOfUniqueRequests]) as percent from requests where url like "%ajax.googleapis.com/ajax/libs/jquery/%" and mimeType like "%script%"

Hosted frameworks

Page 61: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

48% of selected URLs use Facebook plugins directly instead of Gigya

select count(distinct(pageid)) as count, (100* count(distinct(pageid))/[NumberOfUniqueRequests]) as percent from requests where (url like "%://connect.facebook.net%" or url like "%://static.ak.fbcdn.net%")and mimeType like "%script%"

3rd party scripts

Page 62: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Visualize data with local HTTP Archive instance

Page 63: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Out-of-the box setup

Page 64: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Page 65: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Custom pie charts

Page 66: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Collecting measurements - Real user monitoring (RUM)

Page 67: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

boomerang.js: JavaScript library for RUMMeasures the page load time, latency, bandwidth (and more) experienced by real users

Page 68: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

t_done Perceived load time of the page

bw User's measured bandwidth in bytes/s

lat User's measured HTTP latency in ms

Collecting RUM

Page 69: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

+

Page 70: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

+

Captain RUM

Page 71: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

• Add script to touch news landing page sends beacon.gif with params (e.g. t_done, bw, lat, UA etc.)

• Define sampling rate

• Parse Apache log files for beacon.gif, extract params and import into database

• Very noisy data, need to be normalized

+

Captain RUM

Page 72: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Captain RUM results

Page 73: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Latency in ms for CBC touch news landing page

0

10

20

30

40

200 300 400 500 600 700 800 900 1000 2000

1%1%1%1%2%4%

7%

18%

37%

27%

Data points: 1913

Page 74: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

RUM page load time (PLT) in ms for CBC touch news landing page

0

7.5

15

22.5

30

500 700 1000 2000 3000 5000 7000 10000 15000 50000

2%2%4%

5%

13%

21%

26%

13%

10%

3%

Data points: 4864

Page 75: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Bandwidth distribution for CBC touch news landing page

1%7%

41%

24%

21%

6%<64Kbps64-256Kbps256-512Kbps512Kbps-1.6Mbps1.6-3Mbps3-8Mbps

Data points: 8994

Page 76: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

With RUM data “[...] your real users are experiencing page load times that are twice as long as their corresponding synthetic measurements.”

Steve Souders

Page 77: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Comparing synthetic test results with RUM

Page 78: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Tools

Target

Network Profile

Data points

CBC news touch landing page CBC news touch landing page

1) Public WebPagetest No Mobitest (DSL/Wifi)

2) PhantomJS with Slowy for shaping connection

Captain Rum (boomerang.js, parsed beaon.gif params into DB)

1) 1002) 100

After de-noising data: 4864

1) 3G simulation (“apples with apples”)2) Slowy app with 3G simulation

Real user, baby!

Median and 95th percentile of page load time (PLT)

Median and 95th percentile of page load time (PLT)

Synthetic Testing Real User Monitoring

Measurements

Page 79: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Page load time for touch news landing page (RUM and synthetic)

RUM (t_done)

PhantomJS (3G)

WebPagetest (3G)

0 2750 5500 8250 11000

5005 ms

3726.5 ms

1926.5 ms

6094 ms

5246 ms

10088 ms95th percentile

Median

RU

MS

ynth

etic

Page 80: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

• Synthetic

• Lots of variances possible

• Challenges to properly simulate for mobile

• RUM

• Users benefit from cache

• Android wrapper app faster than Android browser

Some observations

Page 81: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Avoid dangerous temptations

Page 82: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

That’s a lot of cookies

Yikes! Oh No!

Temptations

Page 83: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Tipping the scale

Temptations

Page 84: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Cookies on a diet

Page 85: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

• Use the path option to limit cookie scope

Cookies on a diet

Page 86: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

• Use the path option to limit cookie scope

• Store your static assets at a different domain (images.cbc.ca)

Cookies on a diet

Page 87: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

• Use the path option to limit cookie scope

• Store your static assets at a different domain (images.cbc.ca)

• Don’t use cookies for fun

Cookies on a diet

Page 88: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

• Use the path option to limit cookie scope

• Store your static assets at a different domain (images.cbc.ca)

• Don’t use cookies for fun

• Ask: Do you really need them?

Cookies on a diet

Page 89: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Other temptations (front-end)

Page 90: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

3rd party monsters

Page 91: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Monsters?

Page 92: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

• Ads, tracking, social buttons etc.

Monsters?

Page 93: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

• Ads, tracking, social buttons etc.

• They are unpredictable, scary, disruptive, sneaky and

Monsters?

Page 94: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

• Ads, tracking, social buttons etc.

• They are unpredictable, scary, disruptive, sneaky and

• Could slow down your site

Monsters?

Page 95: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

• Ads, tracking, social buttons etc.

• They are unpredictable, scary, disruptive, sneaky and

• Could slow down your site

• Could bring down your site (SPOF - single point of failure)

Monsters?

Page 96: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

• Ads, tracking, social buttons etc.

• They are unpredictable, scary, disruptive, sneaky and

• Could slow down your site

• Could bring down your site (SPOF - single point of failure)

• Could do things you don’t want them to do

Monsters?

Page 97: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

• Ads, tracking, social buttons etc.

• They are unpredictable, scary, disruptive, sneaky and

• Could slow down your site

• Could bring down your site (SPOF - single point of failure)

• Could do things you don’t want them to do

• Will add weight and complexity to your page

Monsters?

Page 98: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

What would a life without ads feel like....????

Page 99: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

The wonderful life without ads

Page 100: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

CBC Touch Mobile without ads

Page 101: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Using no (client-side) ads code reduced our page load time by ~40%

40%

Page 102: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Using server-side ads code over client-side ads code saved us ~20% of page load time

20%

Page 103: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Get in shape

Page 104: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

• Last mile acceleration (use GZip compression)

• Take advantage of a CDN, if possible

• Only use cookies where necessary

• Caches are your friend

Server and back-end

Page 105: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Dedicated mobile sites

Page 106: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

• Decide on the server what to serve

• Different websites (Text, Rich, Touch) for optimized experience

• Optimized and different images for all of our 3 mobile sites

• Edge side include technology (ESI) for device detection and/or conditional loading

Server-side optimization & device detection

Page 107: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Responsive web design and web performance

Page 108: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

“72% of the sites using responsive design don't optimize for mobile” (86% in 2012)

Guy Podjarny

72%

Page 109: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Responsive Web Design with Server Side Components

RESS

Heavy resource lifting should be done on the server

Page 110: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Exercises that worked for CBC

Page 111: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

• Very important to support If-Modified-Since requests

• Allows caches to properly cache content. Don’t cache bust!

The power of If-Modified-Since

Page 112: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

The proof

28kb

12kb

0

7.5

15

22.5

30

10/29/2011 11/01/2011 11/04/2011 11/07/2011 11/10/2011 11/13/2011 11/16/2011

kByt

es p

er H

it

Page 113: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Before and after

Page 114: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

• Heavy 404 Page?

• Browser will download the 404 page even if it’s for a broken image or other asset

Keep those 404s in check

Page 115: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Definitely not super thin

Page 116: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf#velocityconf

Page 117: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf#velocityconf

Page 118: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

The difference ....

5.2kB 1.1kB

Before After

80%

Page 119: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Global Shell

Page 120: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Global Shell• Shared by all

• Visual representation

Page 121: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Global Shell• Shared by all

• Visual representation

Page 122: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Global Shell• Shared by all

• Visual representation

• Non-visual representation

• SSI variables in header to serve ads and tracking

• Global scripts, 3rd party scripts and stylesheets

Page 123: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Improvement is easier than you think

Page 124: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

• Re-factored code: Removed old/un-used code

• Moved some scripts to the bottom of page

• Minified and concatenated scripts and CSS files to reduce file size and HTTP requests

How did we improve

Page 125: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Why optimizing manually if you can automate it?Included performance optimization into your deployment and release process

Page 126: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

• Maven, Ant Tools and Plugins

• Closure Compiler (Google)

• Minify-maven-plugin

• HTMLCompressor

• Confess

• cssembed.jar or compass for data:uri

Automated & built-in tools

Page 127: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

• If you can’t / don’t want to use Maven / Ant

• You should use taskrunners and scaffolding: Grunt, Yeoman

• Continuous integration (e.g SPOFcheck, yslow)

Automated & built-in tools

Page 128: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

What were the results?

Page 129: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Global Shell: Before and after

Page 130: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Global Shell: Before and after

0

6

12

18

24

HTTP Requests

18

24Before After

25%

68

69.4

70.8

72.2

73.6

75

Page Weight (kB)

69.8

71.9

3%

0

0.25

0.5

0.75

1

Start to render (s)

0.691

0.942

26%

0

0.325

0.65

0.975

1.3

Visually complete (s)

0.9

1.3

30%

Improvements

Page 131: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Slimmed down! But the danger with all diets ....

Page 132: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Yo-yo effectDon’t gain the weight back

Page 133: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

If you don’t monitor your weight, you can also make it worse...

Page 134: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf#velocityconf

Page 135: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

3rd Party monsters interrupt

0

2.5

5

7.5

10

7/30/12 8/10/12 8/21/12 9/1/12 9/12/12 9/23/12 10/4/12 10/15/12 10/26/12

Arit

hmet

ic M

ean

in s

Source: Keynote Daily Reports

Page 136: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

3rd Party monsters interrupt

0

2.5

5

7.5

10

7/30/12 8/10/12 8/21/12 9/1/12 9/12/12 9/23/12 10/4/12 10/15/12 10/26/12

Arit

hmet

ic M

ean

in s

Source: Keynote Daily Reports

Page 137: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

3rd Party monsters interrupt

0

2.5

5

7.5

10

7/30/12 8/10/12 8/21/12 9/1/12 9/12/12 9/23/12 10/4/12 10/15/12 10/26/12

Arit

hmet

ic M

ean

in s

Global Shell

Source: Keynote Daily Reports

Page 138: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

3rd Party monsters interrupt

0

2.5

5

7.5

10

7/30/12 8/10/12 8/21/12 9/1/12 9/12/12 9/23/12 10/4/12 10/15/12 10/26/12

Arit

hmet

ic M

ean

in s

Global Shell

Source: Keynote Daily Reports

Page 139: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

3rd Party monsters interrupt

0

2.5

5

7.5

10

7/30/12 8/10/12 8/21/12 9/1/12 9/12/12 9/23/12 10/4/12 10/15/12 10/26/12

Arit

hmet

ic M

ean

in s

Global Shell ISP Issues

Source: Keynote Daily Reports

Page 140: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

3rd Party monsters interrupt

0

2.5

5

7.5

10

7/30/12 8/10/12 8/21/12 9/1/12 9/12/12 9/23/12 10/4/12 10/15/12 10/26/12

Arit

hmet

ic M

ean

in s

Global Shell ISP Issues

Source: Keynote Daily Reports

Page 141: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

3rd Party monsters interrupt

0

2.5

5

7.5

10

7/30/12 8/10/12 8/21/12 9/1/12 9/12/12 9/23/12 10/4/12 10/15/12 10/26/12

Arit

hmet

ic M

ean

in s

Global Shell ISP Issues

Client-side Ads

Source: Keynote Daily Reports

Page 142: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

3rd Party monsters interrupt

0

2.5

5

7.5

10

7/30/12 8/10/12 8/21/12 9/1/12 9/12/12 9/23/12 10/4/12 10/15/12 10/26/12

Arit

hmet

ic M

ean

in s

Global Shell ISP Issues

Client-side Ads

Source: Keynote Daily Reports

Page 143: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

3rd Party monsters interrupt

0

2.5

5

7.5

10

7/30/12 8/10/12 8/21/12 9/1/12 9/12/12 9/23/12 10/4/12 10/15/12 10/26/12

Arit

hmet

ic M

ean

in s

Global Shell ISP Issues

Client-side Ads

Source: Keynote Daily Reports

Page 144: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

3rd Party monsters interrupt

0

2.5

5

7.5

10

7/30/12 8/10/12 8/21/12 9/1/12 9/12/12 9/23/12 10/4/12 10/15/12 10/26/12

Arit

hmet

ic M

ean

in s

Global Shell ISP Issues

Client-side Ads

Ads turned off

Source: Keynote Daily Reports

Page 145: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

3rd Party monsters interrupt

0

2.5

5

7.5

10

7/30/12 8/10/12 8/21/12 9/1/12 9/12/12 9/23/12 10/4/12 10/15/12 10/26/12

Arit

hmet

ic M

ean

in s

Global Shell ISP Issues

Client-side Ads

Ads turned off

Source: Keynote Daily Reports

Page 146: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

3rd Party monsters interrupt

0

2.5

5

7.5

10

7/30/12 8/10/12 8/21/12 9/1/12 9/12/12 9/23/12 10/4/12 10/15/12 10/26/12

Arit

hmet

ic M

ean

in s

Global Shell ISP Issues

Client-side Ads

Ads turned off

Server-side Ads

Source: Keynote Daily Reports

Page 147: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

A user who has to endure an 8-second download delay spends only 1% of their total viewing time looking at

the featured promotional space on a landing page.

In contrast, a user who receives instantaneous page

rendering spends 20% of viewing time within the

promotional area (source: Nielsen)

Page 148: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

CBC’s fitness tips - Take aways

Page 149: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Create a culture of performanceBring everyone on board

Fitness Tip

Page 150: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Start today, collect measurements

Fitness Tip

Run tests frequently, use free or commercial tools to help

Page 151: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Visualize data and complexity to illustrate performance success and bad hits (show before and after)

Fitness Tip

A picture is worth a thousand words

Page 152: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Automate performance optimization

Fitness Tip

Page 153: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Watch those 3rd party monstersEvaluate their impact, ask and push for server-side solutions or use non-blocking, asynchronous solutions

Fitness Tip

Page 154: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Serve only what the client needsDevice detection, server-side components and responsive web design

Fitness Tip

Page 155: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Use RUM and synthetic testing

Fitness Tip

Get to know your users’ performance and your features’ performance

Page 156: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Monitor your fitness level, setup reports

Fitness Tip

Page 157: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Share your ideas and knowledgeCBC’s Web Performance Working Group

Fitness Tip

Page 158: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Set a performance budget

Fitness Tip

Page 159: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Run quick performance tests on mocks and prototypes

Fitness Tip

Page 160: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

There is always room for improvement

Fitness Tip

Keep the momentum

Page 161: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Questions? /blakecrosby /bbinto

Thank you!

Office HoursToday 2:45pm Exhibit Hall (Table 3)

Page 162: The Canadian Public Broadcaster on a Diet: Slimming Down for a Whole Nation

#velocityconf

Photo Credits•http://beautygirlsmom.com/wp-content/uploads/2011/01/diet-funny-sign-spelled-out-vegetable.jpg•http://www.cyklblog.com/wp-content/uploads/2011/06/so-many-push-ups.jpg•http://photobucket.com/images/yo+yo+puppy+dog+yoyo+animated+gif+funny/•http://www.wallpaper-welt.de/gros/film/monster-ag/Monster%20AG.jpg•http://www.passiveaggressivenotes.com/2007/07/29/this-is-why-your-server-is-cranky/•http://4.bp.blogspot.com/-NnFPM5Fgbao/TaIkVwyusEI/AAAAAAAAMPw/fdDbbvgJRb8/s1600/054.jpg•http://thefulltimedomesticgoddess.com/wp-content/uploads/2011/09/girls-holding-hands-bw.jpg•http://cartoonswalls.com/walls/monsters_university_desktop_wallpaper-wide.jpg•http://41inmylife.files.wordpress.com/2011/06/weight_scale.jpg•http://blogs.scientificamerican.com/the-curious-wavefunction/files/2012/08/boeing_777_cockpit.jpg•http://www.liquorlockerla.com/wp-content/uploads/Captain-Morgan-Spiced-Rum-1.75.jpghttp://4.bp.blogspot.com/-Ylnf651-NMg/UW_-ak4lvwI/AAAAAAAAAZs/7UeqyWrrUys/s1600/Boomerang.png•http://2.bp.blogspot.com/-ZrxT4-q5Hrw/UH1kIPawjqI/AAAAAAAAJeg/7f8TCiH2Wao/s1600/you-can-do-it.jpg•http://upload.wikimedia.org/wikipedia/commons/7/77/Celine_Dion_Concert_Singing_'Taking_Chances'_2008.jpg•http://static.wix.com/media/130ef9_bab26cc8c87a64719072275bba963573.jpg

Sources•http://www.slideshare.net/stoyan/psychology-of-performance•http://www.stevesouders.com/blog/2012/11/14/comparing-rum-synthetic-page-load-times/•http://bradfrostweb.com/blog/post/performance-as-design/ •“Who killed my battery: Analyzing Mobile Browser Consumption” http://www2012.wwwconference.org/proceedings/proceedings/p41.pdf•http://www.slideshare.net/guypod/performance-implications-of-mobile-design •http://www.cbc.ca/m/touch/sports/story/2013/03/05/sp-paralympics-oscar-pistorius.html•Desktop: http://www.webpagetest.org/result/130315_TQ_WT1/•Mobile:http://www.webpagetest.org/result/130315_1X_X18/•http://coding.smashingmagazine.com/2012/11/13/the-vanilla-web-diet/•http://www.gomez.com/wp-content/downloads/19986_WhatMobileUsersWant_Wp.pdf