SlideShare ist ein Scribd-Unternehmen logo
1 von 106
Downloaden Sie, um offline zu lesen
Practical intro to web performance
Riviera Dev 2019
Jakub Gieryluk
Agenda
2
Network performance
❖ Latency
❖ Waterfall
❖ Visual comparison tools
Runtime performance / JavaScript
❖ Bundle analysis & Code splitting
❖ Dependencies & 3rd parties
❖ DevTools perf panel
Why performance matters, for users
3
Money
• 💲 Users with limited data plans
• 🚆Users commuting
• ✈ Users in roaming
• Digital exclusion
• poor connectivity areas
• developing markets
https://www.slideshare.net/Ericsson/ericsson-mobility-report-the-stress-of-streaming-delays
Stress
https://whatdoesmysitecost.com
Why performance matters, for CEOs
4
https://wpostats.com
QUICK START
5
PageSpeed Insights:
Lighthouse Online
+ CrUX
https://www.webpagetest.org/
https://developers.google.com/speed/pagespeed/insights/
Real-world analytics
Key metrics
Actionable items
Network
performance
6
7
Bandwidth =
diameter
of the pipe
Latency = length of the pipe
Latency
 Practical intro to web performance - RivieraDEV 2019
NETWORK PERF / LATENCY
9
Check
latency
around
the world
https://tools.keycdn.com/performance
Example:
Not geo-distributed (yet) backend
10
NETWORK PERF / LATENCY
11
Check
latency
around
the world
https://tools.keycdn.com/performance
Example:
Geo-distributed static content
(via CDN)
12
NETWORK PERFORMANCE / LATENCY
Mobile latency
https://twitter.com/katiehempenius/status/1040434962472873984
WebPageTest
13
NETWORK PERFORMANCE
14
WebPageTest
https://www.webpagetest.org/
SWISS-ARMY KNIFE TOOLS
15
WebPageTest: resources review
The waterfall: basics
16
using WebPageTest
NETWORK PERFORMANCE / WATERFALL BASICS
17
The waterfall
HTTP
requests
Time
NETWORK PERFORMANCE / WATERFALL BASICS
18
Waterfall anti-patterns: (unused) massive
subresource
https://twitter.com/dougsillars/status/1114244509360062466
NETWORK PERFORMANCE / WATERFALL BASICS
19
Waterfall anti-patterns: a lot of red
https://calendar.perfplanet.com/2013/web-performance-waterfalls-from-10000-feet/
Red lines = HTTP 4xx responses
(404 not found etc…)
NETWORK PERFORMANCE / WATERFALL BASICS
20
Waterfall anti-patterns: a lot of yellow
https://calendar.perfplanet.com/2013/web-performance-waterfalls-from-10000-feet/
Yellow lines = HTTP 3xx responses
Particularly bad if:
- At beginning
- Multiple
- Cross-origin
RedirectsConditional responses
(resource revalidation)
The waterfall in depth
21
yBryanGoffonUnsplash
using WebPageTest
WATERFALL
22
Life of a single HTTP request
https://www.igvita.com/2015/08/17/eliminating-roundtrips-with-preconnect/
WATERFALL
23
RivieraDEV
waterfall
analysis
https://www.webpagetest.org/waterfall.png?test=190409_JH_e24cc615c65463aaa9af8755dbbda34e&run=1&max=8.5&width=1000&cpu=1&requests=1-30&ut=1
What we can read
from this waterfall?
(tests done from Strasbourg,
Chrome, using “3G Fast”
network throttling)
Test results overview page:
https://www.webpagetest.org/result/190409_JH_e24cc615c65463aaa9af8755dbbda34e/
WATERFALL
24
RivieraDEV
waterfall
analysis
https://www.webpagetest.org/waterfall.png?test=190409_JH_e24cc615c65463aaa9af8755dbbda34e&run=1&max=8.5&width=1000&cpu=1&requests=1-30&ut=1
Page interactive
almost all the time 👍
Some very good things:
Main thread not too busy 👍
(reasonable amount of JS)
High bandwidth utilization
WATERFALL
25
RivieraDEV
waterfall
analysis
https://www.webpagetest.org/waterfall.png?test=190409_JH_e24cc615c65463aaa9af8755dbbda34e&run=1&max=8.5&width=1000&cpu=1&requests=1-30&ut=1
Massive fontawesome
download.
Perhaps could be replaced with
a custom build?
Many big frameworks & libs
provide custom build option
Some things that could be
better:
WATERFALL
26
RivieraDEV
waterfall
analysis
https://www.webpagetest.org/waterfall.png?test=190409_JH_e24cc615c65463aaa9af8755dbbda34e&run=1&max=8.5&width=1000&cpu=1&requests=1-30&ut=1
All requests issued at
the same time, over a
single HTTP connection
(generally good for
performance)
HTTP/2 pattern
WATERFALL
27
RivieraDEV
waterfall
analysis
https://www.webpagetest.org/waterfall.png?test=190409_JH_e24cc615c65463aaa9af8755dbbda34e&run=1&max=12.5&width=1000&cpu=1&requests=17-56&ut=1
• Browser creates max. 6 parallel
connections per domain…
• …and sends requests only when
there’s an unused connection
Not possible to have more than 6
in-flight requests for a given domain
HTTP/1.1 pattern: “stairs”
WATERFALL
28
Connection View
https://www.webpagetest.org/waterfall.png?test=190409_JH_e24cc615c65463aaa9af8755dbbda34e&run=1&width=930&type=connection
Each HTTP/1.1 connection:
• starts slow,
• does separate
congestion control
HTTP/1.1 connections
“fight” with each other
Lots of static assets requests -> primary use case for HTTP/2
WATERFALL
29
RivieraDEV
waterfall
analysis
https://www.webpagetest.org/waterfall.png?test=190409_JH_e24cc615c65463aaa9af8755dbbda34e&run=1&max=8.5&width=1000&cpu=1&requests=1-30&ut=1
Back to webfonts - looking
closer…
CSS and actual fonts (WOFF2)
are hosted on different
servers.
Hence DNS+TCP+TLS set up is
needed before fetching them.
We could do that upfront with
<link rel=preconnect>
in top of HTML response
WATERFALL
30
RivieraDEV
waterfall
analysis
https://www.webpagetest.org/waterfall.png?test=190409_JH_e24cc615c65463aaa9af8755dbbda34e&run=1&max=8.5&width=1000&cpu=1&requests=1-30&ut=1
…but if we did it ourselves, it
could start even before CSS
request
Google Fonts actually does
preconnect via response header…
👍
WebPageTest:
visual tools
31
WATERFALL
32
Waterfall anti-patterns: blocking resources
https://calendar.perfplanet.com/2013/web-performance-waterfalls-from-10000-feet/
In particular, beware of
third-party, blocking JS (and CSS)
VISUAL TOOLS / SPOF
33
Third-party
blocking
resources
Let’s try to put in place
some chaos…
SPOF = Single Point of
Failure
ℹ works best in Firefox;
ℹ Chrome doesn’t show
failed requests;
ℹ iOS agent doesn’t support
feature
VISUAL TOOLS / SPOF
34
Third-party blocking resources: filmstrip
• It takes the browser
30seconds to
abandon the
blackholed request
https://www.webpagetest.org/video/compare.php?tests=190418_KY_1a8895d28357b7620193d8b99145493c%2C190418_2C_19ed78c24c5a106745227111c731a6a2&thumbSize=150&ival=8000
• <script defer>
is deferred, but still
blocking the load event
VISUAL TOOLS / SPOF
35
Third-party blocking resources: summary
• Prefer async third parties than synchronous ones; load them after `load` event
• Analytics, A/B testing providers, libraries, social widgets…
• Calculate the risk. Does a third party provide SLA or historical uptime data?
• Good sign if the lib is hosted by a reputable CDN provider
• Self-host (if possible) when unsure
• Perhaps have a server-side switch to start serving your own copy instead of 3rd-party
• You don’t want a social widget to take down your website
• When dealing with social widgets: perhaps load on demand (also good for user privacy)
VISUAL TOOLS / COMPARING TESTS
36
Filmstrip comparison
Tip: always run as a logged-in user, to not lose the test ID
VISUAL TOOLS / COMPARING TESTS
37
Video view comparison
https://www.webpagetest.org/video/view.php?id=150512_a1702c187f12d2582548c5e9be8d0b6dd308ab67
Agenda
38
Network performance
❖ Latency
❖ Waterfall
❖ Visual comparison tools
Runtime performance / JavaScript
❖ Bundle analysis & Code splitting
❖ Dependencies & 3rd parties
❖ DevTools perf panel
Runtime
performance
39
PhotobyGarettMizunakaonUnsplash
Bundle
analysis &
code splitting
40
Webpack bundle tools
BUNDLE ANALYSIS
41https://webpack.github.io/analyse/
webpack-bundle-analyzer
https://chrisbateman.github.io/webpack-visualizer/
Tip: disable module concatenation
when analyzing the bundle
{config: {optimization: {concatenateModules: false}}}
Bundle tools: Bundle Buddy
BUNDLE ANALYSIS
42
https://github.com/samccone/bundle-buddy
Find duplicated code across the chunks
Dependencies
43
Bundlephobia – check size of npm packages
DEPENDENCIES
44
https://bundlephobia.com/
Bundlephobia
DEPENDENCIES
45
• Check for regressions before
updating a dependency
• Contrary, maybe there’s a new,
smaller version available
• Import `package.json` to analyze all
your deps
Import Cost – vscode extension
DEPENDENCIES
46
Third-parties
47https://requestmap.herokuapp.com/render/190418_PQ_4b776cc76ed8388b44883c5ee3147a23/
requestmap.herokuapp.com
THIRD-PARTIES
48
Dealing with third parties
• Visualize:
• http://requestmap.herokuapp.com/
• Compare impact of different 3rd-party providers:
• https://github.com/patrickhulce/third-party-web
• https://www.thirdpartyweb.today
• How to deal with 3rd parties:
• Harry Roberts @ performance.now:
https://youtu.be/bmIUYBNKja4
• Put process on adding new tags:
• https://medium.com/the-telegraph-engineering/improving-
third-party-web-performance-at-the-telegraph-a0a1000be5
Chrome
DevTools
performance
panel
49
CHROME DEVTOOLS
50
Performance panel
https://www.webpagetest.org/
CHROME DEVTOOLS
51
Performance panel
https://www.webpagetest.org/
CHROME DEVTOOLS / PERFORMANCE PANEL
52
User Timing API
performance.mark("startMark")
performance.mark("endMark")
performance.measure("myDiff", "startMark", "endMark")
Useful to correlate network & JS activity with what the code is doing
CHROME DEVTOOLS
53
Performance panel
What do the colors mean?
Golden = JS
Dark violet = layout
Dark green = render
All else = random colors,
fixed color per file
https://nolanlawson.com/2018/09/25/accurately-measuring-layout-on-the-web/
Time
JavaScript
call stack
CHROME DEVTOOLS / PERFORMANCE PANEL
54
JavaScript flame chart
Zoom in and look for repeated patterns
Mr. Obvious Tip:
Disable minification
CHROME DEVTOOLS / PERFORMANCE PANEL
55
JavaScript flame chart
https://www.webpagetest.org/Reading the same cookie over and over. Expensive!
CHROME DEVTOOLS / PERFORMANCE PANEL
56
Forced layout recalculation (reflow)
https://gist.github.com/paulirish/5d52fb081b3570c81e3a
More docs: https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference
If part of JS call stack,
multiple times
= bad sign
Red triangle over
purple square
= forced reflow
Typical issues:
- Reading layout props in
arbitrary JS functions
- Reading layout props after
writing
Solutions:
- Read layout in
requestAnimationFrame()
callbacks (it’s free)
- Batch DOM reads and writes, in
correct order (first reads, then
writes)
Experimental
features
57
EXPERIMENTAL FEATURES
58
Feature policy:
browser as a linter
• Feature-Policy
• Enforce rules in staging environment
• No need to run any tools – immediate
feedback
Feature-Policy: oversized-images 'none'
• Feature-Policy-Report-Only
• Deploy to production to gather
real-world data, without enforcing
https://featurepolicy.info/
Web
debugging
proxies
59
https://www.flickr.com/photos/kecko/37272629160CCBY2.0
SWISS-ARMY KNIFE TOOLS / WEB DEBUGGING PROXIES
60
Fiddler
https://www.webpagetest.org/
SWISS-ARMY KNIFE TOOLS / WEB DEBUGGING PROXIES
61
Charles Proxy
https://www.webpagetest.org/
Advanced throttling options
Throttling also possible
in Fiddler, although:
• no dedicated UI (via
FiddlerScript)
• less sophisticated
SWISS-ARMY KNIFE TOOLS / WEB DEBUGGING PROXIES
62
Caveats
https://www.webpagetest.org/
Some proxies downgrade HTTP/2 to HTTP/1.1
which may notably affect how resources are loaded:
• Fiddler
• BrowserStack
• …
Be careful when benchmarking / comparing.
⚠
The ultimate tools
63
THE ULTIMATE TOOLS
64
View source (CTRL-U)
Watch out for:
- random "no one knows why we have this stuff”
- massive inline base64 content
- whitespace and comments not stripped out
- duplicated code or markup etc.
THE ULTIMATE TOOLS
65
Difftool
Beautify and diff your bundles before shipping to production
Find unexpected issues, like:
- Non-deterministic build which affects client-side cache reuse
- Regressions when updating tools or dependencies
Summary
66
Network performance
❖ Latency
❖ Waterfall
❖ Visual comparison tools
Runtime performance / JavaScript
❖ Bundle analysis & Code splitting
❖ Dependencies & 3rd parties
❖ DevTools perf panel
LEARN MORE
67
Understanding the building blocks
• High Performance Browser Networking
• Read for free at https://hpbn.co
• High Performance Networking in Chrome
• https://www.aosabook.org/en/posa/high-performance-networking-in-chrome.html
• Check my blog article
• https://calendar.perfplanet.com/2018/getting-started-with-web-performance-
2019-beginners-guide/
• More perf-oriented articles, books, slides, videos:
• https://calendar.perfplanet.com
• https://www.perf-tooling.today/
Thank you!
__jakub_g
https://jakub.gieryluk.net/slides/rivieradev
Slides available at
Find me on Twitter
Bonus content
69
THE ULTIMATE TOOL
70
Test in production
Some insights can only be drawn
from A/B testing in production.
You can never simulate all real-
world traffic patterns in the lab.
➢ Push to prod
➢ gather RUM data
➢ iterate
Aspects of front-end performance
71
Scrolling & animations
performance
⌚Initial load time Responding to
user input
💲Cost
RuntimeLoading Indirect
🔋Battery life
CHROME DEVTOOLS
72
Runtime code coverage tool
• Can give idea about code splitting opportunities
• May find some dead files
WATERFALL
73
Waterfall anti-patterns: network silence
• Network silence =
opportunity for an
early fetch
https://hpbn.co/mobile-networks/
https://hpbn.co/optimizing-for-mobile-networks/
“[In Pandora music streaming application],
analyticsbeacons [sent every 60 seconds]
accounted for 0.2% bytes and 46% power
consumption”
• Also, grouped
requests are more
battery-efficient
SWISS-ARMY KNIFE TOOLS
74
WebPageTest: killer features
• Testing from all over the world
• “the site is slow in Brazil” (maybe slow local ad?)
• “the site is down in Indonesia”
• Can capture response bodies
• All kinds of browsers and devices
• Same UI regardless of browser tested
• Permanent, shareable test results
• WPT URL = proof of bug / problem
SWISS-ARMY KNIFE TOOLS
75
WebPageTest: more strong points
• Can gather lots of low-level data
• tcpdump, advanced HTTP/2 info, Chrome timeline, Chrome tracing data…
• Data can be exported in HAR format
• Automation possible
• REST API, npm package (https://www.npmjs.com/package/webpagetest)
• Free, open source, not for profit (PHP, https://github.com/WPO-Foundation/webpagetest)
SWISS-ARMY KNIFE TOOLS
76
WebPageTest: caveats
• Public instance = test only public websites (production)
• Although you can set up a private instance
• Small differences in detail level between browsers
• Most notably: some data can’t be gathered on iOS
WEBPAGETEST: EVEN MORE FEATURES
77
Hidden features
• CPU throttling via URL param
• CPU throttling via mobile emulation
• Custom waterfall URL params:
• &width=2000 (width of waterfall in pixels)
• &max=30 (width of waterfall in seconds)
• &ut=1 (show User Timing marks)
• …
• Several more “hidden features” via URL params (check up
docs): high quality images, experimental timings etc.
• Just click around any links on WebPageTest.org to
discover features
• See also:
• https://deanhume.com/ten-things-you-didnt-know-
about-webpagetest-org/
(https://github.com/WPO-Foundation/webpagetest/blob/master/www/settings/mobile_devices.ini)
WATERFALL
78
Waterfall good patterns: preconnect “gaps”
…but since connection
was initiated before
with <link rel=preconnect>,
it avoids 400ms penalty
Browser starts sending actual requests
for subresources here…
https://www.igvita.com/2015/08/17/eliminating-roundtrips-with-preconnect/
WATERFALL BASICS
79
Bonus: keep your favicons at bay
Put a small 16x16 favicon.ico in the root of the domain
Make sure your 404/500 pages are small and self-contained
https://twitter.com/dougsillars/status/1123460280581853186
WATERFALL
80
More waterfall analyses
https://jakearchibald.com/2019/f1-perf/
WEBPAGETEST: COMPARING TESTS
81
Visual comparison
• Useful for “before / after” comparisons after shipping code changes
• Re-run the tests multiple times, compare graphs with the
waterfall, to not draw accidental conclusions
Compare CDNs
CONTENT DELIVERY NETWORKS
82
https://www.cdnperf.com/cdn-compare
http://cdncomparison.com/
COMPRESSION
83
Consider brotli
for static content
• Supported by all modern browsers
(~90%), fall back to gzip
• Decompression speed on par with gzip
• Compression speed: slow on level 10/11
(not suitable for dynamic content)
• Supported by some CDNs (but not all of
them yet)
• Some CDNs can recompress to brotli
even if your server does not serve brotli
• You can build static brotli assets at
build time
https://tools.paulcalvano.com/compression.php
https://paulcalvano.com/index.php/2018/07/25/brotli-compression-how-much-will-it-reduce-your-content/
Images
84Image credit: Tobias Baldauf
Compression is not everything
IMAGES
85
• Modern JPEG encoders and decoders are very good and highly optimized
• WEBP does not support progressive rendering, contrary to JPEG
• JPEG-XR: uses much more CPU than JPEG, and is IE/EdgeHTML-only
• WEBP: still not supported in Safari, and (reluctantly) just landed in Firefox
• Verdict:
• stick to JPEG, compress better (upgrade your encoder), use progressive JPEG
• use lossless WEBP instead of PNG if not afraid of complexity
• Kornel Lesiński | Image Optimization | performance.now() 2018
(https://youtu.be/jTXhYj2aCDU)
• Tobias Baldauf:
• https://calendar.perfplanet.com/2016/even-faster-images-using-http2-and-progressive-jpegs/
• https://calendar.perfplanet.com/2018/dont-use-jpeg-xr-on-the-web/
Manual image optimization tools
IMAGES
86
Raster: https://squoosh.app/ SVG: https://jakearchibald.github.io/svgomg/
See also: https://imageoptim.com/mac - https://imageoptim.com/versions - https://www.sarasoueidan.com/blog/svgo-tools/
Automatic image optimization
IMAGES
87
Commit / build time
• https://jamiemason.github.io/ImageOptim-CLI/
• https://github.com/sindresorhus/gulp-imagemin
Through CDN
• Cloudinary: specialized CDN
• optimizes images on-the-fly
• serves the most suitable file type,
depending on the browser support
• Test tool:
https://webspeedtest.cloudinary.com/
• Finds poorly compressed images
• Finds images that are scaled down by
the browser
SWISS-ARMY KNIFE TOOLS
88
Fiddler: features (perf and beyond)
• Inspecting traffic
• Rewriting traffic (AutoResponder)
• Supports adding latencies to single responses
• Ad-hoc changes in production without deploying
• Allows customization with FiddlerScript and extensions
• Custom arbitrary traffic manipulations
• Including general or per-domain traffic throttling
• Redirect production traffic from Android/iOS to localhost for debugging
SWISS-ARMY KNIFE TOOLS
89
Fiddler: strong points
• Works for traffic from all web browsers 👍 with same UI
• Configure once, have same behavior in all clients
• Allows being configured as a proxy for external devices (Android, iOS) 👍
• Import/export sessions (including HAR format)
• Including importing sessions into AutoResponder
• Ask a user for HAR/SAZ file (or get it from WebPageTest), reproduce exact
experience on your machine (except dynamic JS-generated requests)
SWISS-ARMY KNIFE TOOLS
90
Fiddler: caveats
• Windows-only
• See Charles Proxy for a cross-platform alternative
• Downgrades traffic to HTTP/1.1
• Keep in mind when enabled, as this can lead to false discoveries
• Traffic throttling is easier with Charles
• Like each MITM proxy, requires some setup for HTTPS decryption
• Particularly onerous on recent iOS, Android and a bit in desktop Firefox
• FiddlerScript is JScript.NET(kind of like a mix of JavaScript and C#) and not modular
SWISS-ARMY KNIFE TOOLS
91
Fiddler in action:
changing response via FiddlerScript
SWISS-ARMY KNIFE TOOLS
92
Fiddler in action:
changing response
via AutoResponder
• Select a session; strip gzip encoding in
Inspectors tab
• Drag’n’drop the session to AutoResponder
tab > right click > Generate File
• Pro-tip: Remove `Content-Length` header
when changing response body
• You can remove all headers from response if
they are not important
EXPERIMENTAL FEATURES
93
Feature policy:
browser as a
runtime linter
• Find out about perf / privacy
issues
• Disable features for 3rd-parties
• Disable unused features to
prevent future regressions
(new developer in the team etc.)
https://featurepolicy.info/
Measuring & Browser APIs
94
MEASURING
95
Navigation Timing & Resource Timing
https://www.w3.org/TR/navigation-timing-2/ performance.getEntriesByType('navigation')[0]
MEASURING
96
Navigation Timing & Resource Timing
https://www.w3.org/TR/navigation-timing-2/
(note that many things can be happening here already, including
JS execution – thanks to streaming HTML parsers)
MEASURING
97
Navigation Timing & Resource Timing
• Other APIs
• Use performance.now() instead of Date.now()
• performance.getEntries() / performance.getEntriesByType()
• Gotchas
• Wrong values due to taking measurements before available
• Unexpected negative values or diffs (browser bugs)
• User Timing L2 has some limitations that L3 will fix
• Observer effect
• Consider using a library like https://github.com/akamai/boomerang
EXPERIMENTAL FEATURES
98
Use dev
versions of
browsers
• DevTools evolve fast, add new
features, console warnings
etc. Use Chrome Beta/Canary,
Firefox Dev/Nightly
• Tip: Press `F1` in
Chrome/Firefox DevTools to
enable many features
Usage
• Checks HTTP responses for validity
according to HTTP specs
• Finds invalid / contradictory / useless
response headers
• Analyzes caching, revalidation, content
negotiation etc.
Constraints
• Checks `robots.txt`, needs permission
for `RED` User-Agent
• Reads HTML, but doesn’t execute JS
Redbot – online HTTP linter
HTTP
99
 Practical intro to web performance - RivieraDEV 2019
 Practical intro to web performance - RivieraDEV 2019
 Practical intro to web performance - RivieraDEV 2019
 Practical intro to web performance - RivieraDEV 2019
• Response headers with syntax errors are ignored
• Some headers have non-intuitive syntax.
Easy to make a typo, or forget to escape a special
character
• Some response headers were useful a decade ago
or two, but now are implied or ignored and just
waste bandwidth
• Contradictory rules make debugging much harder
Redbot – problems it solves
HTTP
104
• Improperly configured caching -> browsers
defaulting to heuristics to decide about
cacheability
• If you’re behind a cache (load balancer / CDN etc.),
wrong config can have serious consequences
• Non-HTTPS assets might be improperly processed
by intermediaries (ISP caches etc.)
Redbot – problems it solves
HTTP
105
See also
• https://github.com/vfaronov/httpolice – a similar offline
command line tool which analyzes HAR files
Caching resources
• https://csswizardry.com/2019/03/cache-control-for-civilians/
• https://www.mnot.net/cache_docs/
Final words
FIN
106
• Tools have bugs
• Browsers have bugs and “features” and magic behaviors
• Often indistinguishable
• Your tools also have bugs or are lying to you
• Chrome: incognito = no preconnect
• Chrome automatically preconnects to top domains
[heuristics]
• Firefox 66 preconnect broken

Weitere ähnliche Inhalte

Kürzlich hochgeladen

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 WorkerThousandEyes
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceanilsa9823
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
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 ApplicationsAlberto González Trastoy
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 
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.pdfkalichargn70th171
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 

Kürzlich hochgeladen (20)

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
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
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
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
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
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 

Empfohlen

How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...DevGAMM Conference
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationErica Santiago
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellSaba Software
 
Introduction to C Programming Language
Introduction to C Programming LanguageIntroduction to C Programming Language
Introduction to C Programming LanguageSimplilearn
 

Empfohlen (20)

How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy Presentation
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
 
Introduction to C Programming Language
Introduction to C Programming LanguageIntroduction to C Programming Language
Introduction to C Programming Language
 

Practical intro to web performance - RivieraDEV 2019

  • 1. Practical intro to web performance Riviera Dev 2019 Jakub Gieryluk
  • 2. Agenda 2 Network performance ❖ Latency ❖ Waterfall ❖ Visual comparison tools Runtime performance / JavaScript ❖ Bundle analysis & Code splitting ❖ Dependencies & 3rd parties ❖ DevTools perf panel
  • 3. Why performance matters, for users 3 Money • 💲 Users with limited data plans • 🚆Users commuting • ✈ Users in roaming • Digital exclusion • poor connectivity areas • developing markets https://www.slideshare.net/Ericsson/ericsson-mobility-report-the-stress-of-streaming-delays Stress https://whatdoesmysitecost.com
  • 4. Why performance matters, for CEOs 4 https://wpostats.com
  • 5. QUICK START 5 PageSpeed Insights: Lighthouse Online + CrUX https://www.webpagetest.org/ https://developers.google.com/speed/pagespeed/insights/ Real-world analytics Key metrics Actionable items
  • 7. 7 Bandwidth = diameter of the pipe Latency = length of the pipe Latency
  • 9. NETWORK PERF / LATENCY 9 Check latency around the world https://tools.keycdn.com/performance Example: Not geo-distributed (yet) backend
  • 10. 10
  • 11. NETWORK PERF / LATENCY 11 Check latency around the world https://tools.keycdn.com/performance Example: Geo-distributed static content (via CDN)
  • 12. 12 NETWORK PERFORMANCE / LATENCY Mobile latency https://twitter.com/katiehempenius/status/1040434962472873984
  • 17. NETWORK PERFORMANCE / WATERFALL BASICS 17 The waterfall HTTP requests Time
  • 18. NETWORK PERFORMANCE / WATERFALL BASICS 18 Waterfall anti-patterns: (unused) massive subresource https://twitter.com/dougsillars/status/1114244509360062466
  • 19. NETWORK PERFORMANCE / WATERFALL BASICS 19 Waterfall anti-patterns: a lot of red https://calendar.perfplanet.com/2013/web-performance-waterfalls-from-10000-feet/ Red lines = HTTP 4xx responses (404 not found etc…)
  • 20. NETWORK PERFORMANCE / WATERFALL BASICS 20 Waterfall anti-patterns: a lot of yellow https://calendar.perfplanet.com/2013/web-performance-waterfalls-from-10000-feet/ Yellow lines = HTTP 3xx responses Particularly bad if: - At beginning - Multiple - Cross-origin RedirectsConditional responses (resource revalidation)
  • 21. The waterfall in depth 21 yBryanGoffonUnsplash using WebPageTest
  • 22. WATERFALL 22 Life of a single HTTP request https://www.igvita.com/2015/08/17/eliminating-roundtrips-with-preconnect/
  • 23. WATERFALL 23 RivieraDEV waterfall analysis https://www.webpagetest.org/waterfall.png?test=190409_JH_e24cc615c65463aaa9af8755dbbda34e&run=1&max=8.5&width=1000&cpu=1&requests=1-30&ut=1 What we can read from this waterfall? (tests done from Strasbourg, Chrome, using “3G Fast” network throttling) Test results overview page: https://www.webpagetest.org/result/190409_JH_e24cc615c65463aaa9af8755dbbda34e/
  • 27. WATERFALL 27 RivieraDEV waterfall analysis https://www.webpagetest.org/waterfall.png?test=190409_JH_e24cc615c65463aaa9af8755dbbda34e&run=1&max=12.5&width=1000&cpu=1&requests=17-56&ut=1 • Browser creates max. 6 parallel connections per domain… • …and sends requests only when there’s an unused connection Not possible to have more than 6 in-flight requests for a given domain HTTP/1.1 pattern: “stairs”
  • 28. WATERFALL 28 Connection View https://www.webpagetest.org/waterfall.png?test=190409_JH_e24cc615c65463aaa9af8755dbbda34e&run=1&width=930&type=connection Each HTTP/1.1 connection: • starts slow, • does separate congestion control HTTP/1.1 connections “fight” with each other Lots of static assets requests -> primary use case for HTTP/2
  • 29. WATERFALL 29 RivieraDEV waterfall analysis https://www.webpagetest.org/waterfall.png?test=190409_JH_e24cc615c65463aaa9af8755dbbda34e&run=1&max=8.5&width=1000&cpu=1&requests=1-30&ut=1 Back to webfonts - looking closer… CSS and actual fonts (WOFF2) are hosted on different servers. Hence DNS+TCP+TLS set up is needed before fetching them. We could do that upfront with <link rel=preconnect> in top of HTML response
  • 32. WATERFALL 32 Waterfall anti-patterns: blocking resources https://calendar.perfplanet.com/2013/web-performance-waterfalls-from-10000-feet/ In particular, beware of third-party, blocking JS (and CSS)
  • 33. VISUAL TOOLS / SPOF 33 Third-party blocking resources Let’s try to put in place some chaos… SPOF = Single Point of Failure ℹ works best in Firefox; ℹ Chrome doesn’t show failed requests; ℹ iOS agent doesn’t support feature
  • 34. VISUAL TOOLS / SPOF 34 Third-party blocking resources: filmstrip • It takes the browser 30seconds to abandon the blackholed request https://www.webpagetest.org/video/compare.php?tests=190418_KY_1a8895d28357b7620193d8b99145493c%2C190418_2C_19ed78c24c5a106745227111c731a6a2&thumbSize=150&ival=8000 • <script defer> is deferred, but still blocking the load event
  • 35. VISUAL TOOLS / SPOF 35 Third-party blocking resources: summary • Prefer async third parties than synchronous ones; load them after `load` event • Analytics, A/B testing providers, libraries, social widgets… • Calculate the risk. Does a third party provide SLA or historical uptime data? • Good sign if the lib is hosted by a reputable CDN provider • Self-host (if possible) when unsure • Perhaps have a server-side switch to start serving your own copy instead of 3rd-party • You don’t want a social widget to take down your website • When dealing with social widgets: perhaps load on demand (also good for user privacy)
  • 36. VISUAL TOOLS / COMPARING TESTS 36 Filmstrip comparison Tip: always run as a logged-in user, to not lose the test ID
  • 37. VISUAL TOOLS / COMPARING TESTS 37 Video view comparison https://www.webpagetest.org/video/view.php?id=150512_a1702c187f12d2582548c5e9be8d0b6dd308ab67
  • 38. Agenda 38 Network performance ❖ Latency ❖ Waterfall ❖ Visual comparison tools Runtime performance / JavaScript ❖ Bundle analysis & Code splitting ❖ Dependencies & 3rd parties ❖ DevTools perf panel
  • 41. Webpack bundle tools BUNDLE ANALYSIS 41https://webpack.github.io/analyse/ webpack-bundle-analyzer https://chrisbateman.github.io/webpack-visualizer/ Tip: disable module concatenation when analyzing the bundle {config: {optimization: {concatenateModules: false}}}
  • 42. Bundle tools: Bundle Buddy BUNDLE ANALYSIS 42 https://github.com/samccone/bundle-buddy Find duplicated code across the chunks
  • 44. Bundlephobia – check size of npm packages DEPENDENCIES 44 https://bundlephobia.com/
  • 45. Bundlephobia DEPENDENCIES 45 • Check for regressions before updating a dependency • Contrary, maybe there’s a new, smaller version available • Import `package.json` to analyze all your deps
  • 46. Import Cost – vscode extension DEPENDENCIES 46
  • 48. THIRD-PARTIES 48 Dealing with third parties • Visualize: • http://requestmap.herokuapp.com/ • Compare impact of different 3rd-party providers: • https://github.com/patrickhulce/third-party-web • https://www.thirdpartyweb.today • How to deal with 3rd parties: • Harry Roberts @ performance.now: https://youtu.be/bmIUYBNKja4 • Put process on adding new tags: • https://medium.com/the-telegraph-engineering/improving- third-party-web-performance-at-the-telegraph-a0a1000be5
  • 52. CHROME DEVTOOLS / PERFORMANCE PANEL 52 User Timing API performance.mark("startMark") performance.mark("endMark") performance.measure("myDiff", "startMark", "endMark") Useful to correlate network & JS activity with what the code is doing
  • 53. CHROME DEVTOOLS 53 Performance panel What do the colors mean? Golden = JS Dark violet = layout Dark green = render All else = random colors, fixed color per file https://nolanlawson.com/2018/09/25/accurately-measuring-layout-on-the-web/ Time JavaScript call stack
  • 54. CHROME DEVTOOLS / PERFORMANCE PANEL 54 JavaScript flame chart Zoom in and look for repeated patterns Mr. Obvious Tip: Disable minification
  • 55. CHROME DEVTOOLS / PERFORMANCE PANEL 55 JavaScript flame chart https://www.webpagetest.org/Reading the same cookie over and over. Expensive!
  • 56. CHROME DEVTOOLS / PERFORMANCE PANEL 56 Forced layout recalculation (reflow) https://gist.github.com/paulirish/5d52fb081b3570c81e3a More docs: https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference If part of JS call stack, multiple times = bad sign Red triangle over purple square = forced reflow Typical issues: - Reading layout props in arbitrary JS functions - Reading layout props after writing Solutions: - Read layout in requestAnimationFrame() callbacks (it’s free) - Batch DOM reads and writes, in correct order (first reads, then writes)
  • 58. EXPERIMENTAL FEATURES 58 Feature policy: browser as a linter • Feature-Policy • Enforce rules in staging environment • No need to run any tools – immediate feedback Feature-Policy: oversized-images 'none' • Feature-Policy-Report-Only • Deploy to production to gather real-world data, without enforcing https://featurepolicy.info/
  • 60. SWISS-ARMY KNIFE TOOLS / WEB DEBUGGING PROXIES 60 Fiddler https://www.webpagetest.org/
  • 61. SWISS-ARMY KNIFE TOOLS / WEB DEBUGGING PROXIES 61 Charles Proxy https://www.webpagetest.org/ Advanced throttling options Throttling also possible in Fiddler, although: • no dedicated UI (via FiddlerScript) • less sophisticated
  • 62. SWISS-ARMY KNIFE TOOLS / WEB DEBUGGING PROXIES 62 Caveats https://www.webpagetest.org/ Some proxies downgrade HTTP/2 to HTTP/1.1 which may notably affect how resources are loaded: • Fiddler • BrowserStack • … Be careful when benchmarking / comparing. ⚠
  • 64. THE ULTIMATE TOOLS 64 View source (CTRL-U) Watch out for: - random "no one knows why we have this stuff” - massive inline base64 content - whitespace and comments not stripped out - duplicated code or markup etc.
  • 65. THE ULTIMATE TOOLS 65 Difftool Beautify and diff your bundles before shipping to production Find unexpected issues, like: - Non-deterministic build which affects client-side cache reuse - Regressions when updating tools or dependencies
  • 66. Summary 66 Network performance ❖ Latency ❖ Waterfall ❖ Visual comparison tools Runtime performance / JavaScript ❖ Bundle analysis & Code splitting ❖ Dependencies & 3rd parties ❖ DevTools perf panel
  • 67. LEARN MORE 67 Understanding the building blocks • High Performance Browser Networking • Read for free at https://hpbn.co • High Performance Networking in Chrome • https://www.aosabook.org/en/posa/high-performance-networking-in-chrome.html • Check my blog article • https://calendar.perfplanet.com/2018/getting-started-with-web-performance- 2019-beginners-guide/ • More perf-oriented articles, books, slides, videos: • https://calendar.perfplanet.com • https://www.perf-tooling.today/
  • 70. THE ULTIMATE TOOL 70 Test in production Some insights can only be drawn from A/B testing in production. You can never simulate all real- world traffic patterns in the lab. ➢ Push to prod ➢ gather RUM data ➢ iterate
  • 71. Aspects of front-end performance 71 Scrolling & animations performance ⌚Initial load time Responding to user input 💲Cost RuntimeLoading Indirect 🔋Battery life
  • 72. CHROME DEVTOOLS 72 Runtime code coverage tool • Can give idea about code splitting opportunities • May find some dead files
  • 73. WATERFALL 73 Waterfall anti-patterns: network silence • Network silence = opportunity for an early fetch https://hpbn.co/mobile-networks/ https://hpbn.co/optimizing-for-mobile-networks/ “[In Pandora music streaming application], analyticsbeacons [sent every 60 seconds] accounted for 0.2% bytes and 46% power consumption” • Also, grouped requests are more battery-efficient
  • 74. SWISS-ARMY KNIFE TOOLS 74 WebPageTest: killer features • Testing from all over the world • “the site is slow in Brazil” (maybe slow local ad?) • “the site is down in Indonesia” • Can capture response bodies • All kinds of browsers and devices • Same UI regardless of browser tested • Permanent, shareable test results • WPT URL = proof of bug / problem
  • 75. SWISS-ARMY KNIFE TOOLS 75 WebPageTest: more strong points • Can gather lots of low-level data • tcpdump, advanced HTTP/2 info, Chrome timeline, Chrome tracing data… • Data can be exported in HAR format • Automation possible • REST API, npm package (https://www.npmjs.com/package/webpagetest) • Free, open source, not for profit (PHP, https://github.com/WPO-Foundation/webpagetest)
  • 76. SWISS-ARMY KNIFE TOOLS 76 WebPageTest: caveats • Public instance = test only public websites (production) • Although you can set up a private instance • Small differences in detail level between browsers • Most notably: some data can’t be gathered on iOS
  • 77. WEBPAGETEST: EVEN MORE FEATURES 77 Hidden features • CPU throttling via URL param • CPU throttling via mobile emulation • Custom waterfall URL params: • &width=2000 (width of waterfall in pixels) • &max=30 (width of waterfall in seconds) • &ut=1 (show User Timing marks) • … • Several more “hidden features” via URL params (check up docs): high quality images, experimental timings etc. • Just click around any links on WebPageTest.org to discover features • See also: • https://deanhume.com/ten-things-you-didnt-know- about-webpagetest-org/ (https://github.com/WPO-Foundation/webpagetest/blob/master/www/settings/mobile_devices.ini)
  • 78. WATERFALL 78 Waterfall good patterns: preconnect “gaps” …but since connection was initiated before with <link rel=preconnect>, it avoids 400ms penalty Browser starts sending actual requests for subresources here… https://www.igvita.com/2015/08/17/eliminating-roundtrips-with-preconnect/
  • 79. WATERFALL BASICS 79 Bonus: keep your favicons at bay Put a small 16x16 favicon.ico in the root of the domain Make sure your 404/500 pages are small and self-contained https://twitter.com/dougsillars/status/1123460280581853186
  • 81. WEBPAGETEST: COMPARING TESTS 81 Visual comparison • Useful for “before / after” comparisons after shipping code changes • Re-run the tests multiple times, compare graphs with the waterfall, to not draw accidental conclusions
  • 82. Compare CDNs CONTENT DELIVERY NETWORKS 82 https://www.cdnperf.com/cdn-compare http://cdncomparison.com/
  • 83. COMPRESSION 83 Consider brotli for static content • Supported by all modern browsers (~90%), fall back to gzip • Decompression speed on par with gzip • Compression speed: slow on level 10/11 (not suitable for dynamic content) • Supported by some CDNs (but not all of them yet) • Some CDNs can recompress to brotli even if your server does not serve brotli • You can build static brotli assets at build time https://tools.paulcalvano.com/compression.php https://paulcalvano.com/index.php/2018/07/25/brotli-compression-how-much-will-it-reduce-your-content/
  • 85. Compression is not everything IMAGES 85 • Modern JPEG encoders and decoders are very good and highly optimized • WEBP does not support progressive rendering, contrary to JPEG • JPEG-XR: uses much more CPU than JPEG, and is IE/EdgeHTML-only • WEBP: still not supported in Safari, and (reluctantly) just landed in Firefox • Verdict: • stick to JPEG, compress better (upgrade your encoder), use progressive JPEG • use lossless WEBP instead of PNG if not afraid of complexity • Kornel Lesiński | Image Optimization | performance.now() 2018 (https://youtu.be/jTXhYj2aCDU) • Tobias Baldauf: • https://calendar.perfplanet.com/2016/even-faster-images-using-http2-and-progressive-jpegs/ • https://calendar.perfplanet.com/2018/dont-use-jpeg-xr-on-the-web/
  • 86. Manual image optimization tools IMAGES 86 Raster: https://squoosh.app/ SVG: https://jakearchibald.github.io/svgomg/ See also: https://imageoptim.com/mac - https://imageoptim.com/versions - https://www.sarasoueidan.com/blog/svgo-tools/
  • 87. Automatic image optimization IMAGES 87 Commit / build time • https://jamiemason.github.io/ImageOptim-CLI/ • https://github.com/sindresorhus/gulp-imagemin Through CDN • Cloudinary: specialized CDN • optimizes images on-the-fly • serves the most suitable file type, depending on the browser support • Test tool: https://webspeedtest.cloudinary.com/ • Finds poorly compressed images • Finds images that are scaled down by the browser
  • 88. SWISS-ARMY KNIFE TOOLS 88 Fiddler: features (perf and beyond) • Inspecting traffic • Rewriting traffic (AutoResponder) • Supports adding latencies to single responses • Ad-hoc changes in production without deploying • Allows customization with FiddlerScript and extensions • Custom arbitrary traffic manipulations • Including general or per-domain traffic throttling • Redirect production traffic from Android/iOS to localhost for debugging
  • 89. SWISS-ARMY KNIFE TOOLS 89 Fiddler: strong points • Works for traffic from all web browsers 👍 with same UI • Configure once, have same behavior in all clients • Allows being configured as a proxy for external devices (Android, iOS) 👍 • Import/export sessions (including HAR format) • Including importing sessions into AutoResponder • Ask a user for HAR/SAZ file (or get it from WebPageTest), reproduce exact experience on your machine (except dynamic JS-generated requests)
  • 90. SWISS-ARMY KNIFE TOOLS 90 Fiddler: caveats • Windows-only • See Charles Proxy for a cross-platform alternative • Downgrades traffic to HTTP/1.1 • Keep in mind when enabled, as this can lead to false discoveries • Traffic throttling is easier with Charles • Like each MITM proxy, requires some setup for HTTPS decryption • Particularly onerous on recent iOS, Android and a bit in desktop Firefox • FiddlerScript is JScript.NET(kind of like a mix of JavaScript and C#) and not modular
  • 91. SWISS-ARMY KNIFE TOOLS 91 Fiddler in action: changing response via FiddlerScript
  • 92. SWISS-ARMY KNIFE TOOLS 92 Fiddler in action: changing response via AutoResponder • Select a session; strip gzip encoding in Inspectors tab • Drag’n’drop the session to AutoResponder tab > right click > Generate File • Pro-tip: Remove `Content-Length` header when changing response body • You can remove all headers from response if they are not important
  • 93. EXPERIMENTAL FEATURES 93 Feature policy: browser as a runtime linter • Find out about perf / privacy issues • Disable features for 3rd-parties • Disable unused features to prevent future regressions (new developer in the team etc.) https://featurepolicy.info/
  • 95. MEASURING 95 Navigation Timing & Resource Timing https://www.w3.org/TR/navigation-timing-2/ performance.getEntriesByType('navigation')[0]
  • 96. MEASURING 96 Navigation Timing & Resource Timing https://www.w3.org/TR/navigation-timing-2/ (note that many things can be happening here already, including JS execution – thanks to streaming HTML parsers)
  • 97. MEASURING 97 Navigation Timing & Resource Timing • Other APIs • Use performance.now() instead of Date.now() • performance.getEntries() / performance.getEntriesByType() • Gotchas • Wrong values due to taking measurements before available • Unexpected negative values or diffs (browser bugs) • User Timing L2 has some limitations that L3 will fix • Observer effect • Consider using a library like https://github.com/akamai/boomerang
  • 98. EXPERIMENTAL FEATURES 98 Use dev versions of browsers • DevTools evolve fast, add new features, console warnings etc. Use Chrome Beta/Canary, Firefox Dev/Nightly • Tip: Press `F1` in Chrome/Firefox DevTools to enable many features
  • 99. Usage • Checks HTTP responses for validity according to HTTP specs • Finds invalid / contradictory / useless response headers • Analyzes caching, revalidation, content negotiation etc. Constraints • Checks `robots.txt`, needs permission for `RED` User-Agent • Reads HTML, but doesn’t execute JS Redbot – online HTTP linter HTTP 99
  • 104. • Response headers with syntax errors are ignored • Some headers have non-intuitive syntax. Easy to make a typo, or forget to escape a special character • Some response headers were useful a decade ago or two, but now are implied or ignored and just waste bandwidth • Contradictory rules make debugging much harder Redbot – problems it solves HTTP 104
  • 105. • Improperly configured caching -> browsers defaulting to heuristics to decide about cacheability • If you’re behind a cache (load balancer / CDN etc.), wrong config can have serious consequences • Non-HTTPS assets might be improperly processed by intermediaries (ISP caches etc.) Redbot – problems it solves HTTP 105 See also • https://github.com/vfaronov/httpolice – a similar offline command line tool which analyzes HAR files Caching resources • https://csswizardry.com/2019/03/cache-control-for-civilians/ • https://www.mnot.net/cache_docs/
  • 106. Final words FIN 106 • Tools have bugs • Browsers have bugs and “features” and magic behaviors • Often indistinguishable • Your tools also have bugs or are lying to you • Chrome: incognito = no preconnect • Chrome automatically preconnects to top domains [heuristics] • Firefox 66 preconnect broken