Design and Implementation of Peer-to-Peer Service Routing Algorithm

Due to the lack of QoS (quality of service) guarantee in current Peer-to-Peer services routing network, it is difficult to apply Peer-to-Peer network to business successfully. Therefore, a service guarantee routing model is proposed in this paper, and an ant colony algorithm is designed for this routing model. Finally, the experimental analysis of the Peer-to-Peer services routing algorithm is presented. The experimental result shows the effectiveness of the service routing algorithm.


Introduction
Peer-to-Peer (P2P) service routing is an important area of the P2P network.Currently, the P2P routing is divided into the categories of unstructured and structured routing algorithms.Unstructured P2P network is not fixed logical topology of the P2P network.Joining and leaving Nodes affect only the direct neighbors.The message overhead is relatively small.Typical unstructured P2P network routing includes Gnutella, Freenet, APPN, Neu-roGrid [1] and so on.Unstructured P2P network routing has been used, but faces low routing efficiency, in particular lack of quality of service guarantees.Structured P2P network routing table (referred to as DHT) is constructed in accordance with Direct Hash Table .Each node has a unique identifier.According to the identifier of the message destination, the node can route messages to the node closest to the node identifier and message identifier.The typical structure of P2P networks includes Chord [2], CAN [3], Pastry [4] and Tapestry [5]- [7].P2P has been applied in other fields of business, finance and tourism.The P2P services a wide range of applications and further development in these areas is limited due to lack of quality of service guarantee.Most of the current P2P lacks consideration of the quality of service.This paper studies the P2P routing algorithm from perspective of quality of service.The proposed algorithm is able to provide guaranteed quality of service routing and promote the development and wide application of the P2P network.

P2P Service Routing Problem
For the P2P service routing in this paper, factors affecting the service routing can be considered from the following aspects: the connection bandwidth between network nodes; the maximum bandwidth of node; The session time between nodes.P2P service network routing goal is to establish a service path that meet the above requirements from source node to the destination node, and get the maximum throughput of P2P services along the selected path.

Define P2P Services Routing Problem
P2P services routing problem can be defined as: ( ) show nodes set in P2P, E is the corresponding edge between nodes.Every node can join and leave network random, b i b j is available bandwidth between i and j, then, ( ) , c ij show the minimum available bandwidth between i and j, a service quality assurance of the P2P services routing goal is to find a path to make P2P services network throughput maximization, and satisfy the following requirements.Select the Maximum bandwidth utilization rate; the effective bandwidth between the nodes is between connection bandwidth and acceptable bandwidth.

Formalization P2P Services Routing Problems
In a undirected graph ( ) , B ij is bandwidth between the node I and the node j, F ij show traffic between node I and node j, then defined as follows: Assume source s and destination d, s v ∈ , d v ∈ , there are multiple paths between a given source and destination, a collection of all these paths is ( ) , , , m P s d P P P =  , P i is one of path in ( ) ∈ , B ij is bandwidth between the node i and the node j, x ij is binary variables.
, edg i j is not connected.b ij is available bandwidth between node I and node j, c ij is the minimum accepted bandwidth between node i and j.
In summary, the problem can be described as the following: In this model, the objective function is: the set of multiple paths between a given source and destination, find one of these paths which has maximum utilization of the bandwidth of the path of service.

