Facebook Pixel
Searching...
English
EnglishEnglish
EspañolSpanish
简体中文Chinese
FrançaisFrench
DeutschGerman
日本語Japanese
PortuguêsPortuguese
ItalianoItalian
한국어Korean
РусскийRussian
NederlandsDutch
العربيةArabic
PolskiPolish
हिन्दीHindi
Tiếng ViệtVietnamese
SvenskaSwedish
ΕλληνικάGreek
TürkçeTurkish
ไทยThai
ČeštinaCzech
RomânăRomanian
MagyarHungarian
УкраїнськаUkrainian
Bahasa IndonesiaIndonesian
DanskDanish
SuomiFinnish
БългарскиBulgarian
עבריתHebrew
NorskNorwegian
HrvatskiCroatian
CatalàCatalan
SlovenčinaSlovak
LietuviųLithuanian
SlovenščinaSlovenian
СрпскиSerbian
EestiEstonian
LatviešuLatvian
فارسیPersian
മലയാളംMalayalam
தமிழ்Tamil
اردوUrdu
High Performance Web Sites

High Performance Web Sites

Essential Knowledge for Front-End Engineers
by Steve Souders 2007 168 pages
4.15
500+ ratings
Listen
10 minutes

Key Takeaways

1. Reduce HTTP requests to dramatically improve frontend performance

80–90% of the end user response time is spent downloading all the components in the page.

Frontend optimization is critical. While backend performance is important, the majority of response time is spent downloading page components like images, stylesheets, and scripts. Reducing the number of these components through techniques like CSS sprites, image maps, and inline images can significantly improve load times. Combining multiple JavaScript files or CSS files into single files also reduces HTTP requests. By focusing on minimizing components, you can achieve the biggest gains in frontend performance.

  • Key techniques for reducing HTTP requests:
    • CSS sprites for combining multiple images
    • Image maps for navigation elements
    • Inline images using data: URLs
    • Combining JavaScript and CSS files

2. Leverage browser caching with far future Expires headers

A far future Expires header eliminates the need to check with the server by making it clear whether the browser can use its cached copy of a component.

Maximize browser caching. Setting far future Expires headers (1 year or more) for static components allows browsers to cache them long-term, eliminating unnecessary HTTP requests on subsequent page views. While this requires changing filenames when updating components, the performance gains are substantial. For dynamically generated content that changes frequently, shorter expiration times are appropriate. Proper cache headers can dramatically reduce server load and improve page load times for repeat visitors.

  • Benefits of far future Expires headers:
    • Eliminates HTTP requests for cached components
    • Reduces server load
    • Improves page load times for repeat visitors
  • Considerations:
    • Requires changing filenames when updating components
    • Use shorter expiration for dynamic content

3. Compress components with gzip to reduce transfer time

Gzipping generally reduces the response size by about 70%.

Enable gzip compression. Gzip compression can significantly reduce the size of HTTP responses, typically by about 70%. This decreases transfer times, especially beneficial for users with slower connections. While there is a small CPU cost to compression and decompression, the bandwidth savings far outweigh this. Configure your web server to gzip HTML documents, JavaScript, CSS, and other text responses. Avoid gzipping already compressed formats like images and PDFs. Properly implemented, gzip compression is one of the simplest and most effective performance optimizations.

  • Components to gzip:
    • HTML documents
    • JavaScript files
    • CSS files
    • XML and JSON responses
  • Don't gzip:
    • Images
    • PDF files

4. Place CSS at the top and JavaScript at the bottom of HTML documents

Placing stylesheets near the bottom of the document prohibits progressive rendering in many browsers.

Optimize CSS and JavaScript placement. Putting stylesheets at the top of HTML documents allows browsers to load them quickly and render the page progressively. This provides visual feedback to users faster. Conversely, placing JavaScript files at the bottom of the document prevents them from blocking downloads of other components. This approach balances quick visual rendering with efficient resource loading. When possible, load non-essential scripts after the page load event to further improve perceived performance.

  • CSS placement:
    • Put in <head> section
    • Use <link> tag, not @import
  • JavaScript placement:
    • Put before </body> tag
    • Load non-essential scripts after page load

