Skip to content
Tech News
← Back to articles

The Raft Consensus Algorithm Explained Through "Mean Girls"

read original get Raft Consensus Algorithm T-Shirt → more articles
Why This Matters

This article simplifies the complex Raft consensus algorithm by using the relatable analogy of high school cliques from 'Mean Girls,' making it easier for tech professionals and consumers to understand how data replication and fault tolerance work in distributed systems. Grasping Raft's principles is crucial for developing reliable, consistent, and resilient infrastructure in today's increasingly interconnected digital landscape.

Key Takeaways

Raise your hand if you’ve ever been personally victimized by the Raft Consensus Algorithm.

Understanding Raft can be tough. In fact, I’ve seen conversations recently on social media in which actual technical leaders of infrastructure companies demonstrate a lack of understanding (!). Point being, you’re not alone. Get in, losers, we’re going back to (Hollywood) high school.

So, like, what is Raft?

Raft is a consensus algorithm used in distributed systems to ensure that data is replicated safely and consistently. That sentence alone can be confusing. Hopefully the analogy in this post can help people understand how it works. In honor of national Mean Girls day (“on October 3rd he asked me what day it was”), I present the Raft Consensus Algorithm as explained through the movie Mean Girls. (For a great, more technical overview of Raft, we recommend The Secret Lives of Data).

Raft consensus can be explained using cliques in high school, and nothing does it better than Mean Girls. In the beginning of the movie, Cady is a “home-schooled jungle freak” and thus is not a member of a clique. She is a lone piece of data with no replicas. If she were to be hit by a big yellow school bus, her thoughts on army pants and flip flops would die with her and would never trend.

The Plastics however, are part of a cluster. If Regina is hit by a school bus, the information she had wouldn’t die with her, since she had already shared it with Karen and Gretchen. If someone were looking for the Burn Book, they could find it by asking one of the remaining two members, even while Regina was recovering in the hospital. If she hadn’t replicated that knowledge, nobody would ever be able to locate the book.

Every cluster of replicas needs to have a Raft leader, or a Queen Bee. Of course, this would be Regina George. Regina is the leader of the Plastics, a group comprised of Gretchen Wieners (her father invented Toaster Strudel and her hair is full of secrets) and Karen Smith (she’s not the brightest bulb and she has weather forecasting superpowers). Gretchen and Karen are the follower replicas.

This dynamic is similar to Raft in that if there isn’t consensus among replicas, no action can be taken. I mean, you wouldn’t buy a skirt without asking your friends if it looks good on you first, right? Exactly! That’s why you need consensus, or the majority vote. If Regina is shopping and wants to buy a skirt, she can’t do so unless either Gretchen or Karen has signed off on the purchase.

Let’s say Regina tells Gretchen and Karen that on Wednesdays they wear pink. Gretchen eagerly approves first. Now that Regina has Gretchen’s confirmation, the majority of the Plastics (⅔) are in favor of wearing pink on Wednesdays, and consensus has been reached. Now it’s official.

Understanding Quorum in Raft

... continue reading