How to use Dezyne in implementing the Consensus Algorithm

Consensus is a fundamental problem in distributed computing and multi-agent systems. It is used to achieve agreement on a single data value among distributed processes or systems. The objective of consensus algorithm is to achieve overall system reliability in the presence of a number of faulty processes. Consensus algorithm allows a collection of machines to work as a coherent group that can survive the failures of some of its members. Coming to agreement, or consensus, is easy with one server. But how do we come to consensus if we have multiple servers?

A proven consensus algorithm

Raft is one of the algorithms to solve this distributed consensus problem. It is a proven and reasonably understandable consensus algorithm, used in modern cloud server clusters. Raft is an implementation of the state machine replication concept.

Related: See here all Dezyne examples

Eric Dortmans, who got inspired by the paper In Search of an Understandable Consensus Algorithm (Extended Version) by Diego Ongaro and John Ousterhout, came up with an idea to use Dezyne in implementing the consensus algorithm for his Dezyne Challenge 2018 project.

dezyne model of the raft consensus algorithm

Related: Why Model Driven Software Engineering is the Future of Software Development

Verification, Validation & Model Stimulation

Eric has applied both Verification and Validation on his project. Verification of the model, in particular the ConsensusModule and its interfaces, was perfomed via the Dezyne Model Verification facility in the Dezyne IDE. Eric has also used the Dezyne Model Simulation service to validate the states and state transitions as described in the Raft protocol. Typical scenarios can be executed in the Dezyne IDE by starting Dezyne Model Simulation on the ConsensusModule and pressing the events buttons.

Would you like to browse through project and see the full example? Learn more here.

Feel like playing around?

Although Eric has implemented this algorithm in Dezyne,  it still needs to be completed with some non-Dezyne code and shown in an example case. Do you feel like playing around with Dezyne yourself? Are you interested to build a fully working Raft consensus algorithm demonstrator? Find more information about our Student Assignments here.

New Call-to-action

Related Articles

Enjoy this article? Don't forget to share.