Discover this podcast and so much more

Podcasts are free to enjoy without a subscription. We also offer ebooks, audiobooks, and so much more for just $11.99/month.

Episode 106 - Consistency vs Eventual Consistency

Episode 106 - Consistency vs Eventual Consistency

FromThe Backend Engineering Show with Hussein Nasser


Episode 106 - Consistency vs Eventual Consistency

FromThe Backend Engineering Show with Hussein Nasser

ratings:
Length:
15 minutes
Released:
Aug 27, 2019
Format:
Podcast episode

Description

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
Released:
Aug 27, 2019
Format:
Podcast episode

Titles in the series (100)

Welcome to the Backend Engineering Show podcast with your host Hussein Nasser. If you like software engineering you’ve come to the right place. I discuss all sorts of software engineering technologies and news with specific focus on the backend. All opinions are my own. Most of my content in the podcast is an audio version of videos I post on my youtube channel here http://www.youtube.com/c/HusseinNasser-software-engineering Buy me a coffee https://www.buymeacoffee.com/hnasr ?‍? Courses I Teach https://husseinnasser.com/courses