<story><title>How to beat the CAP theorem</title><url>http://nathanmarz.com/blog/how-to-beat-the-cap-theorem.html</url></story><parent_chain></parent_chain><comment><author>mononcqc</author><text>This doesn&apos;t beat the CAP theorem. The approach can be quickly described as a log-based append-only database with read-repair code based on last-write-wins.&lt;p&gt;The system will have inconsistent views for the whole time a netsplit lasts. If I have two nodes, A and B, and that they both hold a piece of data related to a meeting M0 at 11 on Monday, then a netsplit happens, the strategy suggested won&apos;t help with the following case:&lt;p&gt;Jim and Peter have access to node A, and Mary and Julie have access to the node B. Because there is a netsplit between A and B, communication is impossible there. However, Jim and Peter agree to move the meeting M0 to 3PM on Monday, and we call it {A,M1}. Mary and Julie, however, agree to move the meeting to 1PM on Tuesday. We call it {B,M1}. Now, the M1 record on A and B is no longer the same. If the netsplit isn&apos;t resolved before Monday, then inconsistent data will have caused the loss of our team meeting!&lt;p&gt;When the netsplit is resolved and we consult the meeting, the approach of the blog post will pick either B&apos;s version of M1 or A&apos;s version of M1 based on the map-reduce we&apos;ve had. To the reader, we&apos;ll have discarded either of them. This is why the last write wins -- it&apos;s the latest state in the log of events, the other one is ignored.&lt;p&gt;Last-write-wins is a default mode to be used on read-repair, and nothing solving the problem of losing consistency. During the netsplit, views of the data remain inconsistent.&lt;p&gt;The way to keep them consistent would have been to have A and B blocking writes. As such, we would have kept Jim, Peter, Julie and Mary from writing new meeting times and made sure that they all had the same hour presented.&lt;p&gt;An easy way to test whether you beat the CAP theorem or not is to imagine your system functional during a week-long netsplit. Either it keeps on working with inconsistent data, or it has a way to keep it consistent. The CAP theorem tells us it&apos;s impossible to do both at once, and the blog post didn&apos;t disprove that, but merely provided a way to resolve conflicts in data in an automatic way.&lt;p&gt;I would expect someone to &apos;beat&apos; the CAP theorem as much as I would expect someone to &apos;beat&apos; the Pythagorean theorem. The blog is interesting in its own approach to make the CAP theorem simpler to handle, but misses its own point of beating it.</text></comment>
<story><title>How to beat the CAP theorem</title><url>http://nathanmarz.com/blog/how-to-beat-the-cap-theorem.html</url></story><parent_chain></parent_chain><comment><author>rxin</author><text>Good write up, Nathan. Nonetheless, you started by saying you were going to challenge the basic assumptions of how data systems should be built, but the resulting system architecture is in fact very similar to a lot of data streaming systems that the academia and industry have proposed and built for a number of years. An example of such system is Google&apos;s Percolator [1].&lt;p&gt;In essence, you separate the system into two parts, a read-only part and a real-time part. CAP explains fundamental trade-offs in OLTP type of queries, whereas this system design is catered towards streaming, analytical queries. These are two very different contexts.&lt;p&gt;[1] &lt;a href=&quot;http://research.google.com/pubs/pub36726.html&quot; rel=&quot;nofollow&quot;&gt;http://research.google.com/pubs/pub36726.html&lt;/a&gt;</text></comment>