13. #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
14. #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
15. #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
11 iOS, 3 Android, 5 Blackberry, 3 Windows apps
16. #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 websites
11 iOS, 3 Android, 5 Blackberry, 3 Windows apps
17. #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 websites
11 iOS, 3 Android, 5 Blackberry, 3 Windows apps
18. #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 websites
11 iOS, 3 Android, 5 Blackberry, 3 Windows apps
19. #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, and
vii. reflect the multicultural and multiracial nature of Canada.”
24. #velocityconf
It’s a Mobile (Browser) World
0
500
1000
1500
2000
2007 2008 2009 2010 2011 2012 2013 2014 2015
Desktop Internet Users
Mobile Internet Users
Source: Morgan Stanley
Numberofglobalusersinmillions
53. #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 level
Get concrete information about user’s latency,
bandwidth, page load time
Tools
private/public WebPagetest (API), PageSpeed (API),
phantomJS, commercial products etc.
Tools
boomerang.js, Google Analytics, commercial
products etc.
57. #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
58. #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
60. #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
61. #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
71. #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
73. #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
74. #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
75. #velocityconf
Bandwidth distribution for CBC touch news landing page
1%7%
41%
24%
21%
6%
<64Kbps
64-256Kbps
256-512Kbps
512Kbps-1.6Mbps
1.6-3Mbps
3-8Mbps
Data points: 8994
76. #velocityconf
With RUM data “[...] your real users are experiencing page load times
that are twice as long as their corresponding synthetic
measurements.”
Steve Souders
78. #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) 100
2) 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
79. #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 ms
95th percentile
Median
RUMSynthetic
80. #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
86. #velocityconf
• Use the path option to limit cookie scope
• Store your static assets at a different domain
(images.cbc.ca)
Cookies on a diet
87. #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
88. #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
94. #velocityconf
• Ads, tracking, social buttons etc.
• They are unpredictable, scary, disruptive, sneaky and
• Could slow down your site
Monsters?
95. #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?
96. #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?
97. #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?
104. #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
106. #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
111. #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
122. #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
124. #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
126. #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
127. #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
147. #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)
151. #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
153. #velocityconf
Watch those 3rd party monsters
Evaluate their impact, ask and push for server-side solutions or use non-blocking, asynchronous solutions
Fitness Tip
154. #velocityconf
Serve only what the client needs
Device detection, server-side components and responsive web design
Fitness Tip
155. #velocityconf
Use RUM and synthetic testing
Fitness Tip
Get to know your users’ performance and your features’ performance