REPLACEMENT MECHANISM OF CACHING TECHNIQUE FOR QUERY ROUTING IN PEER TO PEER NETWORKS

In this approach we are proposing an extension to our previous work which deals with Trust Based Routing in the peer to peer network. This peer to peer network is carried out without using a caching mechanism to store the data packets while routing. To achieve this caching mechanism we have proposed methods for caching the data packets in the peers and also to replace these data packets with the new data packets in the next routing process. The method proposed to store the data packets is the Cache Mechanism approach, where this mechanism considers the throughput and the aggregated delay. To get this aggregated delay it considers the latency to return the current reply (L c ) and the latency to reply future data requests (L f ). Then an approach has been proposed to replace this stored data packets with the new data packets for the next routing process where the old data packets are removed from the peer’s cache and the new data packets will be moved to the cache.


INTRODUCTION
The network in which distributed resources are involved to perform a function in a decentralized manner is referred as P2P systems. The computation of power, data and network bandwidth are included in the resources. The distributed computing, data/content sharing, communication and collaboration or platform services are considered as functions in the network. The term decentralized is used in case of applying algorithms, data and metadata or to all of them. The scalability in terms of the node number, resource number, node autonomy, dynamicity, resource heterogeneity decentralized control and self configuration are some characteristics of P2P systems (Al King et al., 2010;Santillan et al., 2010).
The present Internet is expected to be dominated by content-oriented traffic, including but not limited to P2P traffic, which does not conform to the client-server paradigm and generates redundant indirection overheads when users try to retrieve the desired data. Since the unstructured P2P network is less efficient due to its blind flooding search mechanism. The irregularity between the Internet design and the real usage is expected to be further increased, as the Internet is envisaged to provide the means to share and distribute multimedia business and user-centric services, with superior quality and striking flexibility from everyone to everyone. In consequence, it is necessary to redesign the internet based on a contentcentric paradigm to provide data/content to the users in an efficient manner (Zahariadis et al., 2010).
In some of the P2P networks does not use cache mechanism through which the maintenance cost of the network gradually increases. During the routing between the peers if the data packets are lost the destination node once again have to request the source node to resend the data packets through which the delay between the peers increases.

JCS
If any p2p networks implement the cache mechanism it has to have a cache replacement policy else it becomes more difficulty for the peers to store all the data packets during the routing. This leads to loss of more data packets in the network and also to inefficient routing. Through this cache replacement policy it is possible to replace the cache with the most recent entries. The main drawback of this replacement policy is the risk that cache content may become obsolete. We propose trust based query routing technique for P2P Networks. Initially the node with maximum trust value is chosen as cluster head. These cluster heads are designated as trust managers. Each peer maintains a trust table which gets updated once it gets feedback from the trust manager about the resource requested peer. If the update denotes that the node is reachable and trusted, the routing is performed. Otherwise its echo time is verified again to decide the re-routing process. During peer node join or leave action, bootstrap technique is employed. Though cluster based routing reduces the overhead and delay, if the requested item is not present in the current cluster, it has to fetch the data from the other cluster (Arivazhagu and Srinivasan, 2012). If the destination node is located far away from the source cluster head, it will increase the delay. Here it explains about the secured routing among all the peers and the status of the peers. The cost of the network can be reduced by storing the data packets during the routing. Delay can be reduced by retrieving the loss of data during routing by this cache mechanism. So as an extension to the previous works, we propose a caching mechanism which can reduce the delay and overhead to great extent. Hefeeda et al. (2011) have proposed pCache method which is design and evaluation of a complete, running, proxy cache for P2P traffic. pCache transparently intercepts and serves traffic from different P2P systems. A new storage system is proposed and implemented in pCache. This storage system is optimized for storing P2P traffic and it is shown to outperform other storage systems. In addition, a new algorithm to infer the information required to store and serve P2P traffic by the cache is proposed. The advantage of this approach is that this method saves the bandwidth usage and also reduces the load on the backbone links. Zhao et al. (2010) have proposed a novel asymmetric cooperative cache approach, where the data requests are transmitted to the cache layer on every node, but the data replies are only transmitted to the cache layer at the intermediate nodes that need to cache the data. This solution not only reduces the overhead of copying data between the user space and the kernel space, it also allows data pipelines to reduce the end-to-end delay. They have also studied the effects of different MAC layers, such as 802.11-based ad hoc networks and multiinterface-multichannel-based mesh networks, on the performance of cooperative cache. The advantage of this approach is that it can significantly reduce the data access delay compared to the symmetric approach due to data pipelines. Filali and Huet (2010) have proposed two schemes which can be used to improve the search performance in unstructured peer-to-peer networks. The first one is a simple caching mechanism based on resource descriptions. Peers that offer resources send periodic advertisement messages. These messages are stored into a cache and are used for routing requests. The second scheme is a dynamic Time-To-Live (TTL) enabling messages to break their horizon. Instead of decreasing the query TTL by 1 at each hop, it is decreased by a value v such as 0 <v<1. The main aim of this approach is it achieves a high success rate while incurring low search traffic. Akon et al. (2010) have proposed Systematic P2P Aided Cache Enhancement or SPACE, a new collaboration scheme among clients in a computer cluster of a high performance computing facility to share their caches with each other. The collaboration is achieved in a distributed manner and is designed based on Peer-to-Peer computing model. The objective is to provide a decentralized solution and a near optimal performance with reasonably low overhead. The advantage of this approach is that the SPACE evenly distributes workloads among participators and entirely eliminates any requirement of a central cache manager. Brunkhorst and Dhraief (2007) have proposed the use of semantic caching in the environment of schema-based super-peer networks. Different from traditional caching, semantic caching allows the answering of queries that are not in the cache directly. The challenge of answering the queries using the cache is reduced to the problem of answering queries using materialized views. For this purpose the authors have implemented the MiniConalgorithm, which delivers the maximally-containedrewritings of a posed query based on the stored views. The advantage of this approach is that this method does the job efficiently when there are large numbers of queries in the network.

