1. Imagine you are implementing the consistency model for a site such as Faceboo
ID: 3911180 • Letter: 1
Question
1. Imagine you are implementing the consistency model for a site such as Facebook.
a. It’s important from a user’s point of view that any actions they do on their account (for example, changing their password) are implemented in the order that they happen. What consistency model do we need to ensure that happens, and why?
b. For things like status updates, we can usually get away with a weaker definition of consistency- if you and a friend both post a status update, it’s not that important which one shows up in your status feed first. What is important is that if person A does a status update, and person B replies to it, that A’s update appears before B’s reply. What consistency model do we need to ensure that happens, and why?
Explanation / Answer
Qa) It’s important from a user’s point of view that any actions they do on their account (for example, changing their password) are implemented in the order that they happen. What consistency model do we need to ensure that happens, and why?
ANS - Sequential Consistency - Because we need to maintain and track the order in which DBMS Transactions are occurring. Eg:- User changes a password, then updates mobile no and then logs in. So the Sequence of Tasks/Transactions done by the user will be:-
Here the sequence of operations is very important and it should not be that without changing the password, the user logged in , and is able to view the updated mobile no. This will only happen when he resets the password, updates mobile no and then when he logs in he can see the reflected changes done.
Qb) For things like status updates, we can usually get away with a weaker definition of consistency- if you and a friend both post a status update, it’s not that important which one shows up in your status feed first. What is important is that if person A does a status update, and person B replies to it, that A’s update appears before B’s reply. What consistency model do we need to ensure that happens, and why?
ANS - Causal Consistency - This model relaxes Sequential consistency on concurrent writes by a processor and on writes that are not causally related. Two writes can become causally related if one write to a variable is dependent on a previous write to any variable if the processor doing the second write has just read the first write
So here in our case we will first have the Status Update done by A (that will be some text data that will be stored in FB Database) which is write data, and then Person B will reply/like/vote that post that A just made which is again write data. So, second write is casually related to the first write and while doing the second write of B, it will read the data from A, which staisfies the criteria of Casual Consistency.
Please let em know in case of any clarifications required. Thanks!
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.