<?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: Active Cache for MySQL</title>
	<atom:link href="http://www.mysqlperformanceblog.com/2010/01/10/active-cache-for-mysql/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mysqlperformanceblog.com/2010/01/10/active-cache-for-mysql/</link>
	<description>Percona&#039;s MySQL &#38; InnoDB performance and scalability blog</description>
	<lastBuildDate>Sat, 11 Feb 2012 16:45:54 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Daniel</title>
		<link>http://www.mysqlperformanceblog.com/2010/01/10/active-cache-for-mysql/comment-page-1/#comment-710184</link>
		<dc:creator>Daniel</dc:creator>
		<pubDate>Fri, 15 Jan 2010 19:06:38 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/?p=2005#comment-710184</guid>
		<description>I think you are running into the same problem that I&#039;ve been wondering about.

I like mysql/RDBMS because if the transaction handling, indexing capability, and &quot;information density&quot;, which is a 4 byte integer takes up 4 bytes, and is not converted to its string representation. 

On the other hand, I like memcache, redis, tokyotyrant, and other such key/value stores, because of the performance and distribution (the document storage format)

I think some of the core of the problem you are talking about depends on how you look at the data in the database.

If you look at the database as an &quot;interesting&quot; form of data storage, then the objects (or tables...) are probably already in the format you are talking about.

