{"id":358,"date":"2006-06-26T21:43:20","date_gmt":"2006-06-27T03:43:20","guid":{"rendered":"http:\/\/www.mooreds.com\/wordpress\/?p=358"},"modified":"2006-06-26T21:43:20","modified_gmt":"2006-06-27T03:43:20","slug":"using-wget-to-verify-on-the-fly-page-compression","status":"publish","type":"post","link":"https:\/\/www.mooreds.com\/wordpress\/archives\/358","title":{"rendered":"Using wget to verify on the fly page compression"},"content":{"rendered":"<p>I&#8217;ve <a href='http:\/\/www.mooreds.com\/weblog\/archives\/000261.html'>written about wget<\/a> before, but I just found a very cool use for it.  I&#8217;m looking at ways to speed up a site, by stripping out whitespace.  I found <a href='http:\/\/www.servletsuite.com\/servlets\/trimflt.htm'>one servlet filter<\/a> by googling around.  However, that code has a license restriction for commercial use (you just have to <a href='https:\/\/secure.shareit.com\/shareit\/checkout.html?PRODUCT[300014157]=1'>pay for it<\/a>).  <\/p>\n<p>A bit more looking and I found this fantastic article: <a href='http:\/\/www.onjava.com\/pub\/a\/onjava\/2003\/11\/19\/filters.html'>Two Servlet Filters Every Web Application Should Have<\/a>.  Give it a read if you do java web development.  The article provides a free set of filters, one of which compresses a servlet response if the browser can handle it.  (I&#8217;ve <a href='http:\/\/www.mooreds.com\/weblog\/archives\/000119.html'>touched on using gzip for such purposes before<\/a> as well.)<\/p>\n<p>I was seeing some fantastic decreases in page size.  (The article states that you can&#8217;t tell, but FireFox&#8217;s Page Info command [ Tools \/ Page Info ] seemed to reflect the differences.)  Basically, a 300% decrease in size: 50K to 5K, 130K to 20K.  Pretty cool.  Note that if your application is CPU bound, adding this filter will not help performance.  But if you&#8217;re bandwidth bound, decreasing your average page size will help.<\/p>\n<p>I couldn&#8217;t believe those numbers.  I also wanted to make sure that clients who didn&#8217;t understand gzip could still see the pages.  Out comes trusty wget.  <code>wget url<\/code> pulls down the standard sized file.  <code>wget --header=\"accept-encoding: gzip\" url<\/code> pulls down a gzipped version that I can even ungzip and verify that nothing has changed.<\/p>\n<p>The only issue I saw was that &#8216; c &#8216; is apparently rendered as the copyright symbol in uncompressed pages.  For compressed pages, you need to use the standard: &amp;copy;.  Other than that, the compression was transparent.  Way cool.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve written about wget before, but I just found a very cool use for it. I&#8217;m looking at ways to speed up a site, by stripping out whitespace. I found [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-358","post","type-post","status-publish","format-standard","hentry","category-programming"],"_links":{"self":[{"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/posts\/358","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/comments?post=358"}],"version-history":[{"count":0,"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/posts\/358\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/media?parent=358"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/categories?post=358"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/tags?post=358"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}