P2P Service Routing Implementation Process of the Ant Colony Algorithm
Nodes in the P2P service network play an important role in routing.The bandwidth of the node is related to the performance of the entire network, so attributes of high capacity nodes are considered.In this paper, the available bandwidth of nodes is considered and guarantees the available bandwidth of nodes so as to ensure that each service can be achieved availability.First, the P2P service routing model is built, then ant colony algorithm to solve the service routing problems is design.
Ant colony or swarm intelligence algorithm [8]- [10] is an optimization algorithm inspired by the patterns of behavior by the ants to find food, the ant colony algorithm as a heuristic algorithm is to provide a very good network quality of service algorithms, ant colony algorithm has the potential ability in applying to solve the routing problem, artificial ants are probe packets, they will leave artificial pheromone on the path, the transition probability of ants on each route can calculate through the pheromone in the statistics on the path and inspire factor [11]- [13], after several iterations, the highest pheromone routing is to answer.
The selection probability of ants on each route (i, j) can be described as follows: As ( ) In Equation ( 3): shows the k ant the next selection set of paths; ( ) p t show the k ant probability through path (i, j) from i to j, ( ) show the pheromone in the path (i, j) ; F ij show traffic through path (i, j); B ij is the bandwidth through path (i, j).∂ and β show weight in controlling the pheromone and path respectively.Now τ show the pheromone in the path (i, j) at the t time, while an t finish one cycle, then the pheromone become as follow: ( ) ( ) In this Equation ( 4), ρ is constant coefficient between o and 1, 1 ρ − show pheromone evaporation be- tween time t and time t plus 1.
In this equation, ∆ is the pheromone variable through path (i, j) between time t and time t plus 1.It can be defined: In Equation ( 6), Q is a constant.It is the pheromone after ant finish one complete path search.L k is the total path bandwidth utilization of the k ant.It is equal to the sum of the k-th segment of the passed path of the ants bandwidth utilization.If the total bandwidth utilization of the path of the ants is higher, concentration of pheromone is higher by released per unit path.Obviously, the ants will not release pheromone on the path which has never experienced.
Dynamic Ant Colony Algorithm for solving problem as follows: Global search ability and search speed of the application of ant colony algorithm used to solve the P2P service network routing problem [14] [15], Specific of ant colony algorithm realization as follows: Begin Initialization, the m ants on the starting node s, k E φ For k = 1 to m do Ant k to determine if the current node i connecting the node has gone through.Calculate the probability of all nodes are not traversed, and selecting randomly the next node j according to the probability applying for Equation ( 2), (3); Update the pheromone concentration in the path between nodes m i and j applying for Equation ( 4), ( 5) and ( 6), If node j is object node t then Determine the path bandwidth utilization is the largest, if it is the largest path then record the point ( ) The starting node s and destination node t are interchangeable and empty node traversed records End If approximate bandwidth utilization is greater than the sum given the current bandwidth utilization then exit Loop

Experimental Analysis
Environment of the experiment to build 16 units of the Red Hat Linux operating system on 16 PCs, using Java to design and realization [16] [17].Waxman topology generation algorithm based on will generate the network topology.In order to verify the effectiveness of service-based P2P service routing algorithm, randomly selected 16 as an ordinary node.The data communication between nodes used the Java RMI mechanism, synchronization cycle simulation.In each round a loop, each node is read from its input queue, and then processed according to the specified routing rules.
P2P service routing algorithm, assume 1 . All nodes every two seconds sending service advertising messages in the two systems generate network congestion, because the experimental derivation of the LAN environment, the transmission time between two nodes is very short, not enough to reflect the real Internet environment, so each times send an additional 10 seconds of delay between each two nodes.
From Figure 1, we can see that service P2P service network routing ant colony algorithm is less than Dijkstra algorithm caused by the bottleneck at any one time interval.Therefore in the same network conditions, Ant algorithm has less router price, has better performance than the Dijkstra algorithm.
The convergence rate in different network scale under the conditions of two kinds of algorithms, it can be seen from Figure 2, with the increase of network nodes, Ant algorithm has faster convergence speed, this is because with the increasing scale of the network, the algorithm of feasible solution space increased, if the evolutionary algorithm cannot effectively reduce the solution space, will not improve the convergence rate of the algorithm.The Ant algorithm uses the idea of simulated annealing, so as to ensure the convergence of feasible solution, and ultimately accelerate the iteration to find the optimal solution (or approximate optimal solution) speed.Dijkstra algorithm is able to find the shortest path from a node to another node of the graph, after Dijkstra algorithm once, we can get the shortest path from start to within its searching all nodes, and its time complexity  (n is nodes in graph).The main concern is the shortest path between two specific nodes rather than the point of origin to other points in the calculation of network routing.The characteristic of the Ant colony algorithm is an enhanced learning system, distributed computing features and has a strong robustness.Ant colony algorithm is very suitable for solving complex combinatorial optimization problems, the P2P service network routing problem is a combinatorial optimization problem, so the Ant colony algorithm to solve the P2P service network routing problems.Using the ant colony algorithm and Dijkstra algorithm respectively solve P2P service network routing problems.The experimental results show that the Ant colony algorithm is relatively fast to find the approximate route, and the system copies the information less, the reason is that the Ant colony algorithm is a simulation of evolutionary algorithms, ant colony algorithm with groups of co-operation, positive feedback and distributed computing features and many main Agent (referred to here the main body of the ant) can be better to complete the task of optimizing collaboration between groups of cooperation; positive feedback makes the algorithm quickly find better solutions; it is easy to achieve parallelism for distributed computing algorithm.

Figure 1 .
Figure 1.The comparison of router price of the two algorithms.

Figure 2 .
Figure 2. The iterative time with the network nodes vary.