Web Performance Optimization
Upcoming SlideShare
Loading in...5
×
 

Web Performance Optimization

on

  • 1,202 views

Slides from webinar "Web Performance Optimization"

Slides from webinar "Web Performance Optimization"

Statistics

Views

Total Views
1,202
Views on SlideShare
1,196
Embed Views
6

Actions

Likes
1
Downloads
43
Comments
0

1 Embed 6

http://www.linkedin.com 6

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Web Performance Optimization Web Performance Optimization Presentation Transcript

  • Web Performance Optimization
    2010 © Pavel Paulau
  • Getting started
    2
    • Look into web front-ends performance
    • Learn how to
    - Estimate and track web performance
    - Analyze and diagnose page bottlenecks
    - Make website faster easily without code modification and eye candy losses
    • Forget for a hour about load, transactions and servers
  • 3
    End user experience
    1
    Automated web performance testing
    2
    In-depth performance analysis
    3
    Effective content delivery and transformation
    4
    Optimization examples
    5
    Conclusion
    6
    View slide
  • Performance aspects
    4
    • Availability
    The amount of time an application is available to the end user.
    • Response time
    The amount of time it takes for the application to respond to a user request.
    • Throughput
    The rate at which application-oriented events occur.
    • Utilization
    The percentage of the theoretical capacity of a resource that is being used.
    View slide
  • Behind the scene
    5
    • Just one user’s click lead to
    - Tens of HTTP requests
    - Hundreds of XHR calls
    - Kilobytes of network traffic
    - Multiple CPU calls
    - Expensive IO operations
    • However, the end user doesn’t know anything about HTTP, web technologies, browsers and servers
    • The only thing the user experiences is a page load time
  • Challenges
    6
    • Traditional performance testing techniques do not reflect real browser behavior
    • Dependence on connection quality
    • Multiple browsers and versions of browsers
    • Lots of components and pages
    • Third-party components
    • A false view of the performance bottlenecks
  • Browsers multiplicity
    7
    * browserscope.org
  • Different browsers offer different performance
    8
    Source: Gomez Real-User Monitoring
    > Real users around the world
    > Broadband
    > 466M pages over 30 days
    > 200+ sites
  • Response time components
    9
    Critical for
    Web 2.0 application
    Server side
    Content delivery
    Rendering
    Outside the application -
    still part of our responsibility
    80-90% of the end-user response time is spent on the frontend
  • Web performance anatomy
    10
    Latency
    HTTP
    AJAX/XHR
    IE
    Firefox
    Chrome
    Safari
    Opera
    Server
    Browser
    Internet
    Images
    CSS
    JavaScript
    Flash
    Ads, widgets, analytics
    Cache
    3rd-party
    servers
    DNS Server
    Parsing
    Layouting
    Rendering
  • Performance impact
    11
    • E-commerce applications
    - People stay on website longer and view more pages
    - People perceive business to be more trustworthy
    - Significantly decreased visitor frustration levels
    - Google uses site speed in web search ranking
    • Enterprise applications
    - Faster responses keep users more attentive and concentrated
    - Some business processes require extremely fast interactions
  • 12
    End user experience
    1
    Automated web performance testing
    2
    In-depth performance analysis
    3
    Effective content delivery and transformation
    4
    Optimization examples
    5
    Conclusion
    6
  • Performance metrics
    13
    There are two basic approaches to performance estimation
    • Time-driven testing – measuring absolute load time
    - Time to first byte
    - Time to first impression
    - onLoad time
    - Fully loaded time
    • Rank-driven testing – based on best practices
    - Yahoo! YSlow grades
    - Google Page Speed scores
    - dynaTraceAJAX edition ranks
  • Test automation framework
    14
    Analyst workstation
    Test environment
    LAMP (WAMP) Server
    Test Controller
    (Java, C#, Python,
    Ruby, Perl, PHP)
    Show Slow
    SeleniumRemote-Control
    WebPagetest
    URL Blast
  • Advantages
    15
    • Open source solution
    > Free and flexible
    • Websites testing with real browsers, not via HTTP requests
    > Parsing and rendering aren’t ignored
    • End-to-end process
    > Benchmark ->Analysis ->Optimization
    • Scripting using the most popular languages
    >Java, C#, Python, Ruby, PHP, Perl.
  • Features. Results storageand visualization
    16
    • Test results stored in MySQL database. Reliable and accessible approach
    • “Measurements over time” feature provides the continuous control support
    • Screen shots, waterfall views, visual comparison, video capture, content and domain breakdowns… not a full list of analytic solutions
  • Features. WAN emulation
    17
    • Using Dummynet it’s possible to define the following connection options:
    - Bandwidth download speed
    - Bandwidth upload speed
    - Network latency
    - Packet loss
    • That’s an extremely important feature for worldwide applications without CDN
  • Features. Optimization checklist
    18
  • 19
    End user experience
    1
    Automated web performance testing
    2
    In-depth performance analysis
    3
    Effective content delivery and transformation
    4
    Optimization examples
    5
    Conclusion
    6
  • Available tools
    20
    • Free and open source tools available for almost any browser:
    - Firebug with add-ons (Firefox)
    - dynaTraceAjax Edition (IE)
    - Speed Tracer (Chrome)
    - Web Inspector/Developer Tools (Safari/Chrome)
    - HttpWatch(IE/Firefox)
    - Dragonfly (Opera)
    • These tools vary in functionality, flexibility and advantages, but together provide amazing capabilities
  • 21
    Performance Ranking
    It’s possible just to grade web pages total performance with any general rating system or KPI’s.
  • 22
    HTTP waterfall charts
    Sometimes it is not unlikely to notice a problem at a glance – just with HTTP waterfall charts. Blocking issues, non-existent elements, too long requests could be found within a minute.
  • 23
    Timeline analysis
    Understanding of what is really going on inside of browser is a key point of page speed analysis.
  • 24
    JavaScript Profiling
    When JavaScript becomes a trouble it’s extremely easy to analyze code execution and find the most expensive call
  • 25
    CSS Usage Analysis
    Not only JS-scripts but style spreadsheets lead to performance issues.
    Additional analysis features provide an ability to controls the effectiveness of CSS usage
  • 26
    Optimization advices
    The most delicious feature of these tools is a strong possibility to get an instantaneous advice based on diverse best practices
  • 27
    End user experience
    1
    Automated web performance testing
    2
    In-depth performance analysis
    3
    Effective content delivery and transformation
    4
    Optimization examples
    5
    Conclusion
    6
  • 28
    Common optimization principles
    • Eliminate wasteful work
    • Identify the action that's consuming most of user response time.
    • Make the application do that action less often.
    • Make the application do that action faster.
    The fastest way to do something is don’t do it
    28
  • 29
    Available best practices
    Google, Yahoo! and dynaTrace specialists provide and constantly update best practices on
    Cache optimization
    Round-trip times minimization
    Components size minimization
    Parsing and rendering optimization
    29
  • Cache optimization
    30
    • A first-time visit to a page may require several HTTP requests to load all the components.
    • By using Expires or Cache-Control headers these components become cacheable, which avoids unnecessary HTTP requests on subsequent page views.
    • Expires headers are most often associated with images, but they can and should be used on all page components including scripts, stylesheets and Flash.
  • Round-trip times minimization
    31
    • Decreasing the number of components on a page reduces the number of HTTP requests and network packets required to render the page, resulting in faster page loads.
    • Common way to reduce the number of components includes
    - Combine multiple scripts into one script
    - Combine multiple CSS files into single stylesheet
    - Use CSS Sprites and image maps
  • Round-trip times minimization
    32
    • Inserting a redirect between the user and the final HTML document delays everything on the page since nothing on the page can be rendered and no components can be downloaded until the HTML document arrives.
    • Reference to missing resources is a time wasting process
  • XHR calls minimization
    33
    • JavaScript and XmlHttpRequests are the basis for what in general is called AJAX. Frameworks like jQuery make it very easy to make AJAX calls in order to retrieve additional content from the server.
    • When the user navigates to the next page we request the next page via an AJAX call and refresh the DOM. This avoids a full round-trip and avoids the browser reloading the whole page.
    • A mistake that is often made is that too much information is fetched dynamically with too many calls.
  • Component size minimization
    34
    • Most modern browsers support data compression for HTML, CSS, and JavaScript files. This allows content to be sent over the network in more compact form and can result in a dramatic reduction in download time.
    • Gzip is the most popular and effective compression method currently available and generally reduces the response size by about 70%.
  • Component size minimization
    35
    • Minification removes unnecessary characters from a file to reduce its size, thereby improving load times.
    • When a file is minified, comments and unneeded white space characters (spaces, newlines, and tabs) are removed. This improves response time since the size of the download files is reduced.
    • Properly formatting and compressing images can save many bytes of data.
  • Rendering optimization
    36
    • JavaScript scripts block parallel downloads - to help the page load faster, move scripts to the bottomof the page if they are deferrable.
    • Moving stylesheetsto the document headelement helps pages appear to load quicker since this allows pages to render progressively.
    • Specifying a width and height for all images allows for faster rendering by eliminating the need for unnecessary reflows and repaints.
  • Effective DOM manipulation
    37
    • Many JavaScript libraries provide nice visual effects, e.g: dynamic popup menus, accordion effects, etc.
    • Where most of these frameworks do a good job on sample web sites, some of them do not perform well on real life pages with large DOMs.
    • It is important to analyze the impact of visual effects on the browser’s CPU, the rendering engine and the overall web site performance.
  • 3-rd party components
    38
    • You can't control it all
    • Speed up what you can
    Ensure that things you have control over are lightening fast
    • Defer everything you can't control
    Make sure it’s the last thing that is called on the page before it's done loading
  • 39
    End user experience
    1
    Automated web performance testing
    2
    In-depth performance analysis
    3
    Effective content delivery and transformation
    4
    Optimization examples
    5
    Conclusion
    6
  • Sotheby’s landing page
    40
    • Page load time (IE7, 1024/512 Kbps, 50 ms RTT)
    • 15.5 seconds (first view)
    • 7.5 seconds (repeat view)
    • Google Page Speed score
    • 67 (D)
    • Yahoo! YSlow grade
    • 63 (D)
    • dynaTrace AJAX edition rank
    • 73 (C)
  • Optimization list
    41
    • CSS merging eliminates 33 HTTP requests.
    • JS merging eliminates 16 HTTP requests.
    • CSS, JS and HTML minimization saves about 160 kilobytes of network traffic.
    • Images optimization reduce the page size by about 130 kilobytes.
    • GZip compression removes 420 kilobytes of unnecessary network traffic.
    • Cache tweaks (Expire headers and ETag optimization) to make repeat load faster.
    • Automatic adjustments with Apache mod_pagespeed.
  • Page resources
    42
    Before
    After
  • Performance metrics
    43
    Page load time – 3x faster
    Optimization ranks
  • 44
    End user experience
    1
    Automated web performance testing
    2
    In-depth performance analysis
    3
    Effective content delivery and transformation
    4
    Optimization examples
    5
    Conclusion
    6
  • Resume
    45
    • Websites performance matters
    • Traditional performance testing techniques cover only smallest part of the end user experience
    • There are methods and tools to test, analyze and optimize websites speed
    • These methods don’t contradict common performance testing approaches but complement them
    Do not ignore front-ends!
  • 46
    Best practices
    Books
    - High Performance Web Sites
    - Even Faster Web Sites
    - Website Optimization
    - Complete Web Monitoring
    - High Performance JavaScript
    Web
    - Google Web Performance Best Practices
    - Yahoo! Best Practices for Speeding Up Your Web Site
    - DynaTrace Best Practices on Web Site Performance Optimization
  • 47
    Tools
    Google Page Speed Tools Family
    http://code.google.com/speed/page-speed/
    dynaTrace AJAX Edition
    http://ajax.dynatrace.com/ajax/en/
    Yahoo! YSlow
    http://developer.yahoo.com/yslow/
    WebPagetest
    http://www.webpagetest.org/
    Show Slow
    http://www.showslow.com/
    Let's Make the Web Faster
    http://code.google.com/intl/en-EN/speed/tools.html