1 / 52

Consistency & Replication II

Consistency & Replication II. CSE5306 Lecture Quiz due 14 April 2014. Read Your Writes. Yes. A data store is said to provide read-your-writes consistency, if the following condition holds:

balin
Download Presentation

Consistency & Replication II

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Consistency & Replication II CSE5306 Lecture Quiz due 14 April 2014

  2. Read Your Writes Yes • A data store is said to provide read-your-writes consistency, if the following condition holds: • The effect of a write operation by a process on data item x will always be seen by a successive read operation on x by the same process. • Positive example (above left): Write operation completes before successive read operation, wherever the read takes place. • Negative example (above right): Just-changed password still doesn’t let you in (security and app servers not collaborating). No, previous write operation didn’t propagate to L2

  3. R U O K ? • Define “read-your-writes” consistency in data stores. • The effect of a write operation by a process on data item x will not always be seen by a successive read operation on x by the same process. • A write operation completes before successive read operation, wherever the read takes place. • A just-changed password still doesn’t let you in, because your security and app servers are not collaborating. • All of the above. • None of the above.

  4. Writes Follow Reads Yes No • A data store is said to provide writes-follow-reads consistency, if the following holds: • A write operation by a process on a data item x following a previous read operation on x by the same process is guaranteed to take place on the same or a more recent value of x that was read. • Positive example (above left): A reader’s reaction to an article is posted, after the article is written. • Negative example (above right): No guarantees on posting order (newsgroup editor is on vacation).

  5. R U O K ? 2. Define “writes-follow-reads” consistency in data stores. • A write operation by a process on a data item x following a previous read operation on x by the same process is not guaranteed to take place on the same or a more recent value of x that was read. • A reader’s reaction to an article is posted, after the article is written. • There are no guarantees on posting order, when the newsgroup editor is on vacation. • All of the above. • None of the above.

  6. Replica Management • When, where and by whom should replicas be placed? • Replicated servers – best locations? • Replicated data – best host for each data item? • And after placement, how will the replicas be kept consistent?

  7. Replica Server Placement • Replication server must be placed in real time, because of “flash crowds”; i.e., bursts of requests for one popular Web site. • Szymaniak proposes that… • Cluster similar-content users with little internode latency (above). • Compute the size a box around each cluster, using the average distance between two nodes and the number of required replicates. • Choose as your replica server any of the nodes in the box that contains the greatest number of nodes. This places the 20 best replicates among 64,000 nodes in real time; i.e., 50,000 times as fast as competing brute force methods.

  8. R U O K ? 3. How can a needed replication server be strategically placed in real time? • Cluster all similar-content users who have insignificant internode latency. • Compute the size a box around each cluster, using the average distance between two nodes and the number of required replicates. • Choose as your replica server any of the nodes in the box that contains the greatest number of nodes. • All of the above. • None of the above.

  9. Content Replication & Placement • Three different types of content replicas appear in (already properly placed) servers: • Permanent replicas. • Server-initiated replicas. • Client-initiated replicas.

  10. R U O K ? 4. What type(s) of content replicas appear in already properly placed servers? • Permanent replicas. • Server-initiated replicas. • Client-initiated replicas. • All of the above. • None of the above.

  11. Permanent Replicas • The initial set of replicas of a distributed data store: • A few servers at the same site. • Mirror sites geographically spread across the Internet. • Shared-nothing architecture: • Distributed database replicated in a concentrated or geographically spread out server cluster. • Processors do not share disks or main memory.

  12. R U O K ? 5. Which of the following exemplifies replicas of a distributed data store? • A few servers at the same site. • Mirror sites geographically spread across the Internet. • Distributed database replicated in a concentrated or geographically spread out server cluster. • All of the above. • None of the above.

  13. Server-Initiated Replicas • The owner’s data store replicates enhance its performance: • E.g., the owner installs several new servers to L.A. to handle a burst of L.A. Internet requests, in behalf of overloaded NYC Web server. Better yet, she sends her data store replicate to a Web hosting service, who already has many servers in L.A., to help handle the extra traffic. • Rabinovich’ content placement algorithm: • When the count of requests cntQ(S,F) for server S’s file F falls below a predefined deletion threshold del(S,F), that file is deleted, if it is not the last copy (see figure above). • When cntQ(S,F) exceeds the predefined replication threshold rep(S,F), that very popular file gets replicated at the server that relays most of S’s requests for F. • When cntQ(S,F) lies between del(S,F) and rep(S,F), the file simply moves to the server that relays most of S’s requests for F.

  14. R U O K ? 6. Describe a widely used content placement algorithm. • When the count of requests for your server’s file falls below a predefined deletion threshold, you delete that file (if it is not the last copy). • When that count exceeds the predefined replication threshold, your very popular file gets replicated at the server, which relays most of your server’s file requests. • When the count lies between those thresholds, your file simply moves to the server, which relays most of your server’s file requests. • All of the above. • None of the above.

  15. Client-Initiated Replicas • Clients can cache recent web pages to reduce their re-access time. Clients with similar interests (e.g., many whiteboard designers) also may share a level-2 cache in their LAN or WAN’s Web server. • Web servers may tell the caches their data items are stale, but they do not attempt to enforce consistency policies upon clients’ caches. • Web pages get purged from cache, when they expire, to make space for other Web pages.

  16. R U O K ? 7. How could you effectively manage client-based replicas? • Clients can cache recent web pages to reduce their re-access time. Clients with similar interests (e.g., many whiteboard designers) also may share a level-2 cache in their LAN or WAN’s Web server. • Web servers may tell the caches their data items are stale, but they do not attempt to enforce consistency policies upon clients’ caches. • Web pages get purged from cache, when they expire, to make space for other Web pages. • All of the above. • None of the above.

  17. Content Distribution • How are updated contents propagated to the relevant replica servers…? • It depends….

  18. State vs. Operations It depends on… whatis to be propagated: • Propagate only a notification of an update: • An “invalidation protocol” simply tells another that part or all of its replicate is out of date—stock market traders don’t like inconsistencies. • This works best when data get stale quickly, but they are seldom read; i.e., high write/read ratio. • Transfer data from one copy to another: • Server gets partial or full update from its nearest neighbor. • This works best when data get stale slowly, but they are read often; i.e., low write/read ratio. • Propagate the update operation to other copies: • “Active replication” tells each replica which of its preprogram-med update operations it should perform and what its parameters are. • This may reduce network bandwidth, if the parameters are small. But it may require significant processing power, if the operation is complex.

  19. R U O K ? 8. Which of the following propagation strategies would work best, when the read/write ratio is small? • Propagate only a notification of an update. • Transfer data from one copy to another. • Propagate the update operation to other copies. • All of the above. • None of the above.

  20. Pull vs. Push Protocols • It depends on… whether replicas are active or passive agents of change. • Server-based protocols push updates to replicas: • A permanent replica pushes to a server-initiated replica, or the latter pushes to its clients. • Use this when a high degree of consistency is required among many clients; i.e., high read/update ratio. • Client must inform server if it purges a page to make space. • Client-based protocols pull updates from servers: • Upon cache hit, ask Web server if cached copy is stale; if so, pull it. • Use this when cache isn’t shared among clients; i.e., low read/update ratio. Don’t, when response must be quick. • A “lease” is server’s limited-time promise to push, then client must pull: • Long-lasting leases work well on unchanging Web pages. • Frequently pulled pages (better customers) get longer-term leases. • Short-term leases give overloaded server relief from pushing.

  21. Unicasting vs. Multicasting • It depends on… whether unicasting or multicasting works better: • Push-based updates can be multicasted efficiently; the LAN does all the work. • Pull-based updates must be sent point-to-point (unicasted).

  22. R U O K ? Classify each of the following as: a) push, b) pull or c) both. 9. Server-based protocols __ 10. Client-based protocols __ 11. Leases __ 12. Multicasting __ 13. Point-to-point unicasting __

  23. Consistency Protocols • How do we design consistency protocols to implement particular consistency models…?

  24. Continuous Consistency • Continuous consistency protocols seek to limit… • numerical deviations, • staleness deviations or • ordering deviations. • (See p.278 for definitions.)

  25. R U O K ? 14. Admittedly imperfect continuous consistency protocols seek to limit what kinds of consistency measures? • Numerical deviations. • Staleness deviations. • Ordering deviations. • All of the above. • None of the above.

  26. Bounding Numerical Deviation • A server pushes a series of write commands to its nearest neighbors (epidemic protocol). • If a receiving server senses that it is not keeping pace with its updates, it asks the sender to push its current state (i.e., the ultimate result of the series of writes) and it updates to that.

  27. R U O K ? 15. What can a receiving server do, when its numerical deviations exceed predefined limits? • Request only the most recent write operations. • Ask the sender to push its current state. • Abort the session by dropping the connection. • All of the above. • None of the above.

  28. Bounding Staleness Deviation • Every server keeps a vector clock (see p.249). • When a receiving server sees that its vector clock is falling behind the sender’s, it pulls the most recent update.

  29. R U O K ? 16. What can a receiving server do, when its staleness deviation exceeds predefined limits? • Request only the most recent write operations. • Ask the sender to push its current state. • Pull the sender’s most recent update. • All of the above. • None of the above.

  30. Bounding Ordering Deviations • When the queue of pending writes (received in scrambled order) gets too long, a receiving server must negotiate with its neighbors on what that order should be. • Together they determine the proper ordervia a primary-based or quorum-based protocol.

  31. R U O K ? 17. What can a receiving server do, when its queue of uncommitted writes gets too long? • Negotiate with its neighbors on what the order of those writes should be. • Ask the sender to push its current state. • Pull the sender’s most recent update. • All of the above. • None of the above.

  32. Primary-Based Protocols • Each data item, x, has a designated “primary” server, who coordinates all replicas’ write operations on x. • Simple primary-based protocols are the most popular way of achieving sequential consistency; i.e., ordering operations via locking or transactions. • The primary may be fixed, accepting old copies of x, doing the write and returning updated x values; i.e. “remote write.” • Or a server needing an update may pull the primary’s write operation to it; i.e., the primary travels to the replica to accomplish a “local write.”

  33. R U O K ? 18. Which of the following accurately describes primary-based protocols? • Each data item, x, has a designated server, which coordinates all replicas’ write operations on x. • Simplest and most popular way of achieving sequential consistency. • It may do a requested remote write operation on its data item, or it may travel to a replica to do a local write. • All of the above. • None of the above.

  34. Remote-Write Protocols • The remote-write protocol is: • Any process that wants to change x forwards its desired operation to the primary server, and it blocks. • The primary changes its local value of x and forwards the the update to its backup servers. • When all backups have ACKed the primary, it sends its own ACK to the initiating process. • The non-blocking alternative has fault tolerance issues, in that the primary ACKs immediately, on the assumption that its backups will respond later.

  35. R U O K ? 19. Which of the following accurately describes the remote-write protocol? • Any process that wants to change x forwards its desired operation to the primary server, and it blocks. • The primary changes its local value of x and forwards the the update to its backup servers. • When all backups have ACKed the primary, it sends its own ACK to the initiating process. • All of the above. • None of the above.

  36. Local-Write Protocols • The local-write protocol is: • Any process that wants to change x must capture the itinerant primary. • The primary changes the local value of x, and moves on to the next needy process, keeping a record of all of the changes it has made. • When it is done changing x, it returns home to broadcast all of its changes to all processes. • In this non-blocking protocol, multiple successive write operations can be carried out locally, while reading processes have full access to their local copy. • If the initiator is a mobile process, all updates can be done while passing through a tunnel, and the primary can go home after it emerges. • A remote-write primary may do an occasional local write to boost performance.

  37. R U O K ? 20. Which of the following accurately describes the local-write protocol? • Any process that wants to change x must capture the itinerant primary. • The primary changes the local value of x, and moves on to the next needy process, keeping a record of all of the changes it has made. • When it is done changing x, it returns home to broadcast all of its changes to all processes. • All of the above. • None of the above.

  38. Replicated-Write Protocols • Multiple replicas may simultaneously write to a data item in a replicated-write protocol. • Active replication forwards the same operation (or the resulting update) to all replicas. • Quorum-based consistency protocols allow processes to vote on data item changes.

  39. R U O K ? 21. Which of the following accurately describes the replicated-write Protocol? • Multiple replicas may simultaneously write to a data item. • Active replication forwards the same operation (or the resulting update) to all replicas. • Quorum-based consistency protocols enable processes to vote on data item changes. • All of the above. • None of the above.

  40. Active Replication • To ensure that all replicas make the prescribed update at the same time, a totally-ordered multicast is required based on Lamport’s logical clocks (p.244), which are not scalable. • Total ordering also can be achieved by a central coordinator/sequencer, which attaches sequence numbers to all operations before, so that all processes can apply the operations in their proper sequence. • Only a combination of both actually is scalable.

  41. R U O K ? 22. Which of the following accurately describe active replication? • A totally-ordered multicast is based on Lamport’s logical clocks. • Or a central coordinator/sequencer can attach sequence numbers to all operations prior to multicasting. • Only a combination of both actually is scalable. • All of the above. • None of the above.

  42. Quorum-Based Protocols • Quorum-based protocols require that clients get the permission of multiple servers before reading or writing a replicated data item. • If the majority agree, • All change the file and affix the same new version number or… • All read the file which has the most often reported version number. • Changing majority voting to quorum voting (above left): • Write quorum, NW > N/2, a constraint that prevents write-write conflicts among the N voting servers. • Read quorum, NR + NW > N, a constraint that prevents read-write conflicts.

  43. R U O K ? 23. Which of the following accurately describe quorum-based protocols? • Clients must get permission from multiple servers before reading or writing a replicated data item. • A write quorum is more than half of the voting servers. • A read quorum is more than the number of voting servers minus the write quorum. • All of the above. • None of the above.

  44. Cache-Coherence Protocols • How do we ensure that a client’s cache is consistent with the server-initiated replicas: • Coherence detection strategy (when consistent): • A compiler does the analysis before execution or • The client checks with the server at runtime to see if its cache is stale. • Block item access till freshness is verified. • Abort operation on presumed fresh data, if it is stale. • Verify freshness just before writing results of operation. • Coherence enforcement strategy (how consistent): • Prohibit clients from sharing cachesor • Server invalidates all caches when data item changes or • Propagate the update to all cache users. • How may processes write to shared caches: • Write-through—the client becomes the data item’s primary. • Write-back—allow multiple writes before informing the server.

  45. R U O K ? 24. How can cache coherence be enforced? • Prohibit clients from sharing caches. • Server invalidates all caches when data item changes. • Propagate update to all cache users. • Any of the above. • None of the above.

  46. Implementing Client-Centric Consistency • How may clients ensure consistency, without servers’ help?

  47. A Naive Implementation • An autonomous client can maintain consistency simply …albeit slowly by: • Monotonic read consistency: • i.e., writes relevant to subsequent the client’s reads. • Before every read, server verifies writes are done. • Monotonicwrite consistency: • i.e., the client’s writes. • Before every write, server verifies prior writes are done. • Read-your-writes consistency: • Client updates server on all write operations prior to read. • Writes-follow-reads consistency: • Client updates server on all write operations including current one.

  48. R U O K ? Match the following autonomous clients’ consistency maintenance strategies with their definitions below. 25. Monotonic read consistency __ 26. Monotonic write consistency __ 27. Read-your-writes consistency __ 28. Writes-follow-reads consistency __ • Client updates server on all write operations including current one. • Before every read, server verifies writes are done. • Client updates server on all write operations prior to read. • Before every write, server verifies prior writes are done.

  49. Improving Efficiency • The naive implementation’s performance is poor because its read and write sets are very large—they cannot commit till their order is known. • Half of the solution is to limit the sets to a single session; i.e., the time from one server application’s logon to logoff. • The other half solution requires vector time stamping all read and write operations, so that their order can be quickly determined and the number of uncommitted operations does not grow. • For example, • Your client PC logs onto a MATLAB server. • With your MATLAB password goes the vector timestamp “4PM.” • The server replaces its time stamp with your more recent one. • Because its time stamp was out of date, it knows it has not seen all of your operations, so it pulls all of your intervening offline updates. • It applies that backlog of operations to your data items, in ascending order of their timestamps. • The server returns your accurate MATLAB answers with its current timestamp, “4:02PM.” • Your client updates its timestamp to “4:02PM” and awaits your command.

  50. R U O K ? 29. What’s the problem and solution to the naive implementation’s poor performance is poor? • Its read and write sets are very large, because they cannot commit till their order is known. • Limit the sets to a single session. • Vector time-stamp all read and write operations. • All of the above. • None of the above.

More Related