<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Apache mod_deflate and mod_cache issues</title>
	<atom:link href="http://www.digitalsanctuary.com/tech-blog/general/apache-mod_deflate-and-mod_cache-issues.html/feed" rel="self" type="application/rss+xml" />
	<link>http://www.digitalsanctuary.com/tech-blog/general/apache-mod_deflate-and-mod_cache-issues.html</link>
	<description>Java, ATG, Seam, and related Technologies</description>
	<lastBuildDate>Sat, 13 Mar 2010 02:12:57 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Devon</title>
		<link>http://www.digitalsanctuary.com/tech-blog/general/apache-mod_deflate-and-mod_cache-issues.html/comment-page-1#comment-49914</link>
		<dc:creator>Devon</dc:creator>
		<pubDate>Fri, 11 Dec 2009 21:27:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.digitalsanctuary.com/tech-blog/?p=165#comment-49914</guid>
		<description>Ahh!  Great news!  Thanks!  Looking forward to it all working happily together.</description>
		<content:encoded><![CDATA[<p>Ahh!  Great news!  Thanks!  Looking forward to it all working happily together.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Leonid</title>
		<link>http://www.digitalsanctuary.com/tech-blog/general/apache-mod_deflate-and-mod_cache-issues.html/comment-page-1#comment-49909</link>
		<dc:creator>Leonid</dc:creator>
		<pubDate>Fri, 11 Dec 2009 20:02:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.digitalsanctuary.com/tech-blog/?p=165#comment-49909</guid>
		<description>Having run into this problem recently we have work with the apache folks and by the looks of it the result is to move mod_cache to be a content rather then a  quick handler. See http://www.gossamer-threads.com/lists/apache/dev/374883 for more details. It looks like this is going into Apache 2.3 and is being planned for a backport back into 2.2</description>
		<content:encoded><![CDATA[<p>Having run into this problem recently we have work with the apache folks and by the looks of it the result is to move mod_cache to be a content rather then a  quick handler. See <a href="http://www.gossamer-threads.com/lists/apache/dev/374883" rel="nofollow">http://www.gossamer-threads.com/lists/apache/dev/374883</a> for more details. It looks like this is going into Apache 2.3 and is being planned for a backport back into 2.2</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Devon</title>
		<link>http://www.digitalsanctuary.com/tech-blog/general/apache-mod_deflate-and-mod_cache-issues.html/comment-page-1#comment-43208</link>
		<dc:creator>Devon</dc:creator>
		<pubDate>Wed, 01 Jul 2009 00:03:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.digitalsanctuary.com/tech-blog/?p=165#comment-43208</guid>
		<description>Andy,

unfortunately I haven&#039;t found a good solution:(  I&#039;ve just been either caching or deflating based on the file type, but not doing both.</description>
		<content:encoded><![CDATA[<p>Andy,</p>
<p>unfortunately I haven&#8217;t found a good solution:(  I&#8217;ve just been either caching or deflating based on the file type, but not doing both.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andy</title>
		<link>http://www.digitalsanctuary.com/tech-blog/general/apache-mod_deflate-and-mod_cache-issues.html/comment-page-1#comment-43189</link>
		<dc:creator>Andy</dc:creator>
		<pubDate>Tue, 30 Jun 2009 17:41:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.digitalsanctuary.com/tech-blog/?p=165#comment-43189</guid>
		<description>I have the same problem with mod_deflate and mod_disk_cache clashing. I have tried many things including                

CacheIgnoreHeaders Age Date Host User-Agent Accept Accept-Language Accept-Encoding Accept-Charset Keep-Alive Connection Cookie Cache-Control Vary (this indicates that I am not a power user of linux ;)

Anyway, I was wondering if you have found a solution to this. We have an apache(2.2.11)/mod_jk/jboss(4.2.2) setup wherein we want to cache non-user specific xml files (like http://www.tennisearth.com/widget/displayLiveScores.htm) requested from jboss to be cached for 10 seconds. To take care of the fact that the last modified time of these files might be only a few milliseconds in past, we had even set CacheLastModifiedFactor to 10000.
I guess there is some other header that we should ignore that should do the trick. We do not want to remove mod_deflate.</description>
		<content:encoded><![CDATA[<p>I have the same problem with mod_deflate and mod_disk_cache clashing. I have tried many things including                </p>
<p>CacheIgnoreHeaders Age Date Host User-Agent Accept Accept-Language Accept-Encoding Accept-Charset Keep-Alive Connection Cookie Cache-Control Vary (this indicates that I am not a power user of linux <img src='http://www.digitalsanctuary.com/tech-blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Anyway, I was wondering if you have found a solution to this. We have an apache(2.2.11)/mod_jk/jboss(4.2.2) setup wherein we want to cache non-user specific xml files (like <a href="http://www.tennisearth.com/widget/displayLiveScores.htm)" rel="nofollow">http://www.tennisearth.com/widget/displayLiveScores.htm)</a> requested from jboss to be cached for 10 seconds. To take care of the fact that the last modified time of these files might be only a few milliseconds in past, we had even set CacheLastModifiedFactor to 10000.<br />
I guess there is some other header that we should ignore that should do the trick. We do not want to remove mod_deflate.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hummy: Apache Mod Cache Mod Cache</title>
		<link>http://www.digitalsanctuary.com/tech-blog/general/apache-mod_deflate-and-mod_cache-issues.html/comment-page-1#comment-37209</link>
		<dc:creator>Hummy: Apache Mod Cache Mod Cache</dc:creator>
		<pubDate>Tue, 07 Apr 2009 21:49:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.digitalsanctuary.com/tech-blog/?p=165#comment-37209</guid>
		<description>[...] http://www.digitalsanctuary.com/tech-blog/general/apache-mod_deflate-and-mod_cache-issues.html [...]</description>
		<content:encoded><![CDATA[<p>[...] <a href="http://www.digitalsanctuary.com/tech-blog/general/apache-mod_deflate-and-mod_cache-issues.html" rel="nofollow">http://www.digitalsanctuary.com/tech-blog/general/apache-mod_deflate-and-mod_cache-issues.html</a> [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Improving ATG Performance With a Content Delivery Network (CDN) &#124; Devon Hillard Tech Blog</title>
		<link>http://www.digitalsanctuary.com/tech-blog/general/apache-mod_deflate-and-mod_cache-issues.html/comment-page-1#comment-17242</link>
		<dc:creator>Improving ATG Performance With a Content Delivery Network (CDN) &#124; Devon Hillard Tech Blog</dc:creator>
		<pubDate>Mon, 19 Jan 2009 23:15:38 +0000</pubDate>
		<guid isPermaLink="false">http://www.digitalsanctuary.com/tech-blog/?p=165#comment-17242</guid>
		<description>[...] will use all available RAM to cache those files in memory for rapid serving. If you plan on using mod_gzip and mod_disk_cache together, please read my post on the issues encountered using them toget....   Share and [...]</description>
		<content:encoded><![CDATA[<p>[...] will use all available RAM to cache those files in memory for rapid serving. If you plan on using mod_gzip and mod_disk_cache together, please read my post on the issues encountered using them toget&#8230;.   Share and [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ATG Performance Tuning: Improving JSP Serving Time for an ATG Application &#124; Devon Hillard Tech Blog</title>
		<link>http://www.digitalsanctuary.com/tech-blog/general/apache-mod_deflate-and-mod_cache-issues.html/comment-page-1#comment-15774</link>
		<dc:creator>ATG Performance Tuning: Improving JSP Serving Time for an ATG Application &#124; Devon Hillard Tech Blog</dc:creator>
		<pubDate>Mon, 12 Jan 2009 23:16:01 +0000</pubDate>
		<guid isPermaLink="false">http://www.digitalsanctuary.com/tech-blog/?p=165#comment-15774</guid>
		<description>[...] can read more about this configuration, plus some issues that arise when using mod_disk_cache and mod_deflate together here. You can get around this by only gzipping html output from your JSPs, which you won&#039;t be caching [...]</description>
		<content:encoded><![CDATA[<p>[...] can read more about this configuration, plus some issues that arise when using mod_disk_cache and mod_deflate together here. You can get around this by only gzipping html output from your JSPs, which you won&#8217;t be caching [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Devon</title>
		<link>http://www.digitalsanctuary.com/tech-blog/general/apache-mod_deflate-and-mod_cache-issues.html/comment-page-1#comment-15147</link>
		<dc:creator>Devon</dc:creator>
		<pubDate>Wed, 31 Dec 2008 18:32:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.digitalsanctuary.com/tech-blog/?p=165#comment-15147</guid>
		<description>@Neil:  I just went to your options page and counted up the various options.  It looked like each option was given a numeric value and concatenated together for the cookie value?  Anyhow, not a big deal:)

I&#039;m glad that the CacheDirLevel change has helped some!</description>
		<content:encoded><![CDATA[<p>@Neil:  I just went to your options page and counted up the various options.  It looked like each option was given a numeric value and concatenated together for the cookie value?  Anyhow, not a big deal:)</p>
<p>I&#8217;m glad that the CacheDirLevel change has helped some!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Neil Gunton</title>
		<link>http://www.digitalsanctuary.com/tech-blog/general/apache-mod_deflate-and-mod_cache-issues.html/comment-page-1#comment-15144</link>
		<dc:creator>Neil Gunton</dc:creator>
		<pubDate>Wed, 31 Dec 2008 17:39:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.digitalsanctuary.com/tech-blog/?p=165#comment-15144</guid>
		<description>Hi Devon,

How do you know what the total number of possible option values is for my website? Did you try setting the option and then peek at the cookie? Even so, that doesn&#039;t cover the number of possible Vary values, since there is also the id cookie which is set for users - and that can have a huge number of permutations since it&#039;s stored as an encrypted hash digest (i.e. long string of gibberish). So you&#039;d need to multiple the opts permutations by the id permutations - and even then, that just gives you the number of possible versions for just one file. There are hundreds of thousands of dynamically generated pages on the site. It wouldn&#039;t work to just have the caching on the home page (to handle slashdottings) since they can link to any interesting page - e.g. a particularly funny pic in a journal, or a day page that talks about something interesting etc etc ad infinitum. It&#039;s really endless, so I need to cache all dynamically generated content, really.

Anyway, I tried setting CacheDirLevels to 2 rather than 3, and already I think I see an improvement. I do have more files now in each of the level 2 subdirs, but at present it only seems to be of the order of 10 or so, which is nothing much - you only see problems when you go to tens of thousands of files in a single directory, as I recall. Even then, you could enable dir_index for the partition to get the hash tree for filename lookup (but I don&#039;t want to do that since it tends to require dodgy multiple reboots with e2fscks and I&#039;ve read that it can cause problems on some systems). 

As it stands now, I have the following for htcacheclean:

htcacheclean -i -t -n -d60 -p/var/cache/www -l1000M

And this morning, I can do a du -hs on the cache directory, it seems to complete in a few seconds (much better). I&#039;ll have to retest randomly, since it&#039;s possible that the directory tree just happened to be mostly in cache - it&#039;s much more telling to do it cold, so the disks actually have to be read. It&#039;s interesting that htcacheclean doesn&#039;t seem to take into account the full size of the directories, since du -hs gives me a size of 1.9GB, almost twice the requested size for htcacheclean. I guess htcacheclean maybe only looks at the actual filesize of the content, and just ignores the size of the directories themselves (which are files, and take up some space). Maybe it also doesn&#039;t take into account the header files, I dunno.

I thought about increasing CacheDirLength to 2, because that would result in an even broader and more shallow directory structure. But looking at the characters it seems to use for the current directories, a-z, A-Z, 0-9, _ and @, then that would give us 64^2 = 4096 possible subdirs in each directory level. I think it&#039;s probably better the way it is right now - something on the order of tens of files is certainly going to be better than thousands in terms of lookup performance.

I do still see little spikes in iowait (using munin to monitor), but I&#039;ll leave this for a day or two to see how it pans out over time. Maybe just removing one level of directories (CacheDirLevels from 3 to 2) is enough to make the difference here - after all, it&#039;s effectively reducing a power function by 1, which is exponential in terms of the possible number of subdirs. We&#039;ll see...

Thanks,

Neil</description>
		<content:encoded><![CDATA[<p>Hi Devon,</p>
<p>How do you know what the total number of possible option values is for my website? Did you try setting the option and then peek at the cookie? Even so, that doesn&#8217;t cover the number of possible Vary values, since there is also the id cookie which is set for users &#8211; and that can have a huge number of permutations since it&#8217;s stored as an encrypted hash digest (i.e. long string of gibberish). So you&#8217;d need to multiple the opts permutations by the id permutations &#8211; and even then, that just gives you the number of possible versions for just one file. There are hundreds of thousands of dynamically generated pages on the site. It wouldn&#8217;t work to just have the caching on the home page (to handle slashdottings) since they can link to any interesting page &#8211; e.g. a particularly funny pic in a journal, or a day page that talks about something interesting etc etc ad infinitum. It&#8217;s really endless, so I need to cache all dynamically generated content, really.</p>
<p>Anyway, I tried setting CacheDirLevels to 2 rather than 3, and already I think I see an improvement. I do have more files now in each of the level 2 subdirs, but at present it only seems to be of the order of 10 or so, which is nothing much &#8211; you only see problems when you go to tens of thousands of files in a single directory, as I recall. Even then, you could enable dir_index for the partition to get the hash tree for filename lookup (but I don&#8217;t want to do that since it tends to require dodgy multiple reboots with e2fscks and I&#8217;ve read that it can cause problems on some systems). </p>
<p>As it stands now, I have the following for htcacheclean:</p>
<p>htcacheclean -i -t -n -d60 -p/var/cache/www -l1000M</p>
<p>And this morning, I can do a du -hs on the cache directory, it seems to complete in a few seconds (much better). I&#8217;ll have to retest randomly, since it&#8217;s possible that the directory tree just happened to be mostly in cache &#8211; it&#8217;s much more telling to do it cold, so the disks actually have to be read. It&#8217;s interesting that htcacheclean doesn&#8217;t seem to take into account the full size of the directories, since du -hs gives me a size of 1.9GB, almost twice the requested size for htcacheclean. I guess htcacheclean maybe only looks at the actual filesize of the content, and just ignores the size of the directories themselves (which are files, and take up some space). Maybe it also doesn&#8217;t take into account the header files, I dunno.</p>
<p>I thought about increasing CacheDirLength to 2, because that would result in an even broader and more shallow directory structure. But looking at the characters it seems to use for the current directories, a-z, A-Z, 0-9, _ and @, then that would give us 64^2 = 4096 possible subdirs in each directory level. I think it&#8217;s probably better the way it is right now &#8211; something on the order of tens of files is certainly going to be better than thousands in terms of lookup performance.</p>
<p>I do still see little spikes in iowait (using munin to monitor), but I&#8217;ll leave this for a day or two to see how it pans out over time. Maybe just removing one level of directories (CacheDirLevels from 3 to 2) is enough to make the difference here &#8211; after all, it&#8217;s effectively reducing a power function by 1, which is exponential in terms of the possible number of subdirs. We&#8217;ll see&#8230;</p>
<p>Thanks,</p>
<p>Neil</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Devon</title>
		<link>http://www.digitalsanctuary.com/tech-blog/general/apache-mod_deflate-and-mod_cache-issues.html/comment-page-1#comment-15132</link>
		<dc:creator>Devon</dc:creator>
		<pubDate>Wed, 31 Dec 2008 04:01:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.digitalsanctuary.com/tech-blog/?p=165#comment-15132</guid>
		<description>@Neil:  I got the 55 million number by multiplying the option value counts, which should give the maximum number of possible cookie values for the opt cookie.

The mv and purge later plan isn&#039;t a bad one.  If you try it, let me know.  Or you could just not do any cleanup.

I&#039;ve found that a more shallow dir structure performs much better, even though it means more files per dir.  I don&#039;t know about you, but I was ending up with very few files in the actual end-node directories, but there were a ton of directories.  The Apache recommendations don&#039;t seem to apply if you&#039;re using any sort of Vary header.  Reducing the directory tree size by a few orders of magnitude only led a hundred files/dir or so, which is very manageable.  So that might be worth a try.

Another thing you could do, if you&#039;re mostly worried about a slashdotting, is to only cache the index page, and let the rest be served from perl.  That would keep your cache very small, and solve your primary concern.  Or you could cache the index page via mod_mem_cache or something.

I mostly use mod_disk_cache to keep my J2EE apps from having to serve out static files from the war repeatedly, so our uses are a bit different.</description>
		<content:encoded><![CDATA[<p>@Neil:  I got the 55 million number by multiplying the option value counts, which should give the maximum number of possible cookie values for the opt cookie.</p>
<p>The mv and purge later plan isn&#8217;t a bad one.  If you try it, let me know.  Or you could just not do any cleanup.</p>
<p>I&#8217;ve found that a more shallow dir structure performs much better, even though it means more files per dir.  I don&#8217;t know about you, but I was ending up with very few files in the actual end-node directories, but there were a ton of directories.  The Apache recommendations don&#8217;t seem to apply if you&#8217;re using any sort of Vary header.  Reducing the directory tree size by a few orders of magnitude only led a hundred files/dir or so, which is very manageable.  So that might be worth a try.</p>
<p>Another thing you could do, if you&#8217;re mostly worried about a slashdotting, is to only cache the index page, and let the rest be served from perl.  That would keep your cache very small, and solve your primary concern.  Or you could cache the index page via mod_mem_cache or something.</p>
<p>I mostly use mod_disk_cache to keep my J2EE apps from having to serve out static files from the war repeatedly, so our uses are a bit different.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
