SlideShare ist ein Scribd-Unternehmen logo
1 von 100
Downloaden Sie, um offline zu lesen
Effectively Monitoring
Client-Side Performance
Andrew Rota
Guidebook app: NEPHP2016
Effectively Monitoring
Client-Side Performance
NEPHP 2016 | @AndrewRota
1. Client-Side Performance
2. Collect + Monitor
3. Effectively
Andrew Rota
Software Engineer, .
@andrewrota
github.com/andrewrota
Boston, MA
Web Performance
Client-Side Web
Performance
Measuring
Performance
Navigation
Render
Additional
Resources
Interaction
Navigation
Render
Additional
Resources
Interaction
Navigation
Render
Additional
Resources
Interaction
Navigation
Render
Additional
Resources
Interaction
There’s no single metric
for measuring web
performance
Performance Metric Sources
1. Observational data
2. Browser devtools
3. Browser reported metrics
Observational Data
Performance Metric Sources
1. Observational data
2. Browser devtools
3. Browser reported metrics
Browser Profiling Metrics
Performance Metric Sources
1. Observational data
2. Browser devtools
3. Browser reported metrics
Performance Metric Sources
1. Observational data
2. Browser devtools
3. Browser reported metrics
• Navigation Timing API
• Paint metrics
• Custom Metrics
Navigation Timing API
Navigation Timing API
• navigationStart
• unloadEventStart
• unloadEventEnd
• redirectStart
• redirectEnd
• fetchStart
• domainLookupStart
• domainLookupEnd
• connectStart
• connectEnd
• secureConnectionStart
• requestStart
• responseStart
• responseEnd
• domLoading
• domInteractive
• domContentLoadedEventStart
• domContentLoadedEventEnd
• domComplete
• loadEventStart
• loadEventEnd
Navigation Timing API
• navigationStart - navigation initiated
• responseStart - first byte of doc from server
• responseEnd - last byte of doc from server
• domInteractive - HTML parsed, DOM constructed
• domContentLoaded - DOM and CSSOM constructed
• domComplete/load - all subresources loaded
navigationStart
responseStart
responseEnd
domInteractive
domContentLoaded
domComplete
Paint Metrics
window.performance.timing.msFirstPaint
window.chrome.loadTimes().firstPaintTime
Internet Explorer
Chrome
firstPaint
Custom Metrics
window.performance.now()
Custom Metrics
window.performance.mark(‘mainImageLoaded’)
window.performance
.getEntriesByName(‘mainImageLoaded’)[0]
.startTime
mainImageLoaded
tableSorted
Making Metrics
Meaningful
Traditional Site Visit
Lifecycle
Page
1
Page
2
Page
3
Page
4
But what about single
page applications (SPAs)?
Page
1
Page
2
Page
3
Page
4
SPAs can improve
performance, but complicate
performance metrics
With SPAs, 1) write scripts
for actions, and 2) double
down on custom metrics.
Determine meaningful abstract metrics
on top of low-level browser/app metrics
Can we automate, collect,
and monitor these metrics?
1. Client-Side Performance
2. Collect + Monitor
3. Effectively
1. Real User Monitoring (RUM)

2. Synthetic
Collecting Performance Metrics
RUM Performance Metrics
Users Collect Metrics
Sources for RUM Metrics
1. Observational data
2. Browser devtools
3. Browser reported metrics
• Navigation Timing API
• Paint metrics
• Custom Metrics
Tools for RUM Metrics
Browser reported
metrics
Collect Metrics
Send Metrics
(XHR)
Tools for RUM Metrics
• Custom JavaScript
• Open source JS libraries
• github.com/lognormal/boomerang







Synthetic Performance
Metrics
Automated Test Collect Metrics
Sources for Synthetic Metrics
1. Observational data
2. Browser devtools
3. Browser reported metrics
• Navigation Timing API
• Paint metrics
• Custom Metrics
Tools for Synthetic
Performance Metrics
Scheduler “Browser” + Test Runner
Schedulers
• Cron













> 0 * * * * /path/to/script.sh
Schedulers
• Cron
• Continuous integration server
• Jenkins







