SlideShare uma empresa Scribd logo
1 de 26
Baixar para ler offline
Web Performance Optimization
Just one second please !
Maxime Lemaitre
• Introduction
• Goals & Objectives
• Why performance matters ?
• Web application delivery chain
• Some rules & Some tools
• Next Steps
2
Agenda
• Evangelize performance and explain why it is
important
– Have a performance culture !
– Have a performance plan !
• Do performance tests, setup production metrics
& KPIs, do monitoring and reports
• And of course, increase responsiveness of
your website !
3
Goals & Objectives
• We won’t talk (today) about
– Load Testing
– How to write efficient data acces queries
– Which is the fastest between C#, Java or Php ?
– ….
4
Web performance matters ?
short history : from a tech challenge to a differentiator
• First decade of the web's existence (1993 – 2003).
– Performance focus on :
• Optimize website code (simple scripts)
• Improve data access (use indexes, fewer queries, …)
• Reduce packet loss and retransmission
• Pushing hardware limitations (CPU, Memory, IO…)
 Not focused on browser display speed
• An emerging industry (2004-2009)
– Steve Souders (Yahoo), pioneer in « web performance optimization »
• 85% of the time that it takes to download and view a website is controlled by the front-end structure
• 10 predictions (fast by default, Visibility into the browser, monitoring, mobile, … => a differientator)
– Velocity 2009 Conference is a key event in web performance
• Many case studies from Microsoft, AOL, Amazon, ShopZilla , …
• Not only for techs but also other parts of the organization (management, marketing, sales, …)
• Last years (2010 – Now)
– Google : « we’ve decided to take site speed into account in our search rankings »
– For an ecommerce website, it’s been proven that speed = money
– Trend : make the web faster because web pages are bigger and more complex than ever
Bing : page that was 2 seconds slower resulted in a 4.3% drop in revenue/user
Yahoo : 400 milliseconds slowdown resulted in a 5-9% drop in full-page traffic
Google : 400 millisecond delay caused a 0.59% drop in searches/user
Even after the delay was removed, these users still had -0.21% fewer searches
 slower user experience affects long term behavior
