title: LMAX Replicator Design - How to support high availability?
body: <p>LMAX Disruptor is generally implemented using the following approach:
  <img src="https://i.stack.imgur.com/s4B3E.jpg" alt="enter image description here"></p>
  
  <p>As in this example, Replicator is responsible for replicating the input events\commands to the slave nodes. Replicating across a set of nodes requires us to apply consensus algorithms, in case we want the system to available in the presence of network failures, master failure and slave failures.</p>
  
  <p>I was thinking of applying RAFT consensus algorithm to this problem. One observation is that: "RAFT requires that the input event\commands are stored to the disk (durable storage) during replication" (Reference this link)</p>
  
  <p>This observation essentially means that we cannot perform a in-memory replication. Hence it appears that we might have to combine the functionality of replicator and journaller to be able to successfully apply RAFT algorithm to LMAX.</p>
  
  <p>There are two options to do this:</p>
  
  <p>Option 1: Using the replicated log as input event queue
  <img src="https://i.stack.imgur.com/4sD9s.jpg" alt="enter image description here"></p>
  
  <ul>
  <li>The receiver would read from the network and push the event onto the replicated log instead of the ring buffer </li>
  <li>A separate "reader" can read from the log and publish the events onto the ring buffer. </li>
  <li>The log can be replicated across nodes using RAFT. We do not need the replicator and journaller as the functionality is already accomplished by RAFT's replicated log</li>
  </ul>
  
  <p>I think a disadvantage of this option has got to do with fact that we do an additional data copy step (receiver to event queue instead of the ring buffer).</p>
  
  <p>Option 2: Use Replicator to push input events\commands to slave's input log file
  <img src="https://i.stack.imgur.com/WM8Vx.jpg" alt="enter image description here"></p>
  
  <p><em>I was wondering if there is any other solution to design of Replicator? What are the different design options that people have employed for replicators? Particularly any design that can support in-memory replication?</em></p>