> 0 * * * * /path/to/script.sh
Synthetic test runners
• Phantomas
• Browser-Perf
• WebPagetest
• Lighthouse





Phantomas
Headless Browsers
Phantomas
> phantomas http://reddit.com
{

"metrics": {

"requests": 73,

"bodySize": 580491,

"contentLength": 629382,

"timeToFirstByte": 94,

"timeToLastByte": 105,

"DOMqueries": 247,

"firstPaint": 0,

"domInteractive": 215,

"domContentLoaded": 213,

"domContentLoadedEnd": 355,

"domComplete": 792,

"httpsRequests": [

"https://www.reddit.com/",

"https://www.redditstatic.com/reddit-init.en.qq9nT0inXvw.js",

"https://www.redditstatic.com/reddit.en.xlHlxcJziiU.js",

"https://www.redditstatic.com/reddit.ooBJpEoO9vY.css",

"https://www.google-analytics.com/analytics.js"

]

// … and more!

}

}
Phantomas
> phantomas http://reddit.com
{

"metrics": {

"requests": 73,

"bodySize": 580491,

"contentLength": 629382,

"timeToFirstByte": 94,

"timeToLastByte": 105,

"DOMqueries": 247,

"firstPaint": 0,

"domInteractive": 215,

"domContentLoaded": 213,

"domContentLoadedEnd": 355,

"domComplete": 792,

"httpsRequests": [

"https://www.reddit.com/",

"https://www.redditstatic.com/reddit-init.en.qq9nT0inXvw.js",

"https://www.redditstatic.com/reddit.en.xlHlxcJziiU.js",

"https://www.redditstatic.com/reddit.ooBJpEoO9vY.css",

"https://www.google-analytics.com/analytics.js"

]

// … and more!

}

}
Phantomas
> phantomas http://reddit.com
{

"metrics": {

"requests": 73,

"bodySize": 580491,

"contentLength": 629382,

"timeToFirstByte": 94,

"timeToLastByte": 105,

"DOMqueries": 247,

"firstPaint": 0,

"domInteractive": 215,

"domContentLoaded": 213,

"domContentLoadedEnd": 355,

"domComplete": 792,

"httpsRequests": [

"https://www.reddit.com/",

"https://www.redditstatic.com/reddit-init.en.qq9nT0inXvw.js",

"https://www.redditstatic.com/reddit.en.xlHlxcJziiU.js",

"https://www.redditstatic.com/reddit.ooBJpEoO9vY.css",

"https://www.google-analytics.com/analytics.js"

]

// … and more!

}

}
Phantomas
> phantomas http://reddit.com
{

"metrics": {

"requests": 73,

"bodySize": 580491,

"contentLength": 629382,

"timeToFirstByte": 94,

"timeToLastByte": 105,

"DOMqueries": 247,

"firstPaint": 0,

"domInteractive": 215,

"domContentLoaded": 213,

"domContentLoadedEnd": 355,

"domComplete": 792,

"httpsRequests": [

"https://www.reddit.com/",

"https://www.redditstatic.com/reddit-init.en.qq9nT0inXvw.js",

"https://www.redditstatic.com/reddit.en.xlHlxcJziiU.js",

"https://www.redditstatic.com/reddit.ooBJpEoO9vY.css",

"https://www.google-analytics.com/analytics.js"

]

// … and more!

}

}
Browser-Perf
Browser-Perf
> browser-perf http://reddit.com
--selenium=selenium.example.com
Browser-Perf
> browser-perf http://reddit.com
--selenium=selenium.example.com
Browser-Perf
> browser-perf http://reddit.com
--selenium=selenium.example.com
Browser-Perf
> browser-perf http://reddit.com
--selenium=selenium.example.com
WebPagetest
http://www.webpagetest.org/
WebPagetest
http://www.webpagetest.org/
WebPagetest
WPT: Speed Index
Paint Time of “Above the Fold” Content
( )
Source: WebPagetest
Calculating Speed Index
1. Take the duration until the page is visually
complete
2. Separate it into 100ms intervals
3. For each interval, assign it a “percent
visually complete”
4. Invert that percentage so it’s “percent
incomplete” or “percent remaining”
5. Multiply that by the interval length (100ms)
6. Sum all of the intervals. Speed Index!
Lighthouse
Lighthouse
Storage and Monitoring
• Aggregation
• Data storage + queries
• Visualization
• Alerts + Notification
Storing and Monitoring
Aggregation via StatsD
Aggregation via StatsD
Storage + Queries with Graphite
mySite.homepage.phantomas.domComplete
Visualization with Grafana
Visualization with Grafana
Source: play.grafana.org/
Alerts and Notifications
1. Client-Side Performance
2. Collect + Monitor
3. Effectively
Effective Monitoring
• Reduce noise
• Beware skewed data
• Make data actionable
• Utilize data
Reduce Noise
• Isolate third party scripts and
external services