AOL : page views drop off as page load times increase
Mozilla : Shaving 2.2 seconds off their home page increased downloads by 15.4%
ShopZilla : 5 second speed up
• 25% increase in page views
• 7-12% increase in revenue
• 50% reduction in hardware
Amazon : Every 100ms delay costs 1% of sales
5
Web performance matters ?
case studies in web industry
6
Why performance matters ?
for customers (source : Velocity Conf, Aberdeen, Gomez, Akamai)
Is Web Performance important for your company ?
• Are you in a competitive industry ?
• Do you sell something ?
• Does another website sell basically the « same
thing »
• Is is important to attract new users ?
• Is SEO important for you ?
• Does you marketing team wants to show
everything on your homepage ?
• ….
• Better user experience
– Customers will be happier and will tell others how good we are
– Keep them more focused on our content, rather than waiting for scripts/images
• Improve SEO
– One of the 200 signals used in Google Rankings
• Mobile performance : a new challenge
– Tablets/Smartphones are slower than desktops
– Much more limits and latency
• Improve conversion rate
– every second win, will boost customer confidence and trust in your site
• Reduce costs
– Bandwidth
– Less Hardware/Servers
• Better Scalability
7
Why performance matters ?
for techs & devs
• Final page speed is a depending on
– User computer and browser
– User current activity
– User network connection/ISP
– Internet Backbone
– Web Hosting location
– HTML (JS, CSS, Images, ..)
– Third-Party libraries / Ads / Analytics
– CDN
– Firewall/Load balancer
– Web Page / server code
– Frontend servers / Web Farms
– API/WebServices Calls
– Middle Tier / Backend servers
– Database
– …
8
Web Application Delivery Chain
performance at the bottom line
Do not trust that every user have a
Core i5 CPU with 8 Go Ram on
Windows 7 on a 100 Mbits/s
connection ! It’s false !
Try to test performance on slowest
computers and slowest bandwidth
80-90% of the end-user response time is spent on the frontend !
9
Web Performance
where to start ?
“We should forget about small efficiencies, say
about 97% of the time: premature optimization is
the root of all evil”
Donald Knuth
Never automatically apply tips, best
practices & improvements without
checking before/after the changes.
=> Profiling and Micro-Benchmark
10
Important Note
before going deeper
• Yslow & PageSpeed
– Proven front-end best practices & recommandations
– Very popular & easy to install (browser extension or online service)
– Current : Yslow (23 best practices) & PageSpeed (31 rules)
• But …
– does not look at our Infrastructure, Application Performance, CDN, DB Queries,
datacenter distribution, load balancing, …
– does not include the actual speed of the tested page !
– Lower scores/grades can load faster than Higher scores
11
Web Performance auditors
Google PageSpeed & YSlow
Html Parsing Pipeline
how page loads
• Loading a page is not as simple as
dowloading a single file
– Involve dynamic ressources
– Cascading stylesheet
– Javascripts
• Common performance issue :
Because JavaScript code can alter the content
and layout of a web page, the browser delays
rendering any content that follows a script tag
until that script has been downloaded, parsed and
executed.
Many browsers block the downloading of
resources referenced in the document after
scripts until those scripts are downloaded and
executed
12
Round-trip time (RTT) is the time it takes for a client to send a request and the
server to send a response over the network, not including the time required for
data transfer.
• Minimize redirects
• Use HTTP Cache Headers
• Avoid bad/duplicated/useless requests
• Combine external JavaScript & Css
• Combine images using CSS sprites
• Optimize the order of styles and scripts
• Prefer asynchronous resources (Async or Deferred JS)
• Parallelize downloads across hostnames
• …
13
Golden Rule #1
minimize round-trip times
Downloading 50 B always have a cost !
14
Less than 6 connections per hostname
Limit number of requests
Amount of data sent in each server response can add significant latency,
especially in areas where bandwidth is constrained
• Enable Gzip compression
• Limit HTTP Headers (Uncompressed)
• Remove unused CSS/JS/comments
• Avoid inline/embedded styles and scripts
• Minify CSS & JavaScript
• Minify HTML
• Optimize, Optimize, Optimize images
• Serve scaled images
• …
15
Golden Rule #2
Minimize Request Overhead & payload size
Web images take up the majority of the download time in most web pages
• Choose an appropriate file format (JPG, PNG, GIF)
– For JPG, use progressive image (demo)
• Optimize image size
– Crop whitespace, Remove useless data (color palette, EXIFF, ..)
– Apply a Lossless compressor (OptiPNG or PNGOUT)
• Try to apply width and height for each <img> tag
– Avoid unnecessary repaints and reflows during rendering
– But do not use it to scale images : server already scaled images
• Use Sprites (see )
– reduced the number of HTTP requests and avoided any potential delay
• Use Data-URI
– inline the content of the URI you would normally point to
16
Images Optimizations
Web images take up the majority of the download time in most web pages
Once resources have been downloaded to the client, the browser still needs to
load, interpret, and render HTML, CSS, and JavaScript code.
• Limit Number of DOM elements
• Defer loading of JavaScript and Third party components
• Avoid DOM alterations
• Styles at top, Scripts at bottom
• Use efficient CSS selectors & Avoid CSS expressions
• Specify image dimensions
• Specify a character set
• Check Javascript and especially Jquery performance
• …
Google SpeedTracer could help you (home)
low level instrumentation points inside Chrome
17
Golden Rule #3
Optimize Browser rendering
• Styles are downloaded and applied when rendering
Browsers block rendering a web page until all external stylesheets have been
downloaded
- Put styles in head allow the browser to progressively render the page
- Put styles in body can cause repaints & reflows (demo)
• Scripts are downloaded, parsed and executed
The page has to wait for the script blocks to be fully downloaded, parsed and
executed before being able to parse and render any following HTML
– Block the rendering of any following HTML
– Block the downloading of resources referenced in the document after the script
18
Quick Focus : Styles & Scripts
Why is it so important to optimize styles & scripts?
What is the page speed (with/without Cache) for this
ridicoulous page ?
19
Scripts
Stop paying the Script tax
• First View
• Repeat View
• Repeat View (on my laptop in power saving mode)
20
Scripts
Stop paying the Script tax²
Even from cache (no
download), it takes a
few ms to parse &
exec Scripts.
Not so fast …
Easy to write JavaScript …
…and easy to write really really bad JavaScript and slow down page load
• Minimal recommandations
– Always use the latest version of Jquery (test)
jQuery team is always looking to bring improvements
– Use appropriate selections (test)
Many ways to select an element, but they don’t have the same performance
Id < Tag < Class
– Do not repeat selectors & abuse chain
Cache results & object
– Use for instead of foreach (test)
Native JavaScript functions is always faster
– Do use Jquery … if possible (test)
Native JavaScript functions is always faster²
• Continue Reading here
21
Jquery Performance
with great power comes great responsibility (Spiderman)
22
How to mesure/improve performance ?
hopefully there are many tools !
• Sql Profiler
• Graphite
• Web Developpers
Tools
• WebPageTest.org
• PhantomJS
• Selenium Web Driver
• Har Viewer
• Google Page Speed
• Yslow
• dotTrace
• Pingdom tools
• Fiddler
• jsPerf
• MVC MiniProfiler
• dynaTrace
• Google Analytics
• IIS & Apache Logs
• Performance coutners
• Visual Studio Web
Perf
• Gtmetrix
• Micro Benchmark
• Google Site Speed
• Centreon
• New Relic
• Node.js
• DB Provider Client
Statistics
• SpeedTrace
• Headless Browsers
• Boomerang.js
• MVC Bundles
• Optipng
• Glimpse
• SpriteMe
• Firebug
• Your own tool here!
• Learn how to improve Web performance
• Investigate available performance tools
– Dev customs tools if necessary
• Automate performance testing
• …
It’s only the beginning !
PS : And of course, check Performance of your Web Site 
23
Next Steps
• https://developers.google.com/speed/
• http://developer.yahoo.com/performance/
• http://www.webpagetest.org/
• http://ie.microsoft.com/testdrive/HTML5/DOMContentLoaded/Default.html
• http://www.softwareishard.com/har/viewer/ (HAR file viewer)
• https://github.com/blog/1252-how-we-keep-github-fast (github performance)
• http://www.whatwg.org/specs/web-apps/current-
work/multipage/parsing.html#parsing (Parsing HTML Documents)
• http://www.stevesouders.com/blog/2010/05/07/wpo-web-performance-
optimization/ (must read)
• http://dmix.ca/2010/01/the-marketing-of-sports-betting-sites/ (betting
industry)
• http://sixrevisions.com/tools/8-excellent-tools-for-optimizing-your-images/
• http://www.browserscope.org
• http://browserdiet.com/
• http://gtmetrix.com/
24
Appendices
Yslow Best Practices
Add Expires headers
Avoid AlphaImageLoader filter
Avoid CSS expressions
Avoid empty src or href
Avoid HTTP 404 (Not Found) error
Avoid URL redirects
Compress components with gzip
Configure entity tags (ETags)
Do not scale images in HTML
Make AJAX cacheable
Make favicon small and cacheable
Make fewer HTTP requests
Make JavaScript and CSS external
Minify JavaScript and CSS
Put CSS at the top
Put JavaScript at bottom
Reduce cookie size
Reduce DNS lookups
Reduce the number of DOM elements
Remove duplicate JavaScript and CSS
Use a Content Delivery Network (CDN)
Use cookie-free domains
Use GET for AJAX requests
25
Avoid a character set in the meta tag
Avoid bad requests
Avoid CSS @import
Avoid CSS expressions (deprecated)
Avoid document.write
Avoid Flash on mobile webpages
Avoid landing page redirects
Combine external CSS
Combine external JavaScript
Combine images using CSS sprites
Defer loading of JavaScript
Defer parsing of JavaScript
Enable gzip compression
Enable Keep-Alive
Improve server response time
Inline small CSS
Inline small JavaScript
Leverage browser caching
Leverage proxy caching (deprecated)
Make landing page redirects cacheable
Minify CSS
Minify HTML
Minify JavaScript
Minimize cookie size (deprecated)
Minimize DNS lookups
Minimize redirects
Minimize request size
Optimize images
Optimize the order of styles and scripts
Parallelize downloads across hostnames
Prefer asynchronous resources
Put CSS in the document head
Remove query strings from static resources
Remove unused CSS
Serve resources from a consistent URL
Serve scaled images
Serve static content from a cookieless domain
Specify a cache validator
Specify a character set early
Specify a Vary: Accept-Encoding header
Specify a viewport for mobile browsers
Specify image dimensions
Use an application cache
Use efficient CSS selectors
26
PageSpeed Rules

