CN102790804A - Intelligent mobile agent-based unstructured P2P network load balancing method and system - Google Patents

Intelligent mobile agent-based unstructured P2P network load balancing method and system Download PDF

Info

Publication number
CN102790804A
CN102790804A CN2012102656139A CN201210265613A CN102790804A CN 102790804 A CN102790804 A CN 102790804A CN 2012102656139 A CN2012102656139 A CN 2012102656139A CN 201210265613 A CN201210265613 A CN 201210265613A CN 102790804 A CN102790804 A CN 102790804A
Authority
CN
China
Prior art keywords
node
nodes
mrow
msub
topology
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN2012102656139A
Other languages
Chinese (zh)
Other versions
CN102790804B (en
Inventor
沈项军
谷培影
蒋中秋
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Jiangsu University
Original Assignee
Jiangsu University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Jiangsu University filed Critical Jiangsu University
Priority to CN201210265613.9A priority Critical patent/CN102790804B/en
Publication of CN102790804A publication Critical patent/CN102790804A/en
Application granted granted Critical
Publication of CN102790804B publication Critical patent/CN102790804B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Data Exchanges In Wide-Area Networks (AREA)
  • Mobile Radio Communication Systems (AREA)

Abstract

本发明提供一种基于移动智能体的无结构对等网络负载均衡方法及系统,目的是避免网络节点拥塞,实现负载均衡。实现本发明目的的技术方案是:一种基于移动智能体的无结构对等网络负载均衡方法,包括以下步骤:S1、网络中每个节点定期发起拓扑调整机制,向处理能力强的节点连接,形成中心式拓扑结构;S2、通过计算节点在某一时刻的拥塞水平判断节点的拥塞状态,进一步进行网络拓扑优化。

Figure 201210265613

The invention provides a mobile agent-based unstructured peer-to-peer network load balancing method and system, with the purpose of avoiding network node congestion and realizing load balancing. The technical solution for realizing the purpose of the present invention is: a method for load balancing of unstructured peer-to-peer networks based on mobile agents, comprising the following steps: S1, each node in the network regularly initiates a topology adjustment mechanism, connects to nodes with strong processing capabilities, Forming a central topology structure; S2, judging the congestion status of nodes by calculating the congestion level of nodes at a certain moment, and further optimizing the network topology.

Figure 201210265613

Description

基于移动智能体的无结构对等网络负载均衡方法及系统Method and system for unstructured peer-to-peer network load balancing based on mobile agent

技术领域 technical field

本发明涉及对等网络技术领域,尤其涉及一种基于移动智能体的无结构对等网络负载均衡方法及系统。The invention relates to the technical field of peer-to-peer networks, in particular to a mobile agent-based unstructured peer-to-peer network load balancing method and system.

背景技术 Background technique

近年来,对等(Peer-to-Peer,P2P)网络已逐渐发展成一种重要的网络模式。这是因为与传统的客户机/服务器(Client/Server,C/S)模式相比,对等网络具有容错性好、可扩展性强、成本低廉、可以充分利用分布资源等优势。对等网络在文件共享、分布式计算、流媒体服务等发面已有广泛的应用。In recent years, peer-to-peer (Peer-to-Peer, P2P) network has gradually developed into an important network model. This is because compared with the traditional client/server (Client/Server, C/S) model, the peer-to-peer network has the advantages of good fault tolerance, strong scalability, low cost, and full use of distributed resources. Peer-to-peer networks have been widely used in file sharing, distributed computing, and streaming media services.

对等网络分为两种:有结构的和无结构的,有结构的对等网络对节点的连接有严格的限制,而无结构的对等网络节点的连接有很大的自由度。由于无结构对等网络节点的分布式特点,节点只知道其邻居节点的资源,却并不知道网络中其它节点上资源的分布情况,因此无结构对等网络中一个极大的难题是网络中的资源定位问题。为此已经提出许多搜索方法来实现无结构对等网络上资源的有效定位,如洪泛法、random walks、APS(Adaptive ProbabilitySearch)等。然而以上方法在资源查找过程中由于查询消息的转发,导致网络中部分节点在查找过程中需要处理的消息过多而出现消息拥塞,进而严重影响搜索的继续进行,造成搜索性能的下降,因而如何在对等网络中实现负载均衡就显得尤为重要。There are two types of peer-to-peer networks: structured and unstructured. The structured peer-to-peer network has strict restrictions on the connection of nodes, while the unstructured peer-to-peer network has a large degree of freedom in the connection of nodes. Due to the distributed characteristics of unstructured peer-to-peer network nodes, nodes only know the resources of their neighbor nodes, but do not know the distribution of resources on other nodes in the network. Therefore, a great problem in unstructured peer-to-peer networks is that resource location problem. For this reason, many search methods have been proposed to effectively locate resources on unstructured peer-to-peer networks, such as flooding, random walks, APS (Adaptive ProbabilitySearch), etc. However, due to the forwarding of query messages in the process of resource search in the above methods, some nodes in the network need to process too many messages during the search process, resulting in message congestion, which seriously affects the continuation of the search, resulting in a decline in search performance. It is particularly important to realize load balancing in a peer-to-peer network.

所谓负载均衡是指将网络负载依据节点的处理能力分摊到各个节点上。现有的负载均衡方法主要有两类,一类是研究通过动态改变网络拓扑结构来实现网络的负载均衡策略,改变网络拓扑结构的方法可以使处理能力强的节点拥有更多的邻居,分担更多的网络负载,充分利用自身的处理能力,达到负载均衡的目的。如Gia根据节点的满意度水平来调整网络结构;Luis等提出的DANTE,节点定期发起重连,并利用节点的吸引力来确定可以重连到那些节点。这些方法中节点发起查询的速率都是固定的,拓扑结构基本稳定后如果网络中的查询负载突然增大很容易在中心节点引发拥塞。另一类是研究在不改变网络的拓扑结构的基础上来实现负载均衡方法,该类方法通过把拥塞节点的多余查询消息有目的地转移到有多余处理能力的节点来实现负载均衡,在这类研究中最关键的问题是如何发现拥塞,由于移动智能体的高灵活性、高效性、低负载、低通信延迟、高异步性等特点,使它逐渐被应用到了拥塞感知方法中。Shekhar等提出了一种基于拥塞感知的移动智能体路由协议,移动智能体随机地从邻居节点中选择下一个访问节点;Li等提出了一种基于移动智能体的对等网络负载均衡方法,移动智能体通过轮流访问节点中的所有节点,来寻找拥塞节点。但是现有的基于移动智能体的负载均衡方法都是在不改变网络的拓扑结构的基础上进行的。The so-called load balancing refers to distributing the network load to each node according to the processing capability of the node. There are two main types of existing load balancing methods. One is to study the load balancing strategy of the network by dynamically changing the network topology. The method of changing the network topology can make nodes with strong processing capabilities have more neighbors and share more burden. Large network load, make full use of its own processing capacity, to achieve the purpose of load balancing. For example, Gia adjusts the network structure according to the satisfaction level of nodes; DANTE proposed by Luis et al., nodes initiate reconnection periodically, and use the attractiveness of nodes to determine which nodes can be reconnected. In these methods, the rate at which nodes initiate queries is fixed. After the topology structure is basically stable, if the query load in the network suddenly increases, it is easy to cause congestion at the central node. The other is to study load balancing methods without changing the topology of the network. This type of method achieves load balancing by transferring redundant query messages from congested nodes to nodes with redundant processing capabilities. The most critical issue in the research is how to discover congestion. Due to the characteristics of high flexibility, high efficiency, low load, low communication delay, and high asynchrony of mobile agents, it has been gradually applied to congestion sensing methods. Shekhar et al. proposed a routing protocol for mobile agents based on congestion awareness. The mobile agent randomly selects the next access node from neighbor nodes; Li et al. proposed a peer-to-peer network load balancing method based on mobile agents. The agent finds congested nodes by visiting all nodes in the node in turn. But the existing load balancing methods based on mobile agents are carried out without changing the topology of the network.

有鉴于此,有必要提出了一种新的基于移动智能体的无结构对等网络负载均衡方法及系统。In view of this, it is necessary to propose a new method and system for unstructured peer-to-peer network load balancing based on mobile agents.

发明内容 Contents of the invention

本发明的目的在于提供一种基于移动智能体的无结构对等网络负载均衡方法及系统,避免了网络节点拥塞,实现负载均衡。The purpose of the present invention is to provide a mobile agent-based unstructured peer-to-peer network load balancing method and system, which avoids network node congestion and realizes load balancing.

本发明的一种基于移动智能体的无结构对等网络负载均衡方法,所述方法包括以下步骤:A kind of unstructured peer-to-peer network load balancing method based on mobile agent of the present invention, described method comprises the following steps:

S1、网络中每个节点定期发起拓扑调整机制,向处理能力强的节点连接,形成中心式拓扑结构;S1. Each node in the network regularly initiates a topology adjustment mechanism to connect to nodes with strong processing capabilities to form a central topology structure;

S2、通过计算节点在某一时刻的拥塞水平判断节点的拥塞状态,进一步进行网络拓扑优化。S2. Judging the congestion state of the node by calculating the congestion level of the node at a certain moment, and further optimizing the network topology.

作为本发明的进一步改进,所述步骤S1具体为:As a further improvement of the present invention, the step S1 is specifically:

S11、节点Pi发出搜集消息来搜集参加该节点拓扑调整的候选节点集;S11. The node P i sends a collection message to collect a set of candidate nodes participating in the topology adjustment of the node;

S12、将节点搜集消息转发到一个随机选择的邻居节点,并将该节点添加到集合Si;同时存活时间TTL减1;若存活时间TTL不等于0,则重复步骤S12,继续搜集节点;S12. Forward the node collection message to a randomly selected neighbor node, and add the node to the set S i ; at the same time, the TTL of the survival time is reduced by 1; if the TTL of the survival time is not equal to 0, repeat step S12, and continue to collect nodes;

S13、将候选节点集Si返回给消息发起节点PiS13. Return the candidate node set Si to the message originating node P i ;

S14、从节点Pi的当前邻居节点集合中选择处理能力最弱且连接度大于1的节点Pmin(Ni)S14, select the node P min(Ni) with the weakest processing capability and a degree of connectivity greater than 1 from the current neighbor node set of node P i ;

S15、从候选节点集Si中取出处理能力最强的节点,记为Pmax(Si),并将其从Si中删除,若节点Pmax(Si)的处理能力不大于Pmin(Ni),执行步骤S17;若节点Pmax(Si)的处理能力大于Pmin(Ni),则向节点Pmax(Si)发出连接请求,若该节点Pmax(Si)拒绝连接请求,则重复步骤S15,继续选择下一个重连节点,若节点Pmax(Si)接受重连请求,则执行步骤S16;S15. Take out the node with the strongest processing capability from the candidate node set S i , record it as P max(Si) , and delete it from S i , if the processing capability of node P max(Si) is not greater than P min(Ni ) , execute step S17; if the processing capacity of the node P max(Si) is greater than P min(Ni) , send a connection request to the node P max(Si) , if the node P max(Si) rejects the connection request, repeat the steps S15, continue to select the next reconnection node, if the node P max(Si) accepts the reconnection request, then execute step S16;

S16、节点Pi断开与选择的邻居节点Pmin(Ni)的连接并与节点Pmax(Si)建立连接。若重新连接的节点个数达到预先设定的节点重连个数的上限数n,则执行步骤S17;若否,则执行步骤S14,选择下一次参加重连的节点;S16. The node P i disconnects from the selected neighbor node P min(Ni) and establishes a connection with the node P max(Si) . If the number of reconnected nodes reaches the preset upper limit n of the number of reconnected nodes, step S17 is performed; if not, step S14 is performed to select the node that will participate in the reconnection next time;

S17、本次拓扑调整结束。S17. This topology adjustment ends.

作为本发明的进一步改进,所述步骤S2具体为:As a further improvement of the present invention, the step S2 is specifically:

S21、移动智能体搜集信息计算节点Pj在当前时刻t的拥塞水平

Figure BDA00001946029700021
并利用
Figure BDA00001946029700022
的值来判断节点的拥塞状态,包括对每个节点设定过载、正常负载和过载三种负载状态,并设定负载状态阈值,将计算出的
Figure BDA00001946029700031
值与设定的负载状态阈值相比较从而确定节点的当前负载状态;若节点Pj负载状态是过载,则执行步骤S22;否则执行步骤S23,进行拓扑的优化,选择下一个访问节点;S21. The mobile agent collects information and calculates the congestion level of node P j at the current moment t
Figure BDA00001946029700021
and use
Figure BDA00001946029700022
value to judge the congestion state of the node, including setting three load states of overload, normal load and overload for each node, and setting the load state threshold, the calculated
Figure BDA00001946029700031
Value is compared with the load state threshold value of setting so as to determine the current load state of node; If the load state of node Pj is overload, then execute step S22; Otherwise execute step S23, carry out the optimization of topology, select next visit node;

S22、所述节点Pj随机选择一部分节点断开连接,并派生出一个子移动智能体;所述子移动智能体以它的产生节点为父节点,以广度优先遍历的方式在网络中寻找有多余处理能力的节点,每到达一个节点先判断节点的负载状态,若节点是轻载的就随机选择一个待重连的节点与之连接,然后继续寻找下一节点,直到所有的待重连节点都重连完毕,子移动智能体主动退出网络;S22. The node P j randomly selects some nodes to disconnect, and derives a child mobile agent; the child mobile agent takes its generation node as the parent node, and searches the network in a breadth-first traversal manner. For nodes with excess processing capacity, each time a node arrives, the load status of the node is judged first. If the node is lightly loaded, a node to be reconnected is randomly selected to connect to it, and then the next node is searched until all nodes to be reconnected After the reconnection is completed, the sub-mobile agent actively exits the network;

S23、移动智能体根据节点Pj的邻居节点Po对该移动智能体的吸引力表以及访问过的节点列表,来选择下一个访问节点,并迁移到该节点;所述访问过的节点列表用于记录智能体访问过的节点;所述邻居节点吸引力表是网络中任一个节点用于记录的其邻居节点的对移动智能体吸引力的表。S23. The mobile agent selects the next visited node according to the attraction table of the neighbor node P o of the node P j to the mobile agent and the list of visited nodes, and migrates to this node; the visited node list It is used to record the nodes visited by the agent; the neighbor node attractiveness table is a table for any node in the network to record the attractiveness of its neighbor nodes to the mobile agent.

作为本发明的进一步改进,所述步骤S21中,所述节点Pj在当前时刻t的拥塞水平

Figure BDA00001946029700032
的计算公式为:As a further improvement of the present invention, in the step S21, the congestion level of the node P j at the current moment t
Figure BDA00001946029700032
The calculation formula is:

CLCL PP jj (( tt )) == 11 ++ QQ PP jj (( tt )) CC PP jj -- -- -- (( 11 ))

其中,

Figure BDA00001946029700034
表示节点Pj处理一条查询消息所需的时间;如果结点正在处理消息那么此时到来的消息都被放在该节点的消息缓存队列中,
Figure BDA00001946029700035
表示时刻t节点Pj的缓存队列中待处理的消息数。in,
Figure BDA00001946029700034
Indicates the time required for node P j to process a query message; if the node is processing the message, the incoming messages at this time are placed in the message cache queue of the node,
Figure BDA00001946029700035
Indicates the number of messages to be processed in the cache queue of node P j at time t.

作为本发明的进一步改进,所述步骤S21中进一步包括:As a further improvement of the present invention, the step S21 further includes:

步骤S210所述节点Pj根据自己的负载状态决定是否接受其它节点的连接请求:若节点Pj当前为过载状态,节点Pj不接受其它节点连接请求;若节点Pj当前为正常负载,且此时如果节点Pj的上一个状态为过载,则节点Pj不接受其它节点连接请求;若节点Pj上一个状态不是过载,而节点Pj当前为正常状态,则节点Pj接受其它节点的连接请求;若节点Pj当前状态为轻载则节点Pj接受其它节点的连接请求。In step S210, the node P j decides whether to accept connection requests from other nodes according to its own load status: if the node P j is currently overloaded, the node P j does not accept other node connection requests; if the node P j is currently under normal load, and At this time, if the last state of node P j is overloaded, then node P j will not accept connection requests from other nodes; if the previous state of node P j is not overloaded, and node P j is currently in a normal state, then node P j will accept other nodes connection request; if the current state of node P j is light load, then node P j accepts connection requests from other nodes.

作为本发明的进一步改进,所述步骤S21中,所述节点Pj在当前时刻t的拥塞水平

Figure BDA00001946029700036
的计算公式为:As a further improvement of the present invention, in the step S21, the congestion level of the node P j at the current moment t
Figure BDA00001946029700036
The calculation formula is:

CLCL PP jj (( tt )) == 11 ++ QQ PP jj (( tt )) CC PP jj -- -- -- (( 11 ))

其中,表示节点Pj处理一条查询消息所需的时间;如果结点正在处理消息那么此时到来的消息都被放在该节点的消息缓存队列中,

Figure BDA00001946029700042
表示时刻t节点Pj的缓存队列中待处理的消息数。in, Indicates the time required for node P j to process a query message; if the node is processing the message, the incoming messages at this time are placed in the message cache queue of the node,
Figure BDA00001946029700042
Indicates the number of messages to be processed in the cache queue of node P j at time t.

作为本发明的进一步改进,所述步骤S21中“将计算出的值与设定的负载状态阈值相比较从而确定节点的当前负载状态”具体为:设定的两个阈值Uthred、Bthred,若

Figure BDA00001946029700044
节点Pj的状态是过载的,记变量flag=1,若节点Pj是正常负载的,记变量flag=0。若
Figure BDA00001946029700046
节点Pj的状态是轻载的,记变量flag=-1。As a further improvement of the present invention, in the step S21 "the calculated The value is compared with the set load state threshold to determine the current load state of the node" specifically: the two set thresholds U thred and B thred , if
Figure BDA00001946029700044
The state of node P j is overloaded, record the variable flag=1, if The node P j is under normal load, and the variable flag=0. like
Figure BDA00001946029700046
The state of node P j is light load, and the variable flag=-1.

作为本发明的进一步改进,所述步骤S210具体包括:所述节点Pj当前变量状态flag=1,节点Pj不接受其它节点连接请求;若节点Pj当前状态flag=0,且此时如果节点Pj的上一个变量状态flag=1,则节点Pj不接受其它节点连接请求;若节点Pj上一个变量状态flag=0或-1,而节点Pj当前变量状态flag=0则节点Pj可以接受其它节点的连接请求;若节点Pj当前变量状态flag=-1,则节点Pj可以接受其它节点的连接请求。As a further improvement of the present invention, the step S210 specifically includes: the current variable state of the node P j is flag=1, and the node P j does not accept other node connection requests; if the current state of the node P j flag=0, and at this time if If the last variable status flag of node P j is = 1, then node P j will not accept other node connection requests; if the previous variable status flag of node P j is = 0 or -1, and the current variable status of node P j is flag = 0, then the node P j can accept connection requests from other nodes; if the current variable status of node P j is flag=-1, then node P j can accept connection requests from other nodes.

作为本发明的进一步改进,所述步骤S23中,所述节点Pj设有一个该节点的邻居节点Po吸引力表,该表用来记录节点Pj上所有邻居节点的处理能力

Figure BDA00001946029700047
及连通度χ(Po,k);邻居节点Po对移动智能体的吸引力计算如下:As a further improvement of the present invention, in the step S23, the node P j is provided with a neighbor node P o attraction table of the node, which is used to record the processing capabilities of all neighbor nodes on the node P j
Figure BDA00001946029700047
and connectivity χ(P o ,k); the attractiveness of the neighbor node P o to the mobile agent is calculated as follows:

AA PP oo == CC PP oo ×× χχ (( PP oo ,, kk )) -- -- -- (( 22 ))

是邻居节点Po的处理能力,表示该邻居节点Po处理一条查询消息所需的时间;χ(Po,k)是节点Po的连通度;节点Po吸引力

Figure BDA000019460297000410
越大,则移动智能体从Pj迁移到节点Po的可能性越高; is the processing capability of the neighbor node P o , which means the time required for the neighbor node P o to process a query message; χ(P o , k) is the connectivity of the node P o ; the attractiveness of the node P o
Figure BDA000019460297000410
The larger is, the higher the possibility of the mobile agent migrating from P j to node P o ;

所述邻居节点Po的连通度计算公式如下:The connectivity calculation formula of the neighbor node P o is as follows:

χχ (( PP oo ,, kk )) == ΣΣ hh == 11 hh == kk NN (( PP oo ,, hh )) hh δδ -- -- -- (( 33 ))

其中,N(Po,h)表示与邻居节点Po相距h跳的节点的个数,k表示计算连通度的半径,δ是控制系数,1/hδ用来控制不同距离节点对连通度影响的权重,χ(Po,k)越大节点Po可能接收到的查询消息越多。Among them, N(P o , h) represents the number of nodes that are h hops away from the neighbor node P o , k represents the radius for calculating connectivity, δ is the control coefficient, and 1/h δ is used to control the connectivity of node pairs at different distances Influenced weight, the larger χ(P o ,k) is, the more query messages the node P o may receive.

相应地,一种基于移动智能体的无结构对等网络负载均衡系统,所述系统包括:Correspondingly, a kind of unstructured peer-to-peer network load balancing system based on mobile agent, said system comprises:

拓扑调整单元,用于网络中每个节点定期发起拓扑调整机制,向处理能力强的节点连接,形成中心式拓扑结构的单元;The topology adjustment unit is used for each node in the network to periodically initiate a topology adjustment mechanism, connect to nodes with strong processing capabilities, and form a central topology unit;

拓扑优化单元,用于通过计算节点在某一时刻的拥塞水平判断节点的拥塞状态,进一步进行网络拓扑优化的单元;The topology optimization unit is used to judge the congestion state of the node by calculating the congestion level of the node at a certain moment, and further perform network topology optimization;

其中,所述拓扑调整单元包括:Wherein, the topology adjustment unit includes:

节点Pi发出搜集消息来搜集参加该节点拓扑调整的候选节点集的单元;The node P i sends a collection message to collect the units of the candidate node set participating in the topology adjustment of the node;

将节点搜集消息转发到一个随机选择的邻居节点,并将该节点添加到集合SiForward the node collection message to a randomly selected neighbor node, and add this node to the set S i ;

将候选节点集Si返回给消息发起节点Pi的单元;Return the candidate node set S i to the unit of the message originating node P i ;

从节点Pi的当前邻居节点集合中选择处理能力最弱且连接度大于1的节点Pmin(Ni)的单元;Select the unit of the node P min(Ni) with the weakest processing capability and a connection degree greater than 1 from the current neighbor node set of node P i ;

从候选节点集Si中取出处理能力最强的节点Pmax(Si),比较节点Pmax(Si)与Pmin(Ni)的处理能力,则向节点Pmax(Si)发出连接请求的单元;Take out the node P max(Si) with the strongest processing capability from the candidate node set S i , compare the processing capabilities of the node P max(Si) and P min(Ni) , and send a connection request to the node P max(Si) ;

节点Pi断开与选择的邻居节点Pmin(Ni)的连接并与节点Pmax(Si)建立连接的单元;The node P i disconnects the connection with the selected neighbor node P min(Ni) and establishes a connection with the node P max(Si) ;

所述拓扑优化单元包括:The topology optimization unit includes:

移动智能体搜集信息计算节点Pj在当前时刻t的拥塞水平

Figure BDA00001946029700051
对每个节点设定过载、正常负载和过载三种负载状态,并设定负载状态阈值,将计算出的
Figure BDA00001946029700052
值与设定的负载状态阈值相比较从而确定节点的当前负载状态的单元;The mobile agent collects information and calculates the congestion level of node P j at the current moment t
Figure BDA00001946029700051
Set three load states of overload, normal load and overload for each node, and set the load state threshold, the calculated
Figure BDA00001946029700052
A unit that compares the value with a set load state threshold to determine the current load state of the node;

节点Pj随机选择一部分节点断开连接,并派生出一个子移动智能体的单元;The node P j randomly selects a part of the nodes to disconnect, and derives a sub-mobile agent unit;

子移动智能体以它的产生节点为父节点,以广度优先遍历的方式在网络中寻找有多余处理能力的节点,每到达一个节点先判断节点的负载状态,若节点是轻载的就随机选择一个待重连的节点与之连接,然后继续寻找下一节点,直到所有的待重连节点都重连完毕,子移动智能体主动退出网络的单元;The child mobile agent takes its generation node as the parent node, and searches for nodes with redundant processing capacity in the network in the way of breadth-first traversal, and judges the load status of the node every time it arrives at a node, and randomly selects the node if it is lightly loaded A node to be reconnected is connected to it, and then continues to search for the next node until all nodes to be reconnected are reconnected, and the sub-mobile agent actively exits the unit of the network;

移动智能体根据节点Pj的邻居节点Po对移动智能体的吸引力以及访问过的节点列表来选择下一个访问节点,并迁移到该节点的单元。The mobile agent selects the next visited node according to the attractiveness of the neighbor node P o of the node P j to the mobile agent and the list of visited nodes, and migrates to the unit of this node.

作为本发明系统的进一步改进,所述节点Pj在当前时刻t的拥塞水平的计算公式为:As a further improvement of the system of the present invention, the congestion level of the node P j at the current moment t The calculation formula is:

CLCL PP jj (( tt )) == 11 ++ QQ PP jj (( tt )) CC PP jj -- -- -- (( 11 ))

其中,表示节点Pj处理一条查询消息所需的时间;如果结点正在处理消息那么此时到来的消息都被放在该节点的消息缓存队列中,

Figure BDA00001946029700056
表示时刻t节点Pj的缓存队列中待处理的消息数;in, Indicates the time required for node P j to process a query message; if the node is processing the message, the incoming messages at this time are placed in the message cache queue of the node,
Figure BDA00001946029700056
Indicates the number of messages to be processed in the cache queue of node P j at time t;

所述邻居节点Po对移动智能体的吸引力计算如下:The calculation of the attractiveness of the neighbor node P o to the mobile agent is as follows:

AA PP oo == CC PP oo ×× χχ (( PP oo ,, kk )) -- -- -- (( 22 ))

是邻居节点Po的处理能力,表示该邻居节点Po处理一条查询消息所需的时间;χ(Po,k)是节点Po的连通度;节点Po吸引力

Figure BDA00001946029700063
越大,则移动智能体从Pj迁移到节点Po的可能性越高; is the processing capability of the neighbor node P o , which means the time required for the neighbor node P o to process a query message; χ(P o , k) is the connectivity of the node P o ; the attractiveness of the node P o
Figure BDA00001946029700063
The larger is, the higher the possibility of the mobile agent migrating from P j to node P o ;

所述邻居节点Po的连通度计算公式如下:The connectivity calculation formula of the neighbor node P o is as follows:

χχ (( PP oo ,, kk )) == ΣΣ hh == 11 hh == kk NN (( PP oo ,, hh )) hh δδ -- -- -- (( 33 ))

其中,N(Po,h)表示与邻居节点Po相距h跳的节点的个数,k表示计算连通度的半径,δ是控制系数,1/hδ用来控制不同距离节点对连通度影响的权重,χ(Po,k)越大节点Po可能接收到的查询消息越多。Among them, N(P o , h) represents the number of nodes that are h hops away from the neighbor node P o , k represents the radius for calculating connectivity, δ is the control coefficient, and 1/h δ is used to control the connectivity of node pairs at different distances Influenced weight, the larger χ(P o ,k) is, the more query messages the node P o may receive.

本发明的有益效果是:本发明网络中每个节点定期启动拓扑重连机制,以形成中心化的拓扑结构。同时节点不断搜集邻居节点的处理能力、连通度等信息以指导移动智能体有目的在网络中不断迁移并不断监控网络中重要节点的负载情况,对网络的拓扑结构进行优化调整,避免拥塞的发生,从而实现无结构对等网络上的负载均衡,还可以根据网络的负载状况及时的调整网络拓扑结构,能够有效地避免网络节点拥塞,提高资源查找效率。The beneficial effects of the present invention are: each node in the network of the present invention periodically starts a topology reconnection mechanism to form a centralized topology structure. At the same time, nodes continuously collect information such as processing capabilities and connectivity of neighboring nodes to guide mobile agents to migrate purposefully in the network and constantly monitor the load of important nodes in the network, optimize and adjust the topology of the network to avoid congestion. , so as to realize the load balance on the unstructured peer-to-peer network, and adjust the network topology in time according to the load status of the network, which can effectively avoid network node congestion and improve resource search efficiency.

附图说明 Description of drawings

图1为本发明一种基于移动智能体的无结构对等网络负载均衡方法的流程图。FIG. 1 is a flow chart of a mobile agent-based unstructured peer-to-peer network load balancing method in the present invention.

图2为图1中步骤S1网络节点拓扑定期调整的具体流程图。FIG. 2 is a specific flow chart of step S1 in FIG. 1 for periodic network node topology adjustment.

图3为图1中步骤S2移动智能体的拓扑优化的具体流程图。FIG. 3 is a specific flowchart of the topology optimization of the mobile agent in step S2 in FIG. 1 .

图4为本发明一实施方式中网络拓扑模拟图。Fig. 4 is a network topology simulation diagram in an embodiment of the present invention.

图5为本发明一实施方式中经过拓扑重连后网络节点的聚集程度图。FIG. 5 is a diagram of the degree of aggregation of network nodes after topology reconnection in an embodiment of the present invention.

图6为本发明一实施方式中经过拓扑重连后网络中不同能力节点的平均连接度变化图。FIG. 6 is a graph showing changes in the average connectivity of nodes with different capabilities in the network after topology reconnection in an embodiment of the present invention.

图7为本发明一实施方式中经过拓扑重连后查询需要的经过的平均节点数变化图。Fig. 7 is a change diagram of the average number of nodes passed by the query after topology reconnection in an embodiment of the present invention.

图8为本发明一种基于移动智能体的无结构对等网络负载均衡系统结构示意图。FIG. 8 is a schematic structural diagram of a mobile agent-based unstructured peer-to-peer network load balancing system according to the present invention.

具体实施方式 Detailed ways

以下将结合附图所示的各实施方式对本发明进行详细描述。但这些实施方式并不限制本发明,本领域的普通技术人员根据这些实施方式所做出的结构、方法、或功能上的变换均包含在本发明的保护范围内。The present invention will be described in detail below in conjunction with various embodiments shown in the drawings. However, these embodiments do not limit the present invention, and any structural, method, or functional changes made by those skilled in the art according to these embodiments are included in the protection scope of the present invention.

参图1所示为本发明一种基于移动智能体的无结构对等网络负载均衡方法的流程图,包括以下步骤:Referring to Fig. 1 shown is a kind of flow chart of the unstructured peer-to-peer network load balancing method based on mobile agent of the present invention, comprises the following steps:

S1、网络中每个节点定期发起拓扑调整机制,向处理能力强的节点连接,形成中心式拓扑结构;S1. Each node in the network regularly initiates a topology adjustment mechanism to connect to nodes with strong processing capabilities to form a central topology structure;

S2、通过计算节点在某一时刻的拥塞水平判断节点的拥塞状态,进一步进行网络拓扑优化。S2. Judging the congestion state of the node by calculating the congestion level of the node at a certain moment, and further optimizing the network topology.

参图2所示为本实施方式中步骤S1网络节点拓扑定期调整的具体流程图,包括以下步骤:Referring to Fig. 2, it is a specific flowchart of step S1 network node topology regular adjustment in this embodiment, including the following steps:

S11、节点Pi发出搜集消息来搜集参加该节点拓扑调整的候选节点集。假设该候选节点集合为Si,且初始Si为空,该消息的存活时间TTL(Time to Live,TTL)为K;S11. The node P i sends a collection message to collect a set of candidate nodes participating in the topology adjustment of the node. Assuming that the set of candidate nodes is S i , and the initial S i is empty, the TTL (Time to Live, TTL) of the message is K;

S12、将节点搜集消息转发到一个随机选择的邻居节点,并将该节点添加到集合Si。搜集消息的存活时间TTL减1,判断存活时间TTL是否等于0,若是,节点搜集过程结束,执行步骤S13,若否,重复步骤S12,继续搜集该节点;S12. Forward the node collection message to a randomly selected neighbor node, and add this node to the set S i . The time-to-live TTL of the collected messages is reduced by 1, and it is judged whether the time-to-live TTL is equal to 0. If so, the node collection process ends, and step S13 is executed. If not, step S12 is repeated to continue collecting the node;

S13、将候选节点集Si返回给消息发起节点PiS13. Return the candidate node set S i to the message originating node P i ;

S14、从节点Pi的当前邻居节点集合中选择处理能力最弱且连接度大于1的节点Pmin(Ni),Ni是节点Pi的邻居节点的集合;S14. Select the node P min(Ni) with the weakest processing capability and a connection degree greater than 1 from the current neighbor node set of node P i , where N i is the set of neighbor nodes of node P i ;

S15、从候选节点集Si中取出处理能力最强的节点Pmax(Si),并将节点Pmax(Si)其从Si中删除。比较节点Pmax(Si)与Pmin(Ni)的处理能力,若节点Pmax(Si)的处理能力不大于Pmin(Ni),则执行步骤S17;若节点Pmax(Si)的处理能力大于Pmin(Ni),则向节点Pmax(Si)发出连接请求。若节点Pmax(Si)拒绝连接请求,则重复步骤S15,继续选择下一个重连节点,若节点Pmax(Si)接受连接请求,则执行步骤S16;S15. Take out the node P max(Si) with the strongest processing capability from the candidate node set S i , and delete the node P max(Si) from S i . Compare the processing capabilities of nodes P max(Si) and P min(Ni) , if the processing capability of node P max(Si) is not greater than P min(Ni) , execute step S17; if the processing capability of node P max(Si) If it is greater than P min(Ni) , a connection request is sent to node P max(Si) . If the node P max (Si) rejects the connection request, then repeat step S15, continue to select the next reconnection node, if the node P max (Si) accepts the connection request, then perform step S16;

S16、节点Pi断开与选择的邻居节点Pmin(Ni)的连接并与节点Pmax(Si)建立连接。若重新连接的节点个数达到预先设定的节点重连个数的上限数n,则执行步骤S17;若否,则执行步骤S14,选择下一次参加重连的节点;S16. The node P i disconnects from the selected neighbor node P min(Ni) and establishes a connection with the node P max(Si) . If the number of reconnected nodes reaches the preset upper limit n of the number of reconnected nodes, step S17 is performed; if not, step S14 is performed to select the node that will participate in the reconnection next time;

S17、本次拓扑调整结束。S17. This topology adjustment ends.

单纯依靠节点自身定期的拓扑重连,最终会形成一个以处理能力最强的几个节点为中心的集中式网络,在没有拥塞的情况下这种结构的网络资源查找效率是最高的,但是几乎所有的节点的资源查找请求都会发送的中心节点,中心节点可能很容易就会发生拥塞,这会严重影响资源查找的效率,为了避免拥塞的发生,在此基础上又引入了基于移动智能体的拓扑优化方法。Simply relying on the regular topological reconnection of the nodes themselves will eventually form a centralized network centered on the nodes with the strongest processing capabilities. In the absence of congestion, the network resource search efficiency of this structure is the highest, but almost The resource search requests of all nodes will be sent to the central node, and the central node may easily be congested, which will seriously affect the efficiency of resource search. In order to avoid the occurrence of congestion, the mobile agent-based topology optimization method.

参图3所示为本实施方式中步骤S2移动智能体的拓扑优化的具体流程图,包括以下步骤:Referring to Fig. 3, it is a specific flowchart of the topology optimization of the step S2 mobile agent in the present embodiment, including the following steps:

S21、移动智能体搜集信息计算节点Pj在当前时刻t的拥塞水平

Figure BDA00001946029700081
并利用
Figure BDA00001946029700082
的值来判断节点的拥塞状态,确定节点的当前负载状态,若节点Pj负载状态是过载的,则执行步骤S22;否则执行步骤S23,进行拓扑的优化,选择下一个访问节点;S21. The mobile agent collects information and calculates the congestion level of node P j at the current moment t
Figure BDA00001946029700081
and use
Figure BDA00001946029700082
value to judge the congestion state of the node, determine the current load state of the node, if the load state of the node P j is overloaded, then perform step S22; otherwise perform step S23, perform topology optimization, and select the next access node;

S22、节点Pj随机选择一部分节点断开连接,并派生出一个子移动智能体;子移动智能体以它的产生节点为父节点,以广度优先遍历的方式在网络中寻找有多余处理能力的节点,每到达一个节点先判断节点的负载状态,若节点是轻载的就随机选择一个待重连的节点与之连接,然后继续寻找下一节点,直到所有的待重连节点都重连完毕,子移动智能体主动退出网络;S22. Node P j randomly selects some nodes to disconnect, and derives a child mobile agent; the child mobile agent takes its generation node as the parent node, and searches for redundant processing capacity in the network in the way of breadth-first traversal. Nodes, each time a node is reached, first judge the load status of the node. If the node is lightly loaded, randomly select a node to be reconnected to connect to it, and then continue to search for the next node until all the nodes to be reconnected are reconnected. , the child mobile agent actively exits the network;

S23、移动智能体根据节点Pj的邻居对它的吸引力列表和移动智能体访问过的节点列表来选择下一个访问节点,并迁移到该节点。S23. The mobile agent selects the next visited node according to the attractiveness list of the neighbors of the node P j and the list of nodes visited by the mobile agent, and migrates to this node.

其中步骤S21中,节点Pj在当前时刻t的拥塞水平

Figure BDA00001946029700083
的计算公式为:In step S21, the congestion level of node P j at the current moment t
Figure BDA00001946029700083
The calculation formula is:

CLCL PP jj (( tt )) == 11 ++ QQ PP jj (( tt )) CC PP jj -- -- -- (( 11 ))

Figure BDA00001946029700085
表示节点Pj处理一条查询消息所需的时间;如果结点正在处理消息那么此时到来的消息都被放在该节点的消息缓存队列中,
Figure BDA00001946029700086
表示时刻t节点Pj的缓存队列中待处理的消息数。该公式表示在时刻t一个查询消息被转发到节点Pj到处理完毕需要花费的时间。
Figure BDA00001946029700085
Indicates the time required for node P j to process a query message; if the node is processing the message, the incoming messages at this time are placed in the message cache queue of the node,
Figure BDA00001946029700086
Indicates the number of messages to be processed in the cache queue of node P j at time t. This formula expresses the time it takes for a query message to be forwarded to node P j to be processed at time t.

步骤S21中“确定节点的当前负载状态”具体为:"Determine the current load state of the node" in step S21 is specifically:

每个节点都设定有三个负载状态,根据

Figure BDA00001946029700087
的值与设定的两个阈值Uthred、Bthred相比较从而确定节点的当前负载状态:Each node is set to have three load states, according to
Figure BDA00001946029700087
The value of is compared with the set two thresholds U thred and B thred to determine the current load status of the node:

Figure BDA00001946029700088
节点Pj的状态是过载的,记变量flag=1,此时认为该节点拥塞;like
Figure BDA00001946029700088
The state of the node P j is overloaded, and the variable flag=1 is considered to be congested at this time;

Figure BDA00001946029700089
节点Pj是正常负载的,记变量flag=0;like
Figure BDA00001946029700089
Node P j is under normal load, record variable flag=0;

Figure BDA000019460297000810
节点Pj的状态是轻载的,记变量flag=-1。like
Figure BDA000019460297000810
The state of node P j is light load, and the variable flag=-1.

进一步地,节点Pj根据自己的负载状态决定是否接受其它节点的连接请求。即节点Pj当前变量状态flag=1,节点Pj不接受其它节点连接请求;若节点Pj当前状态flag=0,且此时如果节点Pj的上一个变量状态flag=1,则节点Pj不接受其它节点连接请求;若节点Pj上一个变量状态flag=0或-1,而节点Pj当前变量状态flag=0则节点Pj可以接受其它节点的连接请求;若节点Pj当前变量状态flag=-1,则节点Pj可以接受其它节点的连接请求。Further, node Pj decides whether to accept connection requests from other nodes according to its own load status. That is , the current variable state of node P j is flag=1, and node P j does not accept connection requests from other nodes; j does not accept connection requests from other nodes; if a variable status flag on node P j =0 or -1, and node P j ’s current variable status flag=0, then node P j can accept connection requests from other nodes; if node P j is currently If the variable status flag=-1, the node P j can accept connection requests from other nodes.

在步骤S23中,为确定节点Pj上所有邻居节点的吸引能力,节点Pj保持有一个该节点的邻居节点吸引力表,该表用来记录节点Pj上所有邻居节点的处理能力及连通度。假设节点Pj的某一邻居节点为Po,Po的连通度计算公式如下:In step S23, in order to determine the attractiveness of all neighbor nodes on node P j , node P j maintains a neighbor node attractiveness table of the node, which is used to record the processing capacity and connectivity of all neighbor nodes on node P j Spend. Assuming that a neighbor node of node P j is P o , the calculation formula of the connectivity of P o is as follows:

χχ (( PP oo ,, kk )) == ΣΣ hh == 11 hh == kk NN (( PP oo ,, hh )) hh δδ -- -- -- (( 22 ))

其中N(Po,h)表示与节点Po相距h跳的节点的个数,k表示计算连通度的半径,δ是控制系数。1/hδ用来控制不同距离节点对连通度影响的权重,χ(Po,k)越大节点Po可能接收到的查询消息越多。Among them, N(P o , h) represents the number of nodes that are h hops away from node P o , k represents the radius for calculating connectivity, and δ is the control coefficient. 1/h δ is used to control the weight of the impact of nodes with different distances on connectivity. The larger χ(P o ,k) is, the more query messages the node P o may receive.

节点Po对移动智能体的吸引力计算如下:The attractiveness of node P o to the mobile agent is calculated as follows:

AA PP oo == CC PP oo ×× χχ (( PP oo ,, kk )) -- -- -- (( 33 ))

Figure BDA00001946029700093
是节点Po的处理能力,χ(Po,k)是节点Po的连通度。节点Po吸引力
Figure BDA00001946029700094
越大,则移动智能体从Pj迁移到节点Po的可能性越高。
Figure BDA00001946029700093
is the processing capability of node P o , χ(P o ,k) is the connectivity of node P o . Node P o attraction
Figure BDA00001946029700094
The larger , the higher the possibility of the mobile agent migrating from P j to node P o .

下面给出本发明的一个具体实施过程的例子,实例中包含10000个网络节点,每个节点上有50个不同的数据,每个数据在网络中有100个副本。由加入网络的第一个节点生成移动智能体,节点的处理能力分五个水平分别为:0.1、1、10、100、1000,所占网络节点的百分比对应为:20、45、30、4.9、0.1,采用random walks的方式进行资源搜索,利用以下两个方式将进行拓扑重连,以实现负载均衡。一个是节点自身定期进行的拓扑重连,目的是使处理能力强的节点可以拥有更多的连接,从而能够处理更多的查询消息,充分利用它们的处理能力;另一个是基于移动智能体的拓扑优化,目的是防止处理能力强的节点拥有过多的邻居造成拥塞,反而影响网络的性能。An example of a specific implementation process of the present invention is given below. The example includes 10,000 network nodes, each node has 50 different data, and each data has 100 copies in the network. The mobile agent is generated by the first node joining the network. The processing power of the node is divided into five levels: 0.1, 1, 10, 100, 1000, and the percentage of network nodes is corresponding to: 20, 45, 30, 4.9 , 0.1, use random walks to search for resources, and use the following two methods to reconnect the topology to achieve load balancing. One is the periodic topology reconnection of nodes themselves. The purpose is to enable nodes with strong processing capabilities to have more connections, so that they can process more query messages and make full use of their processing capabilities; the other is based on mobile agents. The purpose of topology optimization is to prevent nodes with strong processing capabilities from having too many neighbors to cause congestion, which will affect the performance of the network instead.

每个节点每隔30秒发起一次拓扑重连,使自身向处理能力强的节点连接,图4是网络拓扑的一个模拟图,下面为模拟图中一个节点P1的一次拓扑重连过程:Each node initiates a topology reconnection every 30 seconds to connect itself to a node with strong processing capabilities. Figure 4 is a simulation diagram of the network topology. The following is a topology reconnection process of a node P 1 in the simulation diagram:

S11、节点P1发出搜集消息来搜集参加该节点拓扑调整的候选节点集。假设该候选节点集合为S1,且初始S1为空,存活时间TTL为5。S11. The node P 1 sends a collection message to collect a set of candidate nodes participating in the topology adjustment of the node. Assume that the set of candidate nodes is S 1 , and the initial S 1 is empty, and the TTL is 5.

S12、将节点搜集消息转发到一个随机选择的邻居节点,并将该节点添加到集合S1,同时存活时间TTL减1。若存活时间TTL不等于0,则重复步骤S12,继续搜集节点;否则节点搜集过程结束,执行步骤S13。S12. Forward the node collection message to a randomly selected neighbor node, and add the node to the set S 1 , and decrease the TTL by 1 at the same time. If the survival time TTL is not equal to 0, then repeat step S12 to continue collecting nodes; otherwise, the node collecting process ends and step S13 is executed.

S13、将候选节点集S1返回给消息发起节点P1,假设S1为{P,P4,P9,P12,P13},接着执行步骤S14。S13. Return the candidate node set S 1 to the message originating node P 1 , assuming that S 1 is {P, P 4 , P 9 , P 12 , P 13 }, and then execute step S14.

S14、从节点P1的当前邻居节点集合,根据图4则P1节点当前邻居节点集合为{P,P3},选择处理能力最弱且连接度大于1的节点,记为Pmin(N1),N1是节点P1的邻居节点集;接着执行步骤S15。例如P1的邻居节点中当前处理能力最弱的节点是P3,Pmin(N1)为P3节点,然后执行步骤S15。S14, from the current neighbor node set of node P1 , according to Figure 4, the current neighbor node set of P1 node is {P, P3 }, select the node with the weakest processing ability and connection degree greater than 1, and record it as Pmin(N1 ) , N 1 is the neighbor node set of node P 1 ; then execute step S15. For example, among the neighbor nodes of P 1 , the node with the weakest processing capability is P 3 , and P min(N1) is the node P 3 , and then step S15 is executed.

S15、从候选节点集S1中取出处理能力最强的节点,记为Pmax(S1),将Pmax(S1)从S1中删除,若节点Pmax(S1)的处理能力不大于Pmin(N1),则说明所有剩余候选节点的处理能力都比节点P1的现有邻居节点弱,执行步骤S17;若节点Pmax(S1)的处理能力大于Pmin(N1),则向节点Pmax(S1)发出连接请求,若该节点Pmax(S1)拒绝连接请求,则重复步骤S15,继续选择下一个重连节点,若节点Pmax(S1)接受重连请求,则执行步骤S16。例如从候选节点集S1选择当前处理能力最强的节点是P4,且P4的处理能力大于步骤S14中选择的P3节点,则节点P1向P4发出连接请求,且P4接受了连接请求,则执行步骤S16。S15. Take out the node with the strongest processing capability from the candidate node set S 1 , record it as P max(S1) , delete P max(S1) from S 1 , if the processing capability of node P max(S1) is not greater than P min(N1) , it means that the processing capabilities of all the remaining candidate nodes are weaker than the existing neighbor nodes of node P 1 , go to step S17; if the processing capability of node P max(S1) is greater than P min(N1) , send P max(S1) sends a connection request, if the node P max(S1) rejects the connection request, then repeat step S15, continue to select the next reconnection node, if the node P max(S1) accepts the reconnection request, then execute step S16 . For example, the node with the strongest processing capability selected from the candidate node set S1 is P4 , and the processing capability of P4 is greater than the node P3 selected in step S14, then node P1 sends a connection request to P4 , and P4 accepts If the connection request is received, step S16 is executed.

S16、节点P1断开与选择的邻居节点Pmin(N1)的连接并与节点Pmax(S1)建立连接,若已经有n个候选节点参与重连,本实例中n选择3,则执行步骤S17;否则执行步骤S14,开始选择下一次参加重连的节点。例如节点P1与通过步骤S14选择的P3节点断开连接并与P4节点建立连接,由于没有3个候选节点参与重连,则执行步骤S14,开始选择下一次参加重连的节点。S16. Node P 1 disconnects the connection with the selected neighbor node P min (N1) and establishes a connection with node P max (S1) . If there are already n candidate nodes participating in the reconnection, in this example n selects 3, then execute Step S17; otherwise, execute step S14, and start to select a node to participate in the reconnection next time. For example, node P1 disconnects from node P3 selected by step S14 and establishes a connection with node P4 . Since there are no three candidate nodes participating in reconnection, step S14 is executed to start selecting the node to participate in reconnection next time.

S17、本次拓扑调整结束。S17. This topology adjustment ends.

参图4所示,假设移动智能体当前所在节点为P,移动智能体在节点P的拓扑优化过程如下:As shown in Figure 4, assuming that the node where the mobile agent is currently located is P, the topology optimization process of the mobile agent at node P is as follows:

S21、移动智能体搜集信息计算节点P在当前时刻T的拥塞水平CLP(T),并利用CLP(T)的值来判断节点的拥塞状态,同时每个节点都设定有三个负载状态,我们将计算出来的CLP(T)值与设定的两个阈值Uthred、Bthred相比较从而确定节点的当前负载状态。设定的两个阈值Uthred、Bthred分别为0.1和0.05。若CLP(T)>Uthred,节点的状态是过载的,记节点P在时刻T时的当前变量状态flag=1,此时认为该节点拥塞。若Bthred<=CLP(T)<=Uthred,节点P是正常负载,记flag=0。若CLP(T)<Bthred,节点P的状态是轻载的,记flag=-1。节点P根据它的负载状态决定下一个执行步骤,即若节点P的状态是过载的,则执行步骤S22,进行拓扑的优化;否则执行步骤S23,选择下一个访问节点。S21. The mobile agent collects information to calculate the congestion level CL P (T) of node P at the current moment T, and uses the value of CL P (T) to judge the congestion state of the node. At the same time, each node has three load states. , we compare the calculated CLP (T) value with the two set thresholds U thred and B thred to determine the current load status of the node. The two thresholds U thred and B thred are set to be 0.1 and 0.05 respectively. If CL P (T)>U thred , the state of the node is overloaded, record the current variable state flag=1 of the node P at time T, and at this time, the node is considered to be congested. If B thred <=CL P (T)<=U thred , node P is under normal load, and flag=0. If CL P (T)<B thred , the state of node P is lightly loaded, record flag=-1. The node P decides the next execution step according to its load state, that is, if the state of the node P is overloaded, execute step S22 to optimize the topology; otherwise execute step S23 to select the next access node.

此外节点P根据自己的负载状态决定是否接受其它节点的连接请求。即节点P当前变量状态flag=1,节点P不接受其它节点连接请求;若节点P当前状态flag=0,且此时如果节点P的上一个变量状态flag=1,则节点P不接受其它节点连接请求;若节点P上一个变量状态flag=0或-1,而节点P当前变量状态flag=0则节点P可以接受其它节点的连接请求;若节点P当前变量状态flag=-1,则节点P可以接受其它节点的连接请求;In addition, node P decides whether to accept connection requests from other nodes according to its own load status. That is, the current variable state flag of node P=1, node P does not accept other node connection requests; if the current state flag of node P=0, and if the previous variable state flag of node P=1 at this time, node P does not accept other nodes Connection request; if a variable state flag on node P=0 or -1, and node P’s current variable state flag=0, then node P can accept connection requests from other nodes; if node P’s current variable state flag=-1, then node P P can accept connection requests from other nodes;

S22、节点P随机选择一部分节点断开与之的连接,本实施例中一次与两个节点断开连接。假设节点P与两个节点断开连接,并派生出一个子移动智能体。S22. The node P randomly selects some nodes to disconnect from it, and in this embodiment, disconnects from two nodes at a time. Assume node P disconnects from two nodes and spawns a child mobile agent.

子移动智能体主要负责重连被断开的连接,子移动智能体以它的产生节点为父节点,以广度优先遍历的方式在网络中寻找有多余处理能力的节点,每到达一个节点先判断节点的负载状态,若节点是轻载的就随机选择一个待重连的节点与之连接,然后继续寻找下一节点,直到所有的待重连节点都重连完毕,此时子移动智能体主动退出网络;The child mobile agent is mainly responsible for reconnecting the disconnected connection. The child mobile agent takes its generation node as the parent node, and searches for nodes with redundant processing capacity in the network in the way of breadth-first traversal, and judges each time it reaches a node. The load status of the node. If the node is lightly loaded, randomly select a node to be reconnected to connect with it, and then continue to search for the next node until all the nodes to be reconnected are reconnected. At this time, the sub-mobile agent actively log out of the network;

S23、移动智能体根据节点P的邻居对它的吸引力及其访问过的节点列表来选择下一个访问节点,并迁移到该节点,其中k和δ分别为2和1。假设图4中节点P的邻居节点按照对移动智能体的吸引力从大到小排序为:P4、P5、P3、P1、P2,而移动智能体最近访问过的节点列表为:P12、P9、P4,所以移动智能体的下一个访问节点为P5S23. The mobile agent selects the next visited node according to the attractiveness of the neighbors of node P to it and the list of visited nodes, and migrates to this node, where k and δ are 2 and 1 respectively. Assume that the neighbor nodes of node P in Figure 4 are sorted from large to small according to their attractiveness to the mobile agent: P 4 , P 5 , P 3 , P 1 , P 2 , and the list of nodes recently visited by the mobile agent is : P 12 , P 9 , P 4 , so the next visiting node of the mobile agent is P 5 .

图5是拓扑优化过程中网络节点的聚集程度CC(clustering coefficient)变化图,CC的计算公式如下:Figure 5 is a change diagram of the clustering coefficient (CC) of network nodes during the topology optimization process. The calculation formula of CC is as follows:

CCCC == 11 || VV || &Sigma;&Sigma; pp &Element;&Element; VV CCCC pp -- -- -- (( 44 ))

其中V是网络中所有节点的集合,CCp是节点p的邻居节点的聚集系数,计算公式如下:Where V is the set of all nodes in the network, CC p is the aggregation coefficient of the neighbor nodes of node p, and the calculation formula is as follows:

CCCC pp == || (( NN pp &times;&times; NN pp )) &cap;&cap; EE. || kk pp (( kk pp -- 11 )) -- -- -- (( 55 ))

其中Np是节点p的邻居节点的集合,kp=|Np|是节点p的邻居节点的数目,E是网络中节点间的连接的集合。0<=CC<=1,CC值越小网络节点分布的越随机,CC值越大节点越集中。Where N p is the set of neighbor nodes of node p, k p = |N p | is the number of neighbor nodes of node p, and E is the set of connections between nodes in the network. 0<=CC<=1, the smaller the CC value, the more random distribution of network nodes, and the larger the CC value, the more concentrated the nodes.

由图5可以看出,随着拓扑结构的改变,节点的聚集程度越来越高,并达到一个基本稳定的状态,可见网络的拓扑结构由完全随机的,变得越来越集中了。It can be seen from Figure 5 that as the topology changes, the degree of node aggregation becomes higher and higher, and reaches a basically stable state. It can be seen that the topology of the network becomes more and more concentrated from completely random.

图6给出了拓扑重连过程中相同处理能力节点平均节点度(邻居节点的数目)的变化,实验中以100秒为单位来观察节点度的变化,可以看出开始有大量的节点重连到处理能力最强的节点,但很快就达到一个稳定的状态,而且处理能力越强的节点连接度越高,说明处理能力越强的节点可以分担越多的查询负载,能够充分利用网络节点的处理能力。Figure 6 shows the changes in the average node degree (the number of neighbor nodes) of nodes with the same processing capacity during the topology reconnection process. In the experiment, the change of node degree was observed in units of 100 seconds. It can be seen that a large number of nodes began to reconnect to the node with the strongest processing capacity, but it quickly reaches a stable state, and the higher the connection degree of the node with the stronger processing capacity, it means that the node with the stronger processing capacity can share more query load and can make full use of the network nodes processing capacity.

图7是查询成功需要的平均跳数的变化图,实验中对每1000个查询需要的跳数求均值得到如图的结果,随着对网络拓扑结构的优化,查询需要的平均跳数逐渐减小,从图中可以看出,拓扑优化后需要的跳数比开始降低了很多,而查询需要的跳数越少,搜索算法的效率就越高,可见基于移动智能体的拓扑优化方法大大提高了网络的搜索性能。Figure 7 is a change diagram of the average number of hops required for a successful query. In the experiment, the average value of the hops required for every 1000 queries was obtained as shown in the figure. With the optimization of the network topology, the average number of hops required for the query gradually decreased. It can be seen from the figure that the number of hops required after topology optimization is much lower than that at the beginning, and the fewer hops required for query, the higher the efficiency of the search algorithm. It can be seen that the topology optimization method based on mobile agents is greatly improved. network search performance.

相应地,参图8所示,本发明的一种基于移动智能体的无结构对等网络负载均衡系统100,包括:Correspondingly, as shown in FIG. 8, a mobile agent-based unstructured peer-to-peer network load balancing system 100 of the present invention includes:

拓扑调整单元10,用于网络中每个节点定期发起拓扑调整机制,向处理能力强的节点连接,形成中心式拓扑结构的单元;The topology adjustment unit 10 is used for each node in the network to periodically initiate a topology adjustment mechanism to connect to nodes with strong processing capabilities to form a central topology unit;

拓扑优化单元20,用于通过计算节点在某一时刻的拥塞水平判断节点的拥塞状态,进一步进行网络拓扑优化的单元;The topology optimization unit 20 is used to judge the congestion state of the node by calculating the congestion level of the node at a certain moment, and further perform network topology optimization;

拓扑调整单元10包括:The topology adjustment unit 10 includes:

节点Pi发出搜集消息来搜集参加该节点拓扑调整的候选节点集的单元;The node P i sends a collection message to collect the units of the candidate node set participating in the topology adjustment of the node;

将节点搜集消息转发到一个随机选择的邻居节点,并将该节点添加到集合SiForward the node collection message to a randomly selected neighbor node, and add this node to the set S i ;

将候选节点集Si返回给消息发起节点Pi的单元;Return the candidate node set S i to the unit of the message originating node P i ;

从节点Pi的当前邻居节点集合中选择处理能力最弱且连接度大于1的节点Pmin(Ni)的单元;Select the unit of the node P min(Ni) with the weakest processing capability and a connection degree greater than 1 from the current neighbor node set of node P i ;

从候选节点集Si中取出处理能力最强的节点Pmax(Si),比较节点Pmax(Si)与Pmin(Ni)的处理能力,则向节点Pmax(Si)发出连接请求的单元;Take out the node P max(Si) with the strongest processing capability from the candidate node set S i , compare the processing capabilities of the node P max(Si) and P min(Ni) , and send a connection request to the node P max(Si) ;

节点Pi断开与选择的邻居节点Pmin(Ni)的连接并与节点Pmax(Si)建立连接的单元;The node P i disconnects the connection with the selected neighbor node P min(Ni) and establishes a connection with the node P max(Si) ;

拓扑优化单元20包括:The topology optimization unit 20 includes:

移动智能体搜集信息计算节点Pj在当前时刻t的拥塞水平对每个节点设定过载、正常负载和过载三种负载状态,并设定负载状态阈值,将计算出的

Figure BDA00001946029700122
值与设定的负载状态阈值相比较从而确定节点的当前负载状态的单元;其中,节点Pj在当前时刻t的拥塞水平
Figure BDA00001946029700123
的计算公式为:The mobile agent collects information and calculates the congestion level of node P j at the current moment t Set three load states of overload, normal load and overload for each node, and set the load state threshold, the calculated
Figure BDA00001946029700122
The value is compared with the set load state threshold to determine the unit of the current load state of the node; where, the congestion level of node P j at the current time t
Figure BDA00001946029700123
The calculation formula is:

CLCL PP jj (( tt )) == 11 ++ QQ PP jj (( tt )) CC PP jj

其中,

Figure BDA00001946029700125
表示节点Pj处理一条查询消息所需的时间;如果结点正在处理消息那么此时到来的消息都被放在该节点的消息缓存队列中,表示时刻t节点Pj的缓存队列中待处理的消息数;in,
Figure BDA00001946029700125
Indicates the time required for node P j to process a query message; if the node is processing the message, the incoming messages at this time are placed in the message cache queue of the node, Indicates the number of messages to be processed in the cache queue of node P j at time t;

节点Pj随机选择一部分节点断开连接,并派生出一个子移动智能体的单元;The node P j randomly selects a part of the nodes to disconnect, and derives a sub-mobile agent unit;

子移动智能体以它的产生节点为父节点,以广度优先遍历的方式在网络中寻找有多余处理能力的节点,每到达一个节点先判断节点的负载状态,若节点是轻载的就随机选择一个待重连的节点与之连接,然后继续寻找下一节点,直到所有的待重连节点都重连完毕,子移动智能体主动退出网络的单元;The child mobile agent takes its generation node as the parent node, and searches for nodes with redundant processing capacity in the network in the way of breadth-first traversal, and judges the load status of the node every time it arrives at a node, and randomly selects the node if it is light-loaded A node to be reconnected is connected to it, and then continues to search for the next node until all nodes to be reconnected are reconnected, and the sub-mobile agent actively exits the network unit;

移动智能体根据节点Pj的邻居节点Po对移动智能体的吸引力以及访问过的节点列表来选择下一个访问节点,并迁移到该节点的单元;其中,邻居节点Po对移动智能体的吸引力计算如下:The mobile agent selects the next visited node according to the attractiveness of the neighbor node P o of the node P j to the mobile agent and the list of visited nodes, and migrates to the unit of the node; among them, the neighbor node P o is to the mobile agent The attraction for is calculated as follows:

AA PP oo == CC PP oo &times;&times; &chi;&chi; (( PP oo ,, kk ))

Figure BDA00001946029700132
是邻居节点Po的处理能力,表示该邻居节点Po处理一条查询消息所需的时间;x(Po,k)是节点Po的连通度;节点Po吸引力
Figure BDA00001946029700133
越大,则移动智能体从Pj迁移到节点Po的可能性越高;
Figure BDA00001946029700132
is the processing capability of the neighbor node P o , which means the time required for the neighbor node P o to process a query message; x(P o ,k) is the connectivity of the node P o ; the attractiveness of the node P o
Figure BDA00001946029700133
The larger is, the higher the possibility of the mobile agent migrating from P j to node P o ;

所述邻居节点Po的连通度计算公式如下:The connectivity calculation formula of the neighbor node P o is as follows:

&chi;&chi; (( PP oo ,, kk )) == &Sigma;&Sigma; hh == 11 hh == kk NN (( PP oo ,, hh )) hh &delta;&delta;

其中,N(Po,h)表示与邻居节点Po相距h跳的节点的个数,k表示计算连通度的半径,δ是控制系数,1/hδ用来控制不同距离节点对连通度影响的权重,χ(Po,k)越大节点Po可能接收到的查询消息越多。Among them, N(P o , h) represents the number of nodes that are h hops away from the neighbor node P o , k represents the radius for calculating connectivity, δ is the control coefficient, and 1/h δ is used to control the connectivity of node pairs at different distances Influenced weight, the larger χ(P o ,k) is, the more query messages the node P o may receive.

与现有技术相比,本发明网络中每个节点定期启动拓扑重连机制,以形成中心化的拓扑结构。同时节点不断搜集邻居节点的处理能力、连通度等信息以指导移动智能体有目的在网络中不断迁移并不断监控网络中重要节点的负载情况,对网络的拓扑结构进行优化调整,避免拥塞的发生,从而实现无结构对等网络上的负载均衡,还可以根据网络的负载状况及时的调整网络拓扑结构,能够有效地避免网络节点拥塞,提高资源查找效率。Compared with the prior art, each node in the network of the present invention periodically starts a topology reconnection mechanism to form a centralized topology structure. At the same time, nodes continuously collect information such as processing capabilities and connectivity of neighboring nodes to guide mobile agents to migrate purposefully in the network and constantly monitor the load of important nodes in the network, optimize and adjust the topology of the network to avoid congestion. , so as to realize the load balance on the unstructured peer-to-peer network, and adjust the network topology in time according to the load status of the network, which can effectively avoid network node congestion and improve resource search efficiency.

为了描述的方便,描述以上装置时以功能分为各种单元分别描述。当然,在实施本申请时可以把各单元的功能在同一个或多个软件和/或硬件中实现。For the convenience of description, when describing the above devices, functions are divided into various units and described separately. Of course, when implementing the present application, the functions of each unit can be implemented in one or more pieces of software and/or hardware.

通过以上的实施方式的描述可知,本领域的技术人员可以清楚地了解到本申请可借助软件加必需的通用硬件平台的方式来实现。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品可以存储在存储介质中,如ROM/RAM、磁碟、光盘等,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施方式或者实施方式的某些部分所述的方法。It can be known from the above description of the implementation manners that those skilled in the art can clearly understand that the present application can be implemented by means of software plus a necessary general-purpose hardware platform. Based on this understanding, the essence of the technical solution of this application or the part that contributes to the prior art can be embodied in the form of software products, and the computer software products can be stored in storage media, such as ROM/RAM, disk , optical disc, etc., including several instructions to enable a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in various embodiments or some parts of the embodiments of this application.

以上所描述的装置实施方式仅仅是示意性的,其中所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施方式方案的目的。本领域普通技术人员在不付出创造性劳动的情况下,即可以理解并实施。The device implementation described above is only illustrative, wherein the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in One place, or it can be distributed to multiple network elements. Part or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. It can be understood and implemented by those skilled in the art without creative effort.

本申请可用于众多通用或专用的计算系统环境或配置中。例如:个人计算机、服务器计算机、手持设备或便携式设备、平板型设备、多处理器系统、基于微处理器的系统、置顶盒、可编程的消费电子设备、网络PC、小型计算机、大型计算机、包括以上任何系统或设备的分布式计算环境等等。The application can be used in numerous general purpose or special purpose computing system environments or configurations. Examples: personal computers, server computers, handheld or portable devices, tablet-type devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, including A distributed computing environment for any of the above systems or devices, etc.

本申请可以在由计算机执行的计算机可执行指令的一般上下文中描述,例如程序模块。一般地,程序模块包括执行特定任务或实现特定抽象数据类型的例程、程序、对象、组件、数据结构等等。也可以在分布式计算环境中实践本申请,在这些分布式计算环境中,由通过通信网络而被连接的远程处理设备来执行任务。在分布式计算环境中,程序模块可以位于包括存储设备在内的本地和远程计算机存储介质中。This application may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. The application may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including storage devices.

应当理解,虽然本说明书按照实施方式加以描述,但并非每个实施方式仅包含一个独立的技术方案,说明书的这种叙述方式仅仅是为清楚起见,本领域技术人员应当将说明书作为一个整体,各实施方式中的技术方案也可以经适当组合,形成本领域技术人员可以理解的其它实施方式。It should be understood that although this description is described according to implementation modes, not each implementation mode only contains an independent technical solution, and this description in the description is only for clarity, and those skilled in the art should take the description as a whole, and each The technical solutions in the embodiments can also be properly combined to form other embodiments that can be understood by those skilled in the art.

上文所列出的一系列的详细说明仅仅是针对本发明的可行性实施方式的具体说明,它们并非用以限制本发明的保护范围,凡未脱离本发明技艺精神所作的等效实施方式或变更均应包含在本发明的保护范围之内。The series of detailed descriptions listed above are only specific descriptions for feasible implementations of the present invention, and they are not intended to limit the protection scope of the present invention. Any equivalent implementation or implementation that does not depart from the technical spirit of the present invention All changes should be included within the protection scope of the present invention.

Claims (10)

1. A method for load balancing of a structureless peer-to-peer network based on a mobile agent is characterized by comprising the following steps:
s1, each node in the network periodically initiates a topology adjustment mechanism, and the topology adjustment mechanism is connected to the nodes with strong processing capacity to form a central topology structure;
and S2, judging the congestion state of the node by calculating the congestion level of the node at a certain moment, and further performing network topology optimization.
2. The method according to claim 1, wherein the step S1 specifically includes:
s11 and node PiSending a collecting message to collect a candidate node set participating in the node topology adjustment;
s12, forwarding the node collection message to a randomly selected neighbor node, and adding the node to the set Si(ii) a Simultaneously, the survival time TTL is reduced by 1; if the time to live TTL is not equal to 0, repeating step S12, and continuing to collect nodes;
s13, collecting candidate nodes SiReturned to the message originating node Pi
S14, slave node PiSelecting the node P with the weakest processing capability and the connectivity degree larger than 1 from the current neighbor node setmin(Ni)
S15, slave candidate node set SiThe node with the strongest processing capability is taken out and recorded asAnd slave it to SiIn deletion, if the node
Figure FDA00001946029600012
Has a processing capacity of not more than
Figure FDA00001946029600013
Step S17 is executed; if node
Figure FDA00001946029600014
Has a processing capacity greater thanThen to the node
Figure FDA00001946029600016
Sending out a connection request if the node
Figure FDA00001946029600017
Rejecting a connection requestThen step S15 is repeated to continue selecting the next reconnected node, if the node is not the next reconnected node
Figure FDA00001946029600018
If the reconnect request is accepted, go to step S16;
s16 and node PiNeighboring node P of disconnection and selectionmin(Ni)And is connected with node Pmax(Si)Establishing connection; if the number of the reconnected nodes reaches the upper limit number n of the preset number of the reconnected nodes, executing step S17; if not, executing step S14 to select the node to join the reconnection next time;
and S17, finishing the topology adjustment.
3. The method for load balancing of a structureless peer-to-peer network based on mobile agents according to claim 1, wherein the step S2 specifically comprises:
s21 calculation node P for collecting information by mobile agentjCongestion level at the current time t
Figure FDA00001946029600019
And use
Figure FDA000019460296000110
The congestion state of the node is judged by the value of (A), the congestion state of the node comprises setting three load states of overload, normal load and overload for each node, setting a load state threshold value, and calculating
Figure FDA000019460296000111
Comparing the value with a set load state threshold value to determine the current load state of the node; if node PjIf the load status is overload, go to step S22; otherwise, executing step S23, optimizing the topology, and selecting the next access node;
s22, the node PjRandomly selecting a part of nodes to disconnect, and deriving a sub-mobile agent; the child mobile agent takes its generation node as a parent nodeSearching nodes with redundant processing capacity in the network in a breadth-first traversal mode, judging the load state of the nodes when reaching one node, randomly selecting one node to be reconnected to connect with the node if the node is lightly loaded, then continuously searching the next node until all the nodes to be reconnected are reconnected, and actively quitting the network by the sub-mobile intelligent agent;
s23, the mobile agent according to the node PjOf neighbor node PoSelecting a next access node according to the attraction table of the mobile agent and the accessed node list, and migrating the next access node to the node; the accessed node list is used for recording the nodes accessed by the agent; the neighbor node attraction table is a table of the attractions of the neighbor nodes to the mobile agents, which is used by any node in the network for recording.
4. The method for load balancing of unstructured peer-to-peer networks based on mobile agents according to claim 3, wherein the step S21 further comprises:
step S210 said node PjAnd determining whether to accept the connection request of other nodes according to the load state of the node: if node PjCurrently in an overload state, node PjNot accepting other node connection requests; if node PjIs currently under normal load, and at this time if node PjIs overloaded, node PjNot accepting other node connection requests; if node PjThe last state is not overloaded, but node PjWhen the current state is normal, the node PjReceiving connection requests of other nodes; if node PjNode P when the current state is light loadjAnd accepting connection requests of other nodes.
5. The method according to claim 3, characterized in that in step S21, the node PjCongestion level at the current time t
Figure FDA00001946029600021
The calculation formula of (2) is as follows:
Figure FDA00001946029600022
wherein,
Figure FDA00001946029600023
representing a node PjThe time required to process a query message; if a node is processing a message then all incoming messages at that time are placed in the node's message buffer queue,
Figure FDA00001946029600024
indicating the time t node PjThe number of messages to be processed in the buffer queue.
6. The method for load balancing unstructured peer-to-peer networks based on mobile agents according to claim 3, characterized in that in step S23, the node PjNeighbor node P provided with one such nodeoAn attraction meter for recording the node PjProcessing capability of all neighbor nodesAnd connectivity χ (P)o,k);
Neighbor node PoThe attraction to a mobile agent is calculated as follows:
<math> <mrow> <msub> <mi>A</mi> <msub> <mi>P</mi> <mi>o</mi> </msub> </msub> <mo>=</mo> <msub> <mi>C</mi> <msub> <mi>P</mi> <mi>o</mi> </msub> </msub> <mo>&times;</mo> <mi>&chi;</mi> <mrow> <mo>(</mo> <msub> <mi>P</mi> <mi>o</mi> </msub> <mo>,</mo> <mi>k</mi> <mo>)</mo> </mrow> </mrow> </math>
Figure FDA00001946029600027
is a neighbor node PoRepresents the neighboring node PoThe time required to process a query message;
χ(Pok) is a node PoThe connectivity of (c); node PoAttractive force
Figure FDA00001946029600031
The larger the mobile agent slave PjMigration to node PoThe higher the probability of (c);
the neighbor node PoThe connectivity calculation formula is as follows:
<math> <mrow> <mi>&chi;</mi> <mrow> <mo>(</mo> <msub> <mi>P</mi> <mi>o</mi> </msub> <mo>,</mo> <mi>k</mi> <mo>)</mo> </mrow> <mo>=</mo> <munderover> <mi>&Sigma;</mi> <mrow> <mi>h</mi> <mo>=</mo> <mn>1</mn> </mrow> <mrow> <mi>h</mi> <mo>=</mo> <mi>k</mi> </mrow> </munderover> <mfrac> <mrow> <mi>N</mi> <mrow> <mo>(</mo> <msub> <mi>P</mi> <mi>o</mi> </msub> <mo>,</mo> <mi>h</mi> <mo>)</mo> </mrow> </mrow> <msup> <mi>h</mi> <mi>&delta;</mi> </msup> </mfrac> <mo>,</mo> </mrow> </math>
wherein, N (P)oH) represents a neighbor node PoThe number of nodes which are h hops away, k represents the radius of the calculated connectivity, delta is a control coefficient, 1/hδWeight, χ (P), for controlling influence of nodes of different distances on connectivityoK) the larger the node PoThe more query messages that may be received.
7. The method for load balancing unstructured peer-to-peer networks based on mobile agents of claim 4, wherein "will be calculated" in step S21
Figure FDA00001946029600033
The value is compared with a set load state threshold value to determine the current load state of the node, which is specifically: two set thresholds Uthred、BthredIf, ifNode PjIs overloaded, the variable flag =1, if
Figure FDA00001946029600035
Node PjIs normally loaded, the variable flag = 0. If it is
Figure FDA00001946029600036
Node PjIs lightly loaded, and the variable flag = -1.
8. The method for load balancing of a structureless peer-to-peer network based on mobile agents according to claim 7, wherein the step S210 specifically comprises: the node PjCurrent variable state flag =1, node PjNot accepting other node connection requests; if node PjCurrent state flag =0, and at this time if node PjThe last variable state of flag =1, then the node PjNot accepting other node connection requests; if node PjLast variable state flag =0 or-1, and node PjNode P with current variable state flag =0jConnection requests of other nodes can be accepted; if node PjIf the current variable state flag = -1, the node PjConnection requests of other nodes may be accepted.
9. A system for load balancing a structureless peer-to-peer network based on mobile agents, the system comprising:
the topology adjusting unit is used for each node in the network to periodically initiate a topology adjusting mechanism and connect the topology adjusting mechanism to the nodes with strong processing capacity to form a unit of a central topology structure;
a topology optimization unit for judging the congestion state of the node by calculating the congestion level of the node at a certain moment, and further performing network topology optimization;
wherein the topology adjusting unit includes:
node PiA unit for sending a collecting message to collect a candidate node set participating in the node topology adjustment; forwarding the node collecting message to a randomly selected neighbor node, and adding the node to a set Si; set of candidate nodes SiReturned to the message originating node PiA unit of (1);
slave node PiSelecting the node P with the weakest processing capability and the connectivity degree larger than 1 from the current neighbor node setmin(Ni)A unit of (1);
from the set of candidate nodes SiThe node P with the strongest processing capability is taken outmax(Si)Comparing node Pmax(Si)And Pmin(Ni)To the node Pmax(Si)A unit that issues a connection request;
node PiNeighboring node P of disconnection and selectionmin(Ni)And is connected with node Pmax(Si)A unit for establishing a connection;
the topology optimization unit includes:
computing node P for collecting information by mobile agentjCongestion level at the current time t
Figure FDA00001946029600041
Setting three load states of overload, normal load and overload for each node, setting load state threshold value, calculatingThe value is compared with a set load state threshold value to determine the current load state of the nodeA unit of a state;
node PjRandomly selecting a part of nodes to disconnect, and deriving a unit of a sub-mobile agent;
the child mobile intelligent agent takes the generation node as a father node, searches nodes with redundant processing capacity in the network in a breadth-first traversal mode, judges the load state of the node when reaching one node, randomly selects a node to be reconnected to connect with the node if the node is lightly loaded, and then continuously searches the next node until all the nodes to be reconnected are reconnected, and the child mobile intelligent agent actively quits the network unit;
mobile agent according to node PjOf neighbor node PoThe attraction to the mobile agent and the list of visited nodes to select the next visited node and migrate to the unit of that node.
10. The system according to claim 9, wherein the node P is configured to perform load balancing for unstructured peer-to-peer networks based on mobile agentsjCongestion level at the current time tThe calculation formula of (2) is as follows:wherein,representing a node PjThe time required to process a query message; if a node is processing a message then all incoming messages at that time are placed in the node's message buffer queue,
Figure FDA00001946029600046
indicating the time t node PjThe number of messages to be processed in the buffer queue;
the neighbor node PoThe attraction to a mobile agent is calculated as follows:
<math> <mrow> <msub> <mi>A</mi> <msub> <mi>P</mi> <mi>o</mi> </msub> </msub> <mo>=</mo> <msub> <mi>C</mi> <msub> <mi>P</mi> <mi>o</mi> </msub> </msub> <mo>&times;</mo> <mi>&chi;</mi> <mrow> <mo>(</mo> <msub> <mi>P</mi> <mi>o</mi> </msub> <mo>,</mo> <mi>k</mi> <mo>)</mo> </mrow> <mo>,</mo> </mrow> </math>
Figure FDA00001946029600048
is a neighbor node PoRepresents the neighboring node PoThe time required to process a query message; x (P)oK) is a node PoThe connectivity of (c); node PoAttractive force
Figure FDA00001946029600051
The larger the mobile agent slave PjMigration to node PoThe higher the probability of (c);
the neighbor node PoThe connectivity calculation formula is as follows:
<math> <mrow> <mi>&chi;</mi> <mrow> <mo>(</mo> <msub> <mi>P</mi> <mi>o</mi> </msub> <mo>,</mo> <mi>k</mi> <mo>)</mo> </mrow> <mo>=</mo> <munderover> <mi>&Sigma;</mi> <mrow> <mi>h</mi> <mo>=</mo> <mn>1</mn> </mrow> <mrow> <mi>h</mi> <mo>=</mo> <mi>k</mi> </mrow> </munderover> <mfrac> <mrow> <mi>N</mi> <mrow> <mo>(</mo> <msub> <mi>P</mi> <mi>o</mi> </msub> <mo>,</mo> <mi>h</mi> <mo>)</mo> </mrow> </mrow> <msup> <mi>h</mi> <mi>&delta;</mi> </msup> </mfrac> <mo>,</mo> </mrow> </math>
wherein, N (P)oH) represents a neighbor node PoThe number of nodes which are h hops away, k represents the radius of the calculated connectivity, delta is a control coefficient, 1/hδWeight, χ (P), for controlling influence of nodes of different distances on connectivityoK) the larger the node PoThe more query messages that may be received.
CN201210265613.9A 2012-07-29 2012-07-29 Intelligent mobile agent-based unstructured P2P network load balancing method and system Expired - Fee Related CN102790804B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201210265613.9A CN102790804B (en) 2012-07-29 2012-07-29 Intelligent mobile agent-based unstructured P2P network load balancing method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201210265613.9A CN102790804B (en) 2012-07-29 2012-07-29 Intelligent mobile agent-based unstructured P2P network load balancing method and system