• Control conditional code paths (A/B
tests, etc.)
Beware Skewed Data
• Observer effect

• Noisy neighbors
Make Data Actionable
Know what changes will
affect each of your
metrics
How do you improve…
DOM Complete?
How do you improve…
Frame rate during scroll?
How do you improve…
Speed Index?
Do something with this data!
Utilize Data
• Agree on performance metrics
• Agree on performance goals
• Allocate time and resources
to achieving these goals
Performance is a means
to an end:
Remember
Performance is a means
to an end:
user experience
Remember
Andrew Rota, .
@AndrewRota .
Thanks!
Recommend Resources
• bit.ly/google_rails
• bit.ly/webpagetest_docs
• bit.ly/browser_perf
• bit.ly/statsdcc
• bit.ly/phantomas_js
• graphite.readthedocs.io

Weitere ähnliche Inhalte

Mehr von Andrew Rota

Mehr von Andrew Rota (11)

Client-Side Performance Monitoring (MobileTea, Rome)
Client-Side Performance Monitoring (MobileTea, Rome)Client-Side Performance Monitoring (MobileTea, Rome)
Client-Side Performance Monitoring (MobileTea, Rome)
 
Effectively Monitoring Client-Side Performance
Effectively Monitoring Client-Side PerformanceEffectively Monitoring Client-Side Performance
Effectively Monitoring Client-Side Performance
 
UI Rendering at Wayfair
UI Rendering at WayfairUI Rendering at Wayfair
UI Rendering at Wayfair
 
Better PHP-Frontend Integration with Tungsten.js
Better PHP-Frontend Integration with Tungsten.jsBetter PHP-Frontend Integration with Tungsten.js
Better PHP-Frontend Integration with Tungsten.js
 
Tungsten.js: Building a Modular Framework
Tungsten.js: Building a Modular FrameworkTungsten.js: Building a Modular Framework
Tungsten.js: Building a Modular Framework
 
Why Static Type Checking is Better
Why Static Type Checking is BetterWhy Static Type Checking is Better
Why Static Type Checking is Better
 
An Exploration of Frameworks – and Why We Built Our Own
An Exploration of Frameworks – and Why We Built Our OwnAn Exploration of Frameworks – and Why We Built Our Own
An Exploration of Frameworks – and Why We Built Our Own
 
The Complementarity of React and Web Components
The Complementarity of React and Web ComponentsThe Complementarity of React and Web Components
The Complementarity of React and Web Components
 
Web Components + Backbone: a Game-Changing Combination
Web Components + Backbone: a Game-Changing CombinationWeb Components + Backbone: a Game-Changing Combination
Web Components + Backbone: a Game-Changing Combination
 
Bem methodology
Bem methodologyBem methodology
Bem methodology
 
Web Components and Modular CSS
Web Components and Modular CSSWeb Components and Modular CSS
Web Components and Modular CSS
 

Kürzlich hochgeladen

CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
mohitmore19
 

Kürzlich hochgeladen (20)

Pharm-D Biostatistics and Research methodology
Pharm-D Biostatistics and Research methodologyPharm-D Biostatistics and Research methodology
Pharm-D Biostatistics and Research methodology
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptxBUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verifiedSector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
ManageIQ - Sprint 236 Review - Slide Deck
ManageIQ - Sprint 236 Review - Slide DeckManageIQ - Sprint 236 Review - Slide Deck
ManageIQ - Sprint 236 Review - Slide Deck
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfThe Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
 

Effectively Monitoring Client-Side Performance: NEPHP2016