Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Raft Consesus in Distributed System

Raft Consesus in Distributed System

Avatar for Yusuf Syaifudin

Yusuf Syaifudin

May 07, 2021
Tweet

More Decks by Yusuf Syaifudin

Other Decks in Technology

Transcript

  1. What we will discuss? • What is Consensus Algorithm in

    Distributed System? • Why do we need Consensus Algorithm? • Current usage of Consensus Algorithm IRL • Introducing Raft • Demo
  2. What is Consensus Algorithm in Distributed System? A fundamental problem

    in distributed computing and multi-agent systems is to achieve overall system reliability in the presence of a number of faulty processes. - https://en.wikipedia.org/wiki/Consensus_(computer_science)
  3. Why do we need Consensus Algorithm? Consensus is in anywhere

    near us: • Have you ever done discussing about where and what you’ll eat at lunch with your friends? • Picking a time with your teammates to schedule a meeting?
  4. Why do we need Consensus Algorithm? CAP theorem CAP Theorem

    is a concept that a distributed database system can only have 2 of the 3: • Consistency – The data is same in all the server nodes(leader or follower), implying the system has nearly instantaneous sync capabilities • Availability – Every request gets a response(success/failure). It requires the system to be operational 100% of the time to serve requests, and • Partition Tolerance – The system continues to respond, even after some of the server nodes fail. This implies that the system maintains all the requests/responses function somehow.
  5. Current usage of Consensus Algorithm IRL MongoDB: in Replicaset it

    actually just one “master” and the rest of them is “follower” (similar to Raft, will discuss later). Write operation only can be done in master node, while follower only serve read operation. https://github.com/mongodb/mongo-go-driver /blob/v1.5.1/mongo/collection.go#L94-L97 https://github.com/mongodb/mongo-go-driver /blob/v1.5.1/mongo/description/server_selecto r.go#L108-L125 https://docs.mongodb.com/manual/reference/ glossary/#std-term-driver