-
Notifications
You must be signed in to change notification settings - Fork 329
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Raft Distributed Consensus Protocol #1
Comments
Added the "Overview" frame. Still need to add navigation so users can skip ahead. |
@vanstee Here's the Github Issue for Raft. I'll post to this ticket as I update the visualization so feel free to add yourself as a watcher. Otherwise I'll ping you when I get it done. I added an "Overview" section that starts right after the "What is Distributed Consensus" section I sent you earlier. |
Looks really great! But, I want arrow keys! |
Looks awesome. A few bits that'd be great to add:
|
@ongardie Thanks, Diego. I added those items to the description. I'll go through the paper again and flesh out some more details for each section as well. |
👍 |
@ongardie I got the start of an actual simulation going in the Leader Election frame: |
Nice, that's slick :) |
Lots of refactoring to the underlying code and to the playback.js library. Here's the "Leader Election" section: http://thesecretlivesofdata.com/raft/#election It's more simulation-like now but I think I still need to make the Split Vote section clearer. Comment welcome. :) |
I found a bug (I think) in the slides. When the follower animation finishes it automatically continues with the candidate animation, but without moving the text to say "candidate". This confused me a bit when I skipped to the next slide. |
Really cool, @benbjohnson. The leader election section is definitely shaping up now. One last thing to mention would be that a server updates its term when it hears a message with a newer term. The animations show it, but it's worth pointing out. Another thing I'm wondering about is the use of a 4-node cluster to show a split vote. The problem is that we don't expect people to ever run 4-node clusters (since their availability is no better than 3-node clusters), and the definition of majority is less obvious in 4-node clusters (we mean 3 servers but noobs may assume only 2). In general, you need either 3 servers to time out simultaneously for a split vote, or 2 servers and 1 crash or network anomaly. I agree that showing an example with a 3-node cluster is a bit confusing because there's just not enough servers around to show the pattern, but I don't think switching to a 4-node cluster is best. How about switching to either a 5-node cluster with 3 candidates, or a 5-node cluster with 2 candidates and 1 crash (this would be identical to the current scenario except with an extra grayed out node)? It may also be illustrative to show how you can't get a split vote with only 2 candidates if everything is going well (one will necessarily get a majority). |
@stig I think I fixed what you're talking about. Can you check it out and tell me if it's correct now? @ongardie I pushed out an initial cut without the 5-node split vote configuration. I mostly wanted to get a first version out. I'll come back and fix it after the next round of feedback from people. The first draft of the visualization is released: https://twitter.com/secretlivesdata/status/420600602498838529 |
NOTE: I closed the issue for this release but feel free to continue to add additional comments. |
Does the raft protocol outline how clients are meant to find and then interact with leaders? For example, if a client is sending messages to a node that was leader, but becomes a follower after an election, the client needs to know where to send future messages. |
This is really awesome! I've sent this around to the rest of my team. I don't know how you're scoping this particular visualization, but I would have enjoyed more of a discussion on why distributed consensus algorithms are difficult. In the awesome future where everyone just accepts that Raft is the way and the light, that might not be needed, but in the mean time I think there's potentially value to explaining why you should use Raft instead of developing your own (undoubtedly wrong) consensus algorithm. |
@seguer Each node has the current leader that it knows about. If a client sends a request to a follower then it will be denied and it will be notified what the current leader is. I was debating whether to include this point in the visualization because I don't want to overload people with information but I've heard that question from a few people so I'll add it in. @ebroder Thanks! The scope for the visualization was fuzzy. I was mostly trying to explore what a semi-interactive visualization of a distributed system would look like so I went with what I knew best (Raft). One of the hardest parts has been trying to figure out what to put in and what to keep out. Too much information and it's confusing but too little and people don't get a full understanding. I think the understanding behind why distributed consensus is difficult is a more general problem. I'd like to visualize some other consensus algorithms (Paxos, ZAB) so I may leave these bigger questions as a separate visualization entirely. |
One of the cleanest presentation on distributed consensus I've seen so far! I have 2 questions however:
I'de like to contribute on the Paxos visualization since I know quite well the algorithm, and I'm working also on a ZAB explanation. How can I help? |
@TheWinch To answer your questions:
Node B is the leader before the split happens so it stays the leader. However, it can't communicate to a quorum so it's ineffective and can't commit any log entries. You can also implement Raft so that the leader times out if it doesn't hear from a quorum for an election timeout.
You're right. That could have been clearer. When it receives an AppendEntries request from the new leader or when it tries to send an AppendEntries request and receives a response from any node in the new election term it will know about the new term and step down. I had a lot of fun building the Raft implementation but it was really time consuming. I'm swamped right now so I don't have the bandwidth to do any additional implementations right now. I'll let you know if I start another one in the future. |
Sorry if another person asked this before. I'm reading this while working, so I don't have the time to get into it as deep as I like. The question is this: What happens if I have an equal split between 8 nodes? Inside their subnet they could get a majority (Is that enough?). But neither can achieve a global majority (Do they even know how many nodes they are globally? I haven't seen a request that collects all the nodes). What happens now when two clients send different requests to the two leaders? |
Every node knows what nodes exist in the cluster. The 4-4 split would mean that neither group could achieve cluster majority so no leader could be elected and the cluster would be unavailable.
Write requests to the old leader would not be able to replicate to a majority so they would hang until the leader steps down and then an error would be returned. The new leader would be able to complete the write request since it can connect to a majority. If you want consistent reads, you'll need to send your read through the leader. That's a fairly nuanced topic. There's details in the Raft paper and @aphyr did a great write up of all this on his blog: |
Excellent ! It makes things very clear. The way you have covered essential scenarios is amazing. Thanks ! |
Some feedback:
|
What a wonderful job! It make the algorithms clear to understand, do we have other algorithms to show? I want join in. :) |
It'd be nice to be able to step back. Great visualization overall! |
wonderful job! It's woud be better to show paxos algorithm in this method 👍 |
Great animation! As others have mentioned, it would be nice to have navigation. Esp in the Leader Election section, some of the slides went by too fast and I would have liked to go back and review it. |
So impressed animation, very great , could I download it from somewhere? |
Thanks, for your great work: I love it! Maybe add deep linking by changing the hash in the URL between lessons/chapters. This would make it easier to continue reading after the browser had to reload the page and it would ease citation in blog posts. |
That is fantastic work! |
Great |
need backward button,thanks!! |
so great work, it will be perfect if leader election and log replication chapters have backward button. Why on the next heartbeat ? If the clients change the system, we have to wait for the next heartbeat to finish the change? How to make sure the high system perform? |
The back button isn't available throughout the entire tutorial (it disappears when we get to the section on Leader Election). Additionally, I would appreciate a bit more explanation as to how nodes keep track of the current election term. |
Great work! Thanks! |
Just wanted to say you are a hero! Kudos to you for this AMAZING visualisation :) Really waiting for the next ones |
Great Visualization! Kudos for the team for spreading knowledge. BTW which tool is used for presentation? I am also looking for similar tool. Thanks in advance |
Thank you. |
Thank you for the very helpful explanation, I thought I'd let you know that the link to the raft paper in the conclusion is broken, but the paper is available at https://raft.github.io/raft.pdf |
this is awesome! thank you for your work |
@monotypical Thanks for letting me know. The link's been updated. 👍 |
Congratullations, excellent initiative. I suggest to out a menu on left side, because I want to view again some views and it was impossible, just restart process (mayce back button can work, but I can not use it) It is the best resourse I see to undertabd raft. Thank you very much |
@benbjohnson great work 👏 |
@benbjohnson great work bro, you made it easy for us. But may be you forgot to add the "go back to previous page" feature on the pages of chapter "Leader Election" and after. |
Great work. Extremely easy to understand. |
Great work |
Awesome👍 easy to understand, open to share, thank you! |
After reading raft lecture, its so confusal. But this annimation show really does great help for me to comprehend the whole flow of Raft! Brilliant! |
World class how you break down a rather complex algorithm into well explained (and well understandable) smaller steps. Really enjoy this documentation/tutorial, great teaching. Like @ongardie I wonder how does the client know who is the leader? Does it just communicate to any node and the node then replies who the current leader is and then the client resends its request to the leader? |
In a scenario where A is the leader and B and C followers and a client now sends a message to A, say "x = 8" and the following happens: A adds uncommited "x = 8" and notifies B and C |
Recent days I'm preparing for exam, so sorry that I haven't enough time to contemplate such questions. I'll reflect on it after my exam. Thanks!
…---Original---
From: "Christoph ***@***.***>
Date: Sat, Dec 17, 2022 21:27 PM
To: ***@***.***>;
Cc: ***@***.******@***.***>;
Subject: Re: [benbjohnson/thesecretlivesofdata] Raft Distributed ConsensusProtocol (#1)
In a scenario where A is the leader and B and C followers and a client now sends a message to A, say "x = 8" and the following happens:
A adds uncommited "x = 8" and notifies B and C
B + C add uncommited "x = 8" and notify A that they got the instruction/message/transaction
A commits "x = 8" and notifies B and C but right then a network split occurs and A cannot reach B and C anymore
does A then roll back "x = 8" to uncommited?
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you commented.Message ID: ***@***.***>
|
Greate demonstration, adding an option to go to specific step would be great. |
Back button to previous step please! |
Nice work. And I like that sugggestion re: having a Back button, and please arrange for that Back button as well as the Continue button to have one static, predictable location (like top-right corner) rather than having them appear at different locations on the rendered page that depend on other page characteristics/variables. Thx! |
Just went through https://thesecretlivesofdata.com/raft/. Thanks for creating this, gives very clear understanding regarding the RAFT protocol covering various scenarios for leader election and WAL replication 💯 |
Raft explanation was excellent. Thanks ! Looking forward for new concepts to be implemented with |
Overview
The Raft distributed consensus protocol allows a collection of processes to maintain consistency even in the face of multiple node failure. The two main tenants of the protocol are leader election and log replication.
This visualization will lay out the problem of distributed consensus followed by a general overview of leader election and log replication. It will then follow up with details of Leader Election using best case (Single Candidate) and worst case (Split Vote) scenarios. Then it will show details of Log Replication using the best case (Network OK) and worst case (Network Partitions) scenarios. Finally, it will conclude with additional resources on where to learn more.
URL
http://thesecretlivesofdata.com/raft/
Frames
The text was updated successfully, but these errors were encountered: