Maintaining Data Consistency in Structured P2P SystemsAbstract—A fundamental challenge of supporting mutable data replication in a Peer-to-Peer(P2P) system is to efficiently maintain consistency. This paper presents aframework for Balanced Consistency Maintenance (BCoM) in structured P2Psystems with heterogeneous node capabilities and various workload patterns.Replica nodes of each object are organized into a tree structure for disseminatingupdates, and a sliding window update protocol is developed for consistencymaintenance. We present an analytical model to optimize the window sizeaccording to the dynamic network conditions, workload patterns and resourcelimits. In this way, BCoM balances the consistency strictness, object availabilityfor updates, and update propagation performance for various applicationrequirements. On top of the dissemination tree, two enhancements are proposed: 1)a fast recovery scheme to strengthen the robustness against node and link failures,and 2) a node migration policy to remove and prevent bottlenecks allowing moreefficient update delivery.Reasons for the proposal :P2P systems are typically large, where peers with heterogeneous resourcecapabilities experience varying network latencies. Also, the frequent joining andleaving of nodes make the P2P overlay failure prone. Even “deadlock” may occurwhen a crashed replica node causes other replica nodes to wait forever. Hence,system scalability is restricted due to low data availability resulting from longsynchronization delay. At the other extreme, eventual consistency allows replicanodes to concurrently update their local copies, only requiring that all replicacopies become identical after a long enough failure-free and update-free interval.Since replica nodes are highly unreliable in P2P systems, the node issuing updatemay have gone offline by the time update conflicts are detected, leading to
unresolvable conflicts. It is infeasible to rely on a long duration without any failureor further updates. As a result, eventual consistency fails to provide any end-to-endperformance guarantee to P2P users. Hence a proper method is needed forMaintaining data cache in Structured P2P systems.Existing system & demerits:Existing bounded consistency techniques for P2P systems can be divided into twocategories: probabilistic consistency ,  and time-bounded consistency ,, both of which have limitations. Probabilistic consistency only guaranteesconsistency on most nodes. It cannot guarantee that every node receives allupdates. Thus, it is not applicable to the situation where all intermediate updatesare valued by every user.Time-bounded consistency sets a uniform temporal constraint on inconsistency forall nodes. In the situation where nodes have various update frequencies, it isimpossible to set a temporal constrain that works for all nodes.Proposed system :This paper presents a Balanced Consistency Maintenance (BCoM) protocol forstructured P2P systems to balance between consistency strictness, objectavailability for updates, and update dissemination latency.BCoM aims to:1) provide bounded consistency for maintaining a large number of replicas of amutable object;2) balance the consistency strictness, object availability for updating, and updatepropagation performance based on dynamic network conditions, workloadpatterns, and resource constraints;3) make the consistency maintenance robust against frequent node churn andfailures. To fulfill these objectives, BCoM organizes all replica nodes of an object
into a d-ary dissemination tree (dDT) on top of the P2P overlay for disseminatingupdates. It applies three core techniques: the sliding window update protocol, theancestor cache scheme, and the tree node migration policy on a dDT forconsistency maintenance.Protocols :Basic Operations in Sliding Window UpdateThe sliding window update protocol regulates the consistency strictness in a dDT.“Sliding” refers to the incremental adjustment of the window size based ondynamic system conditions. If dDTi of object i is assigned a sliding window sizeki, any replica node in dDTi can buffer up to ki unacknowledged updates beforegetting blocked from receiving new updates. In other words, each node in dDTi isgiven a buffer of size ki. At the beginning, the root receives the first update, sendsit to all children and waits for their ACKs. There are two types of ACKs, R_ACKand NR_ACK. Both indicate that the update has been received. The difference isthat R_ACK means the sender is ready to receive the next update; NR_ACK meansthe sender is not ready. While waiting, the root accepts and buffers the incomingupdates as long as its buffer is not overflowed. When receiving an R_ACK from achild, the root sends the next update to this child if there is a buffered update thathas not been sent to this child. When receiving an NR_ACK from a child, it marksthe update to be received by this child and stops sending update to this child. Afterreceiving ACKs from all children, the update is removed from the root’s buffer.Ancestor Cache Maintenance :Each replica node maintains a cache of mi ancestors starting from its parentleading to the root in dDTi. The value of mi is set based on the node churn rate(i.e., the number of nodes joining and leaving the system during a given period) sothat the probability that all mi nodes simultaneously fail is negligibly small. If anode does not have mi ancestors, it caches all the ancestors from its parent to theroot. A node contacts its cached ancestors sequentially layer by layer upward when
its parent becomes unreachable. This can be detected by ACKs and maintenancemessages. Sequentially contacting enables a node to find the closest ancestor. Theroot is finally contacted if all the other ancestors are unavailable. The root failure ishandled by the overlay routing, as a node with the nearest ID will replace thecrashed node to be the new root. Different replication schemes may be used toreduce the cost of root failure, which is specific to a structured P2P overlay andbeyond the scope of this paper.Tree Node MigrationAny nonleaf node will be blocked from receiving new updates if one of itsdescendants has a buffer overflow in the sliding window update protocol. It is quitepossible that a lower layer node performs faster than a bottleneck node. Thismotivates us to promote the faster node to a higher level and degrade thebottleneck node to a lower level. For example in Fig. 1, assume node 1 is thebottleneck node causing the root 0 to be blocked. The faster node may be adescendant of the bottleneck node as shown in (A) or a descendant of a sibling ofthe bottleneck node as shown in (B). When blocking occurs, node 0 can swap thebottleneck node 1 with a faster descendant who has more recent updates, like node4, to remove blocking. Before blocking occurs, node 1 can be swapped with itsfastest child who has the same update version to prevent blocking. Theperformance improvement through node migration is confirmed by our analyticalmodel in Section 3. There are two forms of node migration, as described below. .Blocking triggered migration. The blocked node searches for a faster descendantwho has a more recent update than the bottleneck node, and swaps them to removeblocking. .Nonblocking migration. When a node observes a child performing faster thanitself, it swaps with this child. Such migration prevents blocking and speeds up theupdate propagation for the subtree rooted at the parent node.