HW 3 (1)

docx

School

University of Missouri, Kansas City *

*We aren’t endorsed by this school

Course

369

Subject

Computer Science

Date

Dec 6, 2023

Type

docx

Pages

4

Uploaded by DukeFreedom11576

Report
Name: Adithya chittajallu Section: 3 1. [ 20 points ] Suppose you logged in your social network website and updated your profile picture and called one of your friends to check. Your friend joins the website and still sees your old picture you had. Draw an event diagram like the one shown in class to show how this can happen in a replicated data system. Event Diagram: Profile Picture Updates Client Server 1 Server 2 Two servers keep the user credentials (replicated data). Password is updated in one server, but the login is attempted in the other server before the password is updated in the second one. 2. (a) [ 15 points ] What does the following three consistency models mean? a. Consistent prefix Consistent prefix consistency guarantees that reads never see out-of-order writes. This means that if a write to a data item is followed by another write to the same data item, then any subsequent read of the data item will always see the latest write. However, consistent prefix consistency does not guarantee that reads will always see the most recent write. This is because the replicas may not Update Picture Me Friend Picture Updated Sign In Not Updated Picture Failed to see the Updated Picture Updated Picture
be updated immediately after the primary node is updated. As a result, a user may read a stale value of the data if they read from a replica that has not yet been updated. b. Bounded staleness Bounded staleness consistency is a stronger consistency model than consistent prefix consistency. It guarantees that reads will never see data that is more than a certain amount of time stale. This means that if a write to a data item is followed by another write to the same data item, then any subsequent read of the data item will always see the latest write, as long as the read is performed within a certain amount of time after the write. The amount of time that a read can be stale is called the staleness threshold. c. Monotone read Monotone read consistency is a weaker consistency model than consistent prefix consistency. It guarantees that reads will always see the same version of a data item, as long as the data item has not been written to since the last read. This means that if a user reads a data item twice, they will always see the same value, even if the data item has been updated between the two reads. However, monotone read consistency does not guarantee that reads will always see the latest write. This is because the replicas may not be updated immediately after the primary node is updated. As a result, a user may read a stale value of the data if they read from a replica that has not yet been updated. (b) [ 15 points ] Suppose your changed your profile picture to these fruits in this order: d. On Monday, “Apple” e. On Tuesday, “Orange” f. On Friday, “Mango”
g. On Sunday, “Pineapple” Your friend saw your updates in the following listed orders: Which consistency models do these updates satisfy? (it can be zero or more models)? Explain your answer in short. (i) “Apple”, “Orange” This order matches the update order and satisfies the constrained staleness and monotone read consistency Prefixes. (ii) On Monday “Apple”, on Sunday “Mango”. This order satisfies the bounded staleness and monotone read consistency models, but not the consistent prefix consistency model, because the friend observed the "Mango" update before the "Orange" update. (iii) On Monday “Pears”, On Wednesday “Watermelon”, on Sunday “Pineapple”. This order fulfills the bounded staleness consistency model because the buddy observed all of the updates, but it does not satisfy the consistent prefix or monotone read consistency models because the updates were observed in a different order than they were applied. 3. [ 20 points ] Based on this article ( https://www.alexdebrie.com/posts/dynamodb-eventual- consistency/ ), answer the following questions: (a) How is data replication related to “eventual consistency”? Based on the article, eventual consistency is a property of replicated database systems where updates to a single data item are not immediately visible to all users. This is because the updates need to be propagated to all replicas of the data, and there may be some delay before this happens. Data replication is the process of copying data from one place to another. In the context of DynamoDB, data is replicated to multiple nodes across different availability zones. This replication helps to improve the availability and durability of the data, as it ensures that the data is still available even if one of the nodes fails. However, data replication can also introduce eventual consistency issues. This is because the replicas may not be updated immediately after the primary node is
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
updated. As a result, a user may read a stale value of the data if they read from a replica that has not yet been updated (b) What is the PACELC theorem? How is this related to the CAP theorem? The PACELC theorem is a tradeoff between consistency and latency, according to the source. Given that both the CAP theorem and this one deal with distributed systems, they are connected. The PACELC theorem, on the other hand, is applicable always, whereas the CAP theorem is only applicable in times of failure. PACELC theorem definition: Partitioning: The system is capable of being split up into several interoperable partitions. Availability: Clients must be able to access the system, even in the event that certain partitions are inaccessible. Consistency: In order for all clients to see the same data even while some partitions are unavailable, the system needs to be consistent. Liveness: Even in the event that some partitions are inaccessible, the system must be live in order to eventually react to client requests. Causal Ordering: The system needs to maintain causal ordering, which means that even in the case that some partitions aren't available, the sequence of events is maintained. According to the PACELC theorem, consistency, availability, and liveness can all be attained to some extent, but not simultaneously. The system's architecture dictates the trade-off between these attributes. A system that employs a robust consistency model, like Paxos, can have low latency and high availability, but it might not be able to withstand partitions. Partitions can be tolerated by a system that employs a weak consistency model, like eventual consistency, although it might have higher latency and less availability. A helpful tool for distributed system design is the PACELC theorem. It can assist system designers in selecting the best consistency model for their system and in understanding the trade-offs between consistency, availability, and liveness.