title: Distributed Erlang and the CAP theorem
body: <p>By the <a href="http://en.wikipedia.org/wiki/CAP_theorem" rel="nofollow">CAP theorem</a>, it is impossible for a <a href="http://www.erlang.org/doc/reference_manual/distributed.html" rel="nofollow">distributed Erlang system</a> to simultaneously provide all three of the following guarantees:</p>
  
  <ul>
  <li>Consistency (all Erlang runtimes, or nodes, see the same data at the same time)</li>
  <li>Availability (node failures do not prevent survivors from continuing to operate)</li>
  <li>Partition Tolerance (the system continues to operate despite arbitrary message loss)</li>
  </ul>
  
  <p>A distributed Erlang system can support <em>zero</em>, <em>one</em>, or <em>two</em> of the guarantees.</p>
  
  <p>Using Erlang and OTP, how can each guarantee be implemented? Most distributed Erlang applications make the practical choice for higher levels of  A and P, and settle for "eventual consistency". It seems Erlang itself was designed to support distributed (P), fault-tolerant (A), soft-real-time, non-stop applications.</p>
  
  <p><strong>The programming language (Erlang), run-time system (ERTS), and set of libraries (OTP) are designed for building distributed fault-tolerant applications; how do I do the three things that <em>define</em> distributed fault-tolerant applications?</strong></p>