The Cache Mechanism Approach
In this cache mechanism, in the first phase after a request message is generated and it is passed down to the cache layer of the node. To forward this request message to the next hop, the cache layer wraps the original request message with next hop address to reach the destination. Here, we consider that the cache layer which caches the incoming data packets of the node can access the routing table and find the next hop to reach the destination node. This way the packet is received and processed hop by hop on the path from the requester to the destination node. The destination node needs to determine the benefit of caching data packets on an intermediate node and decide whether to cache the data or no. After an intermediate node (N i ) caches data packets forwarding the requests to the destination node, saving the communication overhead between N i and the data center. In the Fig. 1 it actually explain the purpose of the cache layer in nodes. Here the N1 node which is the source node sends the data packets to the destination node N6. These data packets sent by the source node reaches the destination node through the intermediate nodes between them. When these data packets are transmitted from the source node every intermediate node caches the data packets in them. After caching these data packets the intermediate node forwards those data packets to the next hop in the network. This way the data packets are stored in all the intermediate nodes till the data packets reaches the destination node. So that if any data packets are lost during the transmission the data packets can be requested from the intermediate node instead requesting the source node again.

Frequency at a Node
Node's frequency to access max data packets per unit time, but excluding the requests forwarded from other nodes on the forwarding path. To compute this Frequency of a node, a node first count all the requests it receives for the given data packet and also the requests generated by itself then divide by the amount of time since the node starts to participate caching. This way it computes the total data request frequency (r i ). The node can attach the value of r i to the forwarding request. When the destination node receives the value of r i for each node along the path, it can compute N f as Equation (1):

Node Delay
The delay to forward a data item with size S from the cache layer of N i to the cache layer of N j , without handing the data up to the cache layer of any intermediate nodes. ND i,j [S] is hard to measure because it is affected by many factors, such as transmission interference, channel diversities, node mobility, Equation (2): Where: ND i,j [S] = The node's delay from one node to other with S as the data size Tp k,k+1 = The link throughput between the neighboring nodes M = The size of MTU (Maximum Transmission Unit) which as to be set Tp i,j = The throughput between two caching nodes In a cache placement mechanism the total delay (D) is aggregated. To get this aggregated delay we also consider the latency to return the current reply (L c ) and the latency to reply future data requests (L f ) Equation (3) L c = Refers to the latency to return the current reply c i = Refers to the subscript of the node N ci on the forwarding path, which implies that node N ci is c i hops away from the destination. D S = Refers to the data size P(D S ) = Refers data processing delay At m nodes the data are reassembled and the forwarding path is cut into m+1 piece, respectively. Where, f j is the excluded data access frequency at node j; R S is the size of the request message for the data request D S is the size of the data, respectively. Finally the Cache Placement (CP) set is optimal if it can minimize the Equation (4):

Throughput
When the links l j uses the channel different from the (l j-1 …… l j-h ) within its interference range h hops Equation (5) When both the links l j and (l j-1 …… l j-h ) uses the same channel for the transmission of the data packets in the network then Equation (6)

Caching Mechanism Algorithm
Science Publications

