<?xml version="1.0" encoding="UTF-8"?> <rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
> <channel><title>Zoompf</title> <atom:link href="http://zoompf.com/feed" rel="self" type="application/rss+xml" /><link>http://zoompf.com</link> <description>Next Generation Web Performance</description> <lastBuildDate>Wed, 22 Feb 2012 11:43:33 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <item><title>Poor Choices are Ruining the Web</title><link>http://zoompf.com/blog/2012/02/poor-choices-are-ruining-the-web</link> <comments>http://zoompf.com/blog/2012/02/poor-choices-are-ruining-the-web#comments</comments> <pubDate>Tue, 21 Feb 2012 20:18:09 +0000</pubDate> <dc:creator>Billy Hoffman</dc:creator> <category><![CDATA[random]]></category> <category><![CDATA[best practice]]></category> <category><![CDATA[images]]></category> <guid
isPermaLink="false">http://zoompf.com/?p=1923</guid> <description><![CDATA[A recent article by John Naughton has sparked a debate inside the web design and web development community. Are designers, with their image heavy designs, ruining the web? The answer is yes, but its not why you think. It&#8217;s not &#8230; <a
href="http://zoompf.com/blog/2012/02/poor-choices-are-ruining-the-web">Continue reading <span
class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<p>A <a
href="http://www.guardian.co.uk/technology/2012/feb/19/john-naughton-webpage-obesity">recent article</a> by <a
href="http://www.guardian.co.uk/profile/johnnaughton">John Naughton</a> has sparked a debate inside the web design and web development community. Are designers, with their image heavy designs, <a
href="http://www.netmagazine.com/news/are-graphic-designers-ruining-web-121780">ruining the web</a>?</p><p>The answer is yes, but its not why you think. It&#8217;s not because designers use big images or even that they use a lot of images. It&#8217;s because they are creating and using images <strong>poorly</strong>.</p> <a
href="http://www.imdb.com/title/tt0097576/"><img
src="http://zoompf.com/wp-content/uploads/2012/02/he-chose...poorly.jpg" alt="" title="he chose...poorly" width="565" height="405" class="alignnone size-full wp-image-1925" /></a><p>I get it. Your name is Chris and you spell it Criss. You have a Mac. You wear trendy clothes. You are an awesome web designer. I&#8217;m happy to have you on the team.</p><p>The problem is you suck at it. Not your art or your design. You are probably awesome at that. Believe me, I&#8217;m hardly qualified to judge art. What you suck at is taking your beautiful design and delivering it to your website&#8217;s visitors in an efficient way which creates an excellent experience. And that&#8217;s what&#8217;s ruining the web.</p><p>Now I want to see your awesome design. I truly do. Because you have a gift that I don&#8217;t to take ideas and visualize how they should look. Even better, you have the skill to express those design ideas in ways that I can only imagine. And often, all I can do is imagine, because when I visit your webpage, all I see is a white screen as my browser downloads megabytes of content.</p><p>As <a
href="http://twitter.com/aarongustafson">Aaron Gustafson</a> <a
href="http://www.netmagazine.com/news/are-graphic-designers-ruining-web-121780">says</a>:</p><blockquote><p>&quot;Graphic designers are not ruining the web, but a lack of web professionalism is. Without proper training and an appreciation of the ramifications of each decision that goes into building a website, you more than likely won&#8217;t make the right decision regarding optimising the user experience. This isn&#8217;t print and it&#8217;s not television – bandwidth is a factor.&quot;</p></blockquote><p>I couldn&#8217;t agree more with Aaron more. What we need here is professionalism and ownership. <a
href="http://zoompf.com/blog/2011/12/amazon-silk-and-performance-responsibility">Performance is not someone else&#8217;s responsibility</a>. Performance is your responsibility. Your job doesn&#8217;t stop when you create that PSD file. You are creating a <em>User Experience</em>, which is far more that the visual characteristics of your design. You are responsible for the experience of actually engaging with the design.</p><p>This is why I&#8217;m so glad this discussion started in the middle of our <a
href="http://zoompf.com/blog/2012/01/lose-the-wait">Lose the Wait series</a>. As we have seen, you can <a
href="http://zoompf.com/blog/2012/01/lose-the-wait-page-weight-and-transfer-weight">lose webpage wait time by shedding page weight</a>. And images are contributing the largest portion of total page weight.</p><p>We at Zoompf have <a
href="http://zoompf.com/blog/2010/02/choosing-png8-candidate-images">made</a> <a
href="http://www.phpied.com/overlooked-optimizations-images/">posts</a> and <a
href="http://zoompf.com/resources">given presentations</a> all about this in the past. <a
href="http://developer.yahoo.com/performance/rules.html">There is a lot</a> <a
href="http://code.google.com/speed/page-speed/docs/rules_intro.html">that can be done</a> to make sure the experience you give to your visitors reflects all the effort and skill that when into the design.</p><p>But lets apply some focus. Forget all the things that can be done to optimize images. Lets focus on a single thing. It&#8217;s easy to do. It&#8217;s obvious to check if it has been done. It has serious and immediate effects. It&#8217;s even something you can do right now.</p><h3>Removing Image Bloat</h3><p>Image files can contain all sorts of data inside of them that has nothing to do with the rendering of the image. This should not be news. In fact, I even <a
href="/blog/2012/02/lose-the-wait-optimizing-gif-images">wrote about it last Friday</a>. While the types of non-graphical data present vary with each file format, a few examples are:</p><ul><li>Unused palette entries</li><li>Embedded thumbnails</li><li>Meta data</li><li>Comments</li><li>Application settings</li><li>Camera information</li></ul><p>Take a photo of something? Edit it in Photoshop? Well now it has an embedded thumbnail in it hitching along and taking up space. Be careful now! You might <a
href="http://graphicssoft.about.com/b/2003/07/26/techtvs-cat-schwartz-exposed-is-photoshop-to-blame.htm">accidentally posted naked pictures of yourself to the Internet</a> if you aren&#8217;t careful. Talk about a user experience.</p><p>So how much can this help? Is this a tempest in a teapot? No. Research shows the average savings by losslessly optimizing an image is 15-20%. That means 1 bytes out of every 4 bytes of an image is wasted bloat.</p><p>All of this sounds kinda of amateurish doesn&#8217;t it? Is this something novices do or are professional designers at real websites doing this to.</p><p>Lets try and experiment. Go check out <a
href="http://www.bestbuy.com">Best Buy&#8217;s</a> website. See those images. <a
href="http://scans.zoompf.com/s/81aa3f597000f80a419aba59a88f323f/report.html#187">The images are bloated by 32%</a> with this non-graphical gunk. 9 months ago, <a
href="http://www.youtube.com/watch?v=5cUVGbmvum0">Twitter had the same problem</a>.</p><h3>Fixing the Problem</h3><p>There two things we need to think about to fix this problem: finding a way to get rid of the bloat now, and finding a way to make sure we get of it consistently in the future.</p><p>The first part is easy. All the <a
href="http://pmt.sourceforge.net/pngcrush/">tools</a> <a
href="http://jpegclub.org/jpegtran/">to</a> <a
href="http://www.lcdf.org/gifsicle/">optimize</a> <a
href="http://optipng.sourceforge.net/">images</a> <a
href="http://pngquant.org/">are</a> <a
href="http://www.smushit.com/ysmush.it/">free</a>. Even better, Chris Sullo of <a
href="http://cirt.net/Nikto2">Nikto fame</a> wrote <a
href="http://cirt.net/SiteCrunch">Site Crunch</a>, a script that lets you automatically run image optimization tools over your entire website.</p><p>The second part is more challenging. Bloated images get on a website, even when the designer knows better, because of your processes, or lack thereof. Marketing needs this image now, so it goes out the door fast and it doesn&#8217;t get optimized. Designers optimize their images, but the product catalog images they get from a 3rd party don&#8217;t get optimized. Organizations need a clear policies or procedures about how images and other assets are placed on a production site. Optimization should be incorporated into that process. That is how to fix the problem long term. Ideally, it becomes <a
href="http://html5boilerplate.com/docs/Build-script/">an automated step in the publish-to-production process</a>. How to do that is another post in and of itself.</p><h3>Summary</h3><p>I love designers. You do things I could never do and make the web a better place. But when you create your design without thinking about the other half of the equation, the actual experience of getting that content, you sell yourself and your design short. And that is what&#8217;s ruining the web.</p><p> Want to see what performance problems your website has? Unoptimzied GIFs, PNGs, and JPEGs are just 3 of the nearly 400 performance issues Zoompf detects when testing your web applications. You can get a <a
href="/free">free performance scan of you website</a> now. Need more performance goodness? Try our <a
href="/products">Zoompf WPO</a> product.</p>]]></content:encoded> <wfw:commentRss>http://zoompf.com/blog/2012/02/poor-choices-are-ruining-the-web/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Lose The Wait: Optimizing GIF Images</title><link>http://zoompf.com/blog/2012/02/lose-the-wait-optimizing-gif-images</link> <comments>http://zoompf.com/blog/2012/02/lose-the-wait-optimizing-gif-images#comments</comments> <pubDate>Fri, 17 Feb 2012 20:46:30 +0000</pubDate> <dc:creator>Billy Hoffman</dc:creator> <category><![CDATA[Lose The Wait]]></category> <category><![CDATA[GIF]]></category> <category><![CDATA[PNG]]></category> <guid
isPermaLink="false">http://zoompf.com/?p=1907</guid> <description><![CDATA[Our Lose the Wait series is all about improving the performance of your web applications. As we have mentioned, a great way to lose the wait is to lose the weight, as in the weight of your page content. In &#8230; <a
href="http://zoompf.com/blog/2012/02/lose-the-wait-optimizing-gif-images">Continue reading <span
class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<img
src="http://zoompf.com/wp-content/uploads/2012/02/lose_the_wait.png" alt="" title="Lose the Wait Logo" width="374" height="75" class="alignnone size-full wp-image-1890" /><p>Our <a
href="/blog/2012/01/lose-the-wait">Lose the Wait</a> series is all about improving the performance of your web applications. As we have mentioned, a great way to lose the wait is to lose the weight, as in the <a
href="/blog/2012/01/lose-the-wait-page-weight-and-transfer-weight">weight of your page content</a>. In our last post, we talked about using <a
href="http://zoompf.com/blog/2012/02/lose-the-wait-http-compression">HTTP compression to reduce the size of the data that needs to be sent to the client</a>, as well as the challenges that are involved. Now let&#8217;s shift our attention from text content to images.</p><p>Images make of the majority of content on the web. According to the <a
href="http://httparchive.org/">HTTP Archive</a>, the total size of an average web page and its supporting content is 968kB. Of that, 601kB, or 62% of the total amount, <a
href="http://httparchive.org/interesting.php#bytesperpage">is image content</a>. Understand images and how to optimize them are skills for any frontend performance advocate. To do this, we start by exploring the GIF image format and how to optimize it.</p> <img
src="http://zoompf.com/wp-content/uploads/2012/02/content-sizes.png" alt="" title="Composition of average web page" width="400" height="225" class="alignnone size-full wp-image-1908" /><p>GIF is a <a
href="http://en.wikipedia.org/wiki/Graphics_Interchange_Format">lossless image format created by CompuServe in the late 1987</a>. This makes GIF the oldest image format in common use on the web today. GIF is a palette based image format, allowing an image to contain up to 256 distinct colors defined from a possible 16,000,0000 colors (2^24). GIF images also support binary transparency. This means a pixel of the image can be completely transparency, showing the background behind the image, or completely opaque, showing the color value for that pixel. GIFs feature the ability to contain multiple graphic images inside of a single file</p><p>Due to their age, simple nature, and a widespread support, GIFs are widely present on the Internet. According to the HTTP Archive, 33% of all images on the web use the GIF format. Due to their prevalence, understanding how to structure optimize GIF images is an important part of understanding.</p> <img
src="http://zoompf.com/wp-content/uploads/2012/02/formats.png" alt="" title="Image formats in use" width="400" height="225" class="alignnone size-full wp-image-1909" /><h3>The Structure of a GIF Image</h3><p>To understand how to optimize GIF images, we need to first explore the <a
href="http://www.w3.org/Graphics/GIF/spec-gif89a.txt">structure of the image format</a> to identify which areas can be streamlined or optimized.</p> <img
src="http://zoompf.com/wp-content/uploads/2012/02/gif-internals.png" alt="GIF File Format Structure" title="GIF File Format Structure" width="229" height="289" class="alignnone size-full wp-image-1911" /><p>GIF are composed of a six byte header, identifying the file format and version. A six byte <em>Logic Screen Descriptor</em> follows, specifying the dimensions of the image, number of colors used, and other flags. The next data structure in a GIF file is the <em>Global Color Table</em>. This defines the color values for each of the up to 256 distinct colors which can referenced by the graphics data.</p><p>Now we get to how the content of an image is saved inside the GIF format. This happens in the <em>Graphic Image Data</em> sections. If the GIF is an animated GIF it will contain multiple Graphic Image Data sections for the different frames of animation. If it is a static, non-animated GIF, there is only one Graphic Image Data section. Each Graphic Image Data section is composed of a few other pieces of data. Obviously, it contains the graphics data that represent the image or a frame of animation. It can also optionally contain a local color palette that is specific to that piece of image data. This means that frame 1 of an animation can be composed of colors from a palette of 256 colors, and frame 2 can be composed of a different palette of colors. Local color palette data override the palette in the Global Color Table. In fact, the Global Color Table is actually optional, and each Graphic Image Data section can define it own palette. When you are dealing with a static image this is not really necessary, as it doesn&#8217;t matter whether the palette information is stored in the Global Image Data of the single Graphic Image Data section. As we will see later, this can be used to optimize animation.</p><p>The graphics data inside of a Graphic Image data section is a bitmap of pixel where each pixel value is a reference to the color palette which defines the actual red, green and blue values which represents the color. This pixel data can be sorted and stored in different ways to enable features like interlacing. All of this pixel data is compressed using the <a
href="http://en.wikipedia.org/wiki/Lempel-Ziv-Welch">Lempel-Ziv-Welch (LZW) lossless data compression algorithm</a>.</p><p>GIFs also have a number of other, optional data sections that can be present. Comments are common section, as are so-called &quot;Application Extension&quot; sections. These sections can be used to a variety of application specific information. The commonly implemented <a
href="http://enthusiasms.org/post/16976438906">Netscape 2.0 Application Extension</a> which enabled the looping of GIF animations. Adobe products store XMP image metadata inside of The Application Extensions. Embedded thumbnails can be stored in Application Extensions. There are also lesser used GIF features which use additional data sections. For example, the Graphic Image Data section can contain other data sections such as a Plain Text Data section, which allows for text to be rendered on top of an image similar to a closed captioning or subtitling system for video files.</p><h3>GIF Optimization opportunities</h3><p>Now that I&#8217;ve told you way more than you ever wanted to know about the internals of a GIF image, we can think about optimizing. There are several aspects of the GIF image format that create opportunities to reduce file size while retaining image quality:</p><ul><li>The LZW compression algorithm has its roots in the 1970s. While impressive for its time, its performance and compression ratios have been eclipsed by more modern lossless compression algorithms. Using an image format with a better compression.</li><li>Palettes can contain more color definitions than actually used by the image</li><li>The size of palette entries can be inefficient when the image contains less than 128 colors.</li><li>GIF comments, metadata, and (most) Application Extension sections don&#8217;t contribution to the rendering of the graphic data. This data can be removed.</li></ul><p>Funny enough, the GIF specification even suggests avoiding Application Extensions saying:</p><blockquote><p>[Not using Application Extensions] is recommended in favor of using Application Extensions, which become overhead for all other applications that do not process them.</p></blockquote><p>&#8220;Overhead&#8221; is just a fancy way of saying wasted bytes!<h3>GIF vs. PNG</h3><p><a
href="http://en.wikipedia.org/wiki/Portable_Network_Graphics">PNG images</a> are also a lossless image format that very closely mirrors GIF images. The PNG format was defined 10 years after the GIF format allowing PNG images address many of the shortcomings of GIF images, such as:</p><ul><li>PNG&#8217;s DEFLATE algorithm achieves better compression than GIF&#8217;s LZW algorithm</li><li>PNG images supports a precompression filter step, which rearranges graphic data before compression to maximize redundancy and thus improve the efficiency of DEFLATE compression. GIF does not have this feature.</li><li>The size of PNG palette entries can be smaller than the corresponding GIF palette entries on images with less than 256 colors.</li><li>PNG&#8217;s ancillary data sections support compression allowing their overall size to be reduced.</li></ul><p>Additionally, programs that convert from a GIF image to a PNG image, such as <em><a
href="http://catb.org/~esr/gif2png/">gif2png</a></em>, focus only on converting graphical data. Comments, metadata, embedded thumbnails, Application Extensions, and other non-graphical information present in a GIF are not transferred over into the resulting PNG. In other words, converting from a GIF to a PNG sheds all this &quot;excess baggage&quot; in addition to better compressing the graphical data. All of these factors mean that converting a GIF image to a PNG almost always results in a smaller image.</p><h3>Bigger as PNG?</h3><p>PNG images can sometimes be larger than the source GIF image. There are a few reasons for this, some of which can be fixed. Ensure the PNG you convert has an 8bit color depth. PNG supports millions of distinct colors in an image, whereas GIF only supports 256 distinct colors. Since you are converting from a source with a maximum of 256 colors, there is no need to support a larger color depth. If you do, it can needlessly result in a larger file.</p><p>It is still possible for GIF images to be smaller than PNG images. This usually only occurs for extremely small images, where the actual graphical data is quite small. For these images, the overhead of various headers and sections inside of the GIF or PNG image contribute to the overall size more so than the graphics data. In this case, very simple GIFs can be smaller than PNGs. In my experience, these extremely small GIF images are used by websites as spacer images or as the response for web services beacons. You shouldn&#8217;t be using spacer GIFs at all, and you should be returning HTTP 204 No Content responses instead of using tiny images. In short, if you find any GIFs on your website that are smaller as GIFs than PNGs, you are probably doing something else that is wrong.</p><h3>The Savings of Converting to PNG</h3><p>To determine the average savings of converting to PNG, I extract the 2547 GIF images that were recently downloaded by Zoompf&#8217;s scanner by users of our <a
href="/free">free performance scanning service</a>. I then converted these from a GIF to a PNG using Optipng, which conveniently converts to a PNG image and then attempts to losslessly optimize the PNG image in a single step. The median size of the GIF images was 6900 bytes. The median size of the result PNG images was 5546 bytes. This means the median savings of converting <strong>all GIFs to PNGs is 21.07%</strong>. That&#8217;s a pretty awesome result and this aligns nicely with <a
href="http://www.phpied.com/give-png-a-chance/">Stoyan&#8217;s analysis from 2009</a>. You can download <a
href="http://zoompf.com/filedump/gif-to-png.xlsx">my test results here</a>.</p><h3>Animated GIFs</h3><p> So far we have been talking about static GIFs, but what about animated GIFs? Luckily, the use of annoying, <a
href="http://www.textfiles.com/underconstruction/">eye bleeding under construction GIFs</a> has past us by (a fact for which I, and all of you, should thank whatever God or gods you pray to, every single day). However animated GIFs are still with us, thanks to the ever present status thumper!</p> <img
src="http://zoompf.com/wp-content/uploads/2012/02/hevequip2.gif" alt="" title="Under Contruction" width="413" height="100" class="alignnone size-full wp-image-1913" /><p>While converting to PNG images provides a simple, easy way to bulk optimize GIFs, what can be done for animated GIFs? PNG does not support animation, so that is not an option.</p><p>Before you can optimize a GIF you need to know whether it&#8217;s animated or not. Ideally we want an easy way to do this from the command line so we can sort and optimize our GIF images and animations in bulk automatically as part of a script. Luckily the identify command of ImageMagick can help us out. The following:</p><pre><code>identify [file] | head -n 1 | grep &quot;\] GIF&quot;
</code></pre><p>This will run identify on the command, and look for the text which indicates this GIF image contains multiple Graphic Image Data sections and thus is part of an animation. Now that we can sort the wheat from the chaff, we can start optimizing animated GIFs.</p><p>The list of optimizations that can be applies to animated GIFs is, in many ways, a superset of the optimizations for a static GIF. While you can&#8217;t gain the advantage of PNG&#8217;s DEFLATE compression algorithm you can:</p><ul><li>Remove metadata, or unused palette entries from a GIF and write a better optimized GIF.</li><li>Combine or generalize local palette information in individual Graphic Image Data sections into the Global Color Table.</li><li>Reuse existing animation frames.</li><li>Minimize what is changing between animation frames, reducing the size different Graphic Image Data sections.</li></ul><p><a
href="http://www.lcdf.org/gifsicle/">Gifsicle</a> is a great command line tool which can, among other things, perform several of these optimizations automatically. Its free, open source, and easy to use. Because its a command line tool, this Gifsicle can be scripted for bulk optimization operations or bundled into build scripts. To optimize a GIF, this is all:</p><pre><code>gifsicle -O2 orig-animation.gif -o new-animation.gif
</code></pre><p>While Gifsicle can automatically optimize GIFs, it can only do some of the optimizations discussed above with varying degrees of success. For example, Gifsicle does a great job detecting and combining duplicate local palette information into the Global Color Table. It does a good job removing GIF comment sections, but does a poor job detecting and removing Application Extensions, embedded thumbnails, and XMP metadata. It does a reasonable job trying to optimize differences between animation frames. Better optimization can be achieved by manually reviewing the animation to detect frames which can be reused as well as reduce the total changes applied to an image between animation frames.</p><p>I am want to sound like I&#8217;m criticizing Gifsicle. Detecting and applying the optimizations discussed above is not easy to do, let alone automate. Gifsicle is an awesome tool and everyone should use it. I just want to be clear that optimizing Animated GIFs is not as easy or straight forward as stripping meta data from a static GIF. Manual examination or optimization may be required to get the results you expect.</p><h3>Conclusions</h3><p>There are numerous aspects of the GIF image format which allow for lossless optimizations to reduce file size while maintaining image quality. Converting to PNG is a nice, universal way to do this. Animated GIFs however, cannot be converted. Instead you can use Gifsicle to automate some optimization and use hand optimization techniques.</p><p> Want to see what performance problems your website has? <i>Unoptimzied GIF Image</i> and <i>Unoptimized Animated GIF Image</i> are just 2 of the nearly 400 performance issues Zoompf detects when testing your web applications. You can get a <a
href="/free">free performance scan of you website</a> now and at a look at our <a
href="/products">Zoompf WPO</a> product at <a
href="http://zoompf.com/">Zoompf.com</a> today!</p>]]></content:encoded> <wfw:commentRss>http://zoompf.com/blog/2012/02/lose-the-wait-optimizing-gif-images/feed</wfw:commentRss> <slash:comments>3</slash:comments> </item> <item><title>How Fast is&#8230; Target.com</title><link>http://zoompf.com/blog/2012/02/how-fast-is-target-com</link> <comments>http://zoompf.com/blog/2012/02/how-fast-is-target-com#comments</comments> <pubDate>Fri, 17 Feb 2012 18:59:33 +0000</pubDate> <dc:creator>Billy Hoffman</dc:creator> <category><![CDATA[How Fast Is...]]></category> <category><![CDATA[How Fast Is?]]></category> <category><![CDATA[video]]></category> <guid
isPermaLink="false">http://zoompf.com/?p=1905</guid> <description><![CDATA[Our regular video series How Fast Is&#8230;? examines real world websites and details the cause of their performances issues as well as what should be done to solve them. After all, the best way to learn about front-end web performance &#8230; <a
href="http://zoompf.com/blog/2012/02/how-fast-is-target-com">Continue reading <span
class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<iframe
class="youtube-player" type="text/html" width="630" height="385" src="http://www.youtube.com/embed/3aBSYYseUdM" frameborder="0"></iframe><p> Our regular video series <b>How Fast Is&#8230;?</b> examines real world websites and details the cause of their performances issues as well as what should be done to solve them. After all, the best way to learn about front-end web performance is to see what other people are doing right and doing wrong. In this edition of <b>How Fast Is&#8230;?</b> we analyze online retailer <a
href="http://www.target.com/">Target</a>.</p><h3>Why Target.com?</h3><p> Because they are the perfect target, obviously! In all seriousness, I wanted to look at Target for a few reasons. The first is that they are a huge and extremely successful retailer with both an online store and traditional brick and mortar locations. When anyone has significant resources to invest in web performance, and would see a huge financial return by doing so, its always interesting to see if they do.</p><p> The other reason to look at Target is that <a
href="http://en.wikipedia.org/wiki/Ron_Johnson_(businessman)">Ron Johnson</a> helped to revitalize their stores and brand in the 1990s. Ron Johnson is the guy who helped launch Apple&#8217;s incredibly successful retail stores. This is a man who understand the importance of a positive user experience and I wanted to see if the ideals he instilled which at Target remained.</p><h3>Implementation Issues</h3><p> In this video, I mainly focus on implementation issues that Target has. They are doing a lot of web performance optimizations. Target&#8217;s problem is that they aren&#8217;t implementing these consistently and uniformly across the site. Specifically we discuss some implementation problems they have around <a
href="http://www.stevesouders.com/blog/2009/05/12/sharding-dominant-domains/">domain sharding</a>, <a
href="http://code.google.com/speed/page-speed/docs/payload.html#duplicate_resources">consistent URL naming</a>, <a
href="http://www.yuiblog.com/blog/2007/01/04/performance-research-part-2/">caching</a>, and combining files.</p><p> <b>Best Quote from Video:</b> &#8220;Because 2 + 2 + 2+ 2 always adds up to&#8230;. whatever it adds up to. I forgot how many 2&#8242;s I said&#8230;&#8221;</p><p> Know a site we should make a video about? <a
href="http://zoompf.com/contact">Contact us</a> and you may see a future episode about it.</p> ]]></content:encoded> <wfw:commentRss>http://zoompf.com/blog/2012/02/how-fast-is-target-com/feed</wfw:commentRss> <slash:comments>2</slash:comments> </item> <item><title>Lose the Wait: HTTP Compression</title><link>http://zoompf.com/blog/2012/02/lose-the-wait-http-compression</link> <comments>http://zoompf.com/blog/2012/02/lose-the-wait-http-compression#comments</comments> <pubDate>Fri, 10 Feb 2012 16:25:56 +0000</pubDate> <dc:creator>Billy Hoffman</dc:creator> <category><![CDATA[Lose The Wait]]></category> <category><![CDATA[apache]]></category> <category><![CDATA[best practice]]></category> <category><![CDATA[compression]]></category> <category><![CDATA[HTTP]]></category> <category><![CDATA[IE]]></category> <category><![CDATA[web server]]></category> <guid
isPermaLink="false">http://zoompf.com/?p=1884</guid> <description><![CDATA[One of the ways you can improve website performance is to reduce the amount of data that needs to get delivered to the client. An easy way to reduce the amount of data sent to a client is to compress &#8230; <a
href="http://zoompf.com/blog/2012/02/lose-the-wait-http-compression">Continue reading <span
class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<p>One of the ways you can improve website performance is to reduce the amount of data that needs to get delivered to the client. An easy way to reduce the amount of data sent to a client is to compress the content and then transfer it to the client. This can be done with HTTP compression. Despite being a surprising simply feature of HTTP, there are numerous challenges which must be addressed to properly use HTTP compression. These challenges are:</p><ol><li>Ensuring you are only compressing compressible content.</li><li>Ensuring you are not wasting resources trying to compress uncompressible content.</li><li>Selecting the correct compression scheme for your visitors.</li><li>Configuring the web server properly so compressed content is sent to capable clients.</li></ol><p>In this post, part of our <a
href="http://zoompf.com/blog/2012/01/lose-the-wait">Lose the Wait</a> performance series, I will discuss each of these issues and demonstrate how to configure your web server to implement HTTP compression properly.</p> <img
src="http://zoompf.com/wp-content/uploads/2012/02/lose_the_wait.png" alt="" title="Lose the Wait Logo" width="374" height="75" class="alignnone size-full wp-image-1890" /><h3>Compressing Compressible Things</h3><p>Let&#8217;s start out easy. What should HTTP compression get applied to? The answer is simple: Any content which is not already natively compressed.</p><p>Notice I didn&#8217;t say &quot;text resources.&quot; Text resources, like HTML, CSS, and JavaScript certainly should be compressed because they are not natively compressed file formats. Unfortunately, most people seem to focus on these 3 types of files. In fact, a quick web search shows that most of the top results for &quot;.htaccess compress&quot; include instructions only on compressing HTML, CSS, and JavaScript files. This just reinforces what I&#8217;ve said before; you have to be careful <a
href="http://calendar.perfplanet.com/2011/advice-on-trusting-advice/">where your advice comes from</a>.</p><p>Here is a list of common text resource types on the web which should be served with HTTP compression:</p><ul><li><em>XML</em>. XML is structured text used a standalone file (like Flash&#8217;s crossdomain.xml or Google&#8217;s sitemap.xml) or as a data format wrapper for API calls.</li><li><em>JSON</em>. JSON is a subset of JavaScript used as a data format wrapper for API calls.</li><li><em>News feeds</em>. Both RSS and Atom feeds are XML documents.</li><li><em>HTML Components (HTC)</em>. HTC files are a proprietary Internet Explorer feature which package markup, style, and code information used for CSS behaviors. HTC files are often used by <a
href="https://github.com/Modernizr/Modernizr/wiki/HTML5-Cross-Browser-Polyfills">polyfills</a> such as <a
href="http://css3pie.com/">Pie</a> or <a
href="http://www.twinhelix.com/css/iepngfix/">iepngfix.htc</a> to fix various problems with IE or to back port modern functionality.</li><li><em>Plain Text</em>. Plain text files can come in many forms, from README and LICENSE files, to <a
href="http://en.wikipedia.org/wiki/Markdown">Markdown</a> files. All should be compressed.</li><li><em>Robots.txt</em>. Robots.txt is a specific text file used to tell search engines what parts of the website to crawl. Robots.txt is often forgotten since it is not usually accessed by humans and does not appear in JavaScript-based web analytics logs. Since robots.txt is repeatedly accessed by search engine crawlers and can be quite large, it can consume large amounts of bandwidth without your knowledge.</li></ul><h3>ICO</h3><p>As I said, HTTP compression isn&#8217;t just for text resources and should be applied to all non-natively compressed file formats. What do I mean by this?</p><p>As an example, let&#8217;s look at <a
href="http://en.wikipedia.org/wiki/ICO_(file_format)">ICO files</a>. ICO files are an image format used originally used for icon images on Windows. The format, as it is in use today, was created over 20 years ago for Windows 3.0. Today, ICO files are used on the web as <a
href="http://en.wikipedia.org/wiki/Favicon">Favicons</a> for a website, usually displayed in the address bar or browser tab. While modern browsers allow other file formats besides ICO support is not universal. Many sites continue to use ICO files as Favicons for compatibility reasons.</p><p>Despite being an image, ICO files are not natively compressed. ICO images are actually a primitive version of a BMP image. Neither ICO nor BMP image formats are natively compressed. While can (and should) avoid using BMP images on your website, you can&#8217;t do this with ICO files. Be sure to configure your web server to server ICO images with HTTP compression.</p><h3>SVG</h3><p>SVG images are example of an image format which is not natively compressed. SVG images are just XML documents, but they have a different MIME type and file extension. This means, while someone might remember to compress XML documents, they forget to compress SVG documents.</p><p>You might be using SVG images on your website and not even know it. This is because of a feature of SVG images, SVG fonts, which allow SVG files to contain font glyphs used to render text. These SVG image-that-really-a-font files can be references in CSS using the <code>@font-face</code> syntax much like a OTF or WOFF font file. <a
href="http://nimbupani.com/about-fonts-in-svg.html">Divya Manian</a> has written a comprehensive post about the pros and cons of SVG fonts. For the purposes of this discussion the main take-away from her post is that, until iOS 5, SVG fonts were the <a
href="http://opentype.info/blog/2010/04/13/the-ipad-and-svg-fonts-in-mobile-safari/">only type of custom font supported</a> by iPhone, iPad, and iPod Touch.</p><p>Font support is, to put it nicely, <a
href="http://paulirish.com/2009/bulletproof-font-face-implementation-syntax/">a giant mess</a>. Font libraries abstract this away from the web developer and serve the correct format, including SVG fonts, to the correct browser. This mean your website can be using SVG without you even knowing it. Remember to serve your SVG files using HTTP compression.</p><h3>Compressing already compressed content</h3><p>Another mistake developers make with HTTP compression is using it on content that is already natively compressed. Apply compression to something that is already compressed doesn&#8217;t help improve performance. In fact, it can hurt performance to two ways.</p><p>First, HTTP compression has a cost. The web server has to take the content, compress it, and then send it to the client. If the content cannot be compressed further, you are just wasting CPU doing a meaningless task.</p><p>Secondly, applying HTTP compression to something that&#8217;s already compressed doesn&#8217;t make it smaller. In fact, the overhead of adding headers, compression dictionaries, and checksums to response body actually makes it bigger, as shown in the figure below:</p> <img
src="http://zoompf.com/wp-content/uploads/2012/02/bigger-with-compression.png" alt="" title="bigger-with-compression" width="601" height="214" class="alignnone size-full wp-image-1885" /><p>Do websites actually do this? Yes, and it&#8217;s more common than you would think.  I used <a
href="http://zoompf.com/products">Zoompf WPO</a> to examine <a
href="http://www.foxnews.com">Fox News</a>. Fox News is the <a
href="http://www.alexa.com/siteinfo/foxnews.com">40th most visited website in the United States</a>. As you can see, Fox News is mistakenly applying HTTP compression to PNG images.</p> <img
src="http://zoompf.com/wp-content/uploads/2012/02/fox-http-response.png" alt="" title="fox-http-response" width="411" height="364" class="alignnone size-full wp-image-1886" /><p>This not only wastes CPU, but also increases the size of the PNG images delivered to Fox News visitors by a few dozen bytes:</p> <img
src="http://zoompf.com/wp-content/uploads/2012/02/wpo-bigger-550.jpg" alt="" title="wpo-bigger-550" width="550" height="367" class="alignnone size-full wp-image-1887" /><p>Zoompf actually has two different checks for this issue. The first check &quot;<em>Compressed Content served with HTTP compression</em>&quot; alerts you that you are wasting CPU time compressing something that is already compressed. The second check, &quot;Bigger with HTTP Compression&quot; identifies content that is actually larger when served using HTTP compression.</p><p>Both of these problems usually are the result of a configuration problem with the web server or an inline network device. Something in your environment is applying HTTP compression to all outbound content instead of only content that should be compressed.</p><h3>GZIP Vs. DEFLATE</h3><p>So far, we have talked about <em>HTTP compression</em> as if it is an opaque or atomic feature. But that is not the case. HTTP simply defines a mechanism for a web client and web server to agree a compression scheme can be used to transmit content. This is accomplished using the <code>Accept-Encoding</code> and <code>Content-Encoding</code> headers. There are two commonly used HTTP compression schemes on the web today: <em>DEFLATE</em>, and <em>GZIP</em>.</p><p>DEFLATE is a patent-free compression algorithm for lossless data compression. There are numerous open source implementations of the algorithm. The standard implementation library most people use is zlib. The zlib library provides functions for compressing and decompressing data using DEFLATE/INFLATE. The zlib library also provides a data format, confusingly named zlib, which wraps DEFLATE compressed data with a header and a checksum.</p><p>GZIP is another compression library which compresses data using DEFLATE. In fact, most implementations of GZIP actually uses the zlib library internal to performance DEFLATE/INFLATE compression operations. GZIP produces its own data format, confusingly named GZIP, which wraps DEFLATE compressed data with a header and a checksum.</p><p>Unfortunately, the HTTP/1.1 RFC does a poor job when describing the allowable compression schemes for the <code>Accept-Encoding</code> and <code>Content-Encoding</code> headers. It defines <code>Content-Encoding: gzip</code> to mean that the response body is composed of the <em>GZIP data format</em> (GZIP headers, deflated data, and a checksum). It also defines <code>Content-Encoding: deflate</code> but, despite its name, this does not mean the response body is a raw block of DEFLATE compressed data. According to RFC-2616, <code>Content-Encoding: deflate</code> means the response body is:</p><blockquote><p>[the] &quot;zlib&quot; format defined in RFC 1950 [31] in combination with
the &quot;deflate&quot; compression mechanism described in RFC 1951 [29].</p></blockquote><p>So, DEFLATE, and <code>Content-Encoding: deflate</code>, <strong>actually means the response body is composed of the zlib format</strong> (zlib header, deflated data, and a checksum).</p><p>This &quot;<em>deflate</em> the identifier doesn&#8217;t mean raw <em>DEFLATE</em> compressed data&quot; idea was rather confusing. Early versions of Microsoft&#8217;s IIS web server was programmed to return raw DEFLATE compressed data for <code>Accept-Encoding: deflate</code> requests instead of a zlib formatted response. And naturally versions of Internet Explorer at the time expected responses with a <code>Content-Encoding: deflate</code> header to have raw DEFLATE response bodies.</p><p>As <a
href="http://en.wikipedia.org/wiki/Mark_Adler">Mark Adler</a>, one of the authors of zlib, <a
href="http://stackoverflow.com/questions/9170338/why-are-major-web-sites-using-GZIP/9186091#9186091">explains in this StackOver thread</a>:</p><blockquote><p>However early Microsoft servers would incorrectly deliver raw deflate for &quot;Deflate&quot; (i.e. just RFC 1951 data without the zlib RFC 1950 wrapper). This caused problems, browsers had to try it both ways, and in the end it was simply more reliable to only use GZIP.</p></blockquote><p>As Mark says, browsers receive <code>Content-Encoding: deflate</code> had to handle two possible situations: the response body is raw DEFLATE data, or the response body is zlib wrapped DEFLATE. So, how well do modern browser handle raw DEFLATE or zlib wrapped DEFLATE responses? <a
href="http://www.vervestudios.co/">Verve Studios</a> put together a test suite and tested a huge number of browsers. <a
href="http://www.vervestudios.co/projects/compression-tests/results">The results are not good</a>.</p><p>All those fractional results in the table means the browser handled raw-DEFLATE or zlib-wrapped-DEFLATE inconsistently, which is really another way of saying &quot;<em>It&#8217;s broken and doesn&#8217;t work reliably.</em>&quot; This seems to be a tricky bug that browser creators keep re-introducing into their products. Safari 5.0.2? No problem. Safari 5.0.3? Complete failure. Safari 5.0.4? No problem. Safari 5.0.5? Inconsistent and broken.</p><p>Sending raw DEFLATE data is just not a good idea. As Mark says &quot;[it's] simply more reliable to only use GZIP.&quot;</p><p>It should be also noted that all browsers that support DEFLATE also support GZIP, but all browser that support GZIP do not support DEFLATE. Some browsers, such as Android, don&#8217;t include <em>deflate</em> in their <code>Accept-Encoding</code> request header. Since you are going to have to configure your web server to use GZIP anyway, you might as well avoid the whole mess with <code>Content-Encoding: deflate</code>.</p><p>Luckily, avoiding DEFLATE isn&#8217;t all that difficult.</p><p>The Apache module which handles all HTTP compression is mod_deflate. Despite its name, mod_deflate don&#8217;t not support deflate at all. ItsIt&#8217;s impossible to get a stock version of Apache 2 to send either raw DEFLATE or zlib wrapped DEFLATE. <a
href="http://nginx.org/">Nginx</a>, like Apache, does not support deflate at all. It will only send GZIP compressed responses. Sending aan Accept-Encoding: deflate request header will result in an uncompressed response.</p><p>Microsoft&#8217;s IIS web server can send both <em>gzip</em> and <em>deflate</em> responses and you can enabled or disable each scheme individually. For IIS6, you can , you can <a
href="http://weblogs.asp.net/owscott/archive/2004/01/12/57916.aspx">edit the metabase to disable DEFLATE support</a>. For IIS7, <a
href="http://www.iis.net/ConfigReference/system.webServer/httpCompression">you can disable DEFLATE support</a> by editing the DEFLATE compression scheme section in the <code>&lt;schemes&gt;</code> element of the <code>&lt;httpCompression&gt;</code> element of the various IIS7 <em>.config</em> files.</p><p> Both Zoompf&#8217;s <a
href="/free">free</a> and <a
href="/products">commercial</a> products have a check built-in, <i>&#8220;Obsolete Compression Format&#8221;</i>, which will detect if your web browser is sending content compressed with DEFLATE.</p><h3>Netscape 4 and Internet Explorer 6 Are Screwing You. Again.</h3><p>So by now you should have your web server configured to:</p><ol><li>Properly compress what needs to be compressed.</li><li>Avoid compressing already compressed content.</li><li>Configured to only use GZIP.</li></ol><p>Now you need to ensure that your configuration is not actually excluding perfectly capable browsers.</p><p>While HTTP compression is a mature feature today, there were some problems early on. Netscape 4 only supported HTTP compression for HTML documents even though it sent an <code>Accept-Encoding: deflate, GZIP</code> for all requests. Serving it HTTP compressed CSS or JS documents would make it crash. For reasons that aren&#8217;t quite clear, the developers of Apache decided to address this client-side bug with a server-side fix. They added the following seemingly harmless line into the Apache configuration file:</p><pre><code>BrowserMatch ^Mozilla/4 GZIP-only-text/html
</code></pre><p>Any browser calling itself <code>Mozilla/4</code> would only receive HTTP compressed HTML files. Since Apache was and is the most popular web server on the Internet, this caused enormous problems which still affect us today.</p><p>First of all, this was the middle of the browser wars and Inter Explorer 4, Internet Explorer 5 and even Internet Explorer 6 all identified themselves as <code>Mozilla/4</code> in their User-Agent strings. But these browsers could accept HTTP compression for non-HTML responses.  Trying to patch around one buggy browser caused another to be slow! Since IE6 would ultimately achieve over 95% market share, it was a problem that IE6 would download webpages more slowly from Apache than from other web servers. To resolve this, the Apache developers were forced to add another configuration directive:</p><pre><code>BrowserMatch \bMSI[E] !no-GZIP !GZIP-only-text/html
</code></pre><p>This line means: if the User-Agent has <code>MSIE</code> in it, then turn off the <code>no-GZIP</code> and <code>GZIP-only-text/html</code> options, thereby instructing Apache to use HTTP compression for all responses if IE asked for it. And all was good, until it wasn&#8217;t.</p><p>You see, IE6 on Windows XP also <a
href="http://support.microsoft.com/kb/321722">multiple</a> <a
href="http://typo3.org/documentation/document-library/extension-manuals/rtehtmlarea/1.4.4/view/6/1/">problems</a> <a
href="http://support.microsoft.com/kb/837251">with</a> <a
href="http://support.microsoft.com/default.aspx?scid=kb;en-us;Q313712">HTTP</a> <a
href="http://sebduggan.com/posts/ie6-GZIP-bug-solved-using-isapi-rewrite">compression</a>. Most of these issues dealt with compressed CSS or JavaScript files being cached as compressed items and which were then read from the cache assuming they were not HTTP compressed. So again another <code>Mozilla/4</code> browser had problems with compression, and so again the Apache developers had to <em>&quot;fix&quot;</em> the issue with another configuration directive:</p><pre><code>BrowserMatch \bMSIE\s6 GZIP-only-text/html
</code></pre><p>This directive instructed the web server to only send compressed content for HTML responses if the browser was IE6. While this helps dealt with the majority of the issues, some of these bugs caused so many extreme edge-case problems that, for reliability reasons, larger sites would completely disable HTTP compression for IE6 entirely:</p><pre><code>BrowserMatch \bMSIE\s6 no-GZIP
</code></pre><p>Eventually Microsoft fixed these issues with hot fixes and, comprehensively, with Windows XP Service Pack 2.  But this created a fragmentation problem, where some IE6 browsers could handle HTTP compression for all content, and some could not. Another rule was added in an attempt to serve compressed content  to IE6 browsers that had SP2 installed. This was done by looking for the poorly named SV1 identifier in IE6&#8242;s User-Agent string:</p><pre><code>BrowserMatch &quot;^Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1&quot; !no-GZIP !GZIP-only-text/html
</code></pre><p>This chain of &quot;deny this, but not this, unless it&#8217;s this, but not it is it also this&quot; directives made configuring a web server to properly serve compressed documents to the appropriate browsers difficult and prone to error. Since these bug/solution cycles happened numerous times over several years these configuration directives mutated. Blog posts from 2004 would tell you to do one thing and blog posts from 2006 would say another. Much like a child&#8217;s game of <a
href="http://en.wikipedia.org/wiki/Chinese_whispers">telephone</a> short comings, errors, missing <a
href="http://en.wikipedia.org/wiki/Edge_case">edge cases</a>, and missing <a
href="http://en.wikipedia.org/wiki/Corner_case">corner cases</a> were magnified as people reused old configuration files and shared the &quot;correct&quot; advice. Even today, many of the top Google search results for configuring HTTP compression for Apache using <code>mod_deflate</code> contain different and incorrect directives.</p><p>As I wrote in <a
href="http://calendar.perfplanet.com/2011/advice-on-trusting-advice/"><em>Advice on Trusting Advice</em></a> it all comes down to where you get your advice from. Follow the advice on <a
href="http://wiki.ninjafocus.net/Apache_Compression">this top search result</a> and IE9+ gets no compression at all. Follow the advice on <a
href="http://www.aptivate.org/webguidelines/Compression.html">this top search result</a> and IE6 gets no compression at all. Follow the advice from <a
href="http://www.contentwithstyle.co.uk/content/moddeflate-and-ie6-bug/index.html">this search result</a> and no version of IE will get anything using HTTP compression, except for IE7. Follow advice from IBM, no version of IE will ever get a non-HTML file using HTTP compression.</p><p>Depending on which directives were used, and how match criteria is configured, you ended up with several possible scenarios:</p><ul><li>HTTP compression is completely disabled for all <code>Mozilla/4</code> browsers.</li><li>HTTP compression is completely disabled for IE6</li><li>HTTP compression is completely disabled for IE6 except SV1</li><li>HTTP compression is completely disabled for all versions of IE</li><li>HTTP compression is completely disabled but all versions of IE, except IE6 (so no compression for IE &gt; 6)</li><li>HTTP compression for non-HTML files is disabled for all <code>Mozilla/4</code> browsers.</li><li>HTTP compression for non-HTML files is disabled for IE6</li><li>HTTP compression for non-HTML files is disabled for IE6 except SV1</li><li>HTTP compression for non-HTML files is disabled for all versions of IE</li><li>HTTP compression for non-HTML files is disabled but all versions of IE, except IE6 (so no compression for IE &gt; 6)</li></ul><p>Apache makes it quite easy to mess this up. Nginx is much easier. It completely ignores the old Netscape 4 browsers and does not attempt to work around them. It also has a <a
href="http://wiki.nginx.org/HttpGzipModule#gzip_disable">very simply mechanism</a> to avoid sending compressed content to bad versions of IE6. You don&#8217;t need to manually define &quot;this is good&quot; and &quot;this is bad&quot; regexs, allows you to avoid making a mistake.</p><p>In practice, you should just not even try to work around these problematic browsers. The problem browser have all been updated or patched. Even the most recent of the affected browsers, IE6, was fixed nearly a decade ago.  Even on platforms that are no longer support this issue has been fixed. You should review you configuration file and remove any browser filtering code used for HTTP compression.</p><p>Hopefully this section has also taught you that fixing a client-side bug with a server-side fix it rarely a good or sustainable idea. As I discussed in <a
href="/blog/2010/03/the-big-performance-improvement-in-ie9-no-one-is-talking-about">The Big Performance Improvement in IE9 No One is Talking About</a>, this approach of using the User-Agent as a factor in content generation forced the widespread use of the <code>Vary: User-Agent</code> header. The <code>Vary</code> header used in this manner effectively nullifies the shared caching which reduces the overall performance of the web.</p><h3>Extension Vs. MIME Type</h3><p>It is important to review <em>how</em> your web server is configured to compress content. Most browsers allow you to specify either a list of file extensions to compress, or a list of MIME types to compress, or both. Be careful to review this list.</p><p>Let&#8217;s say you have configured your application to serve <code>text/javascript</code> responses using compression. Are you sure that&#8217;s the only MIME type you application uses when serving for JavaScript files? What about <code>text/x-javascript</code> or <code>application/x-javascript</code> or <code>application/javascript</code>? What MIME type does your API serve for JSON responses? <code>text\json</code>? <code>application\json</code>? Something else? How about HTML? Are all of your HTML files using <code>text/html</code>? Do you have some sections from the XHTML days which use other MIME types like <code>application/xhtml+xml</code> or <code>text\xhtml</code> or <code>application\xhtml</code>? Is all of the markup generated by your application served using a single and consistent MIME type? And let&#8217;s not forget about the code you didn&#8217;t write. What MIME type does that opaque charting library use to send data to the client? Or that auto-completing textbox widget you got from Github?</p><p>If you are configuring the web server to use compression using file extensions, did you get all of them? .htm or .html or is it something else? What about your 404 handler? A request happens for the non-existent file <code>/foo/bar.jpg</code>. Since the file extension is not explicitly defined as something that should be compressed (or, being an image, is explicitly defined not to be compressed), the 404 response isn&#8217;t sent with compression.</p><p>Care must be taken when configuring your web server to ensure that uncompressed content is not slipping through due to a missing file extension or MIME type declaration.</p><h3>Properly Configuring HTTP Compression</h3><p>So, given all these challenges, how should you go about configuring HTTP compression properly?</p><p>To see where you might have made a mistake configuring your server, your need a something to compare it to. I am a big fan of the <a
href="https://github.com/h5bp/html5-boilerplate/blob/master/.htaccess">.htaccess file</a> from the <a
href="http://html5boilerplate.com">HTML5 Boilerplate Project</a>. This is an Apache configuration file specifically crafted for web performance optimizations. It provides a great starting point for implementing HTTP compression properly. It also serves as a nice guide to compare to an existing web server configuration to verify you are following best practices. At the very least, the HTML5 Boilerplate .htaccess file provides a comprehensive list of common web content which should or should not get served using HTTP compression.</p><p>Getting a good starting point is only half the battle. The configuration for HTTP compression on a web server only works when it matches the application running on that server. Even the HTML5 Boilerplate configuration file can fail you if there is a discrepancy between the file extensions and MIME types in the configuration file and those used by your application. It&#8217;s easy to forget or overlook a MIME type or a file extension that you application uses. To ensure your application matches your configuration, the best thing to do is carefully review:</p><ol><li>How is your web server configured to map MIME types to content or file extensions?</li><li>How is your web server configured to compress content relative to those MIME types or extensions?</li><li>How are your application&#8217;s filenames and extensions structured?</li><li>How does your application change or override a response&#8217;s MIME type?</li><li>What third party libraries use MIME types?</li></ol><p>Once you think you have properly configured the web server, you need to validate it. <a
href="http://web-sniffer.net/">Web Sniffer</a> is a great, free, web-based tool that let you make individual HTTP requests and see the responses. Web Sniffer gives you some control over the <code>User-Agent</code> and <code>Accept-Encoding</code> header to ensure that compressed content is delivered properly. <a
href="http://hurl.it/">Hurl</a> is another web-based HTTP tool you can use. It allows for more control than Web Sniffer, but requires you to manually enter more information to get the same results:</p> <img
src="http://zoompf.com/wp-content/uploads/2012/02/hurl.png" alt="" title="hurl" width="550" height="410" class="alignnone size-full wp-image-1888" /><p>Hurl and Web Sniffer only test a single page at a time. You can use Zoompf&#8217;s <a
href="http://zoompf.com/free">free scan</a> and <a
href="http://zoompf.com/products">Zoompf WPO</a> can be used to scan multiple pages to verify no uncompressed content is slipping through.</p><h3>Conclusions</h3><p>As this post shows, there are many challenges which must be overcome to properly configure HTTP compression. Make sure all non-natively compressed content is served using HTTP compression. Don&#8217;t waste load time, CPU cycles, and bandwidth compressing content that is already compressed. Only use GZIP compression to ensure compatibility. Don&#8217;t try to work around old browsers since it is easy to make a mistake and end up not delivering compressed content to a capable browser. Review your application code and server configuration to make sure the application&#8217;s content and structure matches your HTTP compression settings. Don&#8217;t forget about compressing 404&#8242;s. Finally, don&#8217;t just assume your configuration works. Use a tool to validate that is works.</p><p> Want to see what performance problems your website has? <i>Content Served Without Compression</i>, <i>Compressed Content Served with Compression</i>, <i>Bigger With Compression</i>, and <i>Obsolete Compression Format</i> are just 4 of the nearly 400 performance issues Zoompf detects when testing your web applications. You can get a <a
href="/free">free performance scan of you website</a> now and at a look at our <a
href="/products">Zoompf WPO</a> product at <a
href="http://zoompf.com/">Zoompf.com</a> today!</p>]]></content:encoded> <wfw:commentRss>http://zoompf.com/blog/2012/02/lose-the-wait-http-compression/feed</wfw:commentRss> <slash:comments>6</slash:comments> </item> <item><title>Zoompf&#8217;s Concerns about SOPA and PIPA</title><link>http://zoompf.com/blog/2012/01/zoompf-concerns-about-sopa-and-pipa</link> <comments>http://zoompf.com/blog/2012/01/zoompf-concerns-about-sopa-and-pipa#comments</comments> <pubDate>Wed, 18 Jan 2012 20:26:54 +0000</pubDate> <dc:creator>Billy Hoffman</dc:creator> <category><![CDATA[random]]></category> <category><![CDATA[company]]></category> <category><![CDATA[legal]]></category> <guid
isPermaLink="false">http://zoompf.com/?p=1862</guid> <description><![CDATA[Today many websites have voluntarily taken themselves offline or censored themselves to drawn attention to and protest two pieces of potential legislation currently under consideration in the United States. SOPA and PIPA are complex pieces of legislation which have a &#8230; <a
href="http://zoompf.com/blog/2012/01/zoompf-concerns-about-sopa-and-pipa">Continue reading <span
class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<p>Today many websites have voluntarily taken themselves offline or censored themselves to drawn attention to and protest <a
href="http://en.wikipedia.org/wiki/Wikipedia:SOPA_initiative/Learn_more">two pieces of potential legislation</a> currently under consideration in the United States. SOPA and PIPA are complex pieces of legislation which have a number of provision and I encourage people to <a
href="http://www.cbsnews.com/8301-503544_162-57360665-503544/sopa-pipa-what-you-need-to-know/">read more about them to understand</a> their composition and implications. They have gone through multiple revisions which have added or removed various provisions and are still in a state of flux. Also, exactly what measures are or are not in each bill, and it what form they have been modified to, are not entirely clear.</p> <img
src="http://zoompf.com/wp-content/uploads/2012/01/copyright.jpg" alt="copyright symbol" title="" width="200" height="200" class="alignnone size-full wp-image-1863" /><p>Broadly, these pieces of legislation do several things. First, they provide a mechanism to create a blacklist of websites which contain copyright infringing content. Network operators and Internet service provides in the United States would be required to prevent access to these sites. Additionally, there is a separate provision restricting websites from linking to websites on the blacklist. These pieces of legislation also provide a mechanism for copyright owners to notify payment processors like banks or credit cards about an offending website and ask that the payment processors not do business with those offending sites. Furthermore. there is an anti-circumvention provision which would make it illegal to discuss technical measures which could circumvent the parts of the legislation, such as discussing technology or methods to access blacklisted websites.</p><p>While I have strong personal feelings about this legislation, this is not an appropriate venue to discuss them. However, there two aspects of SOPA and PIPA which directly impact Zoompf&#8217;s business and are of great concern. This post is to discuss those issues and why Zoompf, as a company, is against SOPA and PIPA.</p><h3>Safe Harbor Provisions</h3><p>Zoompf&#8217;s technology works much like a search engine. We crawl a website, copying and storing its contents in various forms, analyze it, and generate reports containing that content or links to that content. A customer or someone using <a
href="/free">our free performance scan</a> can use Zoompf to analyze a site containing illegal copyrighted material. Zoompf would then have a copy of that material and make some of that content available in various forms.</p><p>Currently, Zoompf is protected from liability for copyright infringement done by Zoompf users under the safe harbor provisions of the Digital Millennium Copyright Act (specifically title 2, the Online Copyright Infringement Liability Limitation Act). Other companies such as Google and even hosted blogging solutions like WordPress.com are also protected from the infringing actions of their users by these safe harbor provisions. However, both SOPA and PIPA alter these safe harbor protections. Zoompf&#8217;s liability potentially increases. Additionally, the review process which we would need to go through to resolve copyright infringement disputes would change. The exact changes to the process and their ramifications are still vague and have not been addressed by SOPA or PIPA. At this time the process appears to be much more onerous, difficult, and expensive. This is a great concern to Zoompf as it potentially increases our liability for the actions of our users while simultaneously replacing a known and proven path to resolve disputes with an unknown, unproven, and more costly path.</p><h3>Definition of Foreign Website</h3><p>SOPA and PIPA are only applicable to &quot;foreign websites&quot; or &quot;foreign companies.&quot; This seems to make Zoompf objections moot as Zoompf Incorporated is a US company. However the definitions of &quot;foreign websites&quot; or &quot;foreign companies&quot; in these bills are not clear. For example, Zoompf runs on top of and serves content from data centers in other countries such as Germany and Singapore. These are isolated from the US in that only customers in EMEA and APJ uses these systems and content from websites scanned in those areas is not placed on Zoompf assets in the United States. Are those &quot;foreign websites?&quot; What if our web interface is served from one country and our database is in another? Is it a &quot;foreign website?&quot; It is not clear at what point, if any, a US company operates a &quot;foreign website.&quot;</p><p>Additionally, as part of our expansion into new markets in other countries, it may be advantageous for Zoompf to create foreign subsideraries inside those countries to do business. Is a subsiderary in a foreign country wholly owned by a US company considered a &quot;foreign company&quot; under the provisions of SOPA and PIPA? According to our lawyers this is not clear.</p><h3>Actions taken by Zoompf</h3><p>Zoompf is concerned about how SOPA/PIPA alters the protections Zoompf currently enjoys under the safe harbor provisions of the DMCA. Zoompf is also concerned about how a law that targets &quot;foreign&quot; assets and entities applies to us as we host more and more of our computing and storage assets around the world and as we expand into other countries and new markets.</p><p>Since Zoompf is based in Atlanta GA, we telephoned both our senators: <a
href="http://projects.propublica.org/sopa/I000055">Sen. Johnny Isakson</a> (202-224-3643) and <a
href="http://projects.propublica.org/sopa/C000286">Sen. Saxby Chambliss</a> (202-224-3521). Both are co-sponsors of the PIPA bill in the Senate. We also telephoned <a
href="http://projects.propublica.org/sopa/P000591/">Rep. Tom Price</a> (202-225-4501) who represents our congressional distinct.</p><p>In each case we spoke with a receptionist who said they were receiving an overwhelming response about SOPA/PIPA. They asked us our information and what our concerns were. We calmly explained our specific issues with the bills and asked if there was any information about how the member of congress planned to address those issues.</p><p>Sen. Chambliss&#8217;s office said he was strongly reconsidering his position on PIPA in light all of the opposition and potential negative ramifications of the bill which had not been considered. Rep. Tom Price has not taken any public position for or against SOPA and was listening to his constituents to understand their views before taking a position. Sen. Isakson&#8217;s office did not say what the congressman was going to do to address the concerns.</p><p>That is Zoompf&#8217;s position on SOPA/PIPA. While it is still unclear what will ultimately happen we are hopefully that both SOPA and PIPA will be defeated.</p>]]></content:encoded> <wfw:commentRss>http://zoompf.com/blog/2012/01/zoompf-concerns-about-sopa-and-pipa/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Lose the Wait: Page Weight and Transfer Weight</title><link>http://zoompf.com/blog/2012/01/lose-the-wait-page-weight-and-transfer-weight</link> <comments>http://zoompf.com/blog/2012/01/lose-the-wait-page-weight-and-transfer-weight#comments</comments> <pubDate>Mon, 09 Jan 2012 15:53:55 +0000</pubDate> <dc:creator>Billy Hoffman</dc:creator> <category><![CDATA[random]]></category> <category><![CDATA[Lose The Wait]]></category> <category><![CDATA[reduce size]]></category> <guid
isPermaLink="false">http://zoompf.com/?p=1841</guid> <description><![CDATA[This the first post in Zoompf&#8217;s Lose the Wait series, where we provide tips, tricks, guidance and encouragement to help you lose the wait and optimize your websites for maximum speed. The wait/weight homonym isn&#8217;t just us being clever. According &#8230; <a
href="http://zoompf.com/blog/2012/01/lose-the-wait-page-weight-and-transfer-weight">Continue reading <span
class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<p>This the first post in Zoompf&#8217;s <a
href="/blog/2012/01/lose-the-wait">Lose the Wait</a> series, where we provide tips, tricks, guidance and encouragement to help you lose the wait and optimize your websites for maximum speed. The wait/weight homonym isn&#8217;t just us being clever. According to the excellent <a
href="http://httparchive.org/">HTTP Archive</a>, more than any other factor, the total amount of data transmitted for a webpage has the highest correlation to its page load time.</p> <img
src="http://zoompf.com/wp-content/uploads/2012/01/httpchart.png" alt="" title="Factors and correlation to page load time" width="500" height="225" class="alignnone size-full wp-image-1842" /><p>This makes sense. The more data that the browser has to downloaded, the longer a webpage will take to load. So by losing kilobytes of page weight you can truly lose the timing wait.</p><h3>Measuring Page Weight</h3><p>When I say &#8220;page weight&#8221; I mean the size, in bytes, of all the content which has to be downloaded to view a webpage. This means the base HTML file, any CSS, JavaScript, Images, web fonts, Flash, and anything else that needs to download to render the page. Reducing the size of this content will help us reduce page load time.</p><p>Of course, you cannot improve what you can&#8217;t measure. Having a quick, clear, and reliable way to calculate and visualize page weight is an important first step on our optimization path. Surprisingly most performance tools don&#8217;t do this very well. <a
href="http://www.webpagetest.org/">WebPageTest</a> and <a
href="http://zoompf.com/products">Zoompf WPO</a> will tell you the basic information like total page weight, but they do this as a byproduct of their performance analysis. This means you are going to have to wait 30 seconds or more while they scan your website to get page weight information. <a
href="https://addons.mozilla.org/en-US/firefox/addon/yslow/">YSlow</a>&#8216;s &#8220;Statistics&#8221; tab is better since it provides content size grouped by resource type in addition to total page weight. However you still have to conduct run a YSlow analysis, which can be slow (don&#8217;t use YSlow&#8217;s autorun feature, it pretty much ruins Firefox&#8217;s performance).</p><p>We need something that allows us to dive even deeper into page weight data and something that is fast. For that we can use super awesome <a
href="https://addons.mozilla.org/en-US/firefox/addon/view-dependencies/"><em>View Dependencies</em> add-on for Firefox</a>.</p> <img
src="http://zoompf.com/wp-content/uploads/2012/01/view-dependencies.jpg" alt="" title="view dependencies" width="550" height="371" class="alignnone size-full wp-image-1843" /><p>View Dependencies adds a &#8220;<em>Dependencies</em>&#8221; tab to Firefox&#8217;s native Page Info dialog. View Dependencies shows size of web content and groups them by usage, not content type like YSlow. This is very helpful as images used as a CSS background are separated from regular <code><IMG
SRC></code> images. This helps you to track down resources that aren&#8217;t referenced properly and are not served from a static, cookieless domain.</p><p>Groups of responses are then organized by the hostname that served the response, allowing you to quickly identify servers which are bloated and need further investigation. View Dependencies also rolls up the number of requests for a specific resource type or requests to a specific host.</p><p>Best of all, View Dependencies is <strong>fast</strong>. Since it hooks into Firefox&#8217;s existing Page Info dialog, it doesn&#8217;t need to scan or re-request any resources. The only thing separating you from this wealth of data is how quickly you can get that dialog box open! Sadly, modern Firefox no longer has a native keyboard shortcut for Page Info like it has <code>CTRL+U</code> for View Source. The easiest way to get to the Page Info dialog is to right-click on the current webpage and select &#8220;View Page Info&#8221; from the context menu. There is also an add-on, <a
href="https://addons.mozilla.org/en-US/firefox/addon/page-info-button/">Page Info Button</a>, which places a button on Firefox&#8217;s toolbar which opens the Page Info dialog. This add-on also implements a keyboard shortcut <code>CTRL+I</code> which will open the dialog as well.</p><h3>The Often Forgotten Transfer Weight</h3><p>Page Weight isn&#8217;t the only thing we have to worry about. The bytes of the response body aren&#8217;t the only thing that gets sent to a visitor&#8217;s browser. HTTP itself adds weight in the form of request and response headers. HTTP response headers appear on every response, even empty responses. HTTP headers are also verbose text headers which cannot be compressed the way response bodies can be. HTTP header weight can really add up. <a
href="http://twitter.com/crucially">Artur Bergman</a> of <a
href="http://www.wikia.com/Wikia">Wikia</a> and <a
href="http://www.fastly.com/">Fastly</a> fame <a
href="http://twitter.com/zoompf/status/156207615205056512">recent tweeted</a> that they send <strong>nearly a terabyte of HTTP headers every day</strong>.</p> <img
src="http://zoompf.com/wp-content/uploads/2012/01/artur.png" alt="" title="Wikia http headers overhead" width="518" height="243" class="alignnone size-full wp-image-1844" /><p> Clearly our Lose the Wait fitness plan will need to examine how we can lose some of this transfer weight.</p><h3>Page Weight/Transfer Weight Fitness Plan</h3><p>Over the next several posts, Zoompf plans to explore in great technical detail ways to reduce both response weight and transfer weight. Think of it as your fitness plan to reduce your wait by losing some the weight.</p><p>To some people that might sound very boring or redundant or even too elementary. You might be thinking: &#8220;OK. This is basic stuff. I already know how to reduce the size of content.  A little HTTP compression, some minification, a bit of Closure compiler, some Smush.it, and I&#8217;m done&#8221;.</p><p>While this might be true, we often find that there are aspects of even the most basic optimization that people overlook or think they already know. For example, most people know that HTTP compression should be applied to text resources. But people often forget that &#8220;text resources&#8221; means more than just HTML, CSS, and JavaScript. XML and JSON API responses, Robots.txt, sitemaps, and HTML5 manifest files are all examples of text content which should be served with HTTP compressed but usually isn&#8217;t.</p><p>In fact, saying HTTP compression should apply to &#8220;text resources&#8221; isn&#8217;t the entire picture either. HTTP compression should apply to any non-natively compressed resource. SVG and ICO files are good examples of this. They are images so people think they don&#8217;t need to be compressed. But SVG and ICO are not natively compressed. SVG is just XML, and ICO is a primitive form of the uncompressed BMP file format. Both of these should be served with HTTP compression. Cursor files are another example. Various other binary files and formats are not natively compressed as well.</p><p>To ensure that you are fully optimizing your site, Zoompf is publishing a series of posts exploring different ways to reduce page weight and transfer weight as part of a Lose the Wait fitness plan. Below is a current snapshot of the topics list we plan to write about over the next few weeks:</p><ul><li>HTTP compression (and doing it right)</li><li>Optimizing HTTP headers</li><li>HTML optimization (removing and refactoring structure)</li><li>HTML minification</li><li>CSS minification (and why all the tools suck)</li><li>JavaScript compilation and minification</li><li>Traditional lossless image optimization</li><li>Intelligent lossy image optimization</li></ul><p> Make sure to <a
href="http://twitter.com/zoompf">follow Zoompf on Twitter</a> and <a
href="http://zoompf.com/blog/feed">subscribe to the Lickity Split Blog RSS feed</a> so you don&#8217;t a post in our Lost the Wait series.</p>]]></content:encoded> <wfw:commentRss>http://zoompf.com/blog/2012/01/lose-the-wait-page-weight-and-transfer-weight/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Lose The Wait</title><link>http://zoompf.com/blog/2012/01/lose-the-wait</link> <comments>http://zoompf.com/blog/2012/01/lose-the-wait#comments</comments> <pubDate>Fri, 06 Jan 2012 17:25:10 +0000</pubDate> <dc:creator>Billy Hoffman</dc:creator> <category><![CDATA[random]]></category> <category><![CDATA[Lose The Wait]]></category> <guid
isPermaLink="false">http://zoompf.com/?p=1823</guid> <description><![CDATA[Happy 2012! It&#8217;s a new year and that means people make New Year&#8217;s Resolutions to change something about their life for the better during the coming year. This year, Zoompf asks you to make another New Year&#8217;s Resolution: Lose the &#8230; <a
href="http://zoompf.com/blog/2012/01/lose-the-wait">Continue reading <span
class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<p>Happy 2012! It&#8217;s a new year and that means people make <a
href="http://en.wikipedia.org/wiki/New_Year's_resolution">New Year&#8217;s Resolutions</a> to change something about their life for the better during the coming year. This year, Zoompf asks you to make another New Year&#8217;s Resolution: <b>Lose the Wait</b>.</p> <img
src="http://zoompf.com/wp-content/uploads/2012/01/Scale.jpg" alt="" title="Photo of bathroom Scale" width="500" height="281" class="alignnone size-full wp-image-1824" /><p>That&#8217;s right, start the year off right by promising to <em>Lose the Wait</em> of your website by improve its performance. This just won&#8217;t make your life better, promising to <em>Lose The Wait</em> will help make everyone happier:</p><ul><li><p>Your visitors will be happy. A fast website leads to happy, engaged visitors who are more likely to do business with you.</p></li><li><p>Your IT Ops folks will be happier. A more efficient website reduces server load and allows them to do more with their existing resources.</p></li><li><p>Your CFO or VP of Finance will be happier. Optimizing your website reduces operational costs like bandwidth, and there is no better gift to a financier than reducing costs <em>(except perhaps more money, see first bullet)</em>.</p></li></ul><p>Now I know what your thinking. You&#8217;ve made New Years Resolutions in the past and they didn&#8217;t work out. Or your made some progress towards your goal but it didn&#8217;t last. well fear not! This time around is different because Zoompf will be there to give your the guidance and encouragement so you can you finally <em>Lose the Wait</em> permanently. To do help you build faster sites Zoompf is starting a new series of blog posts, webcasts, white papers, and workshops entitled <em>Lose the Wait</em>!</p><p>If you really make to change your website&#8217;s performance for the better, if you are sick are tired of your slow and bloated site, if you are finally committed to <em>Losing the Wait</em>, Zoompf is here to help you achieve it. We start next week, bright and early so make sure to <a
href="http://twitter.com/zoompf">follow Zoompf on Twitter</a> and <a
href="http://zoompf.com/blog/feed">subscribe to the Lickity Split Blog RSS feed</a> so you don&#8217;t miss a step.</p><p><small><a
href="http://www.flickr.com/photos/puuikibeach/6618384837/sizes/m/in/photostream/">Image by puuikibeach</small></a></p> ]]></content:encoded> <wfw:commentRss>http://zoompf.com/blog/2012/01/lose-the-wait/feed</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>Bandwidth, Latency, and the &#8220;Size of your Pipe&#8221;</title><link>http://zoompf.com/blog/2011/12/i-dont-care-how-big-yours-is</link> <comments>http://zoompf.com/blog/2011/12/i-dont-care-how-big-yours-is#comments</comments> <pubDate>Wed, 28 Dec 2011 18:12:42 +0000</pubDate> <dc:creator>Billy Hoffman</dc:creator> <category><![CDATA[random]]></category> <category><![CDATA[bandwidth]]></category> <category><![CDATA[latency]]></category> <category><![CDATA[perf101]]></category> <guid
isPermaLink="false">http://zoompf.com/?p=1814</guid> <description><![CDATA[I talk about performance a lot and more often than not people say something like &#34;I have a really good Internet connection, so websites are fast for me.&#34; What is a little unsettling was when a company told me &#34;Our &#8230; <a
href="http://zoompf.com/blog/2011/12/i-dont-care-how-big-yours-is">Continue reading <span
class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<p>I talk about performance a lot and more often than not people say something like <em>&quot;I have a really good Internet connection, so websites are fast for me.&quot;</em> What is a little unsettling was when a company told me <em>&quot;Our datacenter has a really fat pipe, so our website is fast.&quot;</em> My reply, delivered with a bit of a smile , is <strong>&quot;The size of your pipe doesn&#8217;t guarantee a satisfying user experience.&quot;</strong></p><p>These conversations show that there is a fundamental misunderstanding about how data is  transferred on the Internet. Technical and non-technical people are confusing or combining the separate concepts of <em>bandwidth</em> and <em>latency</em>. Understanding these 2 concepts is critical to understand the core ideas behind front-end web performance and optimization techniques.</p> <img
src="http://zoompf.com/wp-content/uploads/2011/12/Pipe-Sizes.jpg" alt="" title="Pipe-Sizes" width="500" height="281" class="alignnone size-full wp-image-1815" /><p>If you think of the Internet as a <a
href="http://en.wikipedia.org/wiki/Series_of_tubes">series of tubes</a>, latency is the length of the tube between two points. Bandwidth is how wide the tube is. Indeed, it&#8217;s named bandwidth because it describes the width of the communications band. The wider the tube the more data you can send in parallel. The key point here that gets missed is that, regardless of how much data you are sending, you still have to move it the distance from point A to point B. <strong>That takes time and that is the latency</strong>.</p><p>To better illustrate how latency is not affected by bandwidth, I will use an example from Stuart Cheshire&#8217;s excellent 1996 essay, <a
href="http://rescomp.stanford.edu/~cheshire/rants/Latency.html">&quot;It&#8217;s the Latency, Stupid.&quot;</a> The physical distance from Boston, Massachusetts to Stanford University in California is 4320 kilometers. The speed of light traveling through a fiber optic data cable is 200,000 km/s. (compared to 300,000 km/s in a vacuum). So the travel time for a single photon of light to travel across a direct fiber optic connection from Boston to Stanford is <code>4320 km / 200,000 km/s = 21.6</code> milliseconds. The round-trip time to Boston and back is 43.2 milliseconds. These are fundamental laws of nature. You will never get something to travel faster than that. There will always be a delay of at least 43.2 ms when Boston communicates with Stanford.</p><p>In practice, however, the latency delay is more than 43.2 ms. This is because we do not have a single continuous piece of fiber optic cable connecting Boston and Stanford. Instead, the path goes through several segments along the way where dozens of pieces of networking equipment add to the delay. Regardless of how big and powerful that Cisco router is, it is not functioning at the speed of light! Typically, the Boston to Stanford route is on the order of 75-85 milliseconds.</p><p>Remember, we have yet to talk about bandwidth, or connection speeds. <strong>You need to wrap your head around the fact that to send a single bit of data you will always have a delay caused by latency for the data to travel the physical distance to its destination</strong>. Having a 25 Mbps connection does not somehow allow a single bit data of data to travel that a distance any faster. A large bandwidth connection simply allows you to send or receive more data in parallel. The data still needs to travel to and from your computer. The diagram below illustrates this concept:</p> <img
src="http://zoompf.com/wp-content/uploads/2011/12/bandwith-vs-latency.png" alt="" title="bandwith-vs-latency" width="489" height="340" class="alignnone size-full wp-image-1817" /><p>Here we see two connections: one which is low bandwidth and one which is high bandwidth. When transmitting a JPEG across both connections the latency for the first byte of data to travel from the source to the destination is the same. The high bandwidth connection downloads the file faster than the low bandwidth connection because more data can travel in parallel. So faster transmission, latency still there.</p><p>In the late 1990&#8242;s and early 2000&#8242;s, the impact of latency was less visible due to the fact that personal internet connections were quite slow compared to today. The latency was masked because the delay in sending a request and waiting for a response was much smaller than the total time it took to download all of the response. However, that is no longer the case. It is not uncommon for a browser requesting a small image to wait 100 – 150 milliseconds before spending 5 milliseconds to download the image contents. This means that latency is accounting for 90-95% of the total time to request and download the resource. This is tremendously inefficient!</p><p>So why should a front-end performance advocate care about latency? Because it&#8217;s the basis for many of your performance optimizations! In fact, the entire class of &quot;reduce the number of HTTP requests&quot; optimizations are all about avoiding latency.</p><p>Imagine downloading ten, 10 kilobyte files. The total download time would be <code>10a + 10b</code> where <code>a</code> is the delay due to latency and <code>b</code> is the amount of time it takes to download one 10 kilobyte file. Now consider downloading a single 100 kilobyte file. The total download time would be <code>a + 10b</code>. <code>A</code> is the overhead of a single request and response while <code>10b</code> is amount of time spent downloading the 100 kilobyte file. In this example, the time difference between downloading ten, 10 kilobyte files or a single 100 kilobyte file is <code>9a</code>. If we were transmitting these files using HTTP between Stanford and Boston, that would be <code>85 ms * 9 = 765 milliseconds</code>, or over <strong>3/4 of a second saved</strong>! And that&#8217;s a best case scenario. We haven&#8217;t even started talking about congestion, transmission errors, QoS throttling, taking separate paths, or any of the other things that introduce even more latency. And we haven&#8217;t even begun to talk about CDN&#8217;s and latency. I&#8217;ll save that for another post.</p><p>Remember, latency is the amount time required to travel the path from one location to another. Bandwidth is how much data can be moved in parallel along that path</p>]]></content:encoded> <wfw:commentRss>http://zoompf.com/blog/2011/12/i-dont-care-how-big-yours-is/feed</wfw:commentRss> <slash:comments>6</slash:comments> </item> <item><title>Performance Calendar 2011: Advice on Trusting Advice</title><link>http://zoompf.com/blog/2011/12/performance-calendar-2011-advice-on-trusting-advice</link> <comments>http://zoompf.com/blog/2011/12/performance-calendar-2011-advice-on-trusting-advice#comments</comments> <pubDate>Sat, 24 Dec 2011 15:01:46 +0000</pubDate> <dc:creator>Billy Hoffman</dc:creator> <category><![CDATA[random]]></category> <category><![CDATA[guest post]]></category> <category><![CDATA[transparency]]></category> <guid
isPermaLink="false">http://zoompf.com/?p=1804</guid> <description><![CDATA[It&#8217;s that time of year again for Stoyan&#8217;s excellent Performance advent calendar. I wrote a post for it which was published today entitled: Advice on Trusting Advice. Mathias Bynens summed up the post as &#8220;Always examine a third party code &#8230; <a
href="http://zoompf.com/blog/2011/12/performance-calendar-2011-advice-on-trusting-advice">Continue reading <span
class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<img
src="/wp-content/uploads/2011/12/trust-no-one-300x229.jpg" alt="" title="trust-no-one" width="300" height="229" class="alignnone size-medium wp-image-1807" /><p> It&#8217;s that time of year again for Stoyan&#8217;s excellent Performance advent calendar. I wrote a post for it which was published today entitled: <em><a
href="http://calendar.perfplanet.com/2011/advice-on-trusting-advice/">Advice on Trusting Advice</a></em>. <a
href="https://twitter.com/#!/mathias">Mathias Bynens</a> summed up the post as &#8220;Always examine a third party code snippet before including it in your site, regardless of who wrote it&#8221; but it&#8217;s bigger than that. It&#8217;s not just snippets from competent people can be slow, or that Google can give you bad advice, or even that Zoompf can give you bad advice for that matter. The broader theme is that all aspects of performance must be transparent so they can be discussed, examined, independently verified, and improved. The reason I could write that post about a problem a customer found with a Google+ snippet is that Google was open and transparent about what their snippet did and provided guidance, though incorrect, on how to use the snippet. This allowed me to discuss what it did, show the problems, make recommendations, hopefully change Google&#8217;s advice, and improve things for everyone. But only because of transparency.</p><p> Sadly I&#8217;m seeing some trends where people and companies are making web performance opaque. I began talking about transparency and performance responsibility in my <a
href="/blog/2011/12/amazon-silk-and-performance-responsibility">Amazon Silk and Performance Responsibility</a> post. These are topics I plan to speak of a lot in the new year.</p>]]></content:encoded> <wfw:commentRss>http://zoompf.com/blog/2011/12/performance-calendar-2011-advice-on-trusting-advice/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>REDbot: Awesome HTTP Testing</title><link>http://zoompf.com/blog/2011/12/redbot-awesome-http-testing</link> <comments>http://zoompf.com/blog/2011/12/redbot-awesome-http-testing#comments</comments> <pubDate>Thu, 22 Dec 2011 20:43:17 +0000</pubDate> <dc:creator>Billy Hoffman</dc:creator> <category><![CDATA[random]]></category> <category><![CDATA[HTTP]]></category> <category><![CDATA[tools]]></category> <guid
isPermaLink="false">http://zoompf.com/?p=1797</guid> <description><![CDATA[I am always on the lookout for new and cool web performance and quality tools. One of my favorite tools is REDbot. Every web performance advocate should be using REDbot regularly. Want to know why? To start, REDbot was created &#8230; <a
href="http://zoompf.com/blog/2011/12/redbot-awesome-http-testing">Continue reading <span
class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<p>I am always on the lookout for new and cool web performance and quality tools. One of my favorite tools is <a
href="http://mnot.github.com/redbot/">REDbot</a>. <strong>Every web performance advocate should be using REDbot regularly</strong>. Want to know why?</p><p>To start, REDbot was created by the awesome Australian <a
href="http://www.mnot.net/">Mark Nottingham</a>. Mark writes some excellent technical-yet-easy-to-understand essays on the inner workings of HTTP, such as the definitive <em><a
href="http://www.mnot.net/cache_docs/">Caching tutorial for Web authors and web masters</a></em>. With REDbot, Mark has taken his vast knowledge of all things HTTP and distilled that into a wonderful tool written in Python. So, Mark&#8217;s brain is Reason #1</p><p>Reason #2 is what the tool does. The best way to describe REDbot might be <em>&quot;HTTP <a
href="http://en.wikipedia.org/wiki/Lint_(software)">Lint</a>&quot;</em>, which, funny enough, was the name of the first C# project of what became the Zoompf scanner. REDbot examines a server&#8217;s HTTP response headers and body for performance issues, quality issues, compatibility issues, adherence to the HTTP RFCs, and provides various ancillary info messages. Frankly the depth of issues it looks for is really quite amazing; currently over 150 different items can be <a
href="https://github.com/mnot/redbot/blob/master/redbot/speak.py">detected and reported by REDbot</a>.</p> <img
src="http://zoompf.com/wp-content/uploads/2011/12/redbot-issues.png" alt="screen of some of the issues that REDbot finds" title="redbot-issues" width="419" height="494" class="alignnone size-full wp-image-1798" /><p> As an example, here are just some the things that REDbot checks for with the <code>Last-Modified</code> header.</p><ul><li>Is the date format valid? Invalid dates can&#8217;t get conditionally cached.</li><li>Is the date in the future? Resources in the future cannot be cached.</li><li>Does the web server correctly return a 304 if the resource has not been modified?</li><li>Are there duplicate <code>Last-Modified</code> headers? Do they have different values?</li></ul><p>That is just scratching the surface of what REDbot can find out about your site. Is the <code>Content-Length</code> header right? Is chunked encoding working properly? How many inline caching proxies did the response go through? REDbot has helped me find and fix several issues with Zoompf&#8217;s own web infrastructure. In fact, many of the issues REDbot looks for were so helpful, we added them to list of issues that Zoompf tests for. While Zoompf does not include all of REDbot&#8217;s tests I don&#8217;t know of any other performance tools which look for these kinds of HTTP issues. For the reason of completeness alone, REDbot needs to be part of you toolset.</p><p>Of course, detecting some HTTP problems can get pretty involved. For example, REDbot and Zoompf will verify that a server properly responds to <code>If-Not-Modified</code>, <code>If-None-Match</code>, and <code>Range</code> requests. Additional REDbot and Zoompf can confirm that <code>Vary</code> and <code>Accept-Encoding</code> response headers are correctly operating. All of this involves sending multiple requests to the web server for each issue. Testing a single static resource can involve 5 to 6 requests and processing that many responses! While this isn&#8217;t so bad when testing a single URL, doing for multiple resources is time consuming. The public web instance of REDbot often times out when using the &quot;check assets&quot; feature to test multiple URLs at once. Zoompf website scans can take 2 times or 4 times longer to complete if you conduct these extended HTTP tests. We are playing with a few ways to be intelligent about when we send these extra test requests but it is still a work in progress. In the meantime, this extended HTTP testing capability is disabled by default for our customers and completely unavailable for free scans.</p><p>Reason #3: REDbot is open source and hosted on GitHub which makes it super easy to start using. It can run from the command line, but Mark &#8220;the Awesome Aussie&#8221; Nottingham (it&#8217;s his pro wrestling, look it up) has setup a <a
href="http://redbot.org/">public instance of REDbot with a web interface</a> where anyone can quickly test a resource. If you test an HTML page, you can click the <em>&quot;check assets&quot;</em> link underneath the response headers to recursively test all the referenced resources. This is a handy feature to rapidly test multiple URLs but as we said you will occasionally get timeouts.</p><p>Reason #4: It&#8217;s web UI is gorgeous. As someone who makes incredibly crappy web interfaces (and which I am convinced would somehow be better if I wrote them on a new Macbook Air), I drool over what Mark has done. Fades, transparency, context dialogs, this thing is sexy looking.</p><p> REDbot is an awesome tool which provides much needed HTTP insight and validation available nowhere else. I highly recommend it to anyone interested in the working of the web and I thank Mark Nottingham for his excellent contribution to our community.</p> ]]></content:encoded> <wfw:commentRss>http://zoompf.com/blog/2011/12/redbot-awesome-http-testing/feed</wfw:commentRss> <slash:comments>4</slash:comments> </item> </channel> </rss>
