The Backend Engineering Show with Hussein Nasser

Episode 106 - Consistency vs Eventual Consistency


Listen Later

Consistency vs Eventual Consistency
Consistency is the property of having expected result in view of the data or during reads while working with a database system. It is one of the ACID properties in relational databases. Eventual consistency is another term that was born recently specifcally as NOSQL databases got emerged. In this video we will talk discuss the difference the different kind of consistencies and we will explain what Eventual consistency and how both relational databases and NO SQL databases have this kind of consistency with some examples.
Cache
Leader Following
Consistency in Data
Your data broken into multiple normalized tables/collections is consistent.
Consistency in Reads
If you write a value new transactions will pick up that new value.
If you do not have consistency in data you do not have eventual consistency, your data will not magically correct itself. If you have do not have consistency in reads you might have eventual consistency, you reads might eventually become consistent.
Eventual Consistency means that your reads will become consistent as time pass time. This is true for both NOSQL and relational database system especially if you have leader/follower module. In this video we will talk about an example of eventual consistency and this is tolerable when it’s not.
Eventually Consistency Benefits
Twitter timeline (Eventual Consistency is good)
Let’s say you tweeted something and you have a follower in Spain and a follower on New Zealand 🇳🇿 furthest two countries on Earth. Your Spain follower might see your tweet before your New Zealand one does. This depends on which datacenter your write goes to first. That eventual consistency is tolerable and its ok if New Zealand don’t see your tweets.
Benefits
Write scales much better, you can write to different locations and have them synced.
Add more machine to scale to more and more users.
Twitter privacy example (Eventual Consistency is bad)
However take this scenario, you are Taylor Swift (Taylor swift wishes) a celebrity with 85 million followers. You tweeted something that you regretted later and decided to delete that tweet! That tweet better be deleted instantly to all your 85 million follows. Eventual consistency is not tolerable here otherwise people lose faith of the system. Well, you can always say well I’m gonna take a screenshot of Taylor Swift tweet. To which I would say I’ll give you another example, let’s say you changed your privacy setting to private and you tweeted something right after, that change should be immediately take effect and NO public user should see that tweet unless they are obviously in your followers.
Problems:
Users lose faith in the system.
Cards
4:30 ACID https://www.youtube.com/watch?v=pomxJOFVcQs
...more
View all episodesView all episodes
Download on the App Store

The Backend Engineering Show with Hussein NasserBy Hussein Nasser

  • 4.9
  • 4.9
  • 4.9
  • 4.9
  • 4.9

4.9

40 ratings


More shows like The Backend Engineering Show with Hussein Nasser

View all
Freakonomics Radio by Freakonomics Radio + Stitcher

Freakonomics Radio

32,267 Listeners

Software Engineering Radio - the podcast for professional software developers by team@se-radio.net (SE-Radio Team)

Software Engineering Radio - the podcast for professional software developers

273 Listeners

Risky Business by Patrick Gray

Risky Business

373 Listeners

Science Vs by Spotify Studios

Science Vs

12,172 Listeners

Syntax - Tasty Web Development Treats by Wes Bos & Scott Tolinski - Full Stack JavaScript Web Developers

Syntax - Tasty Web Development Treats

990 Listeners

Darknet Diaries by Jack Rhysider

Darknet Diaries

8,108 Listeners

Practical AI by Practical AI LLC

Practical AI

212 Listeners

Within Reason by Alex J O'Connor

Within Reason

1,659 Listeners

All-In with Chamath, Jason, Sacks & Friedberg by All-In Podcast, LLC

All-In with Chamath, Jason, Sacks & Friedberg

10,224 Listeners

Dwarkesh Podcast by Dwarkesh Patel

Dwarkesh Podcast

551 Listeners

Big Technology Podcast by Alex Kantrowitz

Big Technology Podcast

513 Listeners

Hard Fork by The New York Times

Hard Fork

5,546 Listeners

The AI Daily Brief: Artificial Intelligence News and Analysis by Nathaniel Whittemore

The AI Daily Brief: Artificial Intelligence News and Analysis

662 Listeners

Prof G Markets by Vox Media Podcast Network

Prof G Markets

1,471 Listeners

The Pragmatic Engineer by Gergely Orosz

The Pragmatic Engineer

74 Listeners