<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
    <title>Speed Tweak of the Week</title>
    <link rel="alternate" type="text/html" href="http://www.websiteoptimization.com/speed/tweak/" />
    <link rel="self" type="application/atom+xml" href="http://www.websiteoptimization.com/speed/tweak/atom.xml" />
   <id>tag:www.websiteoptimization.com,2011:/speed/tweak//3</id>
    <link rel="service.post" type="application/atom+xml" href="http://www.websiteoptimization.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=3" title="Speed Tweak of the Week" />
    <updated>2011-12-10T18:23:23Z</updated>
    <subtitle>Learn speed techniques you can use to increase page download speed. Speed Tweak of the Week shows how to optimize XHTML, CSS, JavaScript, graphics, and other web page components to maximize web site speed and usability.</subtitle>
    <generator uri="http://www.sixapart.com/movabletype/">Movable Type 4.21-en</generator>
 

<entry>
    <title>Diagnosing Slow Web Servers with Time to First Byte</title>
    <link rel="alternate" type="text/html" href="http://www.websiteoptimization.com/speed/tweak/time-to-first-byte/" />
    <link rel="service.edit" type="application/atom+xml" href="http://www.websiteoptimization.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=3/entry_id=368" title="Diagnosing Slow Web Servers with Time to First Byte" />
    <id>tag:www.websiteoptimization.com,2011:/speed/tweak//3.368</id>
    
    <published>2011-12-10T18:12:54Z</published>
    <updated>2011-12-10T18:23:23Z</updated>
    
    <summary>Slow web servers can be caused by a number of factors. You can test for slow server response times with the time time to first byte metric.</summary>
    <author>
        <name>website optimization</name>
        <uri>http://www.websiteoptimization.com</uri>
    </author>
    
        <category term="Psychology" />
    
        <category term="Server optimization" />
    
        <category term="Speed optimization" />
    
        <category term="Surveys and Statistics" />
    
        <category term="Web performance" />
    
        <category term="Website optimization" />
    
    <content type="html" xml:lang="en" xml:base="http://www.websiteoptimization.com/speed/tweak/">
        <![CDATA[<p>Although 80% of web performance problems are typically due to front-end issues (Souders 2009), back-end bottlenecks can slow your site down to a crawl. One thing to watch out for is when static pages load relatively quickly, while dynamic pages load slowly. This article shows what to look for when a server slows down a web site.</p>

<style type="text/css">
<!--
dl dt{font-weight:bold;}
-->
</style>

]]>
        <![CDATA[
<h2>Web Site Performance Factors</h2>

<p>Web site response time is made up of a myriad of factors, including network responsiveness, server response time and load, content size and composition, and client side delays (AJAX, etc.). For optimum web site performance all of these factors should be optimized. For most sites, optimizing the content delivered (and perhaps the hosting) is enough to satisfy users (i.e., combining files, optimizing multimedia, properly caching and compressing files, minifying and trimming, converting to CSS behavior, etc.). However, some sites need more than content optimization, they need server optimization. One possible indicator of a slow server is to look for a slow <strong>Time to First Byte</strong> (see Figure 1).</p>

<div align="center">
<p><img src="time-to-first-byte.png" width="787" height"230" alt="slow time to first byte" border="0"></p>
<strong>Figure 1: Slow Time to First Byte</strong><br>
<small>Anonymized Webpagetest.org Waterfall Graph Snippet</small>
</div>

<h3>Time to First Byte</h3>

<p>The Time to First Byte is the amount of time it takes after the client sends an HTTP GET request to receive the first byte of the requested resource from the server. Time to First Byte as WebPageTest.org defines is it the time it takes for the browser to wait for the first byte of a requested resource to be received <em>after</em> the DNS lookup and connection time. Some definitions lump DNS, connection and waiting into the TTFB metric. So TTFB represents the amount of time it takes for the server to respond and build the web page.</p>

<p>Figure 1 shows a 3 second time to first byte time over a DSL connection (a search query result page). This is an unusually long delay, normally TTFB is in the range of 0.1 to 0.5 seconds. Users perceive that your web page is slow if you have a slow Time to First Byte, because the start render time will be delayed. This is a form of feedback that users key off of that is routinely measured in website performance studies. A more typical time to first byte is shown for CNN.com in Figure 2. Note that CNN.com uses one minified CSS file followed by one minified JavaScript file.</p>

<div align="center">
<p><img src="cnn-waterfall.png" width="694" height"353" alt="fast time to first byte" border="0"></p>
<strong>Figure 2: CNN.com Time to First Byte</strong><br>
<small>Webpagetest.org Waterfall Graph Snippet for CNN.com</small>
</div>

<h4>Distribution of Page Load Components</h4>

<p>Web page delay can come from any number of sources. The four metrics at issue here are DNS lookup time (the time to look up the IP address of the domain in question), connection time (the time it takes to set up the TCP connection), wait time (the time it takes to receive the first byte after the connection has been setup (i.e., time to first byte)), and the content download time (the time it takes to download the object). Figures 3 and 4 show the distribution of these four components for 290 top sites tested from a remote connection (Habib & Abrams 2000).</p>

<div align="center">
<p><img src="load-time-components.png" width="466" height"384" alt="distribution of load time components cache miss" border="0"></p>
<strong>Figure 3: Distribution of Load Time Components (cache miss)</strong><br>
<small>Source: Habib & Abrams 2000</small>
</div>

<div align="center">
<p><img src="load-time-components-cached.png" width="457" height"384" alt="distribution of load time components cache hit" border="0"></p>
<strong>Figure 4: Distribution of Load Time Components (cache hit)</strong><br>
<small>Source: Habib & Abrams 2000</small>
</div>

<p>Surprisingly, the <em>Time to First Byte is the largest web page load time component taking 40 to 60% of total web page latency</em>. Overall, Habib and Abrams found that DNS lookup time takes from 10-20%, connection setup time from 20-30%, time to get the first byte takes from 40 to 60%, and content downloading time takes from 10 to 20% of the total page load time. DNS time was signifant in international web sites, and decreased significantly (90+%) on cached resources.</p>

<h2>Slow Server Performance Factors</h2>

<p>Once you know you've got a server performance issue, how do you know what to fix? Here are some server performance issues that may be slowing down your server.</p>

<dl>
<dl><dt>Memory leaks</dt>
<dd>Leaks can accumulate maxing out the memory of your server and slowing it to a crawl. Solution: You can of course increase the memory in your server, but the best fix would be to locate the memory leak and recode the offending script.</dd>

<dt>Too many processes / connections</dt>
<dd>Programs that keep spawning processes or don't release server connections can bog down your server response time. Solution: rewrite the code to release resources upon completion.</dd>

<dt>External resource delays</dt>
<dd>Loading JavaScript or other resources from off-site can cause indeterminate delays for your own site. JQuery, advertising scripts, Google Plus One, Facebook, and other external resources are typically loaded with a remote JavaScript call to Google, Facebook, or some other busy site. Loading infrequently changing resources (like a programming library) remotely introduces DNS and network overhead, and indeterminate delay from a server you don't control. Solution: Periodically cache the resource locally on your server and serve locally. Use a CRON script to copy the resource.</dd>

<dt>Inefficient SQL Queries</dt>
<dd>Database queries that are written poorly can cause slowdowns to web sites. Databases that aren't indexed properly can also cause slowdowns.</dd>

<dt>Slow database calls</dt>
<dd>Each additional plugin can make calls to a database, which can add up. Solution: Disable any unnecessary plugins in Wordress or your favorite CMS.</dd>

<dt>Insuficient server resources</dt>
<dd>Low memory, bandwidth caps, or limited disk space can cause paging and poor server response times. Solution: Use VMStat, Top, etc. to locate bottlenecks and either decrease resource usage or increase resources (more memory and disk space can't hurt).</dd>

<dt>Overloaded Shared Servers</dt>
<dd>Some hosting companies put too many sites on the same shared server. Servers have limited resources and these can be taxed (memory, processes, bandwidth, etc.) by having too many sites competing for the same resources. Just one heavily loaded site hosted on a shared server can slow down all the other sites hosted there (Our own <a href="http://www.webpageanalyzer.com">WebPageAnalyzer.com</a> was kicked off a shared server for that reason). Solution: Move to a lightly loaded shared server, or a dedicated server where you have complete control. .</dd>

<dt>Inconsistent website response times</dt>
<dd>If your site is slower during different parts of the day (say near lunch time for example), it may be due to increased load on the server slowing down your response time due to maxed out resources (processes, memory, disk space, bandwidth). Solution: Find which resource(s) are highly utilized (CPU, memory, processes etc) during high load and profile and fix "hot code" to help minimize the impact of your scripts. Increasing the resources allocated to your server may help (number of processes for example). A dedicated server may also help here.</dd>
</dl>

<h2>Conclusion</h2>

<p>You can use the time to first byte metric to help diagnose a slow web server. Studies have shown that time to first byte can dominate web page latency. This article showed an example of slow time to first byte, and some possible causes of slow web server response times.</p>

<h2>Further Reading</h2>

<dl>
<dt>Habib, M.A. and M. Abrams, "Analysis of sources of latency in downloading web pages."</dt>
<dd>An investigation into the components of slow web page download times. These Virginia Tech researches found that the Time to First Byte component of web page downloads dominated overseas download time. Proceedings of WebNet, 2000.</dd>
<dt>Souders, S. <i><a href="http://stevesouders.com/efws/">Even Faster Web Sites</a></i></dt>
<dd>Souders followup book to "High Performance Web Sites" found that 70 to 80% of performance problems are due to the "front end" or content delivered by the server. This book adds more best practices to the 14 detailed in his first book, focusing on Web 2.0 and more advanced techniques. O'Reilly 2009. </dd>
</dl>


]]>
    </content>
</entry>

<entry>
    <title>Use a Web Page Optimization Tool</title>
    <link rel="alternate" type="text/html" href="http://www.websiteoptimization.com/speed/tweak/tools/" />
    <link rel="service.edit" type="application/atom+xml" href="http://www.websiteoptimization.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=3/entry_id=83" title="Use a Web Page Optimization Tool" />
    <id>tag:www.websiteoptimization.com,2004:/speed/tweaktest//3.83</id>
    
    <published>2011-09-26T15:39:58Z</published>
    <updated>2011-09-27T12:43:26Z</updated>
    
    <summary>Web page analysis and optimization tools can help locate and minimize performance bottlenecks. They can improve accessibility, spelling, XHTML markup, and even search engine visibility. We update our survey of the web page optimization tool landscape. 
</summary>
    <author>
        <name>website optimization</name>
        <uri>http://www.websiteoptimization.com</uri>
    </author>
    
        <category term="CSS optimization" />
    
        <category term="Graphic optimization" />
    
        <category term="JavaScript optimization" />
    
        <category term="Speed optimization" />
    
        <category term="Web performance" />
    
        <category term="XHTML optimization" />
    
    <content type="html" xml:lang="en" xml:base="http://www.websiteoptimization.com/speed/tweak/">
        <![CDATA[Sure you can <a href="http://www.websiteoptimization.com/speed/tweak/whitespace/">remove whitespace</a> by hand, but why bother? A number of web page analysis and optimization tools are available that can help locate performance bottlenecks and automate whitespace and redundant code removal. But some tools don't stop there. You can optimize your JavaScript and images and even CSS with some of these tools. While no replacement for hand-tuned CSS-based pages, webpage optimization tools can give you a good start on your web page dietary plan. ]]>
        <![CDATA[<h2>Webpage Analysis Tools</h2>
<p>Page analysis tools break down web pages into sized components and calculate download speeds at different bandwidths. They can be used to help pinpoint where your problem pages are, and show which parts of these pages need your attention. They can also be used to validate your code, spellcheck your text, check accessibility, check your links, and even compute search engine visibility. Having well-formed valid code makes your visitor's browser work less parsing your code. Here are some popular webpage analysis tools.</p>

<dl>
<dt><a href="http://www.blaze.io/mobile/">Blaze Mobitest</a></dt>
<dd>Test your website on a number of mobile devices to speed up web page load times on mobiles.</dd>
<dt><a href="http://watson.addy.com/">Dr. Watson</a></dt><dd>HTML and Link validation, spell checking, site popularity, search engine compatibility, download speed and more.</ldd>
<dt><a href="http://www.dynatrace.com/">DynaTrace AJAX Edition</a></dt>
<dd>DynaTrace is a powerful tool that analyzes web page load times, and JavaScript execution times and bottlenecks. Developed in-house to help in JavaScript development
 for dynaTrace Software, DynaTrace AJAX edition lets you zoom in on JavaScript and page bottlenecks to locate code that is slowing your pages down.</dd>

<dt><a href="http://loads.in/">Loads.in</a></dt>
<dd>Tests how fast your web page loads from different countries using different browsers. Also provides waterfall chart and HAR files.</dd>
<dt><a href="http://netmechanic.com/">NetMechanic</a></dt><dd>Fix your HTML pages and optimize your images at NetMechanic.com.</dd>
<dt><a href="http://pagespeed.googlelabs.com">Pagespeed Online</a></dt>
<dd>A web-based version Google's Page Speed software that analyzes web pages against web performance best practices, detailed in Steve Souders' two books from O'Reilly, <i>High Performance Web Sites</i>, and <i>Even Faster Web Sites</i>.</dd>
<dt><a href="http://www.showslow.com">Showslow.com</a></dt>
<dd>
Free service that measures and tracks website performance over time. The tool helps you track performance over time = goal is it getting your site faster. There is a private label version (an instance) where you can set up your own instance to show your boss your website's story, and set up beacons. By Sergey Chernyshev.
</dd>

<dt><a href="http://jigsaw.w3.org/css-validator/">The W3C CSS Validator</a></dt><dd>Check your CSS based on the W3C specifications.</dd>
<dt><a href="http://validator.w3.org/">The W3C HTML Validator</a></dt><dd>The de-facto XHTML markup validation service checks your XHTML and finds errors based on W3C specifications.</dd>
<dt><a href="http://www.webpageanalyzer.com">Web Page Analyzer</a></dt><dd>HCI-based web page size and speed analyzer. Breaks pages down into sized components, pinpoints problem areas, and offers advice based on HCI research.</dd>
<dt><a href="http://www.webpagetest.org/">Web Page Test</a></dt>
<dd>This is an enhanced online version of AOL's open source Page Test software. Times web page load times from different locations, using different browsers, and provides waterfall charts and performance guidelines from Pagespeed. Also can create loading videos to show the loading sequence of web pages.</dd>
<dt><a href="http://developer.yahoo.com/yslow/">YSlow</a></dt>
<dd>Like its newer brethren Pagespeed, Yahoo's free browser plug-in analyzes web pages against web performance best practices. In addition to checklists of best practices, creates charts showing the statistical breakdown of web page components. Created initially by Steve Souders.</dd>
</dl>

<h2>HTML Optimization Tools</h2>
<p>Once you've located where the performance bottlenecks are, and validated your code it's time to optimize. A number of companies offer XHTML optimization programs, and some optimize CSS, JavaScript, and images. Here are a few examples.</p>

<dl>
<dt><a href="http://www.tonbrand.nl/">HTML-Optimizer, HTML-Optimizer Plus, HTML-Optimizer Pro, Web Site Maestro</a></dt><dd>Tonbrand Software offers a range of optimizers capable of optimizing HTML, XHTML, JavaScript, VBScript, JScript, CFScript, Java, CSS, PHP, ASP, JSP, CSP and LassoScript.</dd>

<dt><a href="http://www.w3compiler.com">w3compiler</a></dt><dd>Windows-based source code optimizer from Port80 Software. Optimizes XHTML, CSS, ASP, and CFM files. Includes JavaScript parser.</dd>
</dl>

<h2>Conclusion</h2>

<p>Web page analysis and optimization tools can quickly help locate and minimize performance bottlenecks. While no substitute for hand-tuned CSS-based web pages, webpage optimizers offer a quick way to validate and minimize your code. Keep in mind that after optimization, a fat, poorly constructed web page will still be a minimized overweight web page. Only through transforming your page using modern CSS-based style and layout can you maximize performance gains.</p>

<h2>Further Reading</h2>
<dl>
<dt><a href="http://www.webreference.com/authoring/languages/html/optimize/">Extreme HTML Optimization</a></dt><dd>How-to article on no-holds-barred HTML optimization techniques by the author.</dd>
<dt><a href="/speed/3/">HTML Optimization</a></dt><dd>Summary of chapter on optimizing HTML from <i>Speed Up Your Site: Web Site Optimization</i>.</dd>
<dt><a href="../whitespace/">Remove Whitespace</a></dt><dd>Whitespace removal eliminates unnecessary spaces, tabs, and returns for your HTML, CSS, and JavaScript code for faster downloads. From Speed Tweak of the Week.</dd>
<dt><a href="/speed/">Speed Up Your Site</a></dt>
<dd>This book gives techniques on speeding up web sites, along with a couple chapters on SEO, by Andrew B. King from New Riders.</dd>
<dt><a href="http://www.webpageanalzyer.com">Web Page Analyzer</a></dt>
<dd>Free web page analysis tool gives web component size and speed, and advice on speeding up web pages. By Website Optimization.</dd>
<dt><a href="/secrets">Website Optimization: Speed, Search Engine & Conversion Rate Secrets</a></dt>
<dd>About half of this book is devoted to showing how to speed up websites, the other half is on SEM (Search Engine Marketing) techniques. By Andrew B. King, from O'Reilly.</dd>
</dl>
]]>
    </content>
</entry>

<entry>
    <title>JPEGmini: More Efficient Image Compression</title>
    <link rel="alternate" type="text/html" href="http://www.websiteoptimization.com/speed/tweak/jpegmini/" />
    <link rel="service.edit" type="application/atom+xml" href="http://www.websiteoptimization.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=3/entry_id=364" title="JPEGmini: More Efficient Image Compression" />
    <id>tag:www.websiteoptimization.com,2011:/speed/tweak//3.364</id>
    
    <published>2011-08-29T19:28:11Z</published>
    <updated>2011-08-29T19:57:22Z</updated>
    
    <summary>JPEGmini is JPEG optimization software that reduces the size of photographs by up to 5 or 6 times, while maintaining their visual quality. WSO tests the free service and interviews the CTO of ICTV.</summary>
    <author>
        <name>website optimization</name>
        <uri>http://www.websiteoptimization.com</uri>
    </author>
    
        <category term="Graphic optimization" />
    
        <category term="Multimedia optimization" />
    
        <category term="Photography" />
    
        <category term="Speed optimization" />
    
        <category term="Web performance" />
    
        <category term="Website optimization" />
    
    <content type="html" xml:lang="en" xml:base="http://www.websiteoptimization.com/speed/tweak/">
        <![CDATA[<p>JPEGmini is image optimization technology that reduces the size of JPEGs by up to 5 or 6 times their original size, while maintaining resolution and perceived quality. Developed by ICTV, an Israeli startup company, JPEGmini works within the existing JPEG standard to optimize the size of JPEGs for faster downloads and lower storage costs. The patented algorithm developed by ICVT allows JPEGmini to compress images just below the level where perceived artifacts appear. The results, as you will see below, are smaller files that look visually identical to the original images. In this article we test the new service, and interview the CTO.</p>
]]>
        <![CDATA[
<h2>How JPEGmini Works</h2>

<p>JPEGmini works by iteratively reoptimizing existing JPEGs using their own perceptual quality measure. ICVT developed a perceptual quality measure that imitates the qualities of the human visual system. This features enables JPEGmini to apply the optimal amount of compression to each photograph. Rather than using an arbitrary amount of compression as in Photoshop (low, medium, high), JPEG mini applies the optimum amount of compression for each given image, while maintaining existing perceived visual quality.</p>

<h2>Testing JPEGmini</h2>

<p>You can try JPEGmini out for yourself as a free service at <a href="http://www.jpegmini.com">JPEGmini.com</a>. You can upload single images to optimize (or register to upload entire albums and export them to Picasa and Flickr) and download the results. To test the service, we tried optimizing images saved directly from a digital camera, and from scans from slides. Bottom line, we were able to reduce JPEGs saved directly from a digital camera from 3 to 6 times smaller (see Figure 1).</p> 

<div align="center">
<p><img src="jpegmini-paris-screen.jpg" width="616" height"418" alt="jpegmini optimizing paris night photo" border="1"></a></p>
<strong>Figure 1: JPEGmini Optimizing Paris Night Photo</strong>
</div>

<p>The familiar scene of the Eiffel tower lit up at night was shot with a Lumix LX-5 resting on a riverside wall (see Figure 1). Shot on a recent trip to Paris (I highly recommend going), the Eiffel tower lights up on the hour with a spectacular display. The <a href="paris-eiffel-tower-orig.jpg">original image</a> was 3206K or just over 3 Megabytes in size, saved directly from a digital camera. The <a href="paris-eiffel-tower_mini.jpg">JPEGmini optimized version</a> is 536K, or 6 times smaller! That is over 83% smaller in file size, with the same visual quality.</p>

<h4>Optimizing Christmas Cheer</h4>

<p>Another shot of a bedecked building along the Champs-Élysées compressed 3.1 times smaller than the original file (see Figure 2). The <a href="paris-christmas-orig.jpg">original shot</a> was 4005K or just under 4MB in size. The <a href="paris-christmas-orig_mini.jpg">JPEGmini optimized version</a> came in at 1,298K or 3.1 times smaller.</p>

<div align="center">
<p><img src="paris-christmas-screen.jpg" width="617" height"424" alt="jpegmini optimizing paris holiday lights photo" border="1"></a></p>
<strong>Figure 2: JPEGmini Optimizing Paris Holiday Lights Photo</strong>
</div>

<h3>Larger JPEGs Compress Better than Smaller Ones</h3>

<p>JPEGs that come directly from the camera compress better than JPEGs that have been manipulated or scanned. This is because JPEGs that are saved from digital cameras have fewer artifacts. The more artifacts an image has from JPEG compression, the lower the possible compression ratio. Also, the larger the file, the more the potential compression (see Table 1).</p>

<div align="center">
<table align="center">
    <thead>
	<caption>Table 1: Photo Resolution vs. File Size Reduction</caption>
        <tr><td>JPEG Photo Resolution</td><td>Typical JPEGmini file size reduction</td></tr>

    </thead>
    <tbody>
        <tr><td>8 MP and higher</td><td>70% - 80%</td></tr>
        <tr><td>5 - 7 MP</td><td>60 - 75%</td></tr>
        <tr><td>3 MP</td><td>50 - 60%</td></tr>
        <tr><td>2 MP</td><td>30 - 50%</td></tr>
        <tr><td>1024x768</td><td>25 - 35%</td></tr>
        <tr><td>800x600</td><td>20 - 25%</td></tr>
        <tr><td>640x480</td><td>10 - 20%</td></tr>
    </tbody>
</table>
</div>

<p>Testing an original scanned image (from a 6x7 color negative) confirmed this trend. A full-sized Pro Photo CD scan of a 6x7cm negative (saved as a max quality JPEG without optimization in Photoshop) compressed to a file 4 times smaller (see Figure 3).</p>

<div align="center">
<p><img src="orange-rocks-max-screen.jpg" width="614" height"490" alt="jpegmini optimizing a scanned image of orange rocks large" border="1"></a></p>
<strong>Figure 3: JPEGmini Optimizing Scanned Image of Orange Rocks (large)</strong>
</div>

<p>A smaller version of the above file saved as a medium quality JPEG (rather than max above) yields a 307KB file. Optimizing this smaller version of the same image shrinks it by 1.3 times (to 240K) (see Figure 4).</p>

<div align="center">
<p><img src="organgerocksmedscreen.png" width="615" height"49" alt="results from a smaller file 307KB" border="1"></a></p>
<strong>Figure 4: JPEGmini Results from a Smaller Version of Same Photograph</strong>
</div>

<h2>Interview with CTO Dror Gill of ICTV</h2>

<p>We talked to Dror Gill, the CTO of ICTV about JPEGmini.</p>

<p><strong>WSO:</strong> How does JPEGmini work? Do you iterate?</p>

<p><strong>Gill:</strong> We iterate using our own perceptual quality measure, which converges very
fast, and also do some clever stuff with the JPEG encoding itself.</p>


<p><strong>WSO:</strong> Do you accept images other than JPEGs? Say TIFFs?</p>

<p><strong>Gill:</strong> - JPEGmini currently we only supports JPEG images.</p>

<p><strong>WSO:</strong> Do you plan a Photoshop plug-in?</p>

<p><strong>Gill:</strong> We are considering other formats for implementing our technology, 
including offline software such as a desktop application or Photoshop plug-in, and
adding a Web API to our site.</p>

<p><strong>WSO:</strong> Do you offer a way to adjust the level of compression?</p>

<p><strong>Gill:</strong> Our web service currently does not support setting the compression level, 
as we want to create the best quality photos which are perceptually 
identical to the originals.  However, our technology does enable compressing
to lower quality levels as well, and we may expose this functionality in 
future versions of the website or in the offline products.</p>

<p><strong>WSO:</strong> It looks like your software works best from original JPEGs
from digital cameras, correct? Why is that?</p>

<p><strong>Gill:</strong> Yes, our software works best for original JPEGs from the digital camera. The reason is that digital cameras don't have "smart" compression algorithms, so they just set the compression level to a very low number
(=very high quality), and this ensures that almost all photos will not have any artifacts, but at the cost of very large file sizes.  Our technology can identify what is the optimal compression that can be applied to each photo, so no artifacts will be visible at 100% zoom.  Basically we developed a quality measure that is perceptual, i.e. it imitates the qualities of the Human Visual System (HVS) very closely.  This enables us to apply the optimal amount of compression to each photo.</p>


<h2>Conclusion</h2>

<p>JPEGmini is a new JPEG recompression algorithm that shrinks existing JPEGs by up to 5 to 6 times smaller than their original size, without any change in appearance. JPEGmini works most efficiently on JPEGs saved directly from digital cameras. The larger the JPEG, the smaller the resulting file. JPEGs that have been previously optimized or scanned saw lower compression ratios than JPEGs saved directly from digital cameras. The CTO of ICTV hinted that a Photoshop plug-in may be in the works, and that the software can allow for adjusting compression levels. Accepting TIFs would be a welcome addition as well. JPEGmini is an effective way to save storage space and transmission costs for digital images on and off the Web.</p>

<h2>Further Reading</h2>

<dl>
<dt><a href="http://www.websiteoptimization.com/speed/tweak/graphic-optimization/">Graphic Optimization Tips Archive</a></dt>
<dd>Tips and techniques on shrinking Web graphics from WebsiteOptimization.com.</dd>

<dt><a href="http://www.jpegmini.com">JPEGmini</a></dt>
<dd>Free service that recompresses JPEGs to smaller sizes with no discernible change in appearance.</dd>
<dt><a href="http://www.megapixel.co.il/english/archive/21907">JPEGmini: The Future of Image Compression?</a></dt>
<dd>A good summary and interview of JPEGmini.</p>

</dl>

]]>
    </content>
</entry>

<entry>
    <title>Velocity 2011 Web Performance Conference</title>
    <link rel="alternate" type="text/html" href="http://www.websiteoptimization.com/speed/tweak/velocity-2011/" />
    <link rel="service.edit" type="application/atom+xml" href="http://www.websiteoptimization.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=3/entry_id=356" title="Velocity 2011 Web Performance Conference" />
    <id>tag:www.websiteoptimization.com,2011:/speed/tweak//3.356</id>
    
    <published>2011-06-28T19:36:31Z</published>
    <updated>2011-07-21T21:39:42Z</updated>
    
    <summary>Highlights from the 2011 installment of O&apos;Reilly&apos;s Velocity web performance conference, held in Santa Clara, CA in June. The author sums up the tools and tips from the conference as well as a book signing.</summary>
    <author>
        <name>website optimization</name>
        <uri>http://www.websiteoptimization.com</uri>
    </author>
    
        <category term="CSS optimization" />
    
        <category term="JavaScript optimization" />
    
        <category term="Server optimization" />
    
        <category term="Speed optimization" />
    
        <category term="Web performance" />
    
        <category term="Website optimization" />
    
    <content type="html" xml:lang="en" xml:base="http://www.websiteoptimization.com/speed/tweak/">
        I&apos;m back from my combined business and hiking trip out west, visiting the Velocity 2011 Web Performance Conference in Santa Clara, California. The second part of my trip was devoted to hiking and photography in the great Northwest, which we won&apos;t review here. This year&apos;s Velocity was bigger and better and yes, sold out again. Here are some highlights.
        <![CDATA[This year's conference was well attended, with more of an emphasis on mobile web performance, although web performance certainly did not get a short shrift. Web-based tools were out in full force, with updated versions of tools making their debut, usually introduced by the authors themselves.

I attended as many web performance track talks as I could, including:

<dl>
<dt>Performance Tools (June 14, 2011)</dt>
<dd>This session showed the various performance tools available, introduced by the authors. Steve Souders (Google), Patrick Meenan (Google), Alois Reitbauer (dynatrace Software), Sergey Chernyshev (truTV), Craig Conboy (Blaze) were the speakers. Patrick Meenan of <a href="http://www.webpagetest.org">webpagetest.org</a> fame gave a great talk, and showed how to do a couple things including creating comparison video film strips to compare before and afters (advanced tab) and filtering out JavaScript (block textarea for .js) to show the effects of deferring or eliminating JavaScript. The difference can be quite dramatic in useful content and total load time. The dynatrace demo was interesting, some tips were if you see 100% CPU utilization, you should  do a dynatrace to dig deeper into the code and look for bottlenecks. The dynatrace waterfall graph was especially helpful in isolating problem areas. To really get into the nitty gritty behind the scenes of web page performance, you can do a TCP dump to see how the packets are behaving, and use wireshark to open up your TCP dump.</dd>

<dt><a href="http://www.blaze.io/mobile/">iBlaze Mobitest</a></dt>
<dd>You can test your site on a mobile device now with Mobitest from iBlaze. Craig Conboy of iBlaze showed the new mobile performance project, which was built on top of the webpagetest.org codebase/instrastructure. The free service loads web pages on different mobile devices from different locations and shows you how they render, including waterfall graphs. Craig gave some details on how the new service works, it first polls a web page test instance, clears the cache,  loads the web page, monitors loading of page and resources, using an embedded browser. As part of their development process for mobile optimization they wanted to automate the process and realized they had a good basis for a free service and decided to open it up to the public. Craig talked about how mobile OSes are locked down, so getting page load data is complicated and genearlly unsupported so there are some limitations, iphones, js optimizations/caching are not available in iphones and the tool does not support the full WPT feature set due to mobile limitations (waterfall graphs bars are not broken down, into their component parts for example). The program  provides screenshots, loading videos, and waterfall graphs. 

There are other projects built on same, such as Steve Souders' <a href="http://www.httparchive.org">HTTP Archive</a> which tracks the performance and component size trends of web pages.</dd>

<dt><a href="http://www.showslow.com">ShowSlow.com</a></dt>
<dd>Sergey Chernyshev showed off the latest showslow.com, a free service that measures and tracks website performance over time. The tool 
helps you track performance over time = goal is it getting your site faster. Sergey talked about the private label version (an instance)  where you can set up your own instance to show your boss the website's story, set up beacons, etc.</dd>

<dt><a href="http://www.stubbornella.org">Nicole Sullivan</a></dt><dd>
Nicole gave a great talk on CSS3 and HTML5 - Beyond the Hype! Nicole went over the new features of CSS3 including data URIs, border-radius, animations, gradients, offline storage, rgba, and aria roles. Two highlights were the gradient/pattern demo (she showed some backgrounds that looks like custom styled fabric), and <a href="http://www.nczonline.net/">Nicholas Zakas</a> introduced <a href="http://www.csslink.net">CSSLink.net</a>, a free open source tool that shows you what is wrong with your CSS.</dd>

<dt><a href="http://www.webpagetest.org">WebPageTest.org</a></dt>
<dd>Patrick Meenan of Google showed off the latest features of WebPageTest.org, which is based on AOL's Pagetest software, which I helped convince Dave Artz to open source when I was working with AOL. Patrick has really taken the service far, adding PageSpeed results, multiple locations, and many useful features (loading progression videos, blocking components to test various optimization techniques). </dd>

<dt><a href="http://code.google.com/speed/page-speed/">Page Speed</a></dt>
<dd>Bryan McQuade and Joshua Marantz both of Google gave a great talk on "Web  Site Acceleration with Page Speed Technologies" on Wednesday. They talked about the growing family of Page Speed technologies including mod_pagespeed, and its rapid adoption, and how the best practice rules that Page Speed checks web pages for has evolved as the browsers change (parallel downloads removed for IE8 for example). PageSpeed now helps optimize sites for mobile as well as desktop browsers.</dd>

</dl>

<p>Those were the highlights of what I saw at the conference. You really need a few people to see everything, there was a lot to see.</p>

<h2>Book Signing</h2>

<p>One big highlight for me was the official O'Reilly book signing (my second book signing). In the convention hall where vendors displayed their wares O'Reilly had a booth. I was invited to attend a book signing there with 5 other O'Reilly authors, including Nicole Sullivan, Nicholas Zakasm and Douglas Crockford. Each author was given 25 of their books (mine is <a href="/secrets/">Website Optimization Secrets</a>) to sign and give away to lucky attendees. It was fun to watch people come up to me and ask about the book, saying they've read this or that chapter and asking questions. Many of them couldn't believe that the book was free. My stack went away second fastest, with Crockford winning the prize.</p>

<h2>Further Reading</h2>

<dl>
<dt><a href="http://www.csslint.net">CSSLint.net</a></dt>
<dd>Check your CSS to find and fix problems with this open source tool.</dd>
<dt><a href="http://www.webpagetest.org">WebPageTest.org</a></dt>
<dd>Free open source web page performance testing tool based on AOL's Pagetest open source software. Useful for waterfall graphs, before/after videos, and accurate timings. By Patrick Meenan.</dd>
<dt><a href="http://velocityconf.com/velocity2011">Velocity 2011 Web Performance Conference</a></dt>
<dd>The 2011 version of the annual web performance conference started by Steve Souders and Jesse Robbins. See the website for speaker videos and slide shows and the conference schedule. Highly recommended.
</dd>
</dl>
]]>
    </content>
</entry>

<entry>
    <title>Average Web Page Size Septuples Since 2003</title>
    <link rel="alternate" type="text/html" href="http://www.websiteoptimization.com/speed/tweak/average-web-page/" />
    <link rel="service.edit" type="application/atom+xml" href="http://www.websiteoptimization.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=3/entry_id=186" title="Average Web Page Size Septuples Since 2003" />
    <id>tag:www.websiteoptimization.com,2008:/speed/tweak//3.186</id>
    
    <published>2011-05-31T20:00:01Z</published>
    <updated>2011-06-01T20:17:57Z</updated>
    
    <summary>Within the last eight years, the size of the average web page has more than septupled, and the number of external objects has more than tripled. While broadband users have experienced somewhat faster response times, dial-up users have been left behind.
</summary>
    <author>
        <name>website optimization</name>
        <uri>http://www.websiteoptimization.com</uri>
    </author>
    
        <category term="Psychology" />
    
        <category term="Speed optimization" />
    
        <category term="Surveys and Statistics" />
    
        <category term="Web performance" />
    
        <category term="Website optimization" />
    
    <content type="html" xml:lang="en" xml:base="http://www.websiteoptimization.com/speed/tweak/">
        <![CDATA[The size of the average web page of the top 1000 websites has more than septupled since 2003.(our last update in July 2009 found it more than quintupled) From 2003 to 2011 the average web page grew from 93.7K to over 679K (see Figure 1), over 7.2 times larger (Domenech et al. 2007, Flinn &amp; Betcher 2008, Charzinsk 2010, Souders 2011). During the same eight-year period, the number of objects in the average web page more than tripled from 25.7 to 85 objects per page. Longer term statistics show that since 1995 the size of the average web page has increased by 48 times, and the number of objects per page has grown by nearly 37 times. ]]>
        <![CDATA[
<div align="center">
<p><a href="growth-average-web-page-2011.png"><img src="growth-average-web-page-2011sm.png" border="1" width="424" height="373" alt="growth of average web page"></a></p>
<h4>Figure 1: Growth of the Average Web Page</h4>
</div>

<h2>The Effects of Caching and other relevant statistics</h2>

<p>Charzinski's 2010 paper shows the beneficial effects of caching on performance. Table 1 shows that the average top 500 home page goes from 507K and 64.7 requests upon initial cache-cleared load to 98.5K and 16.1 requests. One average, caching on these popular sites saves 81 percent of the bytes, and 75 percent of the requests.</p>

<p>Other data from the study showed that Akamai still dominates CDNs, with 43.6 percent of the top 500 using Akamai, delivering 22.3% of the initial load, and 25.8 percent of the cached loads overall. Limelight, Footprint, Panther Express and Google round out the top five CDNs. 167 (33.4%) of the top 500 sites employed one or more of the Web 2.0 technologies (XHR, JSON, or GWT Google Web Toolkit).. 38 percent employed from 1-10 web bugs on their home pages.</p>

<div align="center">
<table align="center" class="data">
<caption>
<h4>Table 1: Average Web Page Data S1=empty cache, S2=reload</h4></caption>
<tr class="light">
  <th>Load State</th><th>Hosts</th><th>Connections</th>
<th>Bytes Received</th><th>Elements Retrieved</th></tr>

<tr><td>S1 Ave.</td><td>7.6</td><td>25.2</td><td>507K</td><td>64.7</td></tr>
<tr><td>S1 Max</td><td>38</td><td>172</td><td>6.9M</td><td>31.4</td></tr>
<tr><td>S2 Ave</td><td>5.5</td><td>10.9</td><td>98.5K</td><td>16.1</td></tr>
<tr><td>S2 Max</td><td>27</td><td>82</td><td>3.5M</td><td>162</td></tr>
</table>
</div>

<h3>The Average Web Page for the Entire Web</h3>

<p>What about the average web page for the entire Web? A Google engineer used the Google bot to <a href="http://code.google.com/speed/articles/web-metrics.html">crawl and analyze the Web</a>, and found that the average web page is 320K with 43.9 resources per page (Ramachandran 2010). The average web page used 7.01 hosts per page, and 6.26 resources per host.</p>

<br clear="right">
<style type="text/css">
<!--
#side4{float:right;width:350px;margin:0 0 0 2em;padding:1em;border-left:1px solid #c0afcf;border-bottom:1px solid #c0afcf;background:#dcdcdc;color:#000;}
#side4 h2,#side4 h3, #side4 h4, #side h5{margin-top:0;padding-top:0em;text-align:center;}
-->
</style>
<h2>Older Average Web Page Data</h2>

<p>The data below is shown for historical purposes.</p>

<div id="side4">

<h3>Anatomy of a Web Page</h3> 
<p>A web page is made up of a container object (CO) and external objects (EOs). The CO is usually an XHTML file that references EOs such as images, audio, video, and external CSS and JavaScript files. Most non-textual EOs are usually pre-compressed, so you'll only see the benefits of <a href="../compress/">HTTP compression</a> on XHTML and on some CSS and JavaScript files. For more than 60% of web pages, the CO occupies less than 50% of total page size.  The average CO takes up about 44% of total page size (Yuan, Li, &amp; Chi 2005).</p>

<p>Therefore, no matter how efficient your XHTML optimization and HTTP compression, the greatest improvement in web page performance that you can expect from XHTML optimization will be less than 50%. For a 300K home page, on average, you'll still need to download at least 150K of EOs, even after optimizing and compressing your textual data. You can see why it is important to optimize your entire web page, including multimedia, in order to make significant performance gains.</p>
</div>

<h2>Growth of the Top 1000 Web Pages in 2007</h2>

<p>Over 2007, the thousand most popular home pages grew by 24.2% from December 2006 to December 2007, that is, from 250K to 310.4K (see Figure 2.</p>

<div align="center" style="text-align:center;margin:0 auto;">
<p><a href="top-1000-web-page2007.png"><img src="top-1000-web-page2007sm.png" border="1" width="408" height="326" alt="growth of average top 1000 home page 2007"></a></p>
<h4>Figure 2: Growth of the Average Top 1000 Home Page</h4>
</p></div>

<p>The number of objects grew by 14.5% in 2007 from 44.2 in December 2006 to 50.6 objects per page in December 2007. An October 2007 survey of the top 50 retailers revealed that the average number of objects per page was 60.5 (Flinn &amp; Betcher 2007). With the average number of objects per page above 50, the latency due to <a href="../parallel/">object overhead</a> now <em>dominates most web page delays</em>.</p>


<h2>Response Time Trends - The Bandwidth Divide</h2>

<p>From 2003 to 2009 web page size has more than quintupled and the number of external objects grown by 2.5 times. So narrowband users (56K and ISDN) have experienced slower response times over time. Conversely, broadband users have experienced somewhat faster response times over time. For broadband users the average download time of the Keynote Business 40 Internet Performance Index (KB40) has decreased from 2.8 to 2.33 seconds from Feb. 2006 to Feb. 2008 (see Figure 3 and Berkowitz &amp; Gonzalez 2008).</p>

<div align="center"><p><a href="response-time-KB40-2y.png"><img src="response-time-KB40-2ysm.png" border="1" width="550" height="352" alt="average kb40 web site performance over broadband from feb. 2006 to feb. 2008"></a></p>
<h4>Figure 3: Average KB40 Web Site Performance over Broadband from Feb. 2006 to Feb. 2008 (Source: Keynote Systems, Inc.)</h4>
</p></div>

<p>So the increase in the average speed of broadband has more than kept pace with the increase in the size and complexity of the average web page. That is one reason why broadband users expect faster response times. Yet narrowband users have experienced slower response times as web page size has increased. </p>

<h2>Average Web Page Characteristics</h2>

<p>In a 2006 survey of over 21,500 non-framed web pages, Ryan Levering and Michal Cutler found that the average web page contained 474 words, 281 HTML tags, and 41 links, 10 of which pointed outside the domain (Levering &amp; Cutler 2006). They found that the average web page was 1440 pixels in height, about twice the size of the screen height. When the average web page is opened, more of what the user sees is graphics, not text. Graphics make up most of the objects in the average web page. Graphics cause most of the delays that users experience from object overhead.</p>

<h3>Change in the Average Web Page over Time</h3>

<p>A subsequent survey in 2007 run for the author revealed changes in the composition of the average web page. Despite the widespread adoption of CSS, the 2007 survey found that 62.6% of web pages still use tables for layout and 32.8% use the font tag for inline style (Levering 2007). In an encouraging trend, the average table depth decreased by half from the 2006 survey, from 2.95 to 1.47. Complex <a href="../layer/">nested tables</a> can cause rendering delays with browsers because tangled tables must be parsed and rendered before your content displays. Between the 2006 and 2007 surveys, the average number of HTML elements per web page more than doubled from 281 to 592.6 elements per page.</p>

<h4>Use of JavaScript in the Average Web Page</h4>
<p>In the 2007 survey, 84.8% of web pages used the script element. The average size of external scripts was 8,845 bytes uncompressed, and 6,302 bytes compressed. Total script size was 68,812 bytes uncompressed and 49,738 bytes compressed. The average number of external scripts was 7, where 6 of which were unique.</p>

<h4>Use of CSS in the Average Web Page</h4>
<p>In the 2007 survey, 82.4% used the link tag, and 54.5% used the style tag (with an average of 2.27 style tags used internally). The average size of external style sheets was 6,575 bytes, and 4,457 bytes compressed. The total average style size was 15,175 bytes uncompressed, and 10,347 bytes compressed.</p>

<h4>Use of Images in the Average Web Page</h4>
<p>Images were used in 91.6% of web pages in the 2007 survey. GIFs were used in 84.6% of web pages, up from 77.9% in 2006 (see Table 2). JPEGs were used in 64.5% of web pages, up from 55.8% in 2006. PNGs were used in 32.2% of web pages, up significantly from 7.2% in 2006. BMPs were used by 0.8% of web pages in 2006. BMPs in particular can be quite large as they are usually not compressed. They should be avoided for Web use. </p>
<style type="text/css">
<!--
.data tr.right th{text-align:right;}
.data tr th.left{text-align:left;}
.data td{text-align:left;}
-->
</style>
<div align="center">

<TABLE border="1" class="data" align="center">
<colspan>
<col align="left">
 <col align="left">
 <col align="left">
</colspan>

<tr class="light">
<th>Image Encoding</th><th>Frequency 2006</th><th>Frequency 2007</th></tr>
<tr><td>GIF</td><td>77.9%</td><td>84.6%</td></tr>

<tr><td>JPEG</td><td>55.8%</td><td>64.5%</td></tr>
<tr><td>PNG</td><td>7.2%</td><td>32.2%</td></tr>
<tr><td>BMP</td><td>0.8%</td><td>-</td></tr>
</table>
<h4>Table 2: Image Usage in the Average Web Page (2006 and 2007 surveys)</h4></div>

<p>If the images in the average page were grouped together, the image area would be 49,144 pixels, or an image of 221 by 221 pixels in dimension (see Figure 4).</p>

<div align="center"><p><img src="average-total-graphics.png" border="0" width="221" height="221" alt="average aggregated graphic area in average web page"></a></p>
<h4>Figure 4: Average Aggregated Graphic Area in the Average Web Page</h4>
</p></div>

<p>A large-scale study confirmed these findings with over 75% of HTTP requests resulting from images (Gonzalez-Cañete, Casilari, &amp; Triviño-Cabrera 2007).</p>


<h2>The Growth of Multimedia on the Web</h2>

<p>The use of streaming media on the Web has increased by more than 100% each year (Li et al. 2005). From 2000 to 2005 the total volume of streaming media files stored on the Web grew by more than 600%. More than 87% of all streaming media is abandoned by users in the first 10 seconds, however, wasting up to 20% of server bandwidth (Guo et al. 2005). While only 3% of server responses are for videos, they account for over 98.6% of the bytes transferred (Gill et al. 2007). In true Pareto fashion, about 10% of the most popular videos on YouTube account for nearly 80% of the views, making <a href="../cache/">caching</a> an appealing performance enhancement (Cha et al. 2007).</p>

<p>Overall, for videos longer than 30 seconds, about 13% of home and 40% of business users experience quality degradation with their streaming media, caused by re-buffering, stream switching, and video cancellation. For sessions longer than 300 seconds, the results are even worse. As broadband penetration has increased, videos have grown in size, bit rate, and duration (see Figure 5).</p>

<div align="center"><p><img src="web-video-duration.png" border="0" width="470" height="338" alt="growth in web video duration over time"></p>
<h4>Figure 5: Growth in Duration of Web Videos</h4>
</p></div>

<p>In 1997, 90% of videos were under 45 seconds in length (Acharya &amp; Smith 1998). In 2005, the median video was about 120 seconds long (Li et al. 2005). By 2007, the median video was 192.6 seconds in duration (Gill et al. 2007). The median bit rate of web videos grew from 200Kbps in 2005 to 328Kbps on YouTube in 2007. So by late 2007, the median video weighed in at over 63MB in file size. On YouTube, the average video size is 10MB, with over 65,000 new videos added every day. </p>
<h2>Conclusion</h2>

<p>Within the last five years, the size of the average web page has more than tripled, and the number of external objects has nearly doubled. While broadband users have experienced faster load times, narrowband users have been left behind. With the average web page sporting more than 50 external objects, object overhead now dominates most web page delays. <a href="../http/">Minimizing HTTP requests</a> by using <a href="../css-sprites/">CSS sprites</a>, <a href="../suture/">combining JavaScript or CSS files</a>, reducing the number of EOs, and converting graphic effects to CSS while still retaining attractiveness, has become the most important skill set for web performance optimizers.</p>

<h2>Further Reading</h2>
<dl>
<dt>Acharya, S., and B. Smith, "An Experiment to Characterize Videos Stored On the Web,"</dt>
<dd>in <i>MMCN</i> 1998 (San Jose, CA: Jan. 1998), 166-178.</dd>

<dt>Berkowitz, D., and A. Gonzalez, "Andy:  Keynote data for your use,"</dt>
<dd>e-mail to author (Feb. 8, 2008). Keynote Systems, Inc. provided the graph of the KB40 response time from Feb. 2006 to Feb. 2008. The average web page load time for the KB40 decreased from 2.8 to 2.33 seconds from Feb. 2006 to Feb. 2008.</dd>

<dt>Cha, M., Kwak, H., Rodriguez, P., Ahn, Y.-Y., and S. Moon, "I Tube, You Tube, Everybody Tubes: Analyzing the World's Largest User Generated Content Video System,"</dt>
<dd>in <i>IMC 2007</i> (San Diego, CA: October 24-26, 2007), 1-13. YouTube is estimated to carry over 60% of videos online, serving 100 million videos daily. Simple caching of the most popular videos offloaded server traffic by as much as 50%.</dd>

<dt>Charzinski, J. "Traffic Properties, Client Side Cachability
and CDN Usage of Popular Web Sites"</dt>
<dd>
B. M¨uller-Clostermann et al. (Eds.): MMB & DFT 2010, LNCS 5987, pp. 136-150, 2010. 
Springer-Verlag Berlin Heidelberg 2010

</dd>

<dt>Domenech, J., Pont, A., Sahuquillo, J., and J. Gil, "A user-focused evaluation of web prefetching algorithms,"</dt>
<dd><i>Computer Communications</i> 30, no. 10 (2007): 2213-2224. In 1995 there were 2.3 average objects per page and 25.7 in 2003 (average of two traces).</dd>
<dt>Flinn, D., and B. Betcher of Gomez.com, "Re: latest top 1000 website data?"</dt>
<dd>e-mail to author, Jan. 8, 2008. As of January 2008, the average top 1000 home page was 312K in total file size, referencing 49.92 total objects.</dd>

<dt>Flinn, D., and B. Betcher, "Re: mockup of section in book about slower pages vs higher,"</dt>
<dd>e-mail to author, Nov. 16, 2007. Gomez surveyed for the author the top 50 retailers for response times, consistency, and composition.</dd>
<dt>Gill, P., Arlitt, M., Li., Z., and A. Mahanti, "YouTube Traffic Characterization: A View From the Edge,"</dt>
<dd>in <i>IMC 2007</i> (San Diego, California: October 24-26, 2007), 20. About 24% of videos are interrupted because of poor performance or poor content quality.</dd>
<dt>Gonzalez-Cañete, F., Casilari, E., and A. Triviño-Cabrera, "Characterizing Document Types to Evaluate Web Cache Replacement Policies,"</dt>
<dd>in <i>ECUMN 2007</i> (Toulouse, France: Feb. 14-16, 2007), 3-11.</dd>

<dt>Guo, L., Chen, S., Xiao, Z., and X. Zhang, "Analysis of Multimedia Workloads with Implications for Internet Streaming,"</dt>
<dd>in <i>WWW 2005</i> (Chiba, Japan: May 10-14, 2005), 519-528.</dd>
<dt>King, A., "<a href="../css-sprites/">CSS Sprites: How Yahoo.com and AOL.com Improve Web Performance</a>,"</dt>
<dd>Learn how AOL and Yahoo! use CSS sprites to improve performance for their busy home pages. CSS sprites save HTTP requests by using CSS positioning to selectively display composite background images. To maximize accessibility and usability, CSS sprites are best used for icons or decorative effects. Website Optimization, Sep. 26, 2007.</dd>
<dt>King, A., "<a href="../compress/">HTTP Compression</a>,"</dt>

<dd>HTTP compression uses standards-based gzip and deflate compression algorithms to compress your XHTML, CSS, and JavaScript to speed up web page downloads and save bandwidth. Website Optimization, Dec. 4, 2003.</dd>
<dt>King, A., "<a href="../http/">Minimize HTTP Requests</a>,"</dt>
<dd>By combining external files and embedding CSS and JavaScript within your HTML you can minimize the number of HTTP requests required to render your page. Each unique HTTP request requires a round trip to a server, introducing indeterminate delays. Website Optimization, Dec. 17, 2003.</dd>
<dt>King, A., "<a href="../parallel/">Optimize Parallel Downloads to Minimize Object Overhead</a>,"</dt>
<dd>With the average web page growing past 50 external objects, object overhead now dominates most web page delays. Increasing parallel downloads by using multiple hostnames can realize up to a 40% improvement in web page latency. Website Optimization, Dec. 26, 2007.</dd>
<dt>King, A., "<a href="../suture/">Suture CSS or JavaScript Files to Reduce HTTP Requests</a>,"</dt>

<dd>Learn how to "suture" CSS or JavaScript files together before delivery from the server to save HTTP requests. You'll have your organization and eat it too with this server-side approach to merging files. Website Optimization, Oct. 31, 2007.</dd>
<dt>King, A., "<a href="http://www.optimizationweek.com/reviews/average-web-page/">The Average Web Page - Preliminary Results</a>,"</dt>
<dd>Preliminary results from a 2006 web page survey run for the author by Ryan Levering. OptimizationWeek.com, Oct. 26, 2006.</dd>
<dt>King, A., "<a href="../cache/">Use Server Cache Control to Improve Performance</a>,"</dt>
<dd>Configure your Apache server for more efficient caching to save bandwidth and improve web site performance. A web cache reduces latency and improves web site response times. Website Optimization, Oct. 23, 2004.</dd>
<dt>Levering, R., "RE: revised web page survey,"</dt>
<dd>e-mail to author (July 27, 2007). In a random survey of 500 pages indexed by Google for the author, 62.6% of pages used the TABLE tag while 85.1% used the DIV tag. Tables nested to an average maximum depth of 1.47, with an average number of 12.57 table tags per page. The average maximum HTML depth was 15.35, demonstrating how DIVs are replacing table nesting.</dd>

<dt>Levering, R., and M. Cutler, "The Portrait of a Common HTML Web Page,"</dt>
<dd>in <i>DocEng 2006</i> (Amsterdam, The Netherlands: October 10-13, 2006), 198-204. Found that the average web page contained 474 words, 281 HTML tags, and 41 links, 10 of which pointed outside the domain. Also found that the average web page was 1440 pixels in height. Table nesting depth was 2.95. </dd> 
<dt>Li, M., Claypool, M., Kinicki, R., and J. Nichols, "Characteristics of Streaming Media Stored on the Web,"</dt>
<dd><i>ACM Transactions on Internet Technology</i> 5, no. 4 (2005): 601-626.</dd>
<dt>Ramachandran, S. 2010, May 26, "<a href="http://code.google.com/speed/articles/web-metrics.html">Web metrics: size and number of resources</a>,"</dt>
<dd>
Using the Googlebot, Sreeram analyzed both 380 million top sites and 4.2 billion websites to see what the average web page consists of. He found that the average web page is 320K in size, using 43.91 resources per page.Just 66% of compressible bytes were compressed using HTTP compression in the entire Web. 64.3% of the average web page was taken up by images (205.99K of images divided by 320K size of average web page). There were 7 scripts and 3.2 external style sheets. The uncompressed size of the top sites was 477.2K, while the uncompressed size of the average web page (4.2 billion) was 376.7K. Interestingly, the top sites network size (bytes delivered down the pipe) was smaller (312K vs. 320) than the overall average web page, due in part to the increased used of HTTP compression (89% versus 66%). Google, May 26, 2010.</dd>

<dt>Sounders, S. "<a href="http://www.httparchive.org">The HTTP Archive</a>"</dt>
<dd>This useful site tracks statistics about how the web was built, including size, page composition, PageSpeed results, and more. Data taken from the May 16, 2011 test run.
</dd>
<dt>Yuan, J.-L., Li, X., and C.-H. Chi, "Understanding the Impact of Compression on Web Retrieval Performance,"</dt>
<dd>in <i>AusWeb05</i> (Royal Pines Resort, Australia: July 2-6, 2005), http://ausweb.scu.edu.au/aw05/papers/refereed/yuan/paper.html (Feb. 10, 2008).</dd>


</dl>
]]>
    </content>
</entry>

<entry>
    <title>Page Speed Online</title>
    <link rel="alternate" type="text/html" href="http://www.websiteoptimization.com/speed/tweak/page-speed-online/" />
    <link rel="service.edit" type="application/atom+xml" href="http://www.websiteoptimization.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=3/entry_id=355" title="Page Speed Online" />
    <id>tag:www.websiteoptimization.com,2011:/speed/tweak//3.355</id>
    
    <published>2011-04-30T20:48:50Z</published>
    <updated>2011-05-14T20:52:44Z</updated>
    
    <summary>The online version of Google&apos;s Page Speed browser extension features a new mobile web page analysis mode. </summary>
    <author>
        <name>website optimization</name>
        <uri>http://www.websiteoptimization.com</uri>
    </author>
    
        <category term="CSS optimization" />
    
        <category term="Graphic optimization" />
    
        <category term="JavaScript optimization" />
    
        <category term="Multimedia optimization" />
    
        <category term="Server optimization" />
    
        <category term="Speed optimization" />
    
        <category term="Web performance" />
    
        <category term="Website optimization" />
    
        <category term="XHTML optimization" />
    
    <content type="html" xml:lang="en" xml:base="http://www.websiteoptimization.com/speed/tweak/">
        <![CDATA[<p>Page Speed Online is a web-based version of the Page Speed plugin, that allows developers to analyze web pages without the need of downloading an extension. Page Speed Online also features a mobile page analysis, which lets developers analyze their mobile sites like they are viewed in a mobile browser, with mobile-specific optimization recommendations. This article shows the new free service in action.</p>
]]>
        <![CDATA[
<h2>How Page Speed Online Works</h2>

<p>Page Speed Online works similarly to the Page Speed browser extension. Page Speed Online checks web pages against various performance best practices, including CSS and JavaScript positioning, cache policies, GZIP compression, and eTag usage. Figure 1 shows Page Speed Online results for CNN.com</p>

<div align="center">
<p><a href="page-speed-online.png"><img src="page-speed-online-sm.png" border="1" width="943" height="370" alt="page speed online in action on cnn.com"></a></p>
<h4>Figure 1: Page Speed Results for CNN.com</h4>
</p></div>

<p>Clicking on one of the recommendations brings up a detailed screen with recommendations (see Figure 2):</p>

<div align="center">
<p><a href="leverage-browser-caching.png"><img src="leverage-browser-caching-sm.png" border="1" width="996" height="353" alt="page speed online leverage browser caching"></a></p>
<h4>Figure 2: Page Speed Leverage Browser Caching for CNN.com</h4>
</p></div>

<h2>Page Speed Mobile Performance Analysis</h2>

<p>The online version of Page Speed also includes a mobile performance analysis that simulates viewing a mobile site in a mobile browser (page speed automatically follows mobile redirects, acting as a mobile browser). Figure 3 shows the mobile results.</p>

<div align="center">
<p><a href="page-speed-mobile.png"><img src="page-speed-mobile-sm.png" border="1" width="987" height="389" alt="page speed mobile results"></a></p>
<h4>Figure 3: Page Speed Mobile Results for CNN.com</h4>
</p></div>
<h2>Conclusion</h2>

<p>Page Speed online is the web-based version of the Page Speed extension. The online version provides a list of expandable recommentations based on web performance best practices. Unlike the Page Speed 
extension, the online 
 version does not provide a one page report, this would 
be a welcome addition to future versions.</p>

<h2>Further Reading</h2>

<dl
<dt><a href="../mod_pagespeed">mod_pagespeed</a></dt>
<dd>This Apache module automates many of the recommendations in the Page Speed performance plugin.</dd>
<dt><a href="http://www.websiteoptimization.com/speed/tweak/mod_pagespeed/">Page Speed home page</a></dt>
<dd>Google's gateway to the page speed family of services and software.
</dd>]]>
    </content>
</entry>

<entry>
    <title>Serving 2012 Olympic Tickets: London2012 15, CoSport 0</title>
    <link rel="alternate" type="text/html" href="http://www.websiteoptimization.com/speed/tweak/2012-olympics/" />
    <link rel="service.edit" type="application/atom+xml" href="http://www.websiteoptimization.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=3/entry_id=352" title="Serving 2012 Olympic Tickets: London2012 15, CoSport 0" />
    <id>tag:www.websiteoptimization.com,2011:/speed/tweak//3.352</id>
    
    <published>2011-03-18T20:42:52Z</published>
    <updated>2011-03-19T13:02:45Z</updated>
    
    <summary>The race is on to get tickets to the 2012 Summer Olympics in London, England. Are the web sites handing the traffic as fast as the athletes they promote?</summary>
    <author>
        <name>website optimization</name>
        <uri>http://www.websiteoptimization.com</uri>
    </author>
    
        <category term="CSS optimization" />
    
        <category term="Graphic optimization" />
    
        <category term="JavaScript optimization" />
    
        <category term="Psychology" />
    
        <category term="Server optimization" />
    
        <category term="Speed optimization" />
    
        <category term="Surveys and Statistics" />
    
        <category term="Web performance" />
    
        <category term="Website optimization" />
    
        <category term="XHTML optimization" />
    
    <content type="html" xml:lang="en" xml:base="http://www.websiteoptimization.com/speed/tweak/">
        <![CDATA[
<p>The race is on to get tickets to the 2012 Summer Olympics in London, England. Millions of people (some 2.3 to 2.7 million signed up to request tickets so far) are clamoring to attend events featuring the likes of Michael Phelps, Ian Thorpe, and Usain Bolt. To distribute the load in the initial ticket request phase, Olympic organizers are using a batch system to accept requests over a six week period. Even with this even-handed approach, the servers were under tremendous load in the early hours of this past Tuesday. We investigate and show how performance could be improved.</p>

]]>
        <![CDATA[
<h2>London2012.com versus CoSport.com</h2>

<p>Tickets for the 2012 London Summer Olympics went on sale Tuesday March 15. In the UK, registered residents can buy tickets from the official London2012.com website, while those in the US, Australia and some other countries use CoSport.com as their official ticket reseller. With millions of fans are looking for tickets are the servers up to the task?</p>

<h2>Batch versus Live Ticket Sales</h2>

<p>Unlike the future live ticket phases in June and December this initial request phase is a batch, where the millions of people who signed up enter their event choices from March 15 to April 26, 2011. After all the requests are in, tickets will be assigned, with oversubscribed events chosen by random lottery. Ticket requests during this phase receive the same priority, there is no advantage to applying early. Despite this approach, the sites dispensing tickets experienced high loads Tuesday morning. Checking the 
official <a href="http://www.london2012.com">London2012.com</a> site in the morning, it was up and running (see Figure 1):</p>

<div align="center">
<p><a href="london2012tickets.png"><img src="london2012tickets-sm.png" width="600" height"245" alt="london 2012 olympics tickets site" border="1"></a></p>
<strong>Figure 1: <a href="http://www.london2012.com">London2012.com</a> Tickets Site Under Load</strong>
</div>

<h2>CoSport.com Web Site Under Load</h2>

<p>While the authorized US ticket reseller CoSport had some trouble handling the load (see Figure 2):</p>

<div align="center">
<p><a href="cosport.png"><img src="cosport-sm.png" width="600" height"340" alt="cosport.com site under load" border="1"></a></p>
<strong>Figure 2: <a href="http://www.cosport.com">Cosport.com</a> Under Load</strong>
</div>

<p>Emails to Cosport were promptly returned, and a notice went up saying "Site Offline" it is being updated, come back mid-afternoon (see Figure 3).</p>

<div align="center">
<p><a href="cosport1125am.png"><img src="cosport1125amsm.png" width="588" height"243" alt="cosport.com site down" border="1"></a></p>
<strong>Figure 3: <a href="http://www.cosport.com">Cosport.com</a> Site Announcement</strong>
</div>

<p>True to their word as of 4pm EST the site was up and able to take ticket requests (see Figure 4).</p>

<div align="center">
<p><a href="cosportall.png"><img src="cosportall-sm.jpg" width="600" height"389" alt="cosport.com home page" border="1"></a></p>
<strong>Figure 4: <a href="http://www.cosport.com">CoSport.com</a> Home Page</strong>
</div>

<h2>Brief Performance Analysis of London2012.com and CoSport.com</h2>

<p>Let's take a brief look at the two home pages using the YSlow and Page Speed tools. YSlow finds both home pages get a grade of C. The CoSport home page is 504.9K in total size, and uses 36 HTTP requests (see Figure 5).</p>

<div align="center">
<p><img src="cosport-yslow.png" width="433" height"311" alt="cosport.com home page yslow analysis"></p>
<strong>Figure 5: <a href="http://www.cosport.com">CoSport.com</a> YSlow Results</strong>
</div>

<p>The official London2012.com site also scores a C in YSlow, with 1069K total page size, requiring 100 requests (see Figure 6).

<div align="center">
<p><img src="london2012-yslow.png" width="432" height"334" alt="london2012.com home page yslow analysis"></p>
<strong>Figure 6: <a href="http://www.london2012.com">London2012.com</a> YSlow Results</strong>
</div>

<h3>Page Speed Analysis of London2012.com and CoSport.com</h3>

<p>A Page Speed analysis of the two home pages tells a similar story. The CoSport.com home page scores an 80 out of 100 possible points (see Figure 7).</p>

<div align="center">
<p><img src="cosport-pagespeed.png" width="593" height"321" alt="corpost.com home page page speed analysis"></p>
<strong>Figure 7: <a href="http://www.london2012.com">London2012.com</a> Page Speed Results</strong>
</div>

<p>While the London2012.com home page scores a 70 out of 100 with Page Speed (see Figure 8).</p>

<div align="center">
<p><img src="london2012-pagespeed.png" width="591" height"419" alt="london2012.com home page page speed analysis"></p>
<strong>Figure 8: <a href="http://www.london2012.com">London2012.com</a> Page Speed Results</strong>
</div>

<h3>Waterfall Analysis of CoSport.com and London2012.com</h3>

<p>Looking at waterfall graphs can help isolate problem areas in web page performance. Using webpagetest.org, we find the following results for both sites. First the overall results for CoSport.com (see Figure 9).</p>

<div align="center">
<p><img src="cosport-wpt.png" width="988" height"350" alt="cosport.com home page page web page test results"></p>
<strong>Figure 9: <a href="http://www.cosport.com">CoSport.com</a> Web Page Test Results</strong>
</div>

<p>CoSport.com loads in 5.4 seconds, and starts to render content in 2.58 seconds.</p>

<p>The London2012.com site loads in 9.7 seconds, and starts to render content in 4.2 seconds (see Figure 10).</p>

<div align="center">
<p><img src="london2012-wpt.png" width="964" height"336" alt="london2012.com home page page web page test results"></p>
<strong>Figure 10: <a href="http://www.london2012.com">London2012.com</a> Web Page Test Results</strong>
</div>

<h4>Waterfall Graphs</h4>

<p>The waterfall graph for the two sites shows how each web page component loads, and breaks down the different load time components (DNS lookup, time to first byte, content download, etc.). Figure 11 shows the CoSport.com waterfall graph.</p>

<div align="center">
<p><a href="cosport-waterfall.png"><img src="cosport-waterfall-sm.png" width="930" height"445" alt="cosport.com home page waterfall graph" border="1"></a></p>
<strong>Figure 11: <a href="http://www.cosport.com">CoSport.com</a> Waterfall Graph</strong>
</div>

<p>Note the highlighted areas. CoSport.com redirects to a secure page on the home page, with associated SSL delays. Multiple CSS and JavaScript files delay the time to first byte.</p>

<p>The waterfall graph for the London2012.com is shown in Figure 12. The London2012 site shows about a 0.8 second time to first byte for the home page, and multiple CSS and JavaScript files which delay the time that useful content displays.</p>

<div align="center">
<p><a href="london2012-waterfall.png"><img src="london2012-waterfall-sm.png" width="930" height"375" alt="london2012.com home page waterfall graph" border="1"></a></p>
<strong>Figure 12: <a href="http://www.London2012.com">London2012.com</a> Waterfall Graph</strong>
</div>

<h2>Front-End versus Back-End Performance</h2>

<p>The CoSport.com home page is less than half the size of the London2012.com home page (504.9K versus 1069K), and uses nearly 1/3 of the requests (38 versus 100). The front-end engineers at CoSport have done a good job of making their site smaller and more streamlined than the official London2012 site. So even though the CoSport home page is half the size with nearly 1/3 the requests, the London2012 site stayed up and available during the crush of visitors Tuesday morning. This shows that the backend capacity is higher on the London2012.com site. According to Steve Souders, 80% of performance problems are on the front-end (Higher Performance Web Sites, O'Reilly), but under high load the main difference here is the back-end performance and request capacity of the servers.</p>

<h2>Suggested Performance Recommendations</h2>

<p>Based on the findings above, we'd recommend that CoSport.com beef up their back-end infrastructure and CDN to better handle more simultaneous requests and higher peak bandwidth. They could combine CSS files and JavaScript files to minimize HTTP requests, and avoid a redirect to an SSL page on their home page to avoid SSL overhead. During peak access times, they could replace key pages with minimalist pages by substituting CSS text or sprites for graphic text (see the highlighted country button examples above in  Figure 4), to minimize the number of requests served.  The London2012.com team could improve performance by adding GZIP compression, improving caching, minifying and combining JavaScript and CSS, and optimizing and combining images.</p>

<h2>Further Reading</h2>

<dl>
<dt><a href="http://www.cosport.com">CoSport.com</a></dt><dd>Official reseller of Olympic tickets and hospitality packages for Australia, Austra, Bugaria, Canada, Norway, Sweden, and the United States.</dd>

<dt><a href="http://www.london2012.com">London2012.com</a></dt><dd>Official site for the London 2012 Summer Olympic Games.</dd>

<dt><a href="http://code.google.com/speed/page-speed/">Page Speed</a></dt>
<dd>Google's Page Speed browser plug-in analyzes web pages according to an expanded set of performance rules, first created by Steve Souders.</dd>

<dt><a href="http://www.webpageanalyze.com">Web Page Analyzer</a></dt>
<dd>A free web-based web page analysis tool using guidelines to offer recommended improvements.</dd>

<dt><a href="http://developer.yahoo.com/yslow/">Yahoo! YSlow for FireBug</a></dt><dd>Useful browser plug-in that analyzes web pages according to a set of performance rules, first created by Steve Souders.</dd>

</dl>

]]>
    </content>
</entry>

<entry>
    <title>Speed Optimizing Google Analytics</title>
    <link rel="alternate" type="text/html" href="http://www.websiteoptimization.com/speed/tweak/google-analytics/" />
    <link rel="service.edit" type="application/atom+xml" href="http://www.websiteoptimization.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=3/entry_id=350" title="Speed Optimizing Google Analytics" />
    <id>tag:www.websiteoptimization.com,2011:/speed/tweak//3.350</id>
    
    <published>2011-02-13T18:26:56Z</published>
    <updated>2011-02-14T01:24:06Z</updated>
    
    <summary>Learn how to speed up web pages that use Google Analytics with a few simple changes, while maintaining its advantages for faster-loading sites.</summary>
    <author>
        <name>website optimization</name>
        <uri>http://www.websiteoptimization.com</uri>
    </author>
    
        <category term="JavaScript optimization" />
    
        <category term="Psychology" />
    
        <category term="Speed optimization" />
    
        <category term="Web performance" />
    
        <category term="Website optimization" />
    
    <content type="html" xml:lang="en" xml:base="http://www.websiteoptimization.com/speed/tweak/">
        <![CDATA[<p>Many sites now use Google Analytics to track their metrics. Google Analytics gives some useful statistics not normally found from server-side log files, including PPC versus natural SEO traffic and visitor behavior. Used as directed however, Google Analytics can slow down your pages. This article shows how improve the speed of web pages using Google Analytics with a few simple changes, while maintaining its advantages for faster-loading sites.</p>]]>
        <![CDATA[<h2>Placement of Google Analytics' JavaScript</h2>

<p>After you signup for Google Analytics (<a href="http://www.google.com/analytics/">http://www.google.com/analytics/</a>) Google gives you a snippet of JavaScript to include in your web pages. This snippet contains a unique code (see _setAccount below) identifying your website, as well as a link to the "ga.js" JavaScript file (google-analytics.com/ga.js) that is called to grab the data. The code for WebsiteOptimization.com looks like this:</p>


<code><pre>&lt;script type="text/javascript"&gt;

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-21014437-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

&lt;/script&gt;
&lt;/head&gt;</pre></code>

<p>Google instructs webmasters to place this code just before the closing <code>&lt;/head&gt;</code> tag, at the end of the HEAD element in their XHTML files. The code is purported to be asynchonous, meaning it should load the script after the content has loaded. Let's see what actually happens with a waterfall graph (courtesy of WebPageTest.org, see Figure 1).</p>

<div align="center" style="text-align:center;margin:0 auto;">
<p><a href="google-head-waterfall.png"><img src="google-head-waterfallsm.png" border="1" width="930" height="375" alt="waterfall graph of websiteoptimization.com with google analytics in head"></a></p>
<h4>Figure 1: Waterfall Graph of WebsiteOptimization.com Google Analytics in HEAD</h4>
</p></div>

<p><small>Note that the dark blue, orange, green and light blue colors signify DNS lookup, Initial Connection, Time to First Byte, and Content Download times respectively.</small></p>

<p>You can see that the external Google-Analytics.com/ga.js file loads fourth (4) in the sequence of 19 total files, while the 1 pixel GIF from Google loads tenth (10). The DNS lookup (58ms) and initial connection (137ms, in dark blue and orange respectively) times for the external ga.js file total 195 ms. You pay a price for loading files from another server due to DNS lookup time. Under load we noticed a slight delay after adding the Google code to the page.</p>

<p>The overall loading statistics are shown in Figure 2. Start render is shown as 0.844 seconds for the HEAD configuration.</p>

<div align="center" style="text-align:center;margin:0 auto;">
<p><img src="google-head-time.png" border="1" width="775" height="100" alt="loading times of websiteoptimization.com with google analytics in head"></a></p>
<h4>Figure 2: Loading Times for WebsiteOptimization.com with Google Analytics in HEAD</h4>
</p></div>

<p>Let's see what happens when we move the code to the footer.</p>

<h3>Move JavaScript to the Bottom</h3>

<p>As an experiment we moved the Google Analytics JavaScript snippet to the bottom of the page, just before the closing BODY element thus:</p>

<pre><code>&lt;script type="text/javascript"&gt;

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-21014437-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

&lt;/script&gt;
&lt;/body&gt;</code></pre>

<p>The resulting waterfall graph looked like this (see Figure 3):</p>

<div align="center" style="text-align:center;margin:0 auto;">
<p><a href="google-footer-waterfall.png"><img src="google-footer-waterfallsm.png" border="1" width="930" height="375" alt="waterfall graph of websiteoptimization.com with google analytics before closing BODY"></a></p>
<h4>Figure 3: Waterfall Graph of WebsiteOptimization.com with Google Analytics before closing BODY</h4>
</p></div>

<p>The Google Analytics JavaScript file moved from loading fourth (4) to eighth (8) in the sequence. This lets more useful content display for the user, giving them a sense of faster feedback from the page. In this case the DNS lookup was higher at 242ms, and the initial connection time was 55ms, for a total delay of 297ms or about 1/3 of a second on a high speed connection. The start render went from 0.84 to 0.77 seconds moving the JavaScript from the HEAD to the footer (your times may vary with each load See Figure 4).</p>

<p>The overall loading statistics for the code in the footer configuration are shown in Figure 4. Start render is shown as 0.768 seconds for the FOOTER configuration.</p>

<div align="center" style="text-align:center;margin:0 auto;">
<p><img src="google-footer-external-time.png" border="1" width="773" height="98" alt="loading times of websiteoptimization.com with google analytics in footer"></a></p>
<h4>Figure 4: Loading Times for WebsiteOptimization.com with Google Analytics in FOOTER</h4>
</p></div>

<h2>Localize External JavaScripts</h2>

<p>To avoid the extra overhead of off-server resources (DNS lookup and Time to First Byte) you can localize your JavaScripts on your server. We copied the ga.js file from google-analytics.com/ga.js and placed it at websiteoptimization.com/ga.js, and changed the code accordingly (google-analytics.com/ga.js to websiteoptimization.com/ga.js):</p>

<pre><code>&lt;script type="text/javascript"&gt;

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-21014437-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.websiteoptimization.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

&lt;/script&gt;
&lt;/body&gt;</code></pre>

<p>Let's see what happens to the waterfall graph after localizing this file (see Figure 5).</p>

<div align="center" style="text-align:center;margin:0 auto;">
<p><a href="google-footer-local-waterfall.png"><img src="google-footer-local-waterfallsm.png" border="1" width="930" height="379" alt="waterfall graph of websiteoptimization.com with google analytics before closing BODY local"></a></p>
<h4>Figure 5: Waterfall Graph of WebsiteOptimization.com with Google Analytics before closing BODY local</h4>
</p></div>

<p>The Google Analytics file now loads 17th, after all the page content displays. The start render time (green vertical line) moved from 0.77 seconds to 0.73 seconds or 13% faster than the initial start render time of 0.84 seconds (see Figure 6). There is now no DNS or Initial Connection overhead for the JavaScript file because it is stored locally.</p>

<p>The overall loading statistics for the code in the footer configuration are shown in Figure 6. Start render is shown as 0.73 seconds for the FOOTER local file configuration.</p>

<div align="center" style="text-align:center;margin:0 auto;">
<p><img src="google-footer-local-time.png" border="1" width="773" height="97" alt="loading times of websiteoptimization.com with google analytics in footer local"></a></p>
<h4>Figure 6: Loading Times for WebsiteOptimization.com with Google Analytics in FOOTER local</h4>
</p></div>


<h2>Cautions to This Method</h2>

<p>There are a couple of cautions to watch out for with this method. Google periodically updates their analytics code to add more features. You can address this with a CRON script to periodically copy over the latest ga.js file, or copy the file manually periodically. The other caution is that Google says if you place the code at the end, you may lose some visitor data for people that don't wait for the entire page to load. For faster pages this isn't much of an issue, but for slower ones you may lose some visitor data this way. For us, the slight chance of a loss of some visitor data is more than offset in the gain in display speed.</p>

<h2>Conclusion</h2>

<p>You can speed up sites using Google Analytics with two simple changes. Move your analytics code to the bottom, and localize the JavaScript file. This article showed the effect of these changes on a real-world example with waterfall graphs.</p> 

<h2>Further Reading</h2>

<dl>
<dt><a href="http://www.google.com/analtics/">Google Analytics</a></dt>
<dd>Google's free analytics service uses JavaScript to gather data. Formerly the Urchin statistical software acquired, improved, and made into a free  web service by Google.</dd>
<dt><a href="http://www.websiteoptimization.com/speed/tweak/javascript-optimization/">JavaScript Optimiation Tips</a></dt>
<dd>Tips from WebsiteOptimization.com's Speed Tweak.</dd>
</dl>]]>
    </content>
</entry>

<entry>
    <title>ETags Revisited</title>
    <link rel="alternate" type="text/html" href="http://www.websiteoptimization.com/speed/tweak/etags-revisited/" />
    <link rel="service.edit" type="application/atom+xml" href="http://www.websiteoptimization.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=3/entry_id=349" title="ETags Revisited" />
    <id>tag:www.websiteoptimization.com,2011:/speed/tweak//3.349</id>
    
    <published>2011-01-31T19:28:26Z</published>
    <updated>2011-01-31T20:26:41Z</updated>
    
    <summary>Learn how to configure or eliminate ETags to improve website performance.</summary>
    <author>
        <name>website optimization</name>
        <uri>http://www.websiteoptimization.com</uri>
    </author>
    
        <category term="Server optimization" />
    
        <category term="Speed optimization" />
    
        <category term="Web performance" />
    
        <category term="Website optimization" />
    
    <content type="html" xml:lang="en" xml:base="http://www.websiteoptimization.com/speed/tweak/">
        <![CDATA[<p>An Entity tag (ETag) is a unique identifier assigned to a specific version of a given resource on a web server. ETags are used as a cache control mechanism to allow client browsers to make conditional requests. This lets caches work more efficiently by reusing unchanged resources on the client, and avoiding full server responses if the content has not changed. Efficient caching saves bandwidth and improves performance by delivering only what the client needs, not what it already has.</p>]]>
        <![CDATA[<h2>Anatomy of an ETag</h2>

<p>In Apache, ETags are made out of three components: the INode, MTime, and Size.</p>

<pre><code>FileETag INode MTime Size</code></pre>

<p>An ETag looks like this:</p>

<pre><code>ETag: "10690a1-4f2-40d45ae1"</code></pre>

<h2>Cache Conversation</h2>

<p>When clients cache a resource they also save its ETag. If the server resource changes, its ETag is updated. When a client revisits a page, it checks to see if the resource has changed by sending a conditional header If-None-Match and the value of the object's ETag:</p>

<pre><code>If-None-Match: "10690a1-4f2-40d45ae1"</code></pre>

<p>On the subsequent request, the server compares the ETag sent with the current Etag of the resource. If the Etags match the resource has not changed so the server sends the short response of HTTP 304 Not Modified status. The "not modified" status tells the client that the resource in the cache is good, and it can be reused. If the ETags do not match the server sends a complete response including the modified resource. </p>

<h2>The Problem with ETags</h2>

<p>The problem with ETags is that by default they are intended to be used on a single server (the inode portion above). Apache and Microsoft IIS default to the full ETag configuration, including the server's iNode.  For websites served from multiple servers, ETags can cause an unnecessary load by serving the same resource from different servers, even though the resource is identical and unchanged.</p>

<h2>The Solution: Configure ETags</h2>

<p>The solution for sites with multiple servers is to remove the iNode portion of Etags. To do this in Apache add the following lines to your configuration file.</p>

<pre><code>&lt;Directory /usr/local/httpd/htdocs&gt;
    FileETag MTime Size
&lt;/Directory&gt;</code></pre>

<p>An example from a site using iNode-less ETag follows:</p>

<pre><code>Server	        Apache
Last-Modified	Fri, 28 Jan 2011 16:30:52 GMT
Etag	        "15c3-4d42ef3c"
Accept-Ranges	bytes
Content-Length	5571
Content-Type	image/jpeg
Date	        Mon, 31 Jan 2011 18:56:41 GMT</code></pre>

<p>This server-independent ETag avoids the problem of the default ETag configuration, and allows more efficient caching of the same object across different servers.</p>

<h2>Remove ETags Entirely</h2>

<p>Another option is to remove ETags entirely, and rely on other cache control headers like Last-Modified timestamps. To remove ETags in Apache, add the following to your server configuration file.</p>

<pre><code>Header unset Etag
FileETag none</code></pre>

<p>This has the added benefit of reducing the size of your headers, which we'll talk about in a future tweak.</p>

<h2>Conclusion</h2>

<p>Used correctly ETags can improve cache efficiency and improve the performance of your website. However, by default Apache and Microsoft IIS servers send fully specified ETags with a server component that can cause unnecessary requests for an identical resource served from multiple servers. One solution is to configure your ETags to omit the server information (iNode). Another is to eliminate ETags entirely.</p>

<h2>Further Reading</h2>

<dl>
<dt>Clausen. L. "Concerning Etags and datestamps,"</dt>
<dd>In  <i>Proc. Web Archiving Workshop</i>, Bath, United Kingdom, September 2004. - Tested the optimal combination of ETag and datestamp caching.</dd>

<dt><a href="http://www.websiteoptimization.com/secrets/advanced/configure-etags.html">Code: Configure or Eliminate ETags</a></dt>
<dd>An excerpt from <em>Website Optimization</em> showing how to configure ETags.</dd>

<dt><a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.11">ETag from HTTP 1.1 Specification</a></dt>
<dd>Describes the use of ETags.</dd>
</dl>


]]>
    </content>
</entry>

<entry>
    <title>Automatically Speed Up Your Site with mod_pagespeed for Apache</title>
    <link rel="alternate" type="text/html" href="http://www.websiteoptimization.com/speed/tweak/mod_pagespeed/" />
    <link rel="service.edit" type="application/atom+xml" href="http://www.websiteoptimization.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=3/entry_id=346" title="Automatically Speed Up Your Site with mod_pagespeed for Apache" />
    <id>tag:www.websiteoptimization.com,2010:/speed/tweak//3.346</id>
    
    <published>2010-11-12T15:56:12Z</published>
    <updated>2010-11-12T16:07:06Z</updated>
    
    <summary>mod_pagespeed is an open-source Apache module that automatically speeds up web sites. Through a number of filters, mod_pagespeed trims the fat off your HTML, CSS, JavaScript and images, reduces HTTP requests, and improves caching. In this article we introduce mod_pagespeed and summarize the available filters.</summary>
    <author>
        <name>website optimization</name>
        <uri>http://www.websiteoptimization.com</uri>
    </author>
    
        <category term="CSS optimization" />
    
        <category term="Graphic optimization" />
    
        <category term="JavaScript optimization" />
    
        <category term="Server optimization" />
    
        <category term="Speed optimization" />
    
        <category term="Web performance" />
    
        <category term="Website optimization" />
    
        <category term="XHTML optimization" />
    
    <content type="html" xml:lang="en" xml:base="http://www.websiteoptimization.com/speed/tweak/">
        <![CDATA[<p>mod_pagespeed is an open-source Apache 2.2+ module designed to automatically speed up your site by optimizing the various components of your web pages. The module does this by rewriting page resources using filters that adhere to <a href="http://code.google.com/speed/page-speed/docs/rules_intro.html">web performance best practices</a>. mod_pagespeed is the server version of the client-side Firefox module that analyzes web pages using similar best practices.</p>
]]>
        <![CDATA[
<h2>How mod_pagespeed Works</h2>

<p>mod_pagespeed utilizes a number of filters to optimize HTML, JavaScript, CSS, and JPEG and PNG images, as well as set better caching policies. mod_pagespeed rewrites resoruces into a server-side cache to be delivered instead of the original resources, so it is important to configure caching on your server correctly. The module essentially takes existing page resources and trims excess fat (unused resources in images for example), and improves caching (hashed resources with long expiry times). By configuring caching and HTTP compression and using mod_pagespeed, webmasters can speed up their sites by serving optimized resources.</p>

<h3>mod_pagespeed Filters</h3>

<p>This module is configured similarly to other Apache modules, using the pagespeed.conf file. The configuration file turns on and off the filters, and allows webmasters to fine tune threshold settings used by the various filters. A summary of the initial filters is shown below:</p>

<style type="text/css">
<!--
dl dt{font-weight:bold;}
-->
</style>

<dl>
<dt>Add Head</dt>
<dd>Adds an XHTML head section to the document if it finds a <code>&lt;body&gt;</code> tag before finding a <code>&lt;head&gt;</code> tag. This filter is used to make sure there is a place for other filters to write tags into the HEAD of XHTML documents.</dd>
<dt>Add Instrumentation</dt>
<dd>Inserts two small snippets of JavaScript (early in the head, and late in the body) to measure the time the client spends loading and rendering a page, and reports this data  back to the server.</dd>
<dt>Collapse Whitespace</dt>
<dd>This filter replaces contiguous whitespace with a single whitespace character to reduce the transfer time of HTML files.</dd>
<dt>CSS Combine</dt>
<dd>The CSS Combine filter reduces HTTP requests by combining multiple external CSS files into one concatenated CSS file.The filter operates within the scope of a "flush window."</dd>
<dt>Combine Heads</dt>
<dd>Although technically a no-no in XHTML, there are web pages out there that have multple head elements. This filter combines them into one.</dd>
<dt>Elide Attributes</dt>
<dd>
This filter removes attributes from tags when the specified value is equal to the default value of that attribute.</dd>
<dt>Extend Cache</dt>
<dd>The "Extend Cache" filter extends cache lifetimes for all resources that are not otherwise optimized. This filter rewrites the URL referenced in an HTML page to include a hash of the resource. It also rewrites the HTTP header to extend the max-age value of the cacheable resource to one year. mod_pagespeed uses the origin cache TTL to periodically re-examine content to see if it has changed. If so, the hash of the content will change. This mechanism makes it safe to serve hashed URLs with a long timeout. So if a site owner changes a resource, the hash to the resource will change after the specified TTL. Note that this filter is included in other filters that optimize resources.</dd>
<dt>Inline CSS</dt>
<dd>The "Inline CSS" filter moves smaller external CSS files into the HTML file, to save HTTP requests. This filter inlines CSS files below a specified byte threshold.</dd>
<dt>Inline JavaScript</dt>
<dd>The "Inline JavaScript" filter works similarly to the Inline CSS filter. It saves HTTP requests by inlining small external JavaScript files directly into the HTML file. This filter only inlines script below a specified byte size threshold, and only those scripts without both source and inline data, and on-domain JavaScripts.</dd>
<dt>Minify JavaScript</dt>
<dd>This filter minifies JavaScript code to reduce file size. It currently removes most whitespace and comments. This filter allows webmasters to "prettify" their JavaScript to be more legible with indents etc. and still have minified files without the extra step of minification.</dd>
<dt>Move CSS to Head</dt>
<dd>This filter moves all external CSS to the head of the HTML document. This filters aims to minimize the number of times a browser must re-flow a document by ensuring that all CSS is parsed in the head before any body content is encountered. Like some of the other filters in mod_pagespeed, this filter works in the scope of a "flush window." A flush of the output buffer is used to deliver initial content faster, and to increase the apparent response time of web pages (feedback).</dd>
<dt>Optimize Images</dt>
<dd>
The "Optimize Images" filter re-scales, re-compresses, and strips metadata from JPEG and PNG images. It also inlines images using the <code>data:uri</code> scheme below a default (2048 bytes) or specified threshold. The filter does not currently optimize GIFs or 1x1 pixel images. You should also turn on the insert_imagedimensions filter to ensure fast rendering of images.</dd>
<dt>Outline CSS</dt>
<dd>This experimental filter is the opposite of Inline CSS. It takes inlined CSS larger than a minimum byte threshold and makes it into an external resource. Outlining CSS can save bytes across multiple pages that use the same inlined CSS by caching the outlined CSS file.</dd>
<dt>Outline JavaScript</dt>
<dd>This experimental filter works similarly to the Outline CSS filter. It takes inlined JavaScript larger than a minimum byte threshold and makes it an external resource.</dd>
<dt>Remove Comments</dt>
<dd>This filter removes most comments from HTML files. The filter is aware of Internet Explorer's conditional comments, and will not remove these.
</dd>
<dt>Remove Quotes</dt>
<dd>This filter removes unnecessary quotation marks from HTML attributes. Note that XHTML requires quotes around attributes.</dd>
<dt>Rewrite CSS</dt>
<dd>This filter minifies inline and external CSS by stripping out most whitespace, and shortening color names. The example shows #ff0000 shortened to red, it isn't clear if shorthand hex notation is also used for this filter (i.e., #ffcc00 becomes #fc0). Note that this filter should be used with caution on malformed or proprietary CSS.</dd>
</dl>

<h2>Conclusion</h2>

<p>mod_pagespeed is a welcome addition to our web performance toolkit. It automates a number of techniques webmasters either do manually or automatically with shell scripts. While no substitute for recoding pages using CSS sprites, conversion to CSS behavior from JavaScript (drop-down menus for example), substituting CSS layout for table layout, and modular CSS techniques, mod_pagespeed will trim the fat, reduce HTTP requests, and intelligently extend caching policies for your web page resources.</p>

<h2>Further Reading</h2>

<dl>
<dt><a href="http://googlewebmastercentral.blogspot.com/2010/11/make-your-websites-run-faster.html">Make your websites run faster, automatically - try mod_pagespeed for Apache</a></dt>
<dd>Official announcement of the mod_pagespeed Apache module by Richard Rabbat, Product Manager, 'Make the Web Faster' initiative at Google. Last year Google introduced Page Speed, a client-side analysis module that analyzes web pages for performance issues. On November 3, 2010 Google's official blog announced mod_pagespeed, which incorporates 15 on-the-fly optimizations derived from web performance best practices. Initial tests by Google showed speed improvements of up to 50%, or 2X faster on average across a rough sample of web sites.
</dd>

<dt><a href="http://www.modpagespeed.com">modpagespeed.com</a></dt>
<dd>Official website for mod_pagespeed, offers before and after examples of each filter.</dd>

<dt><a href="http://code.google.com/speed/page-speed/docs/using_mod.html">mod_pagespeed documentation codebase</a></dt>
<dd>"mod_pagespeed is an Apache 2.x module. It is added into an existing Apache installation, and configured with the pagespeed.conf configuration file. mod_pagespeed can be installed from source or binary form."
</dd>
</dl> ]]>
    </content>
</entry>

<entry>
    <title>What to Expect from a Web Performance Audit</title>
    <link rel="alternate" type="text/html" href="http://www.websiteoptimization.com/speed/tweak/web-performance-audit/" />
    <link rel="service.edit" type="application/atom+xml" href="http://www.websiteoptimization.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=3/entry_id=344" title="What to Expect from a Web Performance Audit" />
    <id>tag:www.websiteoptimization.com,2010:/speed/tweak//3.344</id>
    
    <published>2010-09-30T11:03:41Z</published>
    <updated>2010-09-30T20:57:42Z</updated>
    
    <summary>Google&apos;s new search rank measure, site speed, is one more reason to make sure your pages fly. For faster websites and higher rankings, many companies turn to a performance analysis. Find out what to look for in a web performance audit.</summary>
    <author>
        <name>website optimization</name>
        <uri>http://www.websiteoptimization.com</uri>
    </author>
    
        <category term="Speed optimization" />
    
        <category term="Surveys and Statistics" />
    
        <category term="Web performance" />
    
        <category term="Website optimization" />
    
    <content type="html" xml:lang="en" xml:base="http://www.websiteoptimization.com/speed/tweak/">
        <![CDATA[<p>With Google now factoring page loading speed into search engine rankings, having a fast website has become even more important. Exactly how much of a factor speed is in search rankings is open to debate, although anecdotal evidence suggests that speed can affect rankings. One of the first steps companies need to take in improving their website speed is a web performance audit. This article details what to expect in a web performance analysis.</p>
]]>
        <![CDATA[<h2>What is a Web Performance Audit?</h2>

<p>A web performance audit is an independent analysis of the factors that contribute to the response time of a website. In addition to measuring the size and rendering speed of the various components that make up a web page, a web performance audit should offer recommendations to speed up the response time of initial and subsequent page loads. Depending on its depth, a web performance audit can also include optimized code examples to replace older less efficient code (XHTML, CSS, JavaScript, and backend PHP, Perl, Java, etc.).</p>

<p>Performance audits come in two flavors, front-end and back-end. Front-end audits are more common than back-end because about 80% to 90% of the time users wait for pages to load are spent on the front-end (Souders 2007). Back-end audits are still useful for performance because you can potentially gain orders of magnitude improvements in performance from back-end optimization. A front-end audit typically includes the following:</p>

<h3>Front-End Web Performance Analysis</h3>

<ul>
<li>Executive summary with overall recommendations</li>
<li>Baseline performance benchmarks (useful for tracking progress and competitive analysis)</li>
<li>Detailed analysis of individual web pages</li>
	<ul>
	<li>Baseline metrics (XHTML, CSS, JavaScript, multimedia size, page load speed [first byte, start render, page load times])</li>
      <li>Triaged recommendations (listed in order of effectiveness) for both page components and server settings</li>
      <li>Code review with optimized examples of first instances of problem areas (XHTML, CSS, and JavaScript)</li>
	<li>Optional: AJAX-specific analysis (code review, unused functions, proper library, compression, server settings])</li>
 	</ul>
</ul>

<h3>Back-End Web Performance Audit</h3>

<p>A back-end audit explores the factors that effect the <em>delivery</em> of the front-end content. Back-end audits typically review server setups, CMS and module configuration, and SQL query efficiency. An example outline of a back-end audit follows:</p>

<ul>
<li>Executive summary with overall recommendations</li>
<li>Baseline performance benchmarks and server setup</li>
	<ul>
	<li>Identify server configuration, middleware, and CMS and module setup/versions</li>
	<li>Recommend improvements for above factors (upgrades, caching, compression, middleware)</li>
	</ul>
<li>Locate target pages with profiling/monitoring tools</li>
<li>Identify slow database queries using SQL profiler</li>
	<ul>
	<li>Show which SQL queries to optimize</li>
	<li>Show where to create indexes for any full table scans</li>
	</ul>
</ul>

<h3>Hybrid Performance Audit</h3>

<p>A hybrid performance audit combines both front-end and back-end analyses into one complete report. Hybrid audits analyze the two main components that contribute to web page speed, the server configuration that delivers the content to the user, and the content itself and how quickly the content renders.</p>

<h3>What about Web Performance Tools?</h3>

<p>Automated performance tools like <a href="http://developer.yahoo.com/yslow/">YSlow</a>, <a href="http://code.google.com/speed/page-speed/">Page Speed</a>, and <a href="http://www.webpageanalyzer.com">WebPageAnalyzer.com</a> can give you some useful metrics and guidelines. Performance experts use these and other tools to analyze your site, review your code in detail, and triage and implement recommendations.</p>
 
<h2>Common Performance Problems</h2>

<p>What can you expect to find when reviewing a site for web performance? Here are some common performance problems we've found when reviewing web sites.</p>

<h3>Long Time To First Byte</h3>

<p>Figure 1 shows an example of a long time to deliver the first byte, over 4 seconds before any data is sent. This delays the time for the display of useful content. A long TTFB indicates a server performance issue, typically from an overloaded shared or dedicated server.</p>

<div align="center">
<h4>Figure 1: Long Time to First Byte (WebPageTest.org waterfall)</h4>
<p><img src="long-time-to-first-byte.png" width="900" height="442" alt="long time to first byte example">
</p>
</div> 

<h3>Slow SSL Connection/Handshake</h3>

<p>For secure transactions you often see a slow SSL connection (see Figure 2). Secure Sockets Layer handshakes are resource intensive and can slow down https pages. One solution is to offload SSL connections to a specialized server.</p>

<div align="center">
<h4>Figure 2: Long SSL Connection (WebPageTest.org waterfall)</h4>
<p><img src="long-ssl.png" width="524" height="140" alt="long ssl handshake">
</p>
</div> 

<h3>Blocking of Content by JavaScript</h3>

<p>When browsers load and execute JavaScript they stop other rendering duties including downloading other resources. Misplaced JavaScript (typically placed after CSS instead of before), can block the downloading of subsequent files. Here is an example where JavaScripts were placed between CSS files (see Figure 3), note the misplaced CSS file after a JavaScript file.</p>

<div align="center">
<h4>Figure 3: Misplaced JavaScript Blocks Parallel Downloads (WebPageTest.org waterfall)</h4>
<p><img src="javascript-blocking.png" width="387" height="240" alt="javascript blocking content">
</p>
</div> 

<h3>Too many external files in the HEAD</h3>

<p>With the <a href="/speed/tweak/average-web-page/">average web page</a> requiring more than 43 objects per page
 <a href="http://www.websiteoptimization.com/speed/tweak/parallel/">object overhead</a> now dominates web page latency. Multiple objects (external JavaScript and CSS files typically) within the HEAD of XHTML documents are particularly harmful to web page performance because they delay the rendering of useful body content that users can interact with. See Figure 3 for an example. One solution is to combine JavaScript files into fewer files, and do the same for CSS. Another solution is to "split the payload" and load only the CSS and JavaScript required by the page (before the onload event) and defer loading of the rest of the JavaScript and CSS after the body content loads (by attaching a node say with JavaScript after the onload event fires).</p>

<h3>Overweight JavaScript</h3>

<p>One trend that we're seeing lately with the advent of Web 2.0-enabled pages is the growth of JavaScript. Libraries like jQuery, Prototype, YUI, and Dojo are used and combined with other behavior (menus in particular) to create more interactive and responsive web interfaces. Unfortunately, all of this JavaScript has to be downloaded and parsed. We've seen total JavaScript payloads larger than 500K! A couple solutions present themselves, compress the JavaScript (with GZIP or deflate) which typically compresses these text files by 75% to 80%. Even better, combine and minify the JavaScript files before compression. The best solution is to rethink the behavior of the page in question, and substitute standards-based methods (CSS drop-down menus for example) for JavaScript.</p>

<h3>Unused or Legacy CSS</h3>

<p>One of the useful metrics that Page Speed gives is an indication of how much of the CSS is actually referenced in a target web page. In recent analyses we've found a fair amount of CSS going unused within pages and sites. To combat CSS bloat remove legacy CSS left over from past designs, and adopt a more object-oriented approach ala Nicole Sullivan (see <a href="http://oocss.org/">OOCSS.org</a> for more information).</p>

<pre><code>Removed unused CSS
45% of CSS (estimated 31.7kB of 70.4kB) is not used by the current page.</code></pre>

<h3>Uncompressed Textual Content</h3>

<p><a href="http://www.websiteoptimization.com/speed/tweak/compress/">HTTP compression</a> is a standards-based way to compress the textual content of your web pages. HTTP compression or "content encoding" uses GZIP and deflate to compress your XHTML, CSS, and JavaScript at the server, and modern browsers decompress these files automatically to speed up web page downloads and save bandwidth. Even though on average HTTP compression can save 75% or more off of textual files, only 66% to 89% of compressible text is compressed on the Web (Ramachandran 2010).</p>

<p>You can test your site for HTTP compression using the above tools or <a href="http://www.webpageanalyzer.com">Web Page Analyzer</a> or <a href="http://www.port80software.com">Port80Software.com</a> tools.</p>

<h3>Unoptimized Images and Multimedia</h3>

<p>On average images make up <a href="../average-web-page/">64.3% of the average web page size</a>, and <a href="http://www.websiteoptimization.com/speed/tweak/average-web-page/">more than 75% of all HTTP requests</a>, so optimizing images is one of the first places to start when speeding up web pages. While lossy methods can significantly reduce web image sizes, not everybody wants to change the quality of their images. You can losslessly trim unnecessary bytes and blocks from your images using a tool like <a href="http://www.smushit.com">Smushit</a> from Yahoo! (see Figure 4)</p>

<div align="center">
<h4>Figure 4: Shushit Losslessly Optimizing Images </h4>
<p><img src="smushit.png" width="633" height="197" alt="smushit optimizing images">
</p>
</div> 

<h3>Complex XHTML Code</h3>

<p>The XHTML provides the skeleton to display the objects in a web page. Making this skeleton lightweight is one key in fast web page display. Overuse of tables for layout and embedded styles and JavaScript are two common problems. One thing to avoid is saving HTML files from Word files. Word outputs a large amount of unnecessary code:</p>

<textarea cols="60" name="text" rows="10">

<pre><code>
&lt;html xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:w="urn:schemas-microsoft-com:office:word"
xmlns:m="http://schemas.microsoft.com/office/2004/12/omml"
xmlns="http://www.w3.org/TR/REC-html40"&gt;

&lt;head&gt;
&lt;meta http-equiv=Content-Type content="text/html; charset=windows-1252"&gt;
&lt;meta name=ProgId content=Word.Document&gt;
&lt;meta name=Generator content="Microsoft Word 12"&gt;
&lt;meta name=Originator content="Microsoft Word 12"&gt;
&lt;link rel=File-List href="index%20IT_file/filelist.xml"&gt;
&lt;link rel=Edit-Time-Data href="index%20IT_file/editdata.mso"&gt;
&lt;!--[if !mso]&gt;
&lt;style&gt;
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
&lt;/style&gt;
&lt;![endif]--&gt;
&lt;title&gt;Sample Home Page HTML from Word&lt;/title&gt;
&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
 &lt;o:DocumentProperties&gt;
  &lt;o:Author&gt;fm&lt;/o:Author&gt;
  &lt;o:Template&gt;Normal&lt;/o:Template&gt;
  &lt;o:LastAuthor>fm</o:LastAuthor&gt;
...
</textarea>
</code></pre>

<h3>Improper Server Settings</h3>

<p>You can detect certain server settings without requiring access to the server, typically using HTTP headers. Caching, keep-alive, HTTP compression, etags usage, cookies on static resources, and other settings can be detected remotely. Figure 5 shows the optimization checklist from <a href="http://www.webpagetest.org">WebPageTest.org</a>, which is an online version of AOL's PageTest open source program.</p>

<div align="center">
<h4>Figure 5: Optimization Checklist Showing Items to Address (WebPageTest.org Optimization Checklist)</h4>
<p><img src="optimization-checklist.png" width="1000" height="189" alt="optimization checklist">
</p>
</div> 

<h2>Conclusion</h2>

<p>With speed now factoring into web page rankings, web performance has suddenly become more important. A web performance audit can show where problem areas are and recommend solutions. This article shows what to expect from a web performance audit. There are two main kinds of performance audits, front-end and back-end. The majority of analyses are front-end, although back-end audits can often reveal significant areas for improvement. We showed some common problems found in websites today, and list some tools used by performance engineers.</p>

<h2>Further Reading</h2>

<dl>
<dt><a href="/speed/tweak/average-web-page/">The Average Web Page</a></dt>
<dd>Shows data for the average top 500 web page and the average web page for the entire web. The average web page as of May 2010 was 320K with 43.9 resources.</dd>

<dt><a href="../compress/">HTTP Compression</a></dt>
<dd>Standards-based way to compress textual content in a web page using GZIP or deflate. Typical compression savings are 75%.</dd>

<dt>King, A. 2008, "<a href="/secrets/">Website Optimization: Speed, Search Engine &amp; Conversion Rate Secrets</a>"</dt>
<dd>
Half of this book is devoted to improving web site performance. Includes a chapter on web metrics and performance tools. By Andrew B. King. O'Reilly.
</dd>


<dt>Ramachandran, S. 2010, May 26, "<a href="http://code.google.com/speed/articles/web-metrics.html">Web metrics: size and number of resources</a>,"</dt>
<dd>
Using the Googlebot, Sreeram analyzed both 380 million top sites and 4.2 billion websites to see what the average web page consists of. He found that the average web page is 320K in size, using 43.91 resources per page.Just 66% of compressible bytes were compressed using HTTP compression in the entire Web. 64.3% of the average web page was taken up by images (205.99K of images divided by 320K size of average web page). There were 7 scripts and 3.2 external style sheets. The uncompressed size of the top sites was 477.2K, while the uncompressed size of the average web page (4.2 billion) was 376.7K. Interestingly, the top sites network size (bytes delivered down the pipe) was smaller (312K vs. 320) than the overall average web page, due in part to the increased used of HTTP compression (89% versus 66%). Google, May 26, 2010.</dd>

<dt>Souders, S. 2007, "<a href="http://www.amazon.com/exec/obidos/ASIN/0596529309/ref=nosim/websiteoptimi-20">High Performance Web Sites</a>",</dt>
<dd>Using his experience as a back-end engineer at Yahoo! Steve Souders wrote his first book on web performance gives 14 rules to follow to speed up your site by 25 to 50%. Each rule is explained and tested with matching live tests on the <a href="http://www.stevesouders.com/hpws/">companion site</a>. O'Reilly.
</dd>


<dt><a href="http://www.webpagetest.org">WebPageTest.org</a></dt>
<dd>A web-based version of AOL's Page Speed program. Gives waterfall charges of resource loading sequences, optimization checklist of major problem areas, and timings at different network locations and bandwidths of page loading metrics.</dd>
</dl>

]]>
    </content>
</entry>

<entry>
    <title>Andrew King Interviewed by Joshua Bixby of Strangeloop Networks</title>
    <link rel="alternate" type="text/html" href="http://www.websiteoptimization.com/speed/tweak/andrew-king-interviewed-strangeloop/" />
    <link rel="service.edit" type="application/atom+xml" href="http://www.websiteoptimization.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=3/entry_id=341" title="Andrew King Interviewed by Joshua Bixby of Strangeloop Networks" />
    <id>tag:www.websiteoptimization.com,2010:/speed/tweak//3.341</id>
    
    <published>2010-08-29T14:20:22Z</published>
    <updated>2010-08-29T14:50:05Z</updated>
    
    <summary>Joshua Bixby interviewed Andrew King about the web performance industry. Learn what to look for in a performance consultant and what to expect in an audit.</summary>
    <author>
        <name>website optimization</name>
        <uri>http://www.websiteoptimization.com</uri>
    </author>
    
        <category term="Speed optimization" />
    
        <category term="Web performance" />
    
        <category term="Website optimization" />
    
    <content type="html" xml:lang="en" xml:base="http://www.websiteoptimization.com/speed/tweak/">
        Our own Andy King was interviewed by Joshua Bixby of Strangeloop Networks. Joshua asked Andy some probing questions about web performance consulting.
        <![CDATA[<p>Joshua, the President of Strangeloop Networks, asked about the value of hiring an outside consultant. Where to start when finding a performance consultant. Asking the right questions to weed out unqualified candidates. If there was a common process that performance consultants follow? And what to expect at the end of the process.</p>

<p><a href="http://www.webperformancetoday.com/2010/08/23/web-performance-consulting/ ">Web Performance Consulting: Five questions for Andrew King</a></p>

<h2>What to look for with a Performance Consultant</h2>

<p>You want to hire a firm that has experience and credibility. Like any job involving a consultant, ask for references. Take a look at their website to see how it fares for speed and design. Use Pagespeed, YSlow, or <a href="http://www.webpageanalyzer.com">Web Page Analyzer</a> to test the speed of their site, to see if they eat their own dog food.</p>

<h2>Performance Consultant Directory?</h2>

<p>Joshua asked an interesting question in the interview. Where can one find a performance consultant? Is there an organization of performance consultants and firms? Unlike SEO which has <a href="http://www.sempo.org">SEMPO</a>, I know of no organization of web performance consultants, looks like there is a need for this.</p>

<h2>Web Performance Audit</h2>

<p>The most common request we have from companies looking for performance consulting is an audit. Front-end audits outnumber back-end audits by a large margin, as 80% of performance problems are due to the front-end, i.e., the content that you deliver from your server to your users. A front-end audit evaluates the XHTML, CSS, javaScript, and multimedia for efficiency, as well as server settings that can help performance. We'll expand on what to expect in a web performance audit in a future tweak.</p>

<h2>Further Reading</h2>

<dl>
<dt><a href="http://www.strangeloopnetworks.com">Strangeloop Networks</a></dt>
<dd>Joshua Bixby's Strangeloop Networks specializes in automatically speeding up websites with services and hardware appliances.</dd>
<dt><a href="http://code.google.com/speed/page-speed/">Page Speed</a></dt>
<dd>A free browser-based tool that analyzes and grades web pages based on performance rules discovered by Steve Souders.</dd>
<dt><a href="http://www.webpageanalzyer.com">Web Page Analyzer</a></dt>
<dd>A free server-based tool that analyzes the performance of web pages.</dd>
<dt><a herf="http://developer.yahoo.com/yslow/">YSlow</a></dt><dd>A Firebug plug-in that analyzes and grades web pages for performance. Useful for summarized statistics.</dd>
</dl>
]]>
    </content>
</entry>

<entry>
    <title>Velocity 2010 Web Performance Conference</title>
    <link rel="alternate" type="text/html" href="http://www.websiteoptimization.com/speed/tweak/web-performance-conference/" />
    <link rel="service.edit" type="application/atom+xml" href="http://www.websiteoptimization.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=3/entry_id=339" title="Velocity 2010 Web Performance Conference" />
    <id>tag:www.websiteoptimization.com,2010:/speed/tweak//3.339</id>
    
    <published>2010-06-29T13:16:49Z</published>
    <updated>2010-06-29T14:09:10Z</updated>
    
    <summary>Highlights from the Velocity 2010 conference on web performance. This sold-out event explored the latest technique for fast websites, and is a must-see for performance engineers.</summary>
    <author>
        <name>website optimization</name>
        <uri>http://www.websiteoptimization.com</uri>
    </author>
    
        <category term="CSS optimization" />
    
        <category term="JavaScript optimization" />
    
        <category term="Psychology" />
    
        <category term="Server optimization" />
    
        <category term="Speed optimization" />
    
        <category term="Surveys and Statistics" />
    
        <category term="Web performance" />
    
        <category term="Website optimization" />
    
    <content type="html" xml:lang="en" xml:base="http://www.websiteoptimization.com/speed/tweak/">
        I just got back from the Velocity 2010 Web Performance and Operations Conference in Santa Clara, California. Now in its third year, the conference is a must-see if you are a web performance or network operations engineer. And engineers were aplenty this year, the conference was sold out with more than 1500 attendees.
        <![CDATA[<p>Founded by Steve Souders (author of High Performance Web Sites, Even Faster Web Sites) and Jesse Robbins (founder of Opscode and Amazon's "Master of Disaster") the Velocity Conference is devoted to helping you make your web pages and web applications faster. The conference this year covered many related issues, including mobile web performance, cloud computing, HTML 5, metrics, and network latency. It is a must-see if you are a web developer interested in making your site faster. And with Google's recent announcement of factoring speed into web page rankings, everyone should be interested in making their pages faster.</p>

<h2>The Web Performance Track</h2>

<p>What follows are some highlights from the talks, keynotes, and workshops I attended. As a web performance engineer, I was most interested in the web performance track, leaving the network operations talks to the sysops.</p>

<h2>Highlights</h2>

<dl>
<dt>Metrics 101:  What to Measure on Your Website   Sean Power (<a href="http://www.watchingwebsites.com">Watching Websites</a>) </dt>
<dd>The best speaker I saw, Sean Powers made metrics interesting, which is no mean feat. Averages are out, percentiles are in. Talked about boiling down metrics into meaningful form, while still retaining enough granularity to be meaningful. Four kinds of sites, transaction, collaboration, SAS, and media, each has its own set of metrics.</dd>
<dt>The Top 5 Mistakes of Massive CSS   Nicole Sullivan (Consultant), Stoyan Stefanov (Yahoo! Inc)</dt>
<dd>Nicole Sullivan talked about modular CSS, where you boil down the common interface features (media block, headers, etc.) and use only classes and classes that extend those classes plus the cascade and inheritance to build minimalist stylesheets. Using infinitely nestable grid systems like Yahoo's YUI, Nicole showed how she significantly reduced Facebook's CSS and HTML (by 50%). This and the Metrics talks were the two best I saw.</dd>
<dt>Speed Matters   Urs Hölzle (Google)</dt>
<dd>Gave a good talk on navigating web pages as fast as you can turn pages in a book. Talked about changes to the building blocks TCP, DNS, etc. One interesting statistic, the average web page is 320K with 44 requests and 7 DNS lookups, taking 4.9 second to load. The average bandwidth is 1.8Mbps. This is close to the <a href="http://www.websiteoptimization.com/speed/tweak/average-web-page/">Average top 1000 web page</a> which we estimate is 350K as of 2010.</dd>
</dl>

<h2>Other Highlights</h2>

<dl> 

<dt>The Browser Performance Toolkit - Matt Sweeney (Yahoo!)</dt>
<dd>Matt provided a good overview of the performance tools available to developers, including YSlow (of course), PageSpeed, Firebug, and others</dd>

<dt>The Psychology of Performance - Stoyan Stephanov (Yahoo!)<dt>
<dd>This should sound familiar to readers of my books, Stoyan showed how to tweak web pages to increase their perceived speed. Talked about flushing the page 2-3 times at key points in the render. The speaker was a bit hard to understand.</dd>
<dt>Building Performance Into the New Yahoo! Homepage   Nicholas Zakas (Yahoo!)<dt>
<dd>This was a well-attended and interesting talk. Nicholas talked about what Yahoo! did when adding features to maintain fast performance. He went beyond the usual suspects of caching, splitting payloads, and minification.</dd>
<dt>Twitter and Facebook talks</dt><dd>Engineers at both Facebook and Twitter talked about how they scale to millions of users.</dd>
<dt>Mitigating Advertising Impact on Page Performance   Ismail Elshareef (Razorgator Inc.) </dt>
<dd>Ismail talked about how his team reduced the impact of display ads at Edmonds.com using a JavaScript loader function at the end of the page.</dd>
<dt>Speeding up Ads</dt>
<dd>The folks at Meebo (toolbar) had an interesting talk about how they loaded ads asynchonously with a hidden iframe and attaching a node with JavaScript. We'll explore the details in a future tweak.</dd>
</dl>

<p>It was well worth attending this conference, met some great people and learned a few things. Being an O'Reilly conference there was an O'Reilly booth equipped with the latest performance-related books, but my book (Website Optimization, half of which is about performance) was not there for some reason.  I recommend going if you are interested in web performance.</p>

<h2>Further Reading</h2>

<p>You can see the speaker's slides (most of them) and videos of speakers at the official <a href="http://en.oreilly.com/velocity2010">O'Reilly Velocity website</a>, which also has talks/slides from the previous two conferences.</p>


]]>
    </content>
</entry>

<entry>
    <title>Page Speed Factored into Google Search Rankings</title>
    <link rel="alternate" type="text/html" href="http://www.websiteoptimization.com/speed/tweak/page-speed-search-rankings/" />
    <link rel="service.edit" type="application/atom+xml" href="http://www.websiteoptimization.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=3/entry_id=334" title="Page Speed Factored into Google Search Rankings" />
    <id>tag:www.websiteoptimization.com,2010:/speed/tweak//3.334</id>
    
    <published>2010-04-11T18:42:35Z</published>
    <updated>2010-04-15T16:11:47Z</updated>
    
    <summary>Google&apos;s addition of a page speed signal to its search rankings algorithm officially links performance with search engine marketing. The loading speed of a web page affects user psychology in a number of ways, and now it can affect its rankings as well. </summary>
    <author>
        <name>website optimization</name>
        <uri>http://www.websiteoptimization.com</uri>
    </author>
    
        <category term="Psychology" />
    
        <category term="Speed optimization" />
    
        <category term="Surveys and Statistics" />
    
        <category term="Web performance" />
    
        <category term="Website optimization" />
    
    <content type="html" xml:lang="en" xml:base="http://www.websiteoptimization.com/speed/tweak/">
        Google has incorporated the speed of a web page into its search engine rankings. While 
 this new signal currently affects only a small percentage of US sites, Google&apos;s announcement officially links performance with search engine marketing.
        <![CDATA[<p>Google has long used various factors, including page load speed, in its <a href="http://adwords.blogspot.com/2008/03/landing-page-load-time-will-soon-be.html">quality scores of PPC landing pages</a>. Now Google has incorporated page loading speed into its search engine rankings. Google announced this new signal in their <a href="http://googlewebmastercentral.blogspot.com/2010/04/using-site-speed-in-web-search-ranking.html">official Webmaster Central blog</a>:</p>

<p><blockquote>"Speeding up websites is important - not just to site owners, but to all Internet users. Faster sites create happy users and we've seen in our internal studies that when a site responds slowly, visitors spend less time there. But faster sites don't just improve user experience; recent data shows that improving site speed also reduces operating costs. Like us, our users place a lot of value in speed - that's why we've decided to take site speed into account in our search rankings. We use a variety of sources to determine the speed of a site relative to other sites."</blockquote></p>

<h2>Linking User Psychology and SEM</h2>

<p>While not currently as strong a signal than inlinks and page relevance, the new Page Speed signal should be taken into account when designing websites This is great news for the usability of the Web and for user satisfaction. Google incorporates more than 200 signals into its search engine ranking algorithm, and the page speed signal now more concretely bridges the gap between the psychology of performance and search engine marketing.</p>

<h2>The Psychological Effects of Speed</h2>

<p><a href="http://www.websiteoptimization.com/speed/tweak/psychology-web-performance/">Research has shown</a> that the speed of a website affects a number of measurable usability factors including:</p>

<ul>
<li><a href="http://www.websiteoptimization.com/speed/tweak/psychology-web-performance/">Ad revenues</a></li>
<li>Aesthetic perception</li>
<li><a href="http://www.websiteoptimization.com/speed/1/">Bailout rates</a></li>
<li>Conversion rates (Akamai study)</li>
<li>Flow states (Novak, Hoffman)</li>
<li><a href="http://www.websiteoptimization.com/speed/1/">Perceived web credibility</a> (Fogg)</li>
<li><a href="http://www.websiteoptimization.com/speed/1/1-3.html">Quality Ratings</a></li>
<li><a href="http://www.websiteoptimization.com/speed/tweak/psychology-web-performance/">Queries per user</a>
<li><a href="http://www.websiteoptimization.com/speed/tweak/psychology-web-performance/">User Frustration</a>  (measured by blood pressure and galvanic skin response)</li>
</ul>

<p>Even in this era of <a href="/bw/">widespread broadband</a>, slow web sites still frustrate users. The <a href="http://www.websiteoptimization.com/speed/tweak/average-web-page/">average web page</a> more than tripled in the 5 years from 2003 to 2008 from 93.7K to 312K in total size. An upcoming survey will show the trend continuing at a similar rate. We have seen home pages in excess of 4 to 10 MB in file size with hundreds of objects! Even on a broadband connection these fat and complex web pages will tax the <a href="http://www.websiteoptimization.com/speed/tweak/psychology-web-performance/">attention thresholds</a> of users.</p>

<p>The average number of objects has grown from 25.7 to 49.9  during the same 5 year time period with no signs of slowing down. <a href="http://www.websiteoptimization.com/speed/tweak/parallel/">Object overhead</a> now dominates page load delays in this era of higher speed connections.</p>

<h2>How Google Incorporates Speed Into Its Algorithm</h2>

<p><a href="http://searchengineland.com/google-now-counts-site-speed-as-ranking-factor-39708">Search Engine Land</a> reported that Google will measure the speed of a page in two ways:</p>

<ol>
<li>How a page responds to Googlebot</li>
<li>Load time as measured by the Google Toolbar</li>
</ol>

<p>Google has long been an advocate of website performance, in fact they provide an entire section of their site devoted to <a href="http://code.google.com/speed/">Speeding Up the Web</a>. Their <a href="http://code.google.com/speed/page-speed/">Page Speed</a> tool, spearheaded by <a href="http://www.stevesouders.com">Steve Souders</a> (who also was integral in Yahoo's <a href="http://developer.yahoo.com/yslow/">Yslow</a> performance tool) incorporates the best practices his team found and he detailed in his two books (<i>High Performance Web Sites</i>, and <i>Even Faster Web Sites</i>, both from O'Reilly). Google included <a href="http://googlewebmastercentral.blogspot.com/2009/12/how-fast-is-your-site.html">site performance in its webmaster tools</a> in December 2009.</p>

<h2>Conclusion</h2>

<p>Google's announcement of adding a page speed signal into its search rankings algorithm will in the long run help reduce user frustration with slow web sites. It is well established that the loading speed of a web page affects user psychology in a number of ways, and now it can effect its rankings as well. The Page Speed signal now concretely links user psychology with search engine marketing.</p>

<h2>Futher Reading</h2>

<dl>


<dt><a href="http://www.mattcutts.com/blog/site-speed/">Google incorporating site speed in search rankings</a></dt>
<dd>Matt Cutt's expands upon his company's official announcement. April 9, 2010.</dd>

<dt><a href="http://searchengineland.com/google-now-counts-site-speed-as-ranking-factor-39708">Google Now Counts Site Speed as Ranking Factor</a></dt>
<dd>Site speed is now a ranking factor in Google's algorithm, and is already in place for U.S. searchers. Search Engine Land, April 9, 2010.</dd>

<dt><a href="http://code.google.com/speed/page-speed/">Page Speed Tool</a></dt>
<dd>Google's free Firefox add-on that analyzes web pages against best practices outlined in Steve Souders' two O'Reilly books.</dd>

<dt><a href="http://www.websiteoptimization.com/speed/">Speed Up Your Site</a></dt>
<dd>Learn how to Speed Up Your Site with a number of techniques still applicable today including HTML, CSS, and JavaScript optimization. New Riders, 2003, Andrew B. King.</dd>

<dt><a href="http://googlewebmastercentral.blogspot.com/2010/04/using-site-speed-in-web-search-ranking.html">Using site speed in web search ranking</a></dt>
<dd>Google's announcement of the Page Speed signal in its search engine rankings algorithm. Official Google Webmaster Central Blog, April 9, 2010.
</dd>

<dt><a href="http://www.webpageanalzyer.com">Web Page Analyzer</a></dt>
<dd>Free web page analysis tool, gives total size of page, components, and number of objects along with recommendations. From Website Optimization.</dd>

<dt><a href="http://www.webpagetest.org">WebPageTest.org</a></dt>
<dd>A web-based version of AOL's Page Test software that analyzes web pages for performance against best practices. Features waterfall graphs to locate response time bottlenecks.</dd>

<dt><a href="http://www.websiteoptimization.com/secrets/">Website Optimization Secrets</a></dt>
<dd>Covers both search engine marketing and website performance techniques. Touches on crossover effects from the two camps (SEO and performance), including conversion, usability, and flow.</dd>

<dt><a href="http://developer.yahoo.com/yslow/">YSlow</a></dt>
<dd>Yahoo's browser plug-in for analyzing the performance of websites. Includes easy to use page stats and recommendations. Requires Firebug.</dd>

</dl>
.
]]>
    </content>
</entry>

<entry>
    <title>PNG24 and PNG Optimization</title>
    <link rel="alternate" type="text/html" href="http://www.websiteoptimization.com/speed/tweak/png-optimization/" />
    <link rel="service.edit" type="application/atom+xml" href="http://www.websiteoptimization.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=3/entry_id=333" title="PNG24 and PNG Optimization" />
    <id>tag:www.websiteoptimization.com,2010:/speed/tweak//3.333</id>
    
    <published>2010-03-31T12:11:00Z</published>
    <updated>2010-04-01T12:31:33Z</updated>
    
    <summary>Which program is the alpha transparency dog of PNG optimization? We put the front runners of the photo optimization pack through their paces.</summary>
    <author>
        <name>website optimization</name>
        <uri>http://www.websiteoptimization.com</uri>
    </author>
    
        <category term="Graphic optimization" />
    
        <category term="Multimedia optimization" />
    
        <category term="Photography" />
    
        <category term="Speed optimization" />
    
        <category term="Web performance" />
    
        <category term="Website optimization" />
    
    <content type="html" xml:lang="en" xml:base="http://www.websiteoptimization.com/speed/tweak/">
        <![CDATA[<p>Over 60% of the file size of the <a href="../average-web-page/">average web page</a> is taken up by graphics and multimedia. So <a href="../graphics-optimization/">graphics optimization</a> is an important step in optimizing web page speed. At an alarming frequency, we have seen large PNG24 and unoptimized JPEGs used on the Web. Large PNG24s should be optimized for file size or converted to PNG8s. This article shows how to optimize PNG files effectively by minimizing their color palettes, and using alpha transparency intelligently.</p>

]]>
        <![CDATA[<h2>PNG vs. GIF</h2>

<p>PNGs were designed to be a superior replacement for the Graphic Interchange Format (GIF). GIFs are limited to 256 colors 
(8-bit color palette), one level of transparency, and the Lempel-Ziv-Welch (LZW) compression algorithm that was patented 
by UNISYS. In most cases, PNG files from the same source images are smaller than corresponding GIFs. 
PNGs use the "deflate" compression algorithm, which is <a href="../png/">10 to 30% more efficient than 
LZW compression</a>.</p>

<p>By design PNGs have some advantages over GIF images. PNGs offer more choices in color depths than GIFs, 
including 8-bit (256 colors), 24-bit (8 bits per channel), and 48-bit (16 bits per channel) truecolor 
allowing for greater color precision and smoother transitions. When you add an alpha channel, PNGs allow 
for up to 64 bits per channel. PNGs can have index color transparency (one color) or alpha transparency 
(multiple levels) useful for smooth shadow transitions over other images. In summary, the advantages of PNGs 
over GIFs are:</p>

<ul>
<li>Alpha channels (multilevel transparency)</li>
<li>Variable bit depths</li>
<li>Cross-platform gamma and color correction</li>
<li>Two-dimensional interlacing</li>
<li>More efficient lossless compression (LZ77 vs. LZ78+)</li>
</ul>

<h2>PNG24 and PNG Optimization</h2>

<p>In a previous article, we discussed how to <a href="../png/">replace GIF with PNG files</a> for smaller file sizes. 
You can also optimize PNG24 files for file size by reducing bit depths and the number of colors used. Photoshop and Fireworks 
offer limited options when optimizing PNG24 files, but there are some third party plugins that offer more control 
over PNG24 color palettes.</p>

<h3>Sample PNG24: NPVetHospital.com</h3>

<p>Our volunteer PNG24 comes from NPVetHospital.com, a California client who was kind enough to 
grant permission to use his site as an example. He came to us concerned that the site was slow 
to load, even on some broadband connections. The site was designed using large PNG24 images with wide 
transparent drop-shadows layered over graduated backgrounds. These 24-bit PNGs gave some beautifully smooth 
transitions around the outer edge of the animals, but were slow to load. While certainly adorable, 
the puppy image alone weighed in at 676K, giving the home page a weight of well over a megabyte (see Figure 1).</p>

<div align="center">
<h4>Figure 1: NPVetHospital.com Original Home Page</h4>
<p><a href="npvetorig.jpg"><img src="npvetorig600x296.jpg" width="600" height="296" alt="NPVetHospital.com Original Home Page" border="1"></a></p>
</div> 

<p>The original image appeared this way in Photoshop (see Figure 2). Note the wide drop shadow around the 
edge of the hand and puppy. The existence of the drop shadow and the transparency-based design are the reasons 
why the original designers chose to use PNGs over GIFs. Note that a JPEG, as shown in these figures, 
reduces to a much smaller file size, but lacks the transparent feature of GIFs and PNGs.</p>

<div align="center">
<h4>Figure 2: PNG24 in Photoshop</h4>
<p><a href="banner_home.png"><img src="photoshop-png24.jpg" width="746" height="410" alt="NPVetHospital.com Original Home Page PNG24" border="1"></a></p>
</div> 

<h3>Photoshop to PNG8, No Dithering</h3>

<p>Reducing the original image in Photoshop to a PNG8 produced mixed results (see Figure 3). Note 
that starting with a layered Photoshop original would give better results: you would avoid requantizing, 
you could minimize drop shadows, and you could equalize transparent flat areas.</p>

<div align="center">
<h4>Figure 3: PNG8 in Photoshop</h4>
<p><img src="photoshoppng8opt.png" width="850" height="583" alt="PNG24 to PNG8 in Photoshop" border="0"></p>
</div> 

<p>Adding diffusion transparency dither got rid of the non-transparent areas in Photoshop, but 
the dithering shows once the image is overlaid on the background (see Figure 4).</p>

<div align="center">
<h4>Figure 4: PNG8 in Photoshop with Diffusion Transparency Dithering</h4>
<p><img src="photoshop-png8dithered.jpg" width="480" height="244" alt="PNG8 in Photoshop with diffusion transparency dithering" border="0"></p>
</div> 

<p>Saving as a PNG24 (File -&gt; Save for Web) cuts the file size to 292K (by 56.8%), but offers 
no options for color reduction (see Figure 5).</p>

<div align="center">
<h4>Figure 5: PNG24 in Photoshop</h4>
<p><a href="banner_home-photoshoppng24.png"><img src="photoshop-png24screen.jpg" width="523" height="510" alt="PNG24 in Photoshop 292K" border="1"></a></p>
</div> 

<h3>Fireworks and PNG Optimization</h3>

<p>Fireworks offers more options than Photoshop when optimizing PNG files. For PNG24s, Fireworks offers no color reduction 
options but reduced our test PNG24 to 243K (by 64%), which is 7 percentage points better than 
Photoshop. But Fireworks 
really shines when optimizing to PNG8 files where it allows both alpha and index transparency (see Figure 6).</p>

<div align="center">
<h4>Figure 6: PNG8 Optimization in Fireworks</h4>
<p><img src="fireworkspng8alphascreen2.jpg" width="798" height="586" alt="PNG8 optimization in Fireworks" border="1"></p>
</div> 

<p>Unfortunately, the upper part of this drop shadow shows some banding in this svelte PNG8 (see Figure 7).</p>

<div align="center">
<h4>Figure 7: Fireworks PNG8 with Alpha Transparency</h4>
<p><a href="banner_homefireworkscs4png8alpha.png"><img src="npvetpng8alphanodither256.jpg" width="442" height="312" alt="Fireworks PNG8 with Alpha Transparency 76K" border="1"></a></p>
</div> 

<p>This version is nearly ideal, however. Let's try adding some dithering and see what happens to the drop shadow 
(see Figure 8). The banding nearly disappears! This version is 94K.</p>

<div align="center">
<h4>Figure 8: Fireworks PNG8 with Alpha Transparency and 100% Dithering</h4>
<p><a href="banner_homefwpng8adaptdith.png"><img src="npvetpng8adaptdithercrop.jpg" width="417" height="275" alt="Fireworks PNG8 with Alpha Transparency and 100% Dithering" border="1"></a></p>
</div> 

<p>This dithered alpha dog will hunt. Its drop shadows are smoother now with only a hint of an outer edge. 
Note that we found a bug in Fireworks CS4 for the Mac. It didn't consistently apply an alpha transparency, while the 
Windows version worked fine. We've reported this behavior to Adobe.</p>

<h3>Optimizing PNGs with Web Image Guru</h3>

<p>Web Image Guru is a Photoshop plug-in from VIMAS Technologies that gives you more control when optimizing 
your images. For PNG24s it allows you to reduce the number of colors in the image using a slider or drop-down menu (see Figure 9). 
Our sample image went from over 54,000 colors to 900 colors when adjusted to the 
highest acceptable setting, a quality level of 10. The result is a 132K PNG24 file with perfectly smooth drop shadows, more than 45% 
smaller than Firewords' best PNG24 effort. However, it doesn't apply dithering as intelligently as Fireworks does to PNG8s.</p>

<div align="center">
<h4>Figure 9: Web Image Guru Optimizing a PNG24</h4>
<p><a href="banner_homewigpng2410.png"><img src="webimagegurupng2410.jpg" width="809" height="532" alt="Web Image Guru optimizing a PNG24 with Color Reduction 132K" border="1"></a></p>
</div> 

<h2>Final Results</h2>

<p>From the original 676K PNG24 we reduced the image to two acceptable versions:</p>

<ul>
<li>An optimized PNG24 file using Web Image Guru</li>
<li>An optimized PNG8 file using Fireworks CS4</li>
</ul>

<p>The PNG24 file was 132K (an 80.5%
 savings) while the PNG8 file was 94K (an 86% savings, see Table 1). We tried combining the two programs for further 
optimization but the result, while about 10% smaller, was not quite as smooth as the version using only Fireworks. Overall 
the home page went from over 1100K to 546K and 506K for the PNG24 and PNG8 versions, respectively.</p>

<div style="text-align:center;">
<table class="data t" align="center">
<caption>Table 1: PNG Optimization Results</caption>
<tr class="light"><th>Graphics Program</th><th>PNG24</td><th>PNG8</th></tr>
<tr><td>Original</td><td><a href="banner_home.png">676K</a></td><td>N/A</td></tr>
<tr><td>Photoshop</td><td><a href="banner_home-photoshoppng24.png">292K</a></td><td>N/A (banded)</td></tr>
<tr><td>Fireworks</td><td><a href="banner_homefireworkscs4.png">243K</a></td><td><a href="banner_homefwpng8adaptdith.png">94K</a> (dithered)</tr>
<tr><td>Web Image Guru</td><td><a href="banner_homewigpng2410.png">132K</a></td><td>N/A (banded)</td></tr>
<tr><td>WIG + Fireworks</td><td>N/A</td><td><a href="banner_homewigpng24256fwdith.png">83K</a></td></tr>
</table>
</div>

<h2>Conclusion</h2>

<p>Optimizing PNG files is a matter of reducing colors, maximizing repeated pixel areas, minimizing drop-shadows, and 
controlling any smooth transitions with a judicious application of dithering. With specialized tools 
you can reduce source images to a fraction of their original size and still maintain acceptable quality. 
Our test puppy went from 676K to 94K in file size, some 86% smaller. In some cases, the alpha 
transparency option in Fireworks for PNG8s allows you to overlay smooth transitions on top of backgrounds without 
resorting to PNG24 images. If you have to use PNG24s, minimize the number of colors in the image first to
 minimize file size. Always ask for the original layered Photoshop file when optimizing images. With
 this original in hand you can reduce drop shadows and avoid requantizing a previously quantized image.</p>

<h2>Further Reading</h2>

<dl>
<dt><a href="http://www.adobe.com">Adobe</a></dt>
<dd>Makers of Photoshop and Fireworks.</dd>

<dt><a href="../average-web-page/">Average Web Page Size Triples since 2003</a></dt>
<dd>
Within the five years since 2003, the size of the average web page has more than tripled, and the number of external objects has nearly doubled. While broadband users have experienced somewhat faster response times, dial-up users have been left behind. 
</dd>
<dt><a href="../graphic-optimization/">Graphic Optimization</a></dt>
<dd>
Tutorials on optimizing web graphics for minimum file size.
</dd>
<dt><a href="http://www.npvethospital.com">NPVetHospital.com</a></dt>
<dd>This Yuba City, California veterinarian provided the sample PNG24s to optimize.</dd>
<dt><a href="../drop-shadow/">Optimize Drop Shadows</a></dt>
<dd>
Learn how to create optimized drop-shadows in Photoshop to minimize the size of web graphics. 
</dd>
<dt><a href="http://www.artzstudio.com/2008/07/png-alpha-transparency-no-clear-winner/">PNG Alpha Transparency - No Clear Winner</a></dt>
<dd>A tutorial on including transparency in PNG files by Dave Artz.</dd>

<dt><a href="../png/">Replace GIF with PNG Images</a></dt>
<dd>
PNGs are designed to be a more efficient, flexible, and patent-free replacement for GIFs. By replacing your GIFs with PNGs you can speed up your web pages and save bandwidth.
</dd>
<dt><a href="http://www.vimas.com">VIMAS Technologies</a></dt>
<dd>Makers of the Web Image Guru plug-in for Photoshop.</p>
</dl>

]]>
    </content>
</entry>

</feed> 


