Your SlideShare is downloading. ×
  • Like
Thomas Deml - Improve Slow Websites
Upcoming SlideShare
Loading in...5

Thanks for flagging this SlideShare!

Oops! An error has occurred.


Now you can save presentations on your phone or tablet

Available for both IPhone and Android

Text the download link to your phone

Standard text messaging rates apply

Thomas Deml - Improve Slow Websites


Best Practices for websites.

Best Practices for websites.

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads


Total Views
On SlideShare
From Embeds
Number of Embeds



Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

    No notes for slide
  • * If you are in China then you can get JavaScript files from a server located in China* If you visit a website that retrieves JavaScript from the CDN in one domain, you do not need to re-download the same JavaScript files when you visit a second website that also uses the same CDN.


  • 1. Required Slide
  • 2. My Web Site Is So Slow…and I Don’t Know What to Do about It!
    Thomas Deml
    Principal Program Manager
    Web Platform and Tools
    Microsoft Corporation
    Required Slide
  • 3. Agenda
    Why Web Performance Is Important
    Web Performance - The Basics
    Web Performance - Best Practices
    Web Performance - Tools and Resources
    Not in scope for this talk:
    Database Tuning
    Distributed Caching / AppFabric / Velocity
    Ajax and Web Services
  • 4. 1.1 Why Care About Performance?
    Customers will abandon your site
    4 second abandonment threshold
    75% of the 1,058 people asked would not return to websites that took longer than four seconds to load.
    Source: Keep Page Download Speed Times Fast (How Fast? 4 Seconds!) | Hobo
    It will be harder to find you on the Net
    Search Crawlers will spend less time on your site
    Site Performance part of Google search rankings
  • 5. 1.2 Impact of Speed-ups and Slow-downs
    Slow Downs:
    A page that was 2 seconds slower resulted in a 4.3% drop in revenue/user.
    A 400 millisecond delay caused a 0.59% drop in searches/user.
    A 400 milliseconds slowdown resulted in a 5-9% drop in full-page traffic.
    Speeding up their site by 5 seconds increased the conversion rate 7-12%, doubled the number of sessions from search engine marketing, and cut the number of required servers in half.
    Shaving 2.2 seconds off their landing pages increased download conversions by 15.4%, which they estimate will result in 60 million more Firefox downloads per year.
    Adopting a single optimization, gzip compression, resulted in a 13-25% speedup and cut their outbound network traffic by 50%. O'Reilly Velocity Conference, May 2009
  • 6. 2. Web Performance Basics
    The 80/20 Rule
    Where to look for web performance improvements
  • 7. 2.1 Web Performance Terminology
    Load Sensitivity
    How response time varies with the load
    Performance divided by resources, e.g. 30 rps/2CPUs = 15 rps/CPU
    Maximum acceptable throughput
    How adding hardware affects performance
    Vertical Scalability (scaling up): Adding memory and/or CPUs
    Horizontal Scalability (scaling out): Adding more servers
    Response Time
    Time it takes to process a request
    Acknowledgement of the request opposed to completion of the request
    Minimum time required to get any form of response
    How much can be done within a given amount of time
    Stress the system is under
    Source: Patterns of Enterprise Application Architecture
  • 8. 2.2 The 80/20 Rule
    Only 20% of the time is spent on the initial document requested
    The remaining 80 % are external resources
  • 9. Sluggish
  • 10. Areas for Speeding Up Your Web Site
    Server Execution Time
    Number of objects transferred
    Amount of data transferred
    Rendering and Layout
  • 11. 3. Web Site Performance In Detail
    Areas for Improving Web Site Performance
    Speed up Execution Time on the Server
    Do more, faster and with fewer resources
    The Network – send fewer bytes
    Amount of data transferred
    Number of objects transferred
    Frontend Optimizations
    Optimize download of page resources
    Optimize rendering and layout of pages
    Other Issues
    The first impression counts!
    This is where server admins and devs usually look
  • 12. 3.1 Execution Time Tuning Side Note
    Goal is to max out the CPU
    If CPU can’t be maxed it might be that
    The Network is maxed out
    The Disk can’t keep up
    Some other lock (e.g. database) blocks execution
    Only if CPU is maxed it makes sense to look how the CPU load can be reduced
  • 13. 3.1.1 Speeding Up IIS Execution TimeBest Practices
    Run Windows Server 2008 on new hardware
    It's optimized for new CPU architectures
    Existing default document on top of list
    Use IIS7 Output Caching for semi-dynamic content
    Turn off features you don't need
    Authentication and SSL only if necessary
    Auth introduces round-trip to backend (AD)
    Encryption impacts processing time and caching
    Request tracing
    But use it if for performance troubleshooting
  • 14. 3.1.3 Speeding Up PHP Execution TimeBest Practices
    Use FastCGI
    Enable WinCache
    Set FastCGIMaxInstances to 0 (FastCGI 1.5)
    enables auto-tuning of FastCGI processes based on system load
  • 15. WinCache for PHP
  • 16. 3.1.2 Speeding Up ASP.NET Execution TimeBest Practices
    Turn off ASP.NET compilation/debug
    No compiler optimizations, increased memory footprint, etc.
    Use <deployment retail="true" /> to enforce across machine
    Read through ASP.NET Performance Coding Best Practices in the Prescriptive Architecture Guides
    Under Memory Pressure?
    Read about the Large Object Heap
    The First Impression Counts!
    Use ASPNET_COMPILER to optimize for the first impression
    Do you really need IIS idle timeout and proactive recycling?
    ASP.NET Thread Pool Settings should be optimized for high throughput sites
    maxConcurrentRequestsPerCPU defaults to 12
  • 17. IIS/ASP.NET Caching Primer
    IIS/ASP.NET Output Cache allows caching across all tiers
    On browsers and proxies via Cache-Control and Expires Headers
    Programmatically in ASP.NET
    SetCacheability(), SetETag(), SetExpires(), SetLastModified(), SetMaxAge(), …
    Declarative in ASP.NET:
    <%@ OutputCache Duration="1000" Location="Client" VaryByParam="none" %>
    Via configuration settings in IIS
    On the Server
    IIS7 Kernel Mode Caching
    Enabled for static files
    Can cache all files with a particular extension: .aspx, .yourextension, …
    Can cache a particular file: e.g. default.aspx
    ASP.Net Application Cache
    Control when items are cached programmatically
    Mix cached and non-cached content
  • 18. Output Caching
  • 19. 3.2 Sending Fewer Bytes over the Network
  • 20. 3.2.1 A Word about Latency
    You don’t see the performance issues your client sees
    As the Developer
    Your cache is primed
    You sit close to the server that is running your app
    You have lots of bandwidth
    You use the latest browser versions and the latest hardware
    Approx. Latencies
    ~250ms latency/TCP packet
    US Eastcoast US Westcoast
    ~100ms latency/TCP Packet
    Did we talk about latency on cell phones yet?
  • 21. Browser Cache
    Don't assume it's primed
    Browser Temporary Files Cache Size is small by default
    Internet Explorer 8: 50MB
    Firefox 3.6: 50MB
    Yahoo Study (TBD: hyperlink)
    65-70% of customers visit Yahoo site with unprimed cache
  • 22. Latency
  • 23. 3.2.2 Use Content Distribution Networks
    Content Delivery Networks improve your website performance because:
    Files get cached across the world
    Files get cached across domains
    Files get compressed
    Files get cached on the browser with a far future expiration header
    The free Microsoft Ajax CDN contains
    Microsoft Ajax Library
    jQuery Validation Library
    ASP.NET Framework JavaScript
  • 24. 3.2.3 Use IIS Compression
    Static Compression (on by default)
    IIS caches compressed resources
    Compression is done on second request
    Dynamic Compression (not installed by default)
    Compression is done on every response
    ~ 5-10% higher CPU load
    IIS7 Compression
    Supports compression levels 1-10
    Is based on MIME Maps
    Supports high and low watermarking
    Can be combined with output caching
    Don't rely on compression alone
    10-15% of requests don't support compression
  • 25. IIS7 Compression
  • 26. 3.2.4 Minify CSS and Javascript
    Crunch Javascript and CSS with AjaxMin
    Comments, white spaces
    Mungesfunction and variable names (converted into smaller strings)
    Other Javascript Optimizations
    Code Splitting
    The Idea behind Microsoft Doloto
    Start with a small piece of code on the client
    Download required code on demand (pull)
    Leads to
    Better application responsiveness
    Faster startup times
    Rarely executed code is rarely downloaded
  • 27. Minification
  • 28. 3.2.5 Optimize ImagesBest Practices
    Do not scale images in HTML!!
    Use jpg for photos
    Use pngfor graphics
    Remove metadata
    CSS Sprites
    Allows combination of multiple images into one
    SEO: can't use the ALT Tag
    Changing a single sprite will force download of full image
    Additional HTML and CSS markup
    Try Image Crushing Tools
  • 29. Image Optimization
  • 30. 3.2.6 ASP.NET Viewstate
    State stored across round trips
    Disable View State whenever possible
    Set EnableViewState="false"
    ViewStateversus ControlState
    Never need ViewState when displaying data
  • 31. Viewstate
  • 32. 3.2.7 Help the Browser Cache Content
    Conditional GETs introduce network round trips
    Use the Cache-Control Header
    Use Versioning for cached content that changes
    GET /Logo.png HTTP/1.1
    If-Modified-Since: Mon, 10 Nov 2008 21:53:27 GMT
    1st Response:
    HTTP/1.1 200 OK
    Last-Modified: Mon, 10 Nov 2008 21:59:09 GMT
    2nd Response:
    HTTP/1.1 304 Not Modified
    Last-Modified: Mon, 2 Nov 2008 20:59:09 GMT
  • 33. Avoiding Conditional GETs
  • 34. 3.2.8 Additional Best Practices to Reduce Network Traffic
    Avoid Redirects
    Additional network round-trips
    Use 301's instead of 302's
    Combine Javascript and Cascading Style Sheets (CSS) as much as possible
    Avoids additional network round-trips
    Strip unnecessary response headers
    Reduce DNS Lookups
    Use authentication and SSL only for content that really needs protection
    Are you dealing with bandwidth hogs?
    Try the IIS Bitrate Throttling Module
  • 35. 3.2.8 More Best Practices to Reduce Network Traffic
    Look at your Cookies
    Do you need all of them?
    Use dedicated domain name for static content, e.g.
    Can you use the Cookie path feature?
    Keep ASP.NET Master Pages lean
    They are part of every ASP.NET page response
    i.e. do not include Javascript etc.
    Careful with the ETag on IIS 6.0
    Use lowercase to reference your resources
    Browser Cache is case-sensitive!
  • 36. 3.3 Optimize the Frontend
    Optimize Downloads
    Strive for parallel downloads
    Best Practices:
    Script should go to the bottom of the page
    If script tag is encountered, no new downloads are started
    I.e. rendering of page cannot start
    Stylesheets should go at the beginning of the <head> section
    CSS needed for rendering and need to be downloaded as early as possible
    Avoid CSS Expressions
  • 37. Browser Optimizations and Putting It All Together
  • 38. Summary
    Performance Matters!
    Speed == Eyeballs
    You can improve performance on three fronts:
    On the Server by doing things faster and more efficient
    On the Network by sending fewer bytes and reducing the round-trips
    On the Browser by optimizing the download and rendering of the page and its resources
    And: There is lot’s of great tools and information out there…
  • 39. Track Resources
    Required Slide
    Track PMs will supply the content for this slide, which will be inserted during the final scrub.
    Steve SoudersBlog ( and books
    Yahoo’s Performance Web-Site (
    Links to everything discussed today will be on tonight. Promise!
  • 40. Resources
    Required Slide
    Sessions On-Demand & Community
    Microsoft Certification & Training Resources
    Resources for IT Professionals
    Resources for Developers
  • 41. Related Content
    Required Slide
    Speakers, please list the Breakout Sessions, Interactive Sessions, Labs and Demo Stations that are related to your session.
    WEB305: Build Web-Sites Faster With Visual Studio 2010
    WEB303-INT: Developing, Extending, and Deploying Web Applications on Internet Information Services (IIS)
    WSV02-HOL: Deploying and Managing Microsoft ASP.NET Using Internet Information Services (IIS) 7.5 on Server Core (V3.0)
    TLC-58: Windows Server 2008 R2 Internet Information Services (IIS)
  • 42. Required Slide
    Complete an evaluation on CommNet and enter to win!
  • 43. © 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.
    The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.