JCS
In the above algorithm, initially the routing is formed through the trust based routing which is the previous work. Once the trust based routing is satisfied, the search for the cache will takes place in the network. During this process the source peer checks the Throughput (TP) of the node and its neighbor node with the Link Throughput (LT) of the node. Then it checks when the total Delay (D) tends to the Node Delay (ND) i.e. the delay occurred when the Cache Placement (CP) set becomes null to the destination i.e. When k = 0, no cache node is found between the destination and the source. This total delay D is the sum of latency to return the current reply (L c ) and the latency to reply future data requests (L f ). From this total delay the optimal Delay (D`) is calculated. For this optimal delay also considers the variations in the L c and L f i.e., ∆L C and ∆L f . If this optimal delay is less than the total delay then the total delay tends to optimal delay. Then finally the optimal Cache Placement (CP) set is found from the total caching Nodes (N k ).

Cache Replacement Policy
The cache replacement policy in the network defines a strategy for replacement of items when supplementary space is needed in the cache. The strategy is used to assign values to the items in the cache; the items with the lowest value are then replaced first. Since these cached resources could become out-of-date under resource dynamicity because the longer a resource is cached, the staler it becomes. So whenever a data packet is received, the peer extracts the details of different resources and peer get updated whenever an entry is made by the data packets into the cache layer.
After the entry the peer first checks if there is a related cache entry. If any entry is found then the peer updates this entry. Then finally the data packet will overwrite previous cache entries in the peer. Some of the most known cache replacement policies are First in First Out (FIFO), Random, Least Recently Used (LRU) and Least Frequently Used (LFU). An important asset is that the cache size does not depend on the number of peers in the network. But rather, the cache size depends on the number of different resource classes due to resource aggregation policy (Filali and Huet, 2010;Akon et al., 2010).

Systematic P2P Aided Cache Enhancement (SPACE)
In the peer to peer network a peer maintains a set which is known as Local Cache Information (LCI) which refers to the local cache. This set of LCI includes an entry for each of the locally cached disk blocks. An entry x of LCI (denoted as LCI (x) ) consists of the tuple (a x , clk x , ob x , ptr x ). Here, a x is the address that the first block LCI (x) is holding. The clk x maintains the clock tick since the last reference of the cache block. The ob x factor is a simple flag and indicates the novelty of a cache block. When a cache block is retrieved from the destination, it is marked as original and replicas of an original cache block are designated as non-original. The last tuple element ptr x holds the reference to the local cache memory where the actual disk data is physically.

Cache Replacement Policy Algorithm
1. Search for a peer p € LCI, such that clk p < clk min 2. If the peer p is not null, then 3. search for peer p € LCI such that clk p ≤ clk n and ob p ≠ originality where n €LCI and p≠n 4. Mark that peer p for replacement 5. Remove data from peer p cache 6. Move the data packets to the peer p cache 7. Return peer p 8. End Initially in the cache replacement policy the source peer searches for a neighbor peer p to check whether the peer's cache. This checking is done in order to know that the cache is already filled with the data or the cache is free. If the cache is free the data packets are stored in it directly. If the peer's cache is not free the source peer checks the clk p which maintains the clock tick since the last reference of the cache block and compares this last reference with the new reference which has to be stored i.e. clk n where the old data of the cache should not be same with new data packets to be added. Also the source peer checks for the status of the originality of the block. Then that peer will be marked for the replacement and the old data packets will be removed and the new data packets will be moved to that peer's cache.

Simulation Results
This section deals with the experimental performance evaluation of our algorithms through simulations. In order to test our technique, the NS-2 simulator is used. NS-2 is a general purpose simulation tool that provides discrete event simulation of user defined networks. We have used the Bit Torrent packet-level simulator for P2P networks. A network topology is only used for the packet-level simulator. We use a topology shown in Fig. 2 for our simulation. In this topology, peer nodes form 5 clusters Server Agents (marked as SA). The SA is marked with different colors. Each SA is connected to an access router. The requested information is fetched from the best peer by the source peer. We compare our intelligent caching mechanism (TBICSQ) routing technique with existing SPACE technique (Akon et al., 2010).

Based on Rate
In our first experiment we vary the transmission rate as 250,500,750 and 1000Kb. From Fig. 3, we can see that the Received bandwidth of our proposed TBICSQ is higher than the existing SPACE technique. From Fig. 4, we can see that the delay of our proposed TBICSQ is less than the existing SPACE technique. From Fig. 5, we can see that the throughput of our proposed TBICSQ is higher than the existing SPACE technique. From Fig. 6, we can see that the packet drop of our proposed TBICSQ is less than the existing SPACE technique.

Based on Cache Size
In our second experiment we vary the cache size as 100,200,300,400 and 500.
From Fig. 7, we can see that the Received bandwidth of our proposed TBICSQ is higher than the existing SPACE technique. From Fig. 8, we can see that the delay of our proposed TBICSQ is less than the existing SPACE technique. From Fig. 9, we can see that the packet drop of our proposed TBICSQ is less than the existing SPACE technique. From Fig. 10, we can see that the throughput of our proposed TBICSQ is higher than the existing SPACE technique.

CONCLUSION
In this approach we are proposing an extension to our previous work which deals with Trust Based Routing in the pee r to peer network. This peer to peer network is carried out without using a caching mechanism to store the data packets while routing. To achieve this caching mechanism we have proposed methods for caching the data packets in the peers and also to replace these data packets with the new data packets in the next routing process. The method to store the data packets is the Cache Mechanism, where this mechanism considers the throughput and the aggregated delay. To get this aggregated delay it considers the latency to return the current reply (L c ) and the latency to reply future data requests (L f ). Then to replace this stored data packets with the new data packets for the next routing process the SPACE method is proposed where the old data packets are removed from the peer's cache and the new data packets will be moved to the cache. Through this we achieve minimum delay during the routing of the data packets and the loss of the data packets will be decreased by caching the data packets in all the peers while routing. The maximum throughput will be achieved since the Science Publications JCS delay is decreased in the network. By the simulation results it shows that the proposed technique reduces the delay, increased in throughput and minimization of Packet drop. When compared to the existing technique .In future, this work is extended to focus with specific replacement policy algorithm and security issues with simulation results.