If you look at the database as a sets of data (foreign keys, 3rd/boyce codd normal form, etc..), then your idea looks like it might make a good model front end, especially if you can solve the replication delay issue.</description>
		<content:encoded><![CDATA[<p>I think you are running into the same problem that I&#8217;ve been wondering about.</p>
<p>I like mysql/RDBMS because if the transaction handling, indexing capability, and &#8220;information density&#8221;, which is a 4 byte integer takes up 4 bytes, and is not converted to its string representation. </p>
<p>On the other hand, I like memcache, redis, tokyotyrant, and other such key/value stores, because of the performance and distribution (the document storage format)</p>
<p>I think some of the core of the problem you are talking about depends on how you look at the data in the database.</p>
<p>If you look at the database as an &#8220;interesting&#8221; form of data storage, then the objects (or tables&#8230;) are probably already in the format you are talking about.</p>
<p>If you look at the database as a sets of data (foreign keys, 3rd/boyce codd normal form, etc..), then your idea looks like it might make a good model front end, especially if you can solve the replication delay issue.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eric Bergen</title>
		<link>http://www.mysqlperformanceblog.com/2010/01/10/active-cache-for-mysql/comment-page-1/#comment-708921</link>
		<dc:creator>Eric Bergen</dc:creator>
		<pubDate>Wed, 13 Jan 2010 02:47:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/?p=2005#comment-708921</guid>
		<description>I did some work on a query cache patch that could specify a ttl for specific queries instead of flushing the cache when the table was updated. After experimenting with it for a while it became obvious that memcache and caching the results outside of mysql was the way to go.</description>
		<content:encoded><![CDATA[<p>I did some work on a query cache patch that could specify a ttl for specific queries instead of flushing the cache when the table was updated. After experimenting with it for a while it became obvious that memcache and caching the results outside of mysql was the way to go.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: alex</title>
		<link>http://www.mysqlperformanceblog.com/2010/01/10/active-cache-for-mysql/comment-page-1/#comment-708893</link>
		<dc:creator>alex</dc:creator>
		<pubDate>Wed, 13 Jan 2010 00:34:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/?p=2005#comment-708893</guid>
		<description>i&#039;m looking for exactly this! :)

i&#039;m wondering, why there&#039;s no extended mysql-query-cache, which allows you to use cached results, even the table was alreasy updated. i think that would be much faster than to realize this via php and memcached.</description>
		<content:encoded><![CDATA[<p>i&#8217;m looking for exactly this! <img src='http://www.mysqlperformanceblog.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>i&#8217;m wondering, why there&#8217;s no extended mysql-query-cache, which allows you to use cached results, even the table was alreasy updated. i think that would be much faster than to realize this via php and memcached.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: peter</title>
		<link>http://www.mysqlperformanceblog.com/2010/01/10/active-cache-for-mysql/comment-page-1/#comment-708892</link>
		<dc:creator>peter</dc:creator>
		<pubDate>Wed, 13 Jan 2010 00:32:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/?p=2005#comment-708892</guid>
		<description>Eric,

I think Active cache is kind of merged API and Cache layer, so the point is your application should be only calling that code.   I liked the Gearman concept here as it allows to glue multiple applications together - think for some objects constructed by Java code while others by Perl :)</description>
		<content:encoded><![CDATA[<p>Eric,</p>
<p>I think Active cache is kind of merged API and Cache layer, so the point is your application should be only calling that code.   I liked the Gearman concept here as it allows to glue multiple applications together &#8211; think for some objects constructed by Java code while others by Perl <img src='http://www.mysqlperformanceblog.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter van Dijk</title>
		<link>http://www.mysqlperformanceblog.com/2010/01/10/active-cache-for-mysql/comment-page-1/#comment-708886</link>
		<dc:creator>Peter van Dijk</dc:creator>
		<pubDate>Wed, 13 Jan 2010 00:06:55 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/?p=2005#comment-708886</guid>
		<description>Eric - Even though it&#039;d be heaps of fun to handling object creation at the cache layer, like you said, i&#039;m sure it&#039;d be an absolute nightmare to implement and maintain. By implementing it at the application layer, we do have a race condition which would result in the cache can become inconsistent, however we&#039;ve always mitigated the effect of this by mandating that the objects in question can only be saved if loaded directly from the database rather than the cache. Not a solution for everyone i&#039;m sure, but it works great for us.

Back to the original topic, I think that being able to specify what gets cached, and how it&#039;s cached, is fairly important - there&#039;s no way that mysql (or by extension any cache) can automatically understand what the application is trying to do. This is (sort of) the fundamental reason why things like memcached exist, and also the reason why the query caches in MySql dont work particularly well. (dont shoot me for that last comment, i&#039;m sure they work just fine for some people)

If you could push some caching logic down closer to the data, then it might be useful in a number of circumstances, but at the end of the day you still need to be able to control what goes into your cache and what doesnt - which is really only something that you&#039;d want the application to handle unless you&#039;re supremely confident in your ability to write caching software at the database level.

The hard part is finding a balance between the two - retaining application control, and proximity to the data.
- Memcached sits on the application side of the fence.
- MySql has it&#039;s own caches which sit completely on the other side.
- The &#039;Active Cache&#039; would sit somewhere between the two - the question is where and how.</description>
		<content:encoded><![CDATA[<p>Eric &#8211; Even though it&#8217;d be heaps of fun to handling object creation at the cache layer, like you said, i&#8217;m sure it&#8217;d be an absolute nightmare to implement and maintain. By implementing it at the application layer, we do have a race condition which would result in the cache can become inconsistent, however we&#8217;ve always mitigated the effect of this by mandating that the objects in question can only be saved if loaded directly from the database rather than the cache. Not a solution for everyone i&#8217;m sure, but it works great for us.</p>
<p>Back to the original topic, I think that being able to specify what gets cached, and how it&#8217;s cached, is fairly important &#8211; there&#8217;s no way that mysql (or by extension any cache) can automatically understand what the application is trying to do. This is (sort of) the fundamental reason why things like memcached exist, and also the reason why the query caches in MySql dont work particularly well. (dont shoot me for that last comment, i&#8217;m sure they work just fine for some people)</p>
<p>If you could push some caching logic down closer to the data, then it might be useful in a number of circumstances, but at the end of the day you still need to be able to control what goes into your cache and what doesnt &#8211; which is really only something that you&#8217;d want the application to handle unless you&#8217;re supremely confident in your ability to write caching software at the database level.</p>
<p>The hard part is finding a balance between the two &#8211; retaining application control, and proximity to the data.<br />
- Memcached sits on the application side of the fence.<br />
- MySql has it&#8217;s own caches which sit completely on the other side.<br />
- The &#8216;Active Cache&#8217; would sit somewhere between the two &#8211; the question is where and how.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eric Bergen</title>
		<link>http://www.mysqlperformanceblog.com/2010/01/10/active-cache-for-mysql/comment-page-1/#comment-708790</link>
		<dc:creator>Eric Bergen</dc:creator>
		<pubDate>Tue, 12 Jan 2010 18:29:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/?p=2005#comment-708790</guid>
		<description>The problem with moving the object creation logic into the cache layer is you end up maintaining two separate codebases, one for the application and the other in the active cache. I don&#039;t think it buys you much other than eliminating some race conditions. Two separate codebases probably won&#039;t be a big deal if you maintain a one to one mapping between memcache key and database row but if memcache is stored whole objects which are normalized in the database the logic in the caching layer can be quite complex trying to translate between the two for a write through cache.</description>
		<content:encoded><![CDATA[<p>The problem with moving the object creation logic into the cache layer is you end up maintaining two separate codebases, one for the application and the other in the active cache. I don&#8217;t think it buys you much other than eliminating some race conditions. Two separate codebases probably won&#8217;t be a big deal if you maintain a one to one mapping between memcache key and database row but if memcache is stored whole objects which are normalized in the database the logic in the caching layer can be quite complex trying to translate between the two for a write through cache.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Darius Jahandarie</title>
		<link>http://www.mysqlperformanceblog.com/2010/01/10/active-cache-for-mysql/comment-page-1/#comment-708458</link>
		<dc:creator>Darius Jahandarie</dc:creator>
		<pubDate>Tue, 12 Jan 2010 03:18:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/?p=2005#comment-708458</guid>
		<description>Regarding Patrick&#039;s comment, I think it is important to realize what memcached has actually brought to the table. Memcached is merely a utility for a distributed key-value in-memory store.

One could argue that memcached is &quot;replacing&quot; the data-tier of your architecture, but in reality it is only evolving it to handle certain cases differently (e.x., hot data -&gt; memcached, cold data -&gt; MySQL).


Going on to what Peter is saying here, I believe it is a middle-ware abstraction of a lot of redundant communications that could happen between the logic-tier and data-tier of your architecture.

If created properly, the logic would still happen in the logic-tier, and the data would still be handled in the data-tier, it is just that the data-tier would be aware of what type of data it is handling and therefore be able to store and return it efficiently.

Naturally, any idea taken to any extreme may result in problems, but I believe what Peter is suggesting could have some serious chances if the core idea is realized to its fullest.

Darius</description>
		<content:encoded><![CDATA[<p>Regarding Patrick&#8217;s comment, I think it is important to realize what memcached has actually brought to the table. Memcached is merely a utility for a distributed key-value in-memory store.</p>
<p>One could argue that memcached is &#8220;replacing&#8221; the data-tier of your architecture, but in reality it is only evolving it to handle certain cases differently (e.x., hot data -&gt; memcached, cold data -&gt; MySQL).</p>
<p>Going on to what Peter is saying here, I believe it is a middle-ware abstraction of a lot of redundant communications that could happen between the logic-tier and data-tier of your architecture.</p>
<p>If created properly, the logic would still happen in the logic-tier, and the data would still be handled in the data-tier, it is just that the data-tier would be aware of what type of data it is handling and therefore be able to store and return it efficiently.</p>
<p>Naturally, any idea taken to any extreme may result in problems, but I believe what Peter is suggesting could have some serious chances if the core idea is realized to its fullest.</p>
<p>Darius</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: http://krow.livejournal.com/</title>
		<link>http://www.mysqlperformanceblog.com/2010/01/10/active-cache-for-mysql/comment-page-1/#comment-708279</link>
		<dc:creator>http://krow.livejournal.com/</dc:creator>
		<pubDate>Mon, 11 Jan 2010 17:58:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/?p=2005#comment-708279</guid>
		<description>Hi!

You are describing what a number of people have been looking at creating :)

Not a crazy idea at all, the problem is picking the correct interface (aka... how will someone use this).

Cheers,
  -Brian</description>
		<content:encoded><![CDATA[<p>Hi!</p>
<p>You are describing what a number of people have been looking at creating <img src='http://www.mysqlperformanceblog.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Not a crazy idea at all, the problem is picking the correct interface (aka&#8230; how will someone use this).</p>
<p>Cheers,<br />
  -Brian</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: peter</title>
		<link>http://www.mysqlperformanceblog.com/2010/01/10/active-cache-for-mysql/comment-page-1/#comment-708037</link>
		<dc:creator>peter</dc:creator>
		<pubDate>Mon, 11 Jan 2010 05:19:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/?p=2005#comment-708037</guid>
		<description>Patrick, 

History tend to repeat itself with slight variations. Modern shift to Web Based technologies is conceptually very similar to use of terminals to mainframe in 60s-70s.  NoSQL existed in form of non relational databases, there are many such examples.

In general a lot of things done for years in J2EE are coming to LAMP in modified form, tuned for a lot more adhoc form.

Designing three tier application is one thing, evolving simply PHP (for example) application by adding memcache, gearman or any other components to take care of important issues in a simple way is completely different.</description>
		<content:encoded><![CDATA[<p>Patrick, </p>
<p>History tend to repeat itself with slight variations. Modern shift to Web Based technologies is conceptually very similar to use of terminals to mainframe in 60s-70s.  NoSQL existed in form of non relational databases, there are many such examples.</p>
<p>In general a lot of things done for years in J2EE are coming to LAMP in modified form, tuned for a lot more adhoc form.</p>
<p>Designing three tier application is one thing, evolving simply PHP (for example) application by adding memcache, gearman or any other components to take care of important issues in a simple way is completely different.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter van Dijk</title>
		<link>http://www.mysqlperformanceblog.com/2010/01/10/active-cache-for-mysql/comment-page-1/#comment-707983</link>
		<dc:creator>Peter van Dijk</dc:creator>
		<pubDate>Mon, 11 Jan 2010 01:12:30 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/?p=2005#comment-707983</guid>
		<description>Just a thought, but having a more active cache infrastructure would definitely be helpful if you wanted to, for example:
- SELECT * FROM table WHERE x; // put the result set into the cache per row
- SELECT specific_field FROM table WHERE x; // could then automagically pull the specific field from the data cached by the previous query

It&#039;s probably not for everyone, but it was just a random idea of the sort of things that might be possible for a system that&#039;s &quot;loosely aware&quot; of the underlying data structures being used.

I think in a general sense, i still prefer to go for the &quot;other approach&quot; of storing cooked data in memcached if possible, rather than raw query data. It doesnt really make sense in all circumstances though.
In one specific case, in our system there is a specific object which is frequently used and takes 5 queries to load. Despite we could cache the 5 queries individually, we&#039;d rather just cache the object as it&#039;s capable of invalidating itself from the cache, because it saves us a lot of overhead.



Have you considered that your active cache suggestion could potentially be implemented by somehow extending the mysql client infrastructure? 
ie. mysql_query(&quot;SELECT * FROM X&quot;, ....., cache=true);
That way you could provide seamless integration for those people that want a simple but highly effective caching solution.</description>
		<content:encoded><![CDATA[<p>Just a thought, but having a more active cache infrastructure would definitely be helpful if you wanted to, for example:<br />
- SELECT * FROM table WHERE x; // put the result set into the cache per row<br />
- SELECT specific_field FROM table WHERE x; // could then automagically pull the specific field from the data cached by the previous query</p>
<p>It&#8217;s probably not for everyone, but it was just a random idea of the sort of things that might be possible for a system that&#8217;s &#8220;loosely aware&#8221; of the underlying data structures being used.</p>
<p>I think in a general sense, i still prefer to go for the &#8220;other approach&#8221; of storing cooked data in memcached if possible, rather than raw query data. It doesnt really make sense in all circumstances though.<br />
In one specific case, in our system there is a specific object which is frequently used and takes 5 queries to load. Despite we could cache the 5 queries individually, we&#8217;d rather just cache the object as it&#8217;s capable of invalidating itself from the cache, because it saves us a lot of overhead.</p>
<p>Have you considered that your active cache suggestion could potentially be implemented by somehow extending the mysql client infrastructure?<br />
ie. mysql_query(&#8220;SELECT * FROM X&#8221;, &#8230;.., cache=true);<br />
That way you could provide seamless integration for those people that want a simple but highly effective caching solution.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

