Background technology
P2P is the abbreviation of peer-to-peer (peer node is to peer node), claims peer-to-peer network again, is each side's pattern of client/server each other in a kind of communication network.In peer system, two or more PCs or miscellaneous equipment, direct communication or cooperation on network, the shared each other resources such as disposal ability (CPU), memory space and data that comprise.The intrinsic propesties of P2P is a Distributed Calculation, its maximum characteristics are not have central server, the computing capability of each computer on the network (particularly client device) can be not fully exerted, reduced costliness expenditure (comprising software, hardware, communication and human input etc.) at the central server end, ability bottleneck and the Single Point of Faliure of also having avoided server to bring, thus the system that makes has lower operation cost and is close to unlimited extended capability.
According to the difference of P2P network topology structure, generally the P2P overlay network is divided into two kinds of structural P 2 P overlay network and non-structural P 2 P overlay networks.As shown in Figure 1, be a kind of typical structural P 2 P overlay network, all Peer (peer node) have formed the P2P overlay network.The structural P 2 P overlay network generally is based on the DHT technology, comes the peer node in the organization network as Chord, CAN, Pastry scheduling algorithm, the building network topology.
As shown in Figure 2, be a kind of P2P overlay network of common Peer-Client (peer node-client) structure.All peer node (Peer) have been formed the P2P overlay network.And client (Client) hangs under the peer node, can only support the issue and received content, do not participate in the P2P overlay network route and search.For example, client can be published to content (Key/Value) above the P2P overlay network by the Put order, peer node 1 finds the peer node 2 of being responsible for the root (being responsible for the peer node of storage key value and corresponding content thereof in structured P 2 P network) that deposits Key/Value specially according to specific P2P rule (for example the DHT algorithm comprises Chord, Pastry or the like).It is right that peer node 2 is preserved Key/Value, and Key/Value is to being to have write down the pairing Value of each Key, and Value is generally the pairing content of Key (this content can be real content, also can be the source address that this content can be provided).When client 2 needs same content (Key), then can initiate the Get order to the P2P overlay network, search the pairing Value of Key.Peer node 3 finds the peer node 2 of being responsible for the root that deposits Key/Value specially according to specific P2P rule (for example the DHT algorithm comprises Chord, Pastry or the like).Last peer node 2 is returned the pairing Value of Key (be the content of client 1 issue, or the address of the client 1 of this content can be provided) and is given client 2.
Between peer node and the peer node, need between peer node and the client to judge whether mutually normally then to need keepalive mechanism.Keepalive mechanism refers to promptly between two communication units that the keep-alive message (Keepalive) by periodically allows a side know whether the opposing party is current normal.As shown in Figure 3, unit 1 sends heartbeat keep-alive message (Keepalive) every period T c to unit 2, and unit 2 is provided with a maximum tolerance timer (Tp, and Tp is greater than Tc) for unit 1.Unit 2 is as long as receive the heartbeat keep-alive message of unit 1 in the Tp scope, then identifying unit 1 is current normal, and reclocking.
State in realization in the keep-alive process, the inventor finds that there are the following problems at least in the prior art:
As shown in Figure 4; under peer node-client framework; each peer node may hang with thousands of down even up to ten thousand clients; and the topological keep-alive object of each client and session (session; finger is before media delivery; need to set up a session connection between two peer node; and consult some in order in order to the parameter of transmission medium) the keep-alive object can overlap on the same peer node again; and topological keep-alive and session connection keep-alive from each client are dispersed again; the total number of keep-alive signaling will seem too fat to move between client and the peer node; because the protocol stack transfer that every keep-alive signaling all needs peer node once, the burden of peer node also can be heavier.
Summary of the invention
Embodiments of the invention provide under a kind of peer node-client framework the method for keep-alive between peer node and client; can reduce the keep-alive signaling quantity between client and peer node; thereby the keep-alive signaling quantity that the protocol stack on the minimizing peer node need be handled alleviates the burden of peer node.
For achieving the above object, embodiments of the invention adopt following technical scheme:
The method of keep-alive between peer node and client under a kind of peer node-client framework comprises:
Peer node periodically receives the keep-alive signaling that client sends, and carries each session connection identification that exists in the described client-side session table in the described keep-alive signaling;
The described session connection sign of carrying in the described keep-alive signaling that described peer node will receive, carry out matching check with each session connection identification of preserving in the local session table, if the two mates fully, determine that then each session connection between described client and described peer node is normal; If the two incomplete coupling is then determined unusual session connection according to described session connection sign.
The method of keep-alive between peer node and client under peer node-client framework that the embodiment of the invention provides, client is carried each session connection identification that exists in client self conversational list in the keep-alive signaling that periodically sends; After peer node receives keep-alive signaling, carry out matching check one by one, judge whether each session connection normally and according to described session connection sign determines unusual session connection with each session connection identification of preserving in the local session table.So; originally need the session keepalive signaling of many of transmissions to unify, consequently, reduced the keep-alive signaling quantity between client and peer node; reduce the keep-alive signaling quantity that the protocol stack on the peer node need be handled, alleviated the burden of peer node.
Embodiments of the invention also provide a kind of client, can reduce the keep-alive signaling quantity that sends between client and peer node, thereby reduce the keep-alive signaling quantity that the protocol stack on the peer node need be handled, and have alleviated the burden of peer node.
For achieving the above object, embodiments of the invention adopt following technical scheme:
A kind of client comprises:
Generation unit is used for periodically generating keep-alive signaling, comprises each session connection identification that exists in client self conversational list in the described keep-alive signaling;
Transmitting element is used for periodically sending the keep-alive signaling that described generation unit generates to the peer node that is connected with described client.
The client that the embodiment of the invention provides; periodically generate keep-alive signaling by generation unit; and in keep-alive signaling, carry each session connection identification that exists in self conversational list; and transmitting element periodically sends keep-alive signaling; thereby effectively reduced the keep-alive signaling quantity between client and peer node; further reduce the keep-alive signaling quantity that the protocol stack on the peer node need be handled, alleviated the burden of peer node.
Embodiments of the invention also provide a kind of peer node, can reduce the keep-alive signaling quantity between client and peer node, thereby have reduced the keep-alive signaling quantity that the protocol stack on the peer node need be handled, and have alleviated the burden of peer node.
For achieving the above object, embodiments of the invention adopt following technical scheme:
A kind of peer node comprises:
Receiving element is used for periodically receiving the keep-alive signaling that client sends, and wherein, carries each session connection identification that exists in described client self conversational list in the described keep-alive signaling;
The session keepalive detecting unit, each session connection identification of preserving in described session connection sign that the described keep-alive signaling that is used for receiving is carried and the local session table is carried out matching check, if the two mates fully, determine that then each session connection between described client and described peer node is normal; If the two incomplete coupling is then determined unusual session connection according to described session connection sign.
The peer node that the embodiment of the invention provides; after receiving element receives keep-alive signaling; by the session keepalive detecting unit; each session connection identification of preserving in session connection sign in the keep-alive signaling that receives and the local session table is carried out matching check one by one, judge whether each session connection normally and according to described session connection sign determines unusual session connection.So; receive keep-alive signaling and can judge also whether all session connections of client are normal; consequently; reduced the keep-alive signaling quantity between client and peer node; further reduce the keep-alive signaling quantity that the protocol stack on the peer node need be handled, thereby alleviated the burden of peer node.
The embodiment of the invention also provides a kind of peer-to-peer network system, can reduce the keep-alive signaling quantity between client and peer node, thereby reduce the keep-alive signaling quantity that the protocol stack on the peer node need be handled, and has alleviated the burden of peer node.
For achieving the above object, embodiments of the invention adopt following technical scheme:
A kind of peer-to-peer network system comprises:
Peer node and the client that is connected with described peer node;
Described client is used for periodically generating keep-alive signaling, and to sending described keep-alive signaling with described peer node, comprises each session connection identification that exists in client self conversational list in the described keep-alive signaling;
Described peer node, be used for periodically receiving the keep-alive signaling that described client sends, and each session connection identification of preserving in described session connection sign of carrying in the described keep-alive signaling that will receive and the local session table is carried out matching check, if the two mates fully, determine that then each session connection between described client and described peer node is normal; If the two incomplete coupling is then determined unusual session connection according to described session connection sign.
The peer-to-peer network system that the embodiment of the invention provides, client can be carried each session connection identification that exists in client self conversational list in the keep-alive signaling that periodically generates and sends; After peer node receives keep-alive signaling, by with the local session table in all session connection identification of preserving carry out matching check one by one, judge that each session connection is whether normal and determine unusual session connection according to described session connection sign.So; originally need the session keepalive signaling of many of transmissions just can unify; consequently; reduced the keep-alive signaling quantity between client and peer node; further reduce the keep-alive signaling quantity that the protocol stack on the peer node need be handled, thereby alleviated the burden of peer node.
Embodiment
Embodiments of the invention provide under a kind of peer node-client framework the method for keep-alive between peer node and client; can reduce the keep-alive signaling quantity between client and peer node; thereby reduced the keep-alive signaling quantity that the protocol stack on the peer node need be handled, alleviated the burden of peer node.
Be described in detail below in conjunction with accompanying drawing.
As shown in Figure 5, the present invention is the method for keep-alive between peer node and client under peer node-client framework of providing of embodiment, comprises the steps:
S1, peer node periodically receive the keep-alive signaling that client sends, and carry each session connection identification that exists in this client-side session table in the described keep-alive signaling;
The described session connection sign of carrying in the described keep-alive signaling that S2, described peer node will receive, carry out matching check with each session connection identification of preserving in the local session table, if the two mates fully, determine that then each session connection between described client and described peer node is normal; If the two incomplete coupling is then determined unusual session connection according to described session connection sign.
So, client can be carried each session connection identification that exists in client self conversational list in the keep-alive signaling that periodically sends; After peer node receives keep-alive signaling, carry out matching check one by one, judge whether each session connection normally and according to described session connection sign determines unusual session connection with each session connection identification of preserving in the local session table.So; originally need the session keepalive signaling of many of transmissions to unify, consequently, reduced the keep-alive signaling quantity between client and peer node; reduce the keep-alive signaling quantity that the protocol stack on the peer node need be handled, thereby alleviated the burden of peer node.
Embodiment one:
As shown in Figure 6, client is carried the session connection sign (Session ID is abbreviated as Ses ID, for example Ses1, Ses2) of all existence in self conversational list simultaneously in the keep-alive signaling that periodically (period T c) sends;
The peer node end periodically receives keep-alive signaling; carry out matching check one by one by all session connections signs of preserving in all session connection signs of carrying immediately in the keep-alive signaling and the peer node local session table simultaneously, with this judge this locality whether have session connection unusual hang dead.If peer node is greater than certain given time (Tp; Tp>Tc; peer node is to the maximum tolerance time of this client keep-alive) in do not receive keep-alive signaling from this client, then judge (all session connections of this client are all unusual) unusually of this client.
For example, as shown in Figure 6:
1) at t0 constantly,
Client is obtained the session connection (have this moment: session connection 1, session connection 2, session connection 3) that current all that self exist and peer node have been set up, carries the session connection sign (have this moment: session connection sign 1 (Ses1), session connection identifies 2 (Ses2) and session connection identifies 3 (Ses3)) of all session connections of having set up with peer node in the keep-alive signaling that sends to peer node simultaneously.
The peer node end is after t0 ' constantly receives keep-alive signaling from client; carry out matching check one by one by all session connections signs of preserving in all session connection signs of will carry in the keep-alive signaling and the local session table; find that both are identical, judge that all session connections of this client are normal.
2) at t1 constantly,
Client is obtained the session connection (have this moment: session connection 2, session connection 4, session connection 5) that current all that self exist and peer node have been set up, carries the session connection sign (have this moment: session connection sign 2 (Ses2), session connection identifies 4 (Ses4) and session connection identifies 5 (Ses5)) of all session connections of having set up with peer node in the keep-alive signaling that sends to peer node simultaneously.
The peer node end is at t1 ' after ((t1 '-t0 ')<Tp) receive keep-alive signaling from client constantly, carries out matching check one by one by all session connections signs of preserving in all session connection signs of will carry in the keep-alive signaling and the peer node local session table.How residual session connection sign 3 (Ses3) judge that then the session connection 3 of this Client is unusual in the session connection of finding to preserve in the peer node local session table, carry out relevant abnormalities and handle (for example: remove Peer and go up session connection 3).
3) (t1 '+Tp) constantly,
The peer node end is not owing to receive the keep-alive signaling of this client in its maximum tolerance time (Tp) scope; therefore judge that this client- side session connection 2,4,5 is unusual, carry out relevant abnormalities and handle (for example: remove session connection 2,4,5 on the peer node).
So; client is carried the sign of the session connection that all and peer node set up in the keep-alive signaling that periodically sends; peer node is after receiving; be complementary by session list with this locality; judge whether the client-side session connection normally and according to described session connection sign determines unusual session connection; this is just with the work that needs originally to finish with many session keepalive signalings; unify; consequently; reduced the keep-alive signaling quantity between client and peer node; reduce the keep-alive signaling quantity that the protocol stack on the peer node need be handled, thereby alleviated the burden of peer node.
Embodiment two:
As shown in Figure 7, client (Client) end in keep-alive (Keepalive) signaling that periodically (period T c) sends except the client identification (Client ID) that carries self, carry session connection sign (the Session ID of all existence in self conversational list simultaneously, be abbreviated as Ses ID, for example Ses1, Ses2);
Peer node (Peer) end is except by periodically receiving keep-alive signaling judges whether this client survives; carry out matching check one by one by all session connections signs of preserving in all session connection signs of carrying in the keep-alive signaling and the peer node local session table simultaneously, with this judge this locality whether have session connection unusual hang dead.If peer node is greater than certain given time (Tp; Tp>Tc; peer node is to the maximum tolerance time of this client keep-alive) in do not receive keep-alive signaling from this client, then judge this client (on the topology unusual and all session connections are all unusual) unusually.
For example, as shown in Figure 7:
1) at t0 constantly,
Client is obtained the session connection (having at this moment: session connection 1, session connection 2, session connection 3) that current all that self exist and peer node have been set up; in the keep-alive signaling that peer node sends except the Client ID that carries self, carry the session connection sign (have this moment: session connection sign 1 (Ses1), session connection sign 2 (Ses2) and session connection identify 3 (Ses3)) of all session connections of having set up with peer node simultaneously.
The peer node end is after t0 ' constantly receives keep-alive signaling from client; carry out matching check one by one by all session connections signs of preserving in all session connection signs of will carry in the keep-alive signaling and the peer node local session table; find that both are identical, judge that all session connections of this client are normal.
2) at t1 constantly,
Client is obtained the session connection (having at this moment: session connection 2, session connection 4, session connection 5) that current all that self exist and peer node have been set up; in the keep-alive signaling that peer node sends except the Client ID that carries self, carry the session connection sign (have this moment: session connection sign 2 (Ses2), session connection sign 4 (Ses4) and session connection identify 5 (Ses5)) of all session connections of having set up with peer node simultaneously.
The peer node end is at t1 ' after ((t1 '-t0 ')<Tp) receive keep-alive signaling from client constantly, carries out matching check one by one by all session connections signs of preserving in all session connection signs of will carry in the keep-alive signaling and the local session table.How residual session connection sign 3 (Ses3) in the session connection of finding to preserve in the local session table, it is 3 unusual to judge that then this client-side session connects, and carries out relevant abnormalities and (for example: session connection 3 on the dismounting peer node) handles.
3) (t1 '+Tp) constantly,
The peer node end is not owing to receive the keep-alive signaling of this client in its maximum tolerance time (Tp) scope; therefore judge that this client is unusual; carry out relevant abnormalities and handle (for example:, find out and remove all and the session connection of this client foundation) by the client identification of this client of preserving before.
So; client is carried the sign of the session connection that all and peer node set up in the keep-alive signaling that periodically sends; peer node is after receiving; be complementary by session list with this locality; judge whether the client-side session connection normally and according to described session connection sign determines unusual session connection; this is just with the work that needs originally to finish with many session keepalive signalings; unify; consequently; reduced the keep-alive signaling quantity between client and peer node; reduce the keep-alive signaling quantity that the protocol stack on the peer node need be handled, thereby alleviated the burden of peer node.In addition, judge the topological keep-alive of this client, also unified topological keep-alive signaling, further reduced the quantity of signaling by client identification.
The embodiment of the invention provides a kind of client, can reduce the keep-alive signaling quantity between client and peer node, thereby has reduced the keep-alive signaling quantity that the protocol stack on the peer node need be handled, and has alleviated the burden of peer node.
As shown in Figure 8, this client comprises:
Generation unit 801 is used for periodically generating keep-alive signaling, comprises each session connection identification that exists in client self conversational list in the described keep-alive signaling;
Transmitting element 802 is used for periodically sending the keep-alive signaling that described generation unit generates to the peer node that is connected with described client.
Further, in the keep-alive signaling that described generation unit 801 generates, also carry the client identification of described client self.
So; make script need the work of finishing with many session keepalive signalings; can unify; consequently; reduced the keep-alive signaling quantity between client and peer node; reduce the keep-alive signaling quantity that the protocol stack on the peer node need be handled, thereby alleviated the burden of peer node.Have again; in the keep-alive signaling that generation unit 801 generates in this enforcement except that carrying all session connection identification; also carry the client identification of client self; can judge the topological keep-alive of this client by client identification; also unify topological keep-alive signaling, further reduced the quantity of signaling.
Embodiments of the invention provide a kind of peer node, can reduce the keep-alive signaling quantity between client and peer node, thereby have reduced the keep-alive signaling quantity that the protocol stack on the peer node need be handled, and have alleviated the burden of peer node.
As shown in Figure 9, this peer node comprises:
Receiving element 901 is used for periodically receiving the keep-alive signaling that client sends, and wherein, carries each session connection identification that exists in described client self conversational list in the described keep-alive signaling;
Session keepalive detecting unit 902, each session connection identification of preserving in described session connection sign that the described keep-alive signaling that is used for receiving is carried and the local session table is carried out matching check, if the two mates fully, determine that then each session connection between described client and described peer node is normal; If the two incomplete coupling is then determined unusual session connection according to described session connection sign.
Further, in the keep-alive signaling that this receiving element 901 receives, also carry the client identification of described client self.
Further again, this node also comprises:
Topology keep-alive detecting unit 903; be used to judge between described client and described peer node be connected whether normal; if described receiving element surpasses the described cycle and does not receive described keep-alive signaling, then according to the client identification of described client self determine between described client and described peer node be connected unusual.
So; by receiving element 901 and session keepalive detecting unit 902; make script need the work of finishing with many session keepalive signalings; can unify; consequently; reduce the keep-alive signaling quantity between client and peer node, reduced the keep-alive signaling quantity that the protocol stack on the peer node need be handled, thereby alleviated the burden of peer node.In addition, judge the topological keep-alive of this client, also unified topological keep-alive signaling, further reduced the quantity of signaling by client identification.
Embodiments of the invention provide a kind of peer-to-peer network system, can reduce the keep-alive signaling quantity between client and peer node, thereby reduce the keep-alive signaling quantity that the protocol stack on the peer node need be handled, and have alleviated the burden of peer node.
As shown in figure 10, this system comprises:
Peer node 101 and the client 102 that is connected with described peer node;
Described client 102 is used for periodically generating keep-alive signaling, and to sending described keep-alive signaling with described peer node, comprises each session connection identification that exists in client self conversational list in the described keep-alive signaling;
Described peer node 101, be used for periodically receiving the keep-alive signaling that described client sends, and each session connection identification of preserving in described session connection sign of carrying in the described keep-alive signaling that will receive and the local session table is carried out matching check, if the two mates fully, determine that then each session connection between described client and described peer node is normal; If the two incomplete coupling is then determined unusual session connection according to described session connection sign.
Further, described client 102 in the keep-alive signaling that periodically generates and sends, carries the client identification of described client self.
Described peer node 101; be used to judge between described client and described peer node be connected whether normal; do not receive described keep-alive signaling if surpass the described cycle, then according to the client identification of described client self determine between described client and described peer node be connected unusual.
Peer node in the peer-to-peer network system that provides in the present embodiment is identical with the client structure with above-mentioned peer node with client, just repeats no more at this.
The peer-to-peer network system that the embodiment of the invention provides, client can be carried each session connection identification that exists in client self conversational list in the keep-alive signaling that periodically sends; After peer node receives keep-alive signaling, by with the local session table in all session connections sign of preserving carry out matching check one by one, judge that each session connection is whether normal and determine unusual session connection according to described session connection sign.So; originally need the session keepalive signaling of many of transmissions just can unify; consequently; reduce the keep-alive signaling quantity between client and peer node, reduced the keep-alive signaling quantity that the protocol stack on the peer node need be handled, thereby alleviated the burden of peer node; in addition; judge the topological keep-alive of this client by client identification, also unified topological keep-alive signaling, further reduced the quantity of signaling.
The above; only be the specific embodiment of the present invention, but protection scope of the present invention is not limited thereto, anyly is familiar with those skilled in the art in the technical scope that the present invention discloses; can expect easily changing or replacing, all should be encompassed within protection scope of the present invention.Therefore, protection scope of the present invention should be as the criterion by described protection range with claim.