<?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>Recoursive &#187; sfManagedCachePlugin</title>
	<atom:link href="http://recoursive.com/blog/archives/tag/sfmanagedcacheplugin/feed" rel="self" type="application/rss+xml" />
	<link>http://recoursive.com/blog</link>
	<description>Technology, Stuff</description>
	<lastBuildDate>Mon, 28 Sep 2009 15:32:12 +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>sfManagedCachePlugin released</title>
		<link>http://recoursive.com/blog/archives/183</link>
		<comments>http://recoursive.com/blog/archives/183#comments</comments>
		<pubDate>Wed, 17 Jun 2009 13:50:10 +0000</pubDate>
		<dc:creator>rkunde</dc:creator>
				<category><![CDATA[symfony]]></category>
		<category><![CDATA[sfManagedCachePlugin]]></category>

		<guid isPermaLink="false">http://recoursive.com/blog/?p=183</guid>
		<description><![CDATA[The first alpha release is up on symfony-project.org now and can be installed through the command line as well.
]]></description>
			<content:encoded><![CDATA[<p>The first alpha release is up on <a href="http://www.symfony-project.org/">symfony-project.org</a> now and can be installed through the command line as well.</p>
]]></content:encoded>
			<wfw:commentRss>http://recoursive.com/blog/archives/183/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>sfManagedCachePlugin</title>
		<link>http://recoursive.com/blog/archives/161</link>
		<comments>http://recoursive.com/blog/archives/161#comments</comments>
		<pubDate>Tue, 19 May 2009 16:56:12 +0000</pubDate>
		<dc:creator>rkunde</dc:creator>
				<category><![CDATA[symfony]]></category>
		<category><![CDATA[cache]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[recoursive]]></category>
		<category><![CDATA[sfManagedCachePlugin]]></category>

		<guid isPermaLink="false">http://recoursive.com/blog/?p=161</guid>
		<description><![CDATA[The rough plugin for Symfony is done, albeit not published yet. Usage is very similar to the sfFunctionCache class, and it comes with the appropriate tasks to refresh/clear cached items.
Usage example:


$sfManagedCache = new sfManagedFunctionCache(
  new sfFileCache(array(
    'cache_dir' =&#62; sfConfig::get('sf_external_cache_dir').'/sfManagedCache',
    'lifetime' =&#62; 86400))
);

$xml = $sfManagedCache-&#62;call(
  array('Webserice', 'call''),
  [...]]]></description>
			<content:encoded><![CDATA[<p>The rough plugin for Symfony is done, albeit not published yet. Usage is very similar to the sfFunctionCache class, and it comes with the appropriate tasks to refresh/clear cached items.</p>
<p>Usage example:</p>
<blockquote>
<pre>
$sfManagedCache = new sfManagedFunctionCache(
  new sfFileCache(array(
    'cache_dir' =&gt; sfConfig::get('sf_external_cache_dir').'/sfManagedCache',
    'lifetime' =&gt; 86400))
);

$xml = $sfManagedCache-&gt;call(
  array('Webserice', 'call''),
  array($parameter1, $parameter2),
  1800
);
</pre>
</blockquote>
<p>The tasks are used like this and should be set up as cron jobs:</p>
<blockquote>
<pre>
./symfony managed_cache:refresh --application=webservice --env=prod
./symfony managed_cache:refresh --env=prod
</pre>
</blockquote>
<p>The first call is for a specific application while the second one is for application-agnostic cache items (not for all items!).</p>
<p>This is not a fire-and-forget plugin. It requires planning and maintenance. Since the cached items are designed to never expire, carelessness can easily lead to problems. I will cleanup the plugin some more, write documentation and then release it.</p>
]]></content:encoded>
			<wfw:commentRss>http://recoursive.com/blog/archives/161/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cachtrocities</title>
		<link>http://recoursive.com/blog/archives/156</link>
		<comments>http://recoursive.com/blog/archives/156#comments</comments>
		<pubDate>Mon, 27 Apr 2009 14:58:18 +0000</pubDate>
		<dc:creator>rkunde</dc:creator>
				<category><![CDATA[symfony]]></category>
		<category><![CDATA[cache]]></category>
		<category><![CDATA[sfManagedCachePlugin]]></category>

		<guid isPermaLink="false">http://recoursive.com/blog/?p=156</guid>
		<description><![CDATA[This week, I&#039;ve had to incorparate a vendor&#039;s webservice into the rendering of an existing website. It was going to replace the programatic generation of URLs for a list of files that used to be hosted internally. In the process I had to deal with X things:
1) The data was raw and needed to be [...]]]></description>
			<content:encoded><![CDATA[<p>This week, I&#039;ve had to incorparate a vendor&#039;s webservice into the rendering of an existing website. It was going to replace the programatic generation of URLs for a list of files that used to be hosted internally. In the process I had to deal with X things:</p>
<p>1) The data was raw and needed to be reprocessed before we could use it. That meant parsing the XML, running it through the processor and then writing it out again. Too much effort to do on every request, so again data would have to be cached.</p>
<p>2) More importantly, the webservice performance was atrocious. Request times for a 4 item rss feed hovered around 5 seconds. A completely rendered page could require several calls to this service. Whether these long request times were due to problems on our end, their end or somewhere in between was unimportant for the moment. The results would have to be cached to be useful.</p>
<p>Naturally, I could have left the caching to the application that used the webservice, ie. parse the information provided and store the results in memcache. The problem with that approach is that memcache is a very simple cache, and paired with the long request times for the webservice you&#039;re bound to run into problems. No matter how scalable your application and infrastructure is, if a reasonably common request is taking 5, 10, 15 seconds to complete, you&#039;re going to see a thread pileup sooner or later, which is what will happen when the items in memcache expire. And don&#039;t even get me started on the degraded user experience.</p>
<p>The proper solution for this is a managed cache.  One important concept is prefetch, ie. refresh the cached data before it expires, so it doesn&#039;t matter how long it takes to create it. WP-Supercache has this feature and Varnish recently introduced this feature as well along with grace. Grace is the other concept, which allows you to continue serving up stale or expired data if the data source becomes unavailable. In most cases, serving up old data is better than no data at all.</p>
<p>Symfony doesn&#039;t have any plugins or classes or other facilities to deal with these kinds of things as of right now, so I decided to just deploy Varnish for the purpose of caching the modified webservice data. No development time and very little effort to deploy and working perfectly. Unfortunately, I have to abandon that setup because of &#034;complexity concerns&#034;. So in the next couple of weeks, I&#039;ll probably write a managed cache plugin for symfony.</p>
]]></content:encoded>
			<wfw:commentRss>http://recoursive.com/blog/archives/156/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