Mais conteúdo relacionado

Semelhante a Web Performance Optimization (WPO)

Website Performance
Website PerformanceWebsite Performance
Website PerformanceHugo Fonseca
 
Mage uk-2013-1345-chris-wells-131030120920-phpapp01
Mage uk-2013-1345-chris-wells-131030120920-phpapp01Mage uk-2013-1345-chris-wells-131030120920-phpapp01
Mage uk-2013-1345-chris-wells-131030120920-phpapp01Karla Mae Tejon
 
The Importance of Site Performance and Simple Steps to Achieve It
The Importance of Site Performance and Simple Steps to Achieve ItThe Importance of Site Performance and Simple Steps to Achieve It
The Importance of Site Performance and Simple Steps to Achieve ItNexcess.net LLC
 
Cvcc performance tuning
Cvcc performance tuningCvcc performance tuning
Cvcc performance tuningJohn McCaffrey
 
Why your slow loading website is costing you sales and how to fix it
Why your slow loading website is costing you sales and how to fix itWhy your slow loading website is costing you sales and how to fix it
Why your slow loading website is costing you sales and how to fix itRobert Flournoy
 
Why your slow loading website is costing you sales and how to fix it
Why your slow loading website is costing you sales and how to fix itWhy your slow loading website is costing you sales and how to fix it
Why your slow loading website is costing you sales and how to fix itstrommen
 
