You are previewing High Performance Web Sites.

High Performance Web Sites

Cover of High Performance Web Sites by Steve Souders Published by O'Reilly Media, Inc.
  1. High Performance Web Sites
    1. SPECIAL OFFER: Upgrade this ebook with O’Reilly
    2. Praise for High Performance Web Sites
    3. Foreword
    4. Preface
      1. How This Book Is Organized
      2. Conventions Used in This Book
      3. Code Examples
      4. Comments and Questions
      5. Safari® Books Online
      6. Acknowledgments
    5. 1. The Importance of Frontend Performance
      1. Tracking Web Page Performance
      2. Where Does the Time Go?
      3. The Performance Golden Rule
    6. 2. HTTP Overview
      1. Compression
      2. Conditional GET Requests
      3. Expires
      4. Keep-Alive
      5. There's More
    7. 3. Rule 1: Make Fewer HTTP Requests
      1. Image Maps
      2. CSS Sprites
      3. Inline Images
      4. Combined Scripts and Stylesheets
      5. Conclusion
    8. 4. Rule 2: Use a Content Delivery Network
      1. Content Delivery Networks
      2. The Savings
    9. 5. Rule 3: Add an Expires Header
      1. Expires Header
      2. Max-Age and mod_expires
      3. Empty Cache vs. Primed Cache
      4. More Than Just Images
      5. Revving Filenames
      6. Examples
    10. 6. Rule 4: Gzip Components
      1. How Compression Works
      2. What to Compress
      3. The Savings
      4. Configuration
      5. Proxy Caching
      6. Edge Cases
      7. Gzip in Action
    11. 7. Rule 5: Put Stylesheets at the Top
      1. Progressive Rendering
      2. sleep.cgi
      3. Blank White Screen
      4. Flash of Unstyled Content
      5. What's a Frontend Engineer to Do?
    12. 8. Rule 6: Put Scripts at the Bottom
      1. Problems with Scripts
      2. Parallel Downloads
      3. Scripts Block Downloads
      4. Worst Case: Scripts at the Top
      5. Best Case: Scripts at the Bottom
      6. Putting It in Perspective
    13. 9. Rule 7: Avoid CSS Expressions
      1. Updating Expressions
      2. Working Around the Problem
      3. Conclusion
    14. 10. Rule 8: Make JavaScript and CSS External
      1. Inline vs. External
      2. Typical Results in the Field
      3. Home Pages
      4. The Best of Both Worlds
    15. 11. Rule 9: Reduce DNS Lookups
      1. DNS Caching and TTLs
      2. The Browser's Perspective
      3. Reducing DNS Lookups
    16. 12. Rule 10: Minify JavaScript
      1. Minification
      2. Obfuscation
      3. The Savings
      4. Examples
      5. Icing on the Cake
    17. 13. Rule 11: Avoid Redirects
      1. Types of Redirects
      2. How Redirects Hurt Performance
      3. Alternatives to Redirects
    18. 14. Rule 12: Remove Duplicate Scripts
      1. Duplicate Scripts—They Happen
      2. Duplicate Scripts Hurt Performance
      3. Avoiding Duplicate Scripts
    19. 15. Rule 13: Configure ETags
      1. What's an ETag?
      2. The Problem with ETags
      3. ETags: Use 'Em or Lose 'Em
      4. ETags in the Real World
    20. 16. Rule 14: Make Ajax Cacheable
      1. Web 2.0, DHTML, and Ajax
      2. Asynchronous = Instantaneous?
      3. Optimizing Ajax Requests
      4. Caching Ajax in the Real World
    21. 17. Deconstructing 10 Top Sites
      1. Page Weight, Response Time, YSlow Grade
      2. How the Tests Were Done
      3. Amazon
      4. AOL
      5. CNN
      6. eBay
      7. Google
      8. MSN
      9. MySpace
      10. Wikipedia
      11. Yahoo!
      12. YouTube
    22. Index
    23. About the Author
    24. Colophon
    25. SPECIAL OFFER: Upgrade this ebook with O’Reilly
O'Reilly logo

eBay

Figure 17-10. http://www.ebay.com

The YSlow grade for eBay (http://www.ebay.com) is very close to a B. With a little bit of work it would perform well. The main problems are with Rules 1, 3, 9, and 13.

Rule 1: Make Fewer HTTP Requests

The eBay page has 10 scripts and 3 stylesheets. A simple fix would be to use the combination technique described in Chapter 3. Four of the scripts are loaded close together at the top of the page, and three are at the bottom of the page. These should be combined into a top script and a footer script, reducing 10 scripts to 5. The three stylesheets are all loaded close together and should also be combined.

Rule 3: Add an Expires Header

One script and one stylesheet have an Expires header that is only nine hours in the future. According to the Last-Modified date, the stylesheet hasn't been modified in 3 days, and the script in 24 days. These are likely assets that change over time, but given the number of users of the site, it would be better to use a far future Expires header to make these files cacheable. Additionally, there are five IFrames without an Expires header. These are used to insert ad images, some of which don't have an Expires header as well.

Rule 9: Reduce DNS Lookups

Nine different domains are used in the eBay page. Typically, a domain count this high includes several domains from third-party advertisers, but in this case, there are seven ...

The best content for your career. Discover unlimited learning on demand for around $1/day.