5. Minimize and combine JavaScript and CSS files

On average, JSMin reduced the size of JavaScript files by 21%, while Dojo Compressor achieved a 25% reduction.

Reduce file sizes. Minifying JavaScript and CSS by removing comments, whitespace, and unnecessary characters can significantly reduce file sizes. Tools like JSMin for JavaScript and CSS minifiers can automate this process. Additionally, combining multiple JavaScript or CSS files into single files reduces HTTP requests. While this may slightly increase the size of the initial download, it improves caching efficiency and reduces overhead on subsequent page views. For larger sites, implement a build process to handle minification and combination automatically.

  • Minification techniques:
    • Remove comments and whitespace
    • Shorten variable and function names
    • Use shorter syntax alternatives
  • Combination strategies:
    • Group files by page or functionality
    • Use server-side includes or build tools

6. Use content delivery networks (CDNs) to reduce latency

If the component web servers are closer to the user, the response times of many HTTP requests are improved.

Leverage CDNs for static content. Content delivery networks distribute your static content across multiple, geographically dispersed servers. This reduces latency by serving content from a server closer to the user's physical location. While CDNs were traditionally used by large companies, many affordable options now exist for smaller sites. CDNs are particularly effective for sites with a geographically diverse user base. They not only improve response times but can also help absorb traffic spikes and reduce the load on your primary web servers.

  • Benefits of using a CDN:
    • Reduced latency for geographically diverse users
    • Improved ability to handle traffic spikes
    • Reduced load on origin servers
  • Consider CDNs for:
    • Images
    • JavaScript files
    • CSS files
    • Large downloadable files

7. Optimize Ajax requests for better Web 2.0 application performance

Using Ajax is no guarantee that the user won't be twiddling his thumbs waiting for those "asynchronous JavaScript and XML" responses to return.

Make Ajax responses cacheable. While Ajax can improve the user experience in Web 2.0 applications, it's not inherently fast. Optimize Ajax responses by making them cacheable with appropriate headers. Use GET requests for Ajax calls that don't modify data, allowing browsers to cache the responses. Minimize the size of Ajax responses by using efficient data formats like JSON. For predictable user actions, consider prefetching data with Ajax to improve perceived performance. Always provide feedback to users during long-running Ajax requests to maintain a responsive feel.

  • Ajax optimization techniques:
    • Use GET for cacheable requests
    • Minimize response size (use JSON)
    • Prefetch predictable data
    • Provide user feedback for long-running requests

8. Configure ETags properly to improve caching efficiency

ETags generated by Apache and IIS for the exact same component won't match from one server to another.

Optimize or remove ETags. Entity tags (ETags) are used to validate cached components, but their default implementation in Apache and IIS can actually hinder caching in multi-server environments. This is because the default ETag includes server-specific information, causing unnecessary revalidation. For multi-server setups, either configure ETags to exclude this information or remove them entirely, relying instead on Last-Modified headers. Properly configured ETags can improve caching efficiency, but improperly configured ones can degrade performance.

  • Options for handling ETags:
    • Remove ETags entirely
    • Configure to exclude server-specific information
    • Use only for resources that change frequently

9. Avoid redirects whenever possible to reduce round trips

Redirects are an easy way to solve many problems, but it's better to use alternative solutions that don't slow down page loading.

Eliminate unnecessary redirects. Each redirect creates an additional HTTP request-response cycle, adding latency to page loads. Common uses of redirects, such as connecting web sites or tracking outbound links, can often be replaced with more efficient alternatives. For example, use server-side includes or URL rewriting instead of redirects to connect different parts of a website. For tracking outbound links, consider using beacon images or the XMLHttpRequest object instead of redirects. When redirects are unavoidable, use permanent (301) redirects to allow browsers to cache the new location.

  • Alternatives to redirects:
    • Server-side includes
    • URL rewriting
    • Alias or mod_rewrite in Apache
    • Beacon images for tracking