Shopzilla - Performance By Design
Shopzilla - Performance By DesignShopzilla - Performance By Design
Shopzilla - Performance By DesignTim Morrow
 
10 things you can do to speed up your web app today stir trek edition
10 things you can do to speed up your web app today   stir trek edition10 things you can do to speed up your web app today   stir trek edition
10 things you can do to speed up your web app today stir trek editionChris Love
 
20 tips for website performance
20 tips for website performance20 tips for website performance
20 tips for website performanceAndrew Siemer
 
Make Drupal Run Fast - increase page load speed
Make Drupal Run Fast - increase page load speedMake Drupal Run Fast - increase page load speed
Make Drupal Run Fast - increase page load speedAndy Kucharski
 
PAC 2019 virtual Mark Tomlinson
PAC 2019 virtual Mark TomlinsonPAC 2019 virtual Mark Tomlinson
PAC 2019 virtual Mark TomlinsonNeotys
 
Supercharge Application Delivery to Satisfy Users
Supercharge Application Delivery to Satisfy UsersSupercharge Application Delivery to Satisfy Users
Supercharge Application Delivery to Satisfy UsersNGINX, Inc.
 
SharePoint Saturday The Conference 2011 - SP2010 Performance
SharePoint Saturday The Conference 2011 - SP2010 PerformanceSharePoint Saturday The Conference 2011 - SP2010 Performance
SharePoint Saturday The Conference 2011 - SP2010 PerformanceBrian Culver
 
Imagine 2014: The Devil is in the Details How to Optimize Magento Hosting to ...
Imagine 2014: The Devil is in the Details How to Optimize Magento Hosting to ...Imagine 2014: The Devil is in the Details How to Optimize Magento Hosting to ...
Imagine 2014: The Devil is in the Details How to Optimize Magento Hosting to ...George White
 
Breaking the Speed Limit: Faster Websites Win
Breaking the Speed Limit: Faster Websites WinBreaking the Speed Limit: Faster Websites Win
Breaking the Speed Limit: Faster Websites WinJonathan Hochman
 
How_To_Soup_Up_Your_Farm
How_To_Soup_Up_Your_FarmHow_To_Soup_Up_Your_Farm
How_To_Soup_Up_Your_FarmNigel Price
 
From Zero to Performance Hero in Minutes - Agile Testing Days 2014 Potsdam
From Zero to Performance Hero in Minutes - Agile Testing Days 2014 PotsdamFrom Zero to Performance Hero in Minutes - Agile Testing Days 2014 Potsdam
From Zero to Performance Hero in Minutes - Agile Testing Days 2014 PotsdamAndreas Grabner
 

Semelhante a Web Performance Optimization (WPO) (20)

Website Performance
Website PerformanceWebsite Performance
Website Performance
 
Salesforce Performance hacks - Client Side
Salesforce Performance hacks - Client SideSalesforce Performance hacks - Client Side
Salesforce Performance hacks - Client Side
 
Mage uk-2013-1345-chris-wells-131030120920-phpapp01
Mage uk-2013-1345-chris-wells-131030120920-phpapp01Mage uk-2013-1345-chris-wells-131030120920-phpapp01
Mage uk-2013-1345-chris-wells-131030120920-phpapp01
 
The Importance of Site Performance and Simple Steps to Achieve It
The Importance of Site Performance and Simple Steps to Achieve ItThe Importance of Site Performance and Simple Steps to Achieve It
The Importance of Site Performance and Simple Steps to Achieve It
 
Cvcc performance tuning
Cvcc performance tuningCvcc performance tuning
Cvcc performance tuning
 
Why your slow loading website is costing you sales and how to fix it
Why your slow loading website is costing you sales and how to fix itWhy your slow loading website is costing you sales and how to fix it
Why your slow loading website is costing you sales and how to fix it
 
