1. Imagine you are implementing the consistency model for a site such as Faceboo
ID: 3911158 • 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
a. For this use-case, we will use Strict Consistency. Strict consistency means whenever we perform a WRITE operation to any variable, then its value must be seen by all processors i.e, all processors must update their copy of the variable with the latest value instantaneously. It is necessary because after updating the password of the account, the user should not be able to open his account using the old password. So all processors must have the updated value. It also ensures that operations are performed in order, this means that if Event A happens before Event B, then all processor must see these in that order only. This case is important because, if a user updates his password multiple times, then those changes must be done in the given sequence else it would lead to security breach.
b. For this use-case, Sequential Consistency is needed. Sequential Consistency means that when we perform a WRITE operation to any variable, then that WRITE does not need to be updated by all processors immediately. But the order of WRITEs must be maintained. This is important because, when you post a status (WRITE A) and your friend replies to it (WRITE B), then if you see the reply a bit late then there won't be any problem. But the order of WRITEs must be maintained; WRITE A must be seen before WRITE B in all circumstances.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.