<?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>Kitchen Soap &#187; Caching</title>
	<atom:link href="http://www.kitchensoap.com/category/caching/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.kitchensoap.com</link>
	<description>Thoughts on capacity planning and web operations.</description>
	<lastBuildDate>Fri, 25 Jun 2010 04:05:16 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Varnish and squid, *again*</title>
		<link>http://www.kitchensoap.com/2008/06/24/varnish-and-squid-again/</link>
		<comments>http://www.kitchensoap.com/2008/06/24/varnish-and-squid-again/#comments</comments>
		<pubDate>Wed, 25 Jun 2008 00:19:55 +0000</pubDate>
		<dc:creator>allspaw</dc:creator>
				<category><![CDATA[Caching]]></category>

		<guid isPermaLink="false">http://www.kitchensoap.com/?p=47</guid>
		<description><![CDATA[Just listened to Artur railing against squid and preaching the virtues of varnish. He quoted what most people quoted, which is how varnish performs serving out of *memory*.
It must be nice to have a working set that small. Until someone can show me numbers of disk-intensive (meaning, full caches, LRU eviction churning all the time) [...]]]></description>
			<content:encoded><![CDATA[<p>Just listened to Artur railing against <a href="http://squid-cache.org" target="_blank">squid</a> and preaching the virtues of <a href="http://varnish.projects.linpro.no/" target="_blank">varnish</a>. He quoted what most people quoted, which is how varnish performs serving out of *memory*.</p>
<p>It must be nice to have a working set that small. Until someone can show me numbers of disk-intensive (meaning, full caches, LRU eviction churning all the time) varnish numbers, then squid does us quite fine.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kitchensoap.com/2008/06/24/varnish-and-squid-again/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Squid patch for making &#8220;time&#8221; stats more meaningful.</title>
		<link>http://www.kitchensoap.com/2008/05/22/squid-patch-for-making-time-stats-more-meaningful/</link>
		<comments>http://www.kitchensoap.com/2008/05/22/squid-patch-for-making-time-stats-more-meaningful/#comments</comments>
		<pubDate>Thu, 22 May 2008 18:40:44 +0000</pubDate>
		<dc:creator>allspaw</dc:creator>
				<category><![CDATA[Caching]]></category>
		<category><![CDATA[Flickr]]></category>
		<category><![CDATA[WebOps]]></category>
		<category><![CDATA[webops squid]]></category>

		<guid isPermaLink="false">http://www.kitchensoap.com/?p=43</guid>
		<description><![CDATA[Thanks to Mark, squid&#8217;s got a patch I&#8217;ve been wanting for a gazillion years: time-to-serve statistics that don&#8217;t include the client&#8217;s location
http://www.squid-cache.org/bugs/show_bug.cgi?id=2345
Normally, squid&#8217;s kept statistics that included the &#8220;time&#8221; to serve an object, whether it be a HIT, MISS, NEAR HIT, etc. The clock starts for this time when the first headers are received by [...]]]></description>
			<content:encoded><![CDATA[<p>Thanks to <a href="http://mnot.net/blog" target="_blank">Mark</a>, squid&#8217;s got a patch I&#8217;ve been wanting for a gazillion years: time-to-serve statistics that don&#8217;t include the client&#8217;s location</p>
<blockquote><p><a href="http://www.squid-cache.org/bugs/show_bug.cgi?id=2345" target="_blank">http://www.squid-cache.org/bugs/show_bug.cgi?id=2345</a></p></blockquote>
<p>Normally, squid&#8217;s kept statistics that included the &#8220;time&#8221; to serve an object, whether it be a HIT, MISS, NEAR HIT, etc. The clock starts for this time when the first headers are received by the client that are validated as a legit squid request, but then doesn&#8217;t stop until the client has every last bit of the response.</p>
<p>What this means is that if you have servers in the US and your traffic pattern follows the NY/SF pattern (peaks from around 9am-4pm) and your overseas traffic (i.e. clients really far from your boxes) has a pattern the inverse of that, then you might see &#8216;time-to-serve&#8217; in squid to be <em>worse</em> during your lowest traffic. Which is confusing, to say the least. <img src='http://www.kitchensoap.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>This patch changes the stopwatch to start at the same time (when squid&#8217;s received headers from the client) but <em>stop </em>when squid&#8217;s preparing the headers for the response. This measures ONLY the time that squid had the object in its hands, for a hit or a miss, which IMHO is a much better measure of how squid is actually performing with the hardware&#8217;s resources.</p>
<p>Yay! Thanks Mark.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kitchensoap.com/2008/05/22/squid-patch-for-making-time-stats-more-meaningful/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tool update: WTF is inside filesystem cache ?</title>
		<link>http://www.kitchensoap.com/2008/03/27/tool-update-wtf-is-inside-filesystem-cache/</link>
		<comments>http://www.kitchensoap.com/2008/03/27/tool-update-wtf-is-inside-filesystem-cache/#comments</comments>
		<pubDate>Thu, 27 Mar 2008 13:04:14 +0000</pubDate>
		<dc:creator>allspaw</dc:creator>
				<category><![CDATA[Caching]]></category>
		<category><![CDATA[Random]]></category>
		<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://www.kitchensoap.com/2008/03/27/tool-update-wtf-is-inside-filesystem-cache/</guid>
		<description><![CDATA[Awhile back, I said I&#8217;d love to have a tool that would allow me to peek inside filesystem cache and tell me what files (or pages of files) are inside. Well Peter Zaitsev points to the fincore tool, which comes pretty damn close: you give it a file, and it will tell you which pages [...]]]></description>
			<content:encoded><![CDATA[<p>Awhile <a href="http://www.kitchensoap.com/2007/01/26/two-tools-that-i-would-love-more-than-anything/" target="_blank">back</a>, I said I&#8217;d love to have a tool that would allow me to peek inside filesystem cache and tell me what files (or pages of files) are inside. Well Peter Zaitsev <a href="http://www.mysqlperformanceblog.com/2008/03/18/the-tool-ive-been-waiting-for-years/" target="_blank">points</a> to the <a href="http://net.doit.wisc.edu/~plonka/fincore/" target="_blank">fincore</a> tool, which comes pretty damn close: you give it a file, and it will tell you which pages of a particular file are in core memory.</p>
<p>Rock. Thanks, David Plonka.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kitchensoap.com/2008/03/27/tool-update-wtf-is-inside-filesystem-cache/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Slides from &#8216;Capacity Planning for LAMP&#8217; talk at MySQL Conf 2007</title>
		<link>http://www.kitchensoap.com/2007/04/27/slides-from-capacity-planning-for-lamp-talk-at-mysql-conf-2007/</link>
		<comments>http://www.kitchensoap.com/2007/04/27/slides-from-capacity-planning-for-lamp-talk-at-mysql-conf-2007/#comments</comments>
		<pubDate>Fri, 27 Apr 2007 12:43:43 +0000</pubDate>
		<dc:creator>allspaw</dc:creator>
				<category><![CDATA[Caching]]></category>
		<category><![CDATA[Slides]]></category>
		<category><![CDATA[Talks]]></category>

		<guid isPermaLink="false">http://www.kitchensoap.com/2007/04/27/slides-from-capacity-planning-for-lamp-talk-at-mysql-conf-2007/</guid>
		<description><![CDATA[This was a fun talk. I saw a lot of nods in the audience when I mentioned things pertaining to social applications (unpredictable usage, etc.).  A lot of folks ask questions about how we use ganglia at Flickr.
A PDF of my slides are here. If anyone can tell me how to get Keynote2 slides [...]]]></description>
			<content:encoded><![CDATA[<p>This was a fun talk. I saw a lot of nods in the audience when I mentioned things pertaining to social applications (unpredictable usage, etc.).  A lot of folks ask questions about how we use <a href="http://ganglia.sf.net">ganglia</a> at Flickr.</p>
<p>A PDF of my slides are <a href="http://www.kitchensoap.com/talks/MySQLConf2007-Capacity.pdf">here</a>. If anyone can tell me how to get Keynote2 slides into an HTML format, I&#8217;d appreciate it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kitchensoap.com/2007/04/27/slides-from-capacity-planning-for-lamp-talk-at-mysql-conf-2007/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Caches and Eviction Policies</title>
		<link>http://www.kitchensoap.com/2007/02/03/caches-and-eviction-policies/</link>
		<comments>http://www.kitchensoap.com/2007/02/03/caches-and-eviction-policies/#comments</comments>
		<pubDate>Sat, 03 Feb 2007 16:18:49 +0000</pubDate>
		<dc:creator>allspaw</dc:creator>
				<category><![CDATA[Caching]]></category>

		<guid isPermaLink="false">http://www.kitchensoap.com/2007/02/03/caches-and-eviction-policies/</guid>
		<description><![CDATA[Caching systems are finite in size.  So what happens when your cache is filled with objects ?
No more objects ? Game over ?
Hopefully, no. Most modern caches have some form of replacement or eviction policy. What means that based on some criteria, it&#8217;ll figure out what objects to throw out the window so it [...]]]></description>
			<content:encoded><![CDATA[<p>Caching systems are finite in size.  So what happens when your cache is filled with objects ?</p>
<p>No more objects ? Game over ?</p>
<p>Hopefully, no. Most modern caches have some form of <em>replacement </em>or <em>eviction </em>policy. What means that based on some criteria, it&#8217;ll figure out what objects to throw out the window so it can make room for incoming objects. I would say that the replacement policy most commonly found is at least some derivative of the LRU method, or &#8220;Least-Recently-Used&#8221; policy.  <a href="http://squid-cache.org">Squid</a> can use it, <a href="http://www.danga.com/memcached">memcached</a> uses it, and most modern <a href="http://en.wikipedia.org/wiki/CPU_cache">CPU caches</a> use it.</p>
<p>There are a lot of alternative <a href="http://en.wikipedia.org/wiki/Page_replacement_algorithm">replacement algorithms</a> out there, but I would say that for most cases of forward and reverse-proxying caches, they are not all that much different, performance wise. But they can be very different, efficiency wise.<br />
One place where they <em>do</em> matter a lot is when the working set is always growing and the window of hot requests could be anywhere inside that increasing set. The cache is spending more time evicting objects, since it&#8217;s<br />
always full.</p>
<p>Damn those users and their photos! <img src='http://www.kitchensoap.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>I&#8217;ve tried the traditional types of replacement policies (at least those supported by squid) and I found some interesting things that, as usual, probably only apply to situations where you&#8217;re dealing with a constantly full cache:</p>
<p>- <strong>Greedy Dual-Size Frequency</strong>:  this is designed to hold hotter and smaller<br />
objects, and lean towards getting rid of big objects that might be very<br />
cacheable but might take up too much room.  The idea is to hold more<br />
objects, cause they&#8217;re smaller.  Which is a great idea in theory, but for<br />
Flickr, it didn&#8217;t work. Just cause you&#8217;re keeping more objects doesn&#8217;t<br />
mean that they&#8217;ll be requested. <img src='http://www.kitchensoap.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />   # of objects went up, hit ratio stayed<br />
the same, and load went up.</p>
<p>- <strong>LFDA</strong> (<font size="-1"><strong>Least Frequently</strong> <strong>Used with</strong><strong> Dynamic Aging</strong>)</font>: this one favors popularity, but it means that huge objects<br />
could just fill up the cache and take the space that could be used<br />
by smaller, (faster to serve) objects.  It didn&#8217;t work for us either.</p>
<p>- <strong>LRU</strong> <strong>(Least Recently Used)</strong>:  this was about the best we had seen in production, and we&#8217;ve stuck with it.  Although we do employ a sort of &#8220;poor man&#8217;s&#8221; GDSF:  we limit the size of objects kept in <em>memory</em> and on disk, which means that for objects of a certain size, we purposefully MISS on that object, in order to keep the cache clear of large objects that (currently) aren&#8217;t being requested all that often.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kitchensoap.com/2007/02/03/caches-and-eviction-policies/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Varnish and the state of web caching</title>
		<link>http://www.kitchensoap.com/2006/12/16/varnish-and-the-state-of-web-caching/</link>
		<comments>http://www.kitchensoap.com/2006/12/16/varnish-and-the-state-of-web-caching/#comments</comments>
		<pubDate>Sat, 16 Dec 2006 17:21:31 +0000</pubDate>
		<dc:creator>allspaw</dc:creator>
				<category><![CDATA[Caching]]></category>
		<category><![CDATA[Flickr]]></category>

		<guid isPermaLink="false">http://www.kitchensoap.com/2006/12/16/varnish-and-the-state-of-web-caching/</guid>
		<description><![CDATA[So there&#8217;s lots of excitement around Varnish, which is a caching proxy that is built to be first and foremost a reverse-proxy, as opposed to squid, which does both forward and reverse. Acceleration (reverse-proxying) is obviously important to us at Flickr, as we use squid extensively.

I&#8217;m hoping to do some testing with Varnish once it&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>So there&#8217;s lots of excitement around <a title="varnish" target="_blank" href="http://www.varnish-cache.org/">Varnish</a>, which is a caching proxy that is built to be first and foremost a reverse-proxy, as opposed to <a title="squid" target="_blank" href="http://squid-cache.org">squid</a>, which does both forward and reverse. Acceleration (reverse-proxying) is obviously important to us at <a target="_blank" href="http://flickr.com">Flickr</a>, as we use squid extensively.</p>
<p><span id="more-9"></span></p>
<p>I&#8217;m hoping to do some testing with Varnish once it&#8217;s stable and has the ability to manage a constantly full cache.  After emailing with <a target="_blank" href="http://people.freebsd.org/~phk/">Poul Henning-Kamp</a> (one of the main developers) he says that object replacement/eviction is indeed on the roadmap, so we shall see.</p>
<p>From what I can tell, Varnish sounds a <em>little </em>like the COSS filesystem that squid can use, in that it uses one big file to store objects in.  In varnish, this is mmap&#8217;d into the process and the kernel does all of the disk work. Since replacement/eviction isn&#8217;t done yet, not sure if the mechanism is &#8220;cyclical&#8221; like COSS, but however it will work, it&#8217;ll probably see some big performance increases when compared to the standard &#8216;nested directories&#8217; way that <em>aufs </em>does things in squid currently.</p>
<p>Woohoo!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kitchensoap.com/2006/12/16/varnish-and-the-state-of-web-caching/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>memory fragmentation in squid and some solutions&#8230;.</title>
		<link>http://www.kitchensoap.com/2006/12/12/memory-fragmentation-in-squid-and-some-solutions/</link>
		<comments>http://www.kitchensoap.com/2006/12/12/memory-fragmentation-in-squid-and-some-solutions/#comments</comments>
		<pubDate>Wed, 13 Dec 2006 06:16:52 +0000</pubDate>
		<dc:creator>allspaw</dc:creator>
				<category><![CDATA[Caching]]></category>

		<guid isPermaLink="false">http://www.kitchensoap.com/2006/12/12/memory-fragmentation-in-squid-and-some-solutions/</guid>
		<description><![CDATA[Taking a look here, it seems like linking squid against TCmalloc could be pretty damn beneficial.
UPDATE: done, and tested.  not in production yet, we&#8217;ll see if I can get to it soon.
]]></description>
			<content:encoded><![CDATA[<p>Taking a look <a target="_blank" href="http://wiki.wikked.net/wiki/Squid_memory_fragmentation_problem">here</a>, it seems like linking squid against <a target="_blank" href="http://goog-perftools.sourceforge.net/doc/tcmalloc.html">TCmalloc</a> could be pretty damn beneficial.</p>
<p>UPDATE: done, and tested.  not in production yet, we&#8217;ll see if I can get to it soon.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kitchensoap.com/2006/12/12/memory-fragmentation-in-squid-and-some-solutions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.513 seconds -->