Why your slow loading website is costing you sales and how to fix it
Why your slow loading website is costing you sales and how to fix itWhy your slow loading website is costing you sales and how to fix it
Why your slow loading website is costing you sales and how to fix it
 
Shopzilla - Performance By Design
Shopzilla - Performance By DesignShopzilla - Performance By Design
Shopzilla - Performance By Design
 
10 things you can do to speed up your web app today stir trek edition
10 things you can do to speed up your web app today   stir trek edition10 things you can do to speed up your web app today   stir trek edition
10 things you can do to speed up your web app today stir trek edition
 
Scalability and performance for e commerce
Scalability and performance for e commerceScalability and performance for e commerce
Scalability and performance for e commerce
 
20 tips for website performance
20 tips for website performance20 tips for website performance
20 tips for website performance
 
Make Drupal Run Fast - increase page load speed
Make Drupal Run Fast - increase page load speedMake Drupal Run Fast - increase page load speed
Make Drupal Run Fast - increase page load speed
 
PAC 2019 virtual Mark Tomlinson
PAC 2019 virtual Mark TomlinsonPAC 2019 virtual Mark Tomlinson
PAC 2019 virtual Mark Tomlinson
 
Supercharge Application Delivery to Satisfy Users
Supercharge Application Delivery to Satisfy UsersSupercharge Application Delivery to Satisfy Users
Supercharge Application Delivery to Satisfy Users
 
SharePoint Saturday The Conference 2011 - SP2010 Performance
SharePoint Saturday The Conference 2011 - SP2010 PerformanceSharePoint Saturday The Conference 2011 - SP2010 Performance
SharePoint Saturday The Conference 2011 - SP2010 Performance
 
Imagine 2014: The Devil is in the Details How to Optimize Magento Hosting to ...
Imagine 2014: The Devil is in the Details How to Optimize Magento Hosting to ...Imagine 2014: The Devil is in the Details How to Optimize Magento Hosting to ...
Imagine 2014: The Devil is in the Details How to Optimize Magento Hosting to ...
 
Breaking the Speed Limit: Faster Websites Win
Breaking the Speed Limit: Faster Websites WinBreaking the Speed Limit: Faster Websites Win
Breaking the Speed Limit: Faster Websites Win
 
How_To_Soup_Up_Your_Farm
How_To_Soup_Up_Your_FarmHow_To_Soup_Up_Your_Farm
How_To_Soup_Up_Your_Farm
 
From Zero to Performance Hero in Minutes - Agile Testing Days 2014 Potsdam
From Zero to Performance Hero in Minutes - Agile Testing Days 2014 PotsdamFrom Zero to Performance Hero in Minutes - Agile Testing Days 2014 Potsdam
From Zero to Performance Hero in Minutes - Agile Testing Days 2014 Potsdam
 
Web performance
Web performanceWeb performance
Web performance
 

Mais de Betclic Everest Group Tech Team

Mais de Betclic Everest Group Tech Team (20)

Mini training - Reactive Extensions (Rx)
Mini training - Reactive Extensions (Rx)Mini training - Reactive Extensions (Rx)
Mini training - Reactive Extensions (Rx)
 
Mini training - Moving to xUnit.net
Mini training - Moving to xUnit.netMini training - Moving to xUnit.net
Mini training - Moving to xUnit.net
 
Mini training - Introduction to Microsoft Azure Storage
Mini training - Introduction to Microsoft Azure StorageMini training - Introduction to Microsoft Azure Storage
Mini training - Introduction to Microsoft Azure Storage
 
Akka.Net
Akka.NetAkka.Net
Akka.Net
 
Mini training- Scenario Driven Design
Mini training- Scenario Driven DesignMini training- Scenario Driven Design
Mini training- Scenario Driven Design
 
Email Management in Outlook
Email Management in OutlookEmail Management in Outlook
Email Management in Outlook
 
Mini-Training: SSO with Windows Identity Foundation
Mini-Training: SSO with Windows Identity FoundationMini-Training: SSO with Windows Identity Foundation
Mini-Training: SSO with Windows Identity Foundation
 
Training - What is Performance ?
Training  - What is Performance ?Training  - What is Performance ?
Training - What is Performance ?
 
Mini-Training: Docker
Mini-Training: DockerMini-Training: Docker
Mini-Training: Docker
 
Mini Training Flyway
Mini Training FlywayMini Training Flyway
Mini Training Flyway
 
Mini-Training: NDepend
Mini-Training: NDependMini-Training: NDepend
Mini-Training: NDepend
 