10. Reduce DNS lookups to minimize connection delays

If you have multiple servers hosting your web site and you're using Apache or IIS with the default ETag configuration, your users are getting slower pages, your servers have a higher load, you're consuming greater bandwidth, and proxies aren't caching your content efficiently.

Optimize DNS usage. DNS lookups add latency to HTTP requests, especially on mobile networks. Reduce the number of unique hostnames used in your web pages to minimize DNS lookups. However, balance this with the need for parallel downloads - using 2-4 hostnames can increase parallelization without excessive DNS overhead. Use Keep-Alive connections to reduce the frequency of DNS lookups for repeat requests to the same hostname. Consider using a content delivery network (CDN) to reduce DNS lookup times for geographically diverse users.

  • Strategies for reducing DNS impact:
    • Limit unique hostnames to 2-4 per page
    • Use Keep-Alive connections
    • Consider using a CDN
    • Investigate DNS prefetching for critical domains

Last updated:

Review Summary

4.15 out of 5
Average of 500+ ratings from Goodreads and Amazon.

High Performance Web Sites receives mixed reviews, with an overall positive reception. Many readers find it informative and essential for web developers, praising its practical advice on improving website performance. Some highlight its continued relevance despite its age, while others consider it outdated. The book is commended for explaining the reasoning behind optimization techniques and providing concrete examples. Critics note that some information is now widely available online or through tools like YSlow. Overall, it's seen as a valuable resource for understanding web performance fundamentals.

Your rating:

About the Author

Steve Souders is a prominent figure in web performance optimization. As a former Chief Performance Yahoo! at Yahoo!, he pioneered many techniques for improving front-end performance. Souders is known for developing tools like YSlow and advocating for performance best practices. His work has significantly influenced how developers approach website optimization. Souders has authored multiple books on web performance, including "Even Faster Web Sites" as a follow-up to "High Performance Web Sites." He has also contributed to various open-source projects and spoken at numerous conferences, establishing himself as a respected authority in the field of web performance engineering.

Download PDF

To save this High Performance Web Sites summary for later, download the free PDF. You can print it out, or read offline at your convenience.
Download PDF
File size: 0.45 MB     Pages: 11

Download EPUB

To read this High Performance Web Sites summary on your e-reader device or app, download the free EPUB. The .epub digital book format is ideal for reading ebooks on phones, tablets, and e-readers.
Download EPUB
File size: 3.16 MB     Pages: 10
0:00
-0:00
1x
Dan
Andrew
Michelle
Lauren
Select Speed
1.0×
+
200 words per minute
Create a free account to unlock:
Bookmarks – save your favorite books
History – revisit books later
Ratings – rate books & see your ratings
Unlock unlimited listening
Your first week's on us!
Today: Get Instant Access
Listen to full summaries of 73,530 books. That's 12,000+ hours of audio!
Day 4: Trial Reminder
We'll send you a notification that your trial is ending soon.
Day 7: Your subscription begins
You'll be charged on Nov 21,
cancel anytime before.
Compare Features Free Pro
Read full text summaries
Summaries are free to read for everyone
Listen to summaries
12,000+ hours of audio
Unlimited Bookmarks
Free users are limited to 10
Unlimited History
Free users are limited to 10
What our users say
30,000+ readers
“...I can 10x the number of books I can read...”
“...exceptionally accurate, engaging, and beautifully presented...”
“...better than any amazon review when I'm making a book-buying decision...”
Save 62%
Yearly
$119.88 $44.99/yr
$3.75/mo
Monthly
$9.99/mo
Try Free & Unlock
7 days free, then $44.99/year. Cancel anytime.
Settings
Appearance