Publications (2)

Publication Number Publication Date
CN102790804A true CN102790804A (en) 2012-11-21
CN102790804B CN102790804B (en) 2015-03-04

Family

ID=47156102

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201210265613.9A Expired - Fee Related CN102790804B (en) 2012-07-29 2012-07-29 Intelligent mobile agent-based unstructured P2P network load balancing method and system

Country Status (1)

Country Link
CN (1) CN102790804B (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103490413A (en) * 2013-09-27 2014-01-01 华南理工大学 Intelligent electricity generation control method based on intelligent body equalization algorithm
CN103546530A (en) * 2013-06-20 2014-01-29 江苏大学 Peer-to-peer network node load balancing method and system based on group resource management
CN106685745A (en) * 2017-03-17 2017-05-17 北京邮电大学 Method and device for constructing network topology
CN107438106A (en) * 2017-08-23 2017-12-05 北京慧点科技有限公司 The method, apparatus and peer-to-peer network system of the load balancing of peer-to-peer network
CN107589992A (en) * 2017-08-02 2018-01-16 北京大学(天津滨海)新代信息技术研究院 A kind of containerization application load dispatching method based on swarm intelligence
CN110351200A (en) * 2019-08-16 2019-10-18 东北大学秦皇岛分校 A kind of opportunistic network jamming control method based on forwarding task immigration

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101119271A (en) * 2007-07-05 2008-02-06 中国科学技术大学 A structured P2P application service platform and its implementation method
US20080148403A1 (en) * 2006-12-13 2008-06-19 Microsoft Corporation Distributed malicious software protection in file sharing environments

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080148403A1 (en) * 2006-12-13 2008-06-19 Microsoft Corporation Distributed malicious software protection in file sharing environments
CN101119271A (en) * 2007-07-05 2008-02-06 中国科学技术大学 A structured P2P application service platform and its implementation method

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103546530A (en) * 2013-06-20 2014-01-29 江苏大学 Peer-to-peer network node load balancing method and system based on group resource management
CN103490413A (en) * 2013-09-27 2014-01-01 华南理工大学 Intelligent electricity generation control method based on intelligent body equalization algorithm
CN103490413B (en) * 2013-09-27 2015-09-02 华南理工大学 A kind of intelligent power generation control method based on intelligent body equalization algorithm
CN106685745A (en) * 2017-03-17 2017-05-17 北京邮电大学 Method and device for constructing network topology
CN106685745B (en) * 2017-03-17 2019-10-29 北京邮电大学 A kind of constructing network topology method and device
CN107589992A (en) * 2017-08-02 2018-01-16 北京大学(天津滨海)新代信息技术研究院 A kind of containerization application load dispatching method based on swarm intelligence
CN107438106A (en) * 2017-08-23 2017-12-05 北京慧点科技有限公司 The method, apparatus and peer-to-peer network system of the load balancing of peer-to-peer network
CN110351200A (en) * 2019-08-16 2019-10-18 东北大学秦皇岛分校 A kind of opportunistic network jamming control method based on forwarding task immigration
CN110351200B (en) * 2019-08-16 2022-07-01 东北大学秦皇岛分校 Opportunistic network congestion control method based on forwarding task migration

Also Published As

Publication number Publication date
CN102790804B (en) 2015-03-04

Similar Documents

Publication Publication Date Title
CN102790804B (en) Intelligent mobile agent-based unstructured P2P network load balancing method and system
CN103546530A (en) Peer-to-peer network node load balancing method and system based on group resource management
Li et al. A multipath routing protocol with load balancing and energy constraining based on AOMDV in ad hoc network
CN100574219C (en) Introducing the peer-to-peer network super node of node importance selects and resource search method
Radenkovic et al. Congestion aware forwarding in delay tolerant and social opportunistic networks
CN101883113B (en) Method and physical nodes for realizing overlay network load balance
CN102857975B (en) Method for establishing load balance CTP (Collection Tree Protocol) routing protocol
CN101123609A (en) Resource Level Adaptive Search Method
CN108449269A (en) SDN-based data center network load balancing method
Panwar et al. DICE: Dynamic multi-RAT selection in the ICN-enabled wireless edge
Shah et al. An efficient unstructured p2p overlay over manet using underlying proactive routing
CN102006238B (en) Balanced quick searching method in structureless P2P (Peer-to-Peer) network
CN103338476B (en) A kind of delay-tolerant network data transmission method based on credit mechanism
Boukerche et al. A cross-layer approach-based gnutella for collaborative virtual environments over mobile ad hoc networks
Pratheema et al. Minimizing end-to-end delay using multipath routing in wireless sensor networks
CN109874162A (en) Design and optimization method of hybrid routing protocol for high-altitude and high-speed mobile node ad hoc network
Suraki et al. FCLCC: fuzzy cross-layer congestion control in mobile ad hoc networks
Yeferny et al. CDP: A content discovery protocol for mobile p2p systems
Ke et al. A priority-based multicast flow scheduling method for a collaborative edge storage datacenter network
Shrivastava et al. A load-balancing approach for congestion adaptivity in MANET
Patel et al. Energy efficient routing using residual energy and stability in mobile ad-hoc network
Chen et al. Energy Aware AOMDV Routing Based on Constrained Queue Length in MANET
Magubane et al. Extended context-aware and load balancing routing protocol for low power and lossy networks in IoT networks (ECLRPL)
Magubane et al. Performance evaluation of ETXPC-RPL routing algorithm in IoT Network
CN103596221B (en) A kind of data transmission method moving Ad Hoc network and system

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20150304

Termination date: 20150729

EXPY Termination of patent right or utility model