Management 3.0 Workout
Management 3.0 WorkoutManagement 3.0 Workout
Management 3.0 Workout
 
Lean for Business
Lean for BusinessLean for Business
Lean for Business
 
Short-Training asp.net vNext
Short-Training asp.net vNextShort-Training asp.net vNext
Short-Training asp.net vNext
 
Training – Going Async
Training – Going AsyncTraining – Going Async
Training – Going Async
 
Mini-Training: Mobile UX Trends
Mini-Training: Mobile UX TrendsMini-Training: Mobile UX Trends
Mini-Training: Mobile UX Trends
 
Training: MVVM Pattern
Training: MVVM PatternTraining: MVVM Pattern
Training: MVVM Pattern
 
Mini-training: Let’s Git It!
Mini-training: Let’s Git It!Mini-training: Let’s Git It!
Mini-training: Let’s Git It!
 
AngularJS Best Practices
AngularJS Best PracticesAngularJS Best Practices
AngularJS Best Practices
 
Mini-Training: Roslyn
Mini-Training: RoslynMini-Training: Roslyn
Mini-Training: Roslyn
 

Último

Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...panagenda
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterMydbops
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI AgeCprime
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Strongerpanagenda
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesThousandEyes
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 

Último (20)

Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI Age
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 

Web Performance Optimization (WPO)

  • 1. Web Performance Optimization Just one second please ! Maxime Lemaitre
  • 2. • Introduction • Goals & Objectives • Why performance matters ? • Web application delivery chain • Some rules & Some tools • Next Steps 2 Agenda
  • 3. • Evangelize performance and explain why it is important – Have a performance culture ! – Have a performance plan ! • Do performance tests, setup production metrics & KPIs, do monitoring and reports • And of course, increase responsiveness of your website ! 3 Goals & Objectives • We won’t talk (today) about – Load Testing – How to write efficient data acces queries – Which is the fastest between C#, Java or Php ? – ….
  • 4. 4 Web performance matters ? short history : from a tech challenge to a differentiator • First decade of the web's existence (1993 – 2003). – Performance focus on : • Optimize website code (simple scripts) • Improve data access (use indexes, fewer queries, …) • Reduce packet loss and retransmission • Pushing hardware limitations (CPU, Memory, IO…)  Not focused on browser display speed • An emerging industry (2004-2009) – Steve Souders (Yahoo), pioneer in « web performance optimization » • 85% of the time that it takes to download and view a website is controlled by the front-end structure • 10 predictions (fast by default, Visibility into the browser, monitoring, mobile, … => a differientator) – Velocity 2009 Conference is a key event in web performance • Many case studies from Microsoft, AOL, Amazon, ShopZilla , … • Not only for techs but also other parts of the organization (management, marketing, sales, …) • Last years (2010 – Now) – Google : « we’ve decided to take site speed into account in our search rankings » – For an ecommerce website, it’s been proven that speed = money – Trend : make the web faster because web pages are bigger and more complex than ever
  • 5. Bing : page that was 2 seconds slower resulted in a 4.3% drop in revenue/user Yahoo : 400 milliseconds slowdown resulted in a 5-9% drop in full-page traffic Google : 400 millisecond delay caused a 0.59% drop in searches/user Even after the delay was removed, these users still had -0.21% fewer searches  slower user experience affects long term behavior AOL : page views drop off as page load times increase Mozilla : Shaving 2.2 seconds off their home page increased downloads by 15.4% ShopZilla : 5 second speed up • 25% increase in page views • 7-12% increase in revenue • 50% reduction in hardware Amazon : Every 100ms delay costs 1% of sales 5 Web performance matters ? case studies in web industry
  • 6. 6 Why performance matters ? for customers (source : Velocity Conf, Aberdeen, Gomez, Akamai) Is Web Performance important for your company ? • Are you in a competitive industry ? • Do you sell something ? • Does another website sell basically the « same thing » • Is is important to attract new users ? • Is SEO important for you ? • Does you marketing team wants to show everything on your homepage ? • ….
  • 7. • Better user experience – Customers will be happier and will tell others how good we are – Keep them more focused on our content, rather than waiting for scripts/images • Improve SEO – One of the 200 signals used in Google Rankings • Mobile performance : a new challenge – Tablets/Smartphones are slower than desktops – Much more limits and latency • Improve conversion rate – every second win, will boost customer confidence and trust in your site • Reduce costs – Bandwidth – Less Hardware/Servers • Better Scalability 7 Why performance matters ? for techs & devs
  • 8. • Final page speed is a depending on – User computer and browser – User current activity – User network connection/ISP – Internet Backbone – Web Hosting location – HTML (JS, CSS, Images, ..) – Third-Party libraries / Ads / Analytics – CDN – Firewall/Load balancer – Web Page / server code – Frontend servers / Web Farms – API/WebServices Calls – Middle Tier / Backend servers – Database – … 8 Web Application Delivery Chain performance at the bottom line Do not trust that every user have a Core i5 CPU with 8 Go Ram on Windows 7 on a 100 Mbits/s connection ! It’s false ! Try to test performance on slowest computers and slowest bandwidth
  • 9. 80-90% of the end-user response time is spent on the frontend ! 9 Web Performance where to start ?
  • 10. “We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil” Donald Knuth Never automatically apply tips, best practices & improvements without checking before/after the changes. => Profiling and Micro-Benchmark 10 Important Note before going deeper
  • 11. • Yslow & PageSpeed – Proven front-end best practices & recommandations – Very popular & easy to install (browser extension or online service) – Current : Yslow (23 best practices) & PageSpeed (31 rules) • But … – does not look at our Infrastructure, Application Performance, CDN, DB Queries, datacenter distribution, load balancing, … – does not include the actual speed of the tested page ! – Lower scores/grades can load faster than Higher scores 11 Web Performance auditors Google PageSpeed & YSlow
  • 12. Html Parsing Pipeline how page loads • Loading a page is not as simple as dowloading a single file – Involve dynamic ressources – Cascading stylesheet – Javascripts • Common performance issue : Because JavaScript code can alter the content and layout of a web page, the browser delays rendering any content that follows a script tag until that script has been downloaded, parsed and executed. Many browsers block the downloading of resources referenced in the document after scripts until those scripts are downloaded and executed 12
  • 13. Round-trip time (RTT) is the time it takes for a client to send a request and the server to send a response over the network, not including the time required for data transfer. • Minimize redirects • Use HTTP Cache Headers • Avoid bad/duplicated/useless requests • Combine external JavaScript & Css • Combine images using CSS sprites • Optimize the order of styles and scripts • Prefer asynchronous resources (Async or Deferred JS) • Parallelize downloads across hostnames • … 13 Golden Rule #1 minimize round-trip times Downloading 50 B always have a cost !
  • 14. 14 Less than 6 connections per hostname Limit number of requests
  • 15. Amount of data sent in each server response can add significant latency, especially in areas where bandwidth is constrained • Enable Gzip compression • Limit HTTP Headers (Uncompressed) • Remove unused CSS/JS/comments • Avoid inline/embedded styles and scripts • Minify CSS & JavaScript • Minify HTML • Optimize, Optimize, Optimize images • Serve scaled images • … 15 Golden Rule #2 Minimize Request Overhead & payload size
  • 16. Web images take up the majority of the download time in most web pages • Choose an appropriate file format (JPG, PNG, GIF) – For JPG, use progressive image (demo) • Optimize image size – Crop whitespace, Remove useless data (color palette, EXIFF, ..) – Apply a Lossless compressor (OptiPNG or PNGOUT) • Try to apply width and height for each <img> tag – Avoid unnecessary repaints and reflows during rendering – But do not use it to scale images : server already scaled images • Use Sprites (see ) – reduced the number of HTTP requests and avoided any potential delay • Use Data-URI – inline the content of the URI you would normally point to 16 Images Optimizations Web images take up the majority of the download time in most web pages
  • 17. Once resources have been downloaded to the client, the browser still needs to load, interpret, and render HTML, CSS, and JavaScript code. • Limit Number of DOM elements • Defer loading of JavaScript and Third party components • Avoid DOM alterations • Styles at top, Scripts at bottom • Use efficient CSS selectors & Avoid CSS expressions • Specify image dimensions • Specify a character set • Check Javascript and especially Jquery performance • … Google SpeedTracer could help you (home) low level instrumentation points inside Chrome 17 Golden Rule #3 Optimize Browser rendering
  • 18. • Styles are downloaded and applied when rendering Browsers block rendering a web page until all external stylesheets have been downloaded - Put styles in head allow the browser to progressively render the page - Put styles in body can cause repaints & reflows (demo) • Scripts are downloaded, parsed and executed The page has to wait for the script blocks to be fully downloaded, parsed and executed before being able to parse and render any following HTML – Block the rendering of any following HTML – Block the downloading of resources referenced in the document after the script 18 Quick Focus : Styles & Scripts Why is it so important to optimize styles & scripts?
  • 19. What is the page speed (with/without Cache) for this ridicoulous page ? 19 Scripts Stop paying the Script tax
  • 20. • First View • Repeat View • Repeat View (on my laptop in power saving mode) 20 Scripts Stop paying the Script tax² Even from cache (no download), it takes a few ms to parse & exec Scripts. Not so fast …
  • 21. Easy to write JavaScript … …and easy to write really really bad JavaScript and slow down page load • Minimal recommandations – Always use the latest version of Jquery (test) jQuery team is always looking to bring improvements – Use appropriate selections (test) Many ways to select an element, but they don’t have the same performance Id < Tag < Class – Do not repeat selectors & abuse chain Cache results & object – Use for instead of foreach (test) Native JavaScript functions is always faster – Do use Jquery … if possible (test) Native JavaScript functions is always faster² • Continue Reading here 21 Jquery Performance with great power comes great responsibility (Spiderman)
  • 22. 22 How to mesure/improve performance ? hopefully there are many tools ! • Sql Profiler • Graphite • Web Developpers Tools • WebPageTest.org • PhantomJS • Selenium Web Driver • Har Viewer • Google Page Speed • Yslow • dotTrace • Pingdom tools • Fiddler • jsPerf • MVC MiniProfiler • dynaTrace • Google Analytics • IIS & Apache Logs • Performance coutners • Visual Studio Web Perf • Gtmetrix • Micro Benchmark • Google Site Speed • Centreon • New Relic • Node.js • DB Provider Client Statistics • SpeedTrace • Headless Browsers • Boomerang.js • MVC Bundles • Optipng • Glimpse • SpriteMe • Firebug • Your own tool here!
  • 23. • Learn how to improve Web performance • Investigate available performance tools – Dev customs tools if necessary • Automate performance testing • … It’s only the beginning ! PS : And of course, check Performance of your Web Site  23 Next Steps
  • 24. • https://developers.google.com/speed/ • http://developer.yahoo.com/performance/ • http://www.webpagetest.org/ • http://ie.microsoft.com/testdrive/HTML5/DOMContentLoaded/Default.html • http://www.softwareishard.com/har/viewer/ (HAR file viewer) • https://github.com/blog/1252-how-we-keep-github-fast (github performance) • http://www.whatwg.org/specs/web-apps/current- work/multipage/parsing.html#parsing (Parsing HTML Documents) • http://www.stevesouders.com/blog/2010/05/07/wpo-web-performance- optimization/ (must read) • http://dmix.ca/2010/01/the-marketing-of-sports-betting-sites/ (betting industry) • http://sixrevisions.com/tools/8-excellent-tools-for-optimizing-your-images/ • http://www.browserscope.org • http://browserdiet.com/ • http://gtmetrix.com/ 24 Appendices
  • 25. Yslow Best Practices Add Expires headers Avoid AlphaImageLoader filter Avoid CSS expressions Avoid empty src or href Avoid HTTP 404 (Not Found) error Avoid URL redirects Compress components with gzip Configure entity tags (ETags) Do not scale images in HTML Make AJAX cacheable Make favicon small and cacheable Make fewer HTTP requests Make JavaScript and CSS external Minify JavaScript and CSS Put CSS at the top Put JavaScript at bottom Reduce cookie size Reduce DNS lookups Reduce the number of DOM elements Remove duplicate JavaScript and CSS Use a Content Delivery Network (CDN) Use cookie-free domains Use GET for AJAX requests 25
  • 26. Avoid a character set in the meta tag Avoid bad requests Avoid CSS @import Avoid CSS expressions (deprecated) Avoid document.write Avoid Flash on mobile webpages Avoid landing page redirects Combine external CSS Combine external JavaScript Combine images using CSS sprites Defer loading of JavaScript Defer parsing of JavaScript Enable gzip compression Enable Keep-Alive Improve server response time Inline small CSS Inline small JavaScript Leverage browser caching Leverage proxy caching (deprecated) Make landing page redirects cacheable Minify CSS Minify HTML Minify JavaScript Minimize cookie size (deprecated) Minimize DNS lookups Minimize redirects Minimize request size Optimize images Optimize the order of styles and scripts Parallelize downloads across hostnames Prefer asynchronous resources Put CSS in the document head Remove query strings from static resources Remove unused CSS Serve resources from a consistent URL Serve scaled images Serve static content from a cookieless domain Specify a cache validator Specify a character set early Specify a Vary: Accept-Encoding header Specify a viewport for mobile browsers Specify image dimensions Use an application cache Use efficient CSS selectors 26 PageSpeed Rules