# Patent

## Title
Method, system, service selection entity for selecting service provision entity

## Abstract

The present invention discloses a method, system, service selection entity, and service management entity for selecting a service provision entity in a peer-to-peer (P2P) network, so as to select heterogeneous service provision entities for heterogeneous service requesting entities. The method includes: receiving service capability information of service provision entities; obtaining service request information of a service requesting entity; and selecting a service provision entity of an appropriate service capability to provide a service for the service requesting entity according to the service capability information of service provision entities and the service request information of the service requesting entity. The present invention is applicable to P2P overlay networks.

## Background
CROSS-REFERENCE TO RELATED APPLICATIONS
This application is a continuation of International Application No. PCT/CN2009/071367, filed on Apr. 20, 2009, which claims priority to Chinese Patent Application No. 200810127175.3, filed on Jun. 23, 2008, both of which are hereby incorporated by reference in their entireties.


FIELD OF THE INVENTION
The present invention relates to peer-to-peer (P2P) networks, and in particular, to a method, system, service selection entity, and service management entity for selecting a service provision entity.
BACKGROUND OF THE INVENTION
In a P2P system, two or more personal computers (PCs) or other devices communicate or collaborate over the network and share common resources including central processing units (CPUs), programs and data. In a P2P structure, there is no central peer or central server. Each peer serves as an information consumer, an information provider, and an information medium. In the P2P network, every peer plays the same role, each computer has equal privileges and obligations, and there is no differentiation as between a server and a client in a client/server (C/S) system.
FIG. 1 illustrates a P2P overlay network with a peer-client structure. All peers together form the P2P overlay network. A client is attached to a peer and is only able to publish and receive content. It does not participate in the routing and searching of the P2P overlay network. Client 1 publishes content (key/value) onto the P2P overlay network through a Put command. Peer 1 finds root peer 2 dedicated to storing key/value pairs according to a specific P2P rule, such as a distributed hash table (DHT) algorithm. Peer 2 stores the key/value pair, which records the value corresponding to each key. Normally, a value is the content corresponding to a key. The content may be true content or a source address that provides the content. When client 2 requests the same key, client 2 sends a Get command to the P2P overlay network to search for a value corresponding to the key. Peer 3 finds root peer 2 dedicated to storing key/value pairs according to a specific P2P rule, such as a DHT algorithm. Finally, peer 2 returns the value corresponding to the key (that is, the content published by client 1 or the address of client 1 that provides the content) to client 2.
According to a prior art, a procedure for selecting a service provision entity in a P2P network includes: selecting a peer of low network cost in the local location or local domain as the service provision entity according to the network information reported by the physical network. A procedure for changing the service provision entity includes: after a client is aware of the fault of a service provision entity, the client sets up a connection with and requests the service from a new service provision entity.
During related researches, the inventor finds the following problem in the prior art:
Because the stability of the selected service provision entity is not evaluated in advance, reselection and changing of the service provision entity frequently occur due to the instability of the service provision entity. For real-time services like video on demand (VoD) and Internet Protocol Television (IPTV), or service requesters with specific requirements, a service provision entity selected according to physical network information cannot assure the stability of service provision. Moreover, it takes time to switch to a new service provision entity after the client detects the fault of the selected service provision entity. This means a delay to the client and therefore does not meet the real-time requirement of the client.
SUMMARY OF THE INVENTION
Embodiments of the present invention provide a method, system, service selection entity, service provision entity, request management entity, and service management entity for selecting a service provision entity in a P2P network, so as to select heterogeneous service provision entities for heterogeneous service requesting entities in the P2P network.
The following technical solution is provided:
A method for selecting a service provision entity in a P2P network includes:
receiving service capability information of service provision entities;
obtaining service request information of a service requesting entity; and
selecting a service provision entity of an appropriate service capability to provide a service for the service requesting entity according to the service capability information of service provision entities and the service request information of the service requesting entity.
A method for selecting a service provision entity in a P2P network includes:
receiving service capability information of service provision entities;
obtaining a service type requested by a service requesting entity or statistics of request information of all service requesting entities; and
selecting an appropriate service provision entity to provide a service for the service requesting entity according to the service type or statistics and the service capability information of service provision entities.
A P2P network system includes:
at least one service provision entity, configured to publish respective service capability information;
a service requesting entity, configured to send service request information; and
a service selection entity, configured to receive the service capability information of the at least one service provision entity and the service request information of the service requesting entity, and select a service provision entity of an appropriate service capability according to the service capability information of the at least one service provision entity and the service request information of the service requesting entity.
A service selection entity includes:
a receiving unit, configured to receive service capability information published by service provision entities and a service type requested by a service requesting entity; and
a selecting unit, configured to select a service provision entity of an appropriate service capability according to the service capability information of service provision entities and the service request information of the service requesting entity.
A service management entity includes:
a receiving unit, configured to receive statistics of request information of all service requesting entities;
a deciding unit, configured to decide an evaluated grade of a data stream currently transferring content according to the statistics of request information of all service requesting entities; and
a requesting unit, configured to request a service selection entity to select a service provision entity of an appropriate service capability according to the evaluated grade of the data stream currently transferring content.
In the technical solution of the embodiments of the present invention, the service selection entity receives service capability information of service provision entities; the service selection entity obtains service request information of the service requesting entity; and the service selection entity selects a service provision entity of an appropriate service capability for the service requesting entity according to the service request information of the service requesting entity. Thereby, heterogeneous service provision entities can be selected for heterogeneous service requesting entities in a P2P network.



BRIEF DESCRIPTION OF THE DRAWINGS
FIG. 1 illustrates a P2P network with a peer-client structure in a prior art;
FIG. 2 is a workflow of a method for selecting a service provision entity in a P2P network according to an embodiment of the present invention;
FIG. 3 illustrates a procedure of the method for selecting a service provision entity in a P2P network shown in FIG. 2;
FIG. 4 is a workflow of a method for selecting a service provision entity in a P2P network according to a second embodiment of the present invention;
FIG. 5 illustrates a procedure of the method for selecting a service provision entity in a P2P network shown in FIG. 4;
FIG. 6 is a workflow of a method for selecting a service provision entity in a P2P network according to a third embodiment of the present invention;
FIG. 7 illustrates a procedure of the method for selecting a service provision entity in a P2P network shown in FIG. 6;
FIG. 8 illustrates a structure of a P2P network system according to a first embodiment of the present invention;
FIG. 9 illustrates a structure of a P2P network system according to a second embodiment of the present invention;
FIG. 10 illustrates a structure of a P2P network system according to a third embodiment of the present invention;
FIG. 11 illustrates a structure of a service selection entity according to a first embodiment of the present invention;
FIG. 12 illustrates a structure of a service selection entity according to a second embodiment of the present invention;
FIG. 13 illustrates a structure of a service management entity according to a first embodiment of the present invention; and
FIG. 14 illustrates a structure of a service management entity according to a second embodiment of the present invention.



DETAILED DESCRIPTION OF THE EMBODIMENTS
To make the technical solution of the present invention more comprehensible, the present invention is described in detail with reference to the accompanying drawings and embodiments.
A method for selecting a service provision entity in a P2P network according to an embodiment of the present invention is described with reference to FIG. 2 and FIG. 3. The method includes the following steps:
S201. A service selection entity receives service capability information of service provision entities.
When the P2P network has a peer-client structure, the step of receiving service capability information of service provision entities is: the service selection entity receives the service capability information of each service provision entity through a service management entity, where the service provision entity belongs to a peer managed by the service management entity.
When the service provision entity publishes content to the service selection entity, the service provision entity also publishes its service capability, which may be indicated by a tag. The tag may be “media server”, “VIP server”, or “supporting multicast”, or it may be represented by a score. In the embodiment of the present invention, service provision entities 2, 3, and 5 all publish content key 1 and the service selection entity stores the information published by the service provision entities 2, 3, and 5 in a key-value-tag table, such as Table 1.











TABLE 1







Key
Value
Tag









Key1
Service provision entity 1
Media server




Service provision entity 2
P2P network cache




Service provision entity 3
Common (80)




Service provision entity 4
Common (45)




Service provision entity 5
VIP server



Key2
Service provision entity 1
Media server




Service provision entity 6
Common (65)




Service provision entity 7
Supporting unicast fast filling




Service provision entity 8
Supporting replication




Service provision entity 9
Supporting multicast










In Table 1, key1 and key2 are content keys and service provision entities 1-9 are different values. The tag indicates the service capability of a service provision entity. For example, service provision entity 1 is a media server, and its tag is “media server”; service provision entity 2 supports P2P network cache, and its tag is “P2P network cache”; for a common service provision entity, a score can be provided according to its maximum bandwidth and the computing capability of its CPU, where a higher score means a higher service capability.
S202. The service selection entity obtains service request information of a service requesting entity.
When the P2P network has a peer-client structure, the step of obtaining service request information of a service requesting entity is: the service selection entity obtains service request information of the service requesting entity through a request management entity, where the service requesting entity belongs to a peer managed by the request management entity.
In this step, the service selection entity may receive the service request of the service requesting entity, where the service request carries a service type identifier. The service type may be: common service request, unicast fast filling service request, replication service request, multicast service request, or VIP service request.
S203. The service selection entity selects a service provision entity of the appropriate service capability to provide a service for the service requesting entity, according to the service capability information of the service provision entities and the service request information of the service requesting entity.
In the embodiment of the present invention, the service selection entity obtains the service type identifier carried in the service request of the service requesting entity and selects an appropriate service provision entity from the key-value-tag table according to the service type identifier.
The workflow in FIG. 3 includes but is not limited to the following occasions:
(1) When the service type requested by the service requesting entity is common service, the service selection entity selects a service provision entity whose service capability information is common service capability, which can reduce the burden of media servers.
(2) When the service type requested by the service requesting entity is VIP service, the service selection entity selects a stable service provision entity whose service capability information is VIP server or media server, which can meet the needs of VIP clients.
(3) When the service type requested by the service requesting entity is unicast fast filling, the service selection entity selects a service provision entity whose service capability information is supporting unicast fast filling.
(4) When the service type requested by the service requesting entity is replication, the service selection entity selects a service provision entity whose service capability information is supporting replication.
(5) When the service type requested by the service requesting entity is multicast, the service selection entity selects a service provision entity whose service capability information is supporting multicast. Thereby, a service provision entity that meets the service need is selected. The above method also realizes the switching between the unicast fast filling service and the replication service or the switching between the unicast fast filling service and the multicast service.
The method according to the embodiment of the present invention may further include:
S204. A data stream is set up between the service requesting entity and the selected service provision entity.
In a P2P network, service provision entities are different devices such as mobile phones, common computers, and servers. These devices provide different performance and different bandwidths and therefore, service provision entities are heterogeneous. Service requesting entities are also heterogeneous because the devices serving as service requesting entities are also different and have different storage spaces. As a result, the service requests of them also vary. In the method for selecting a service provision entity in a P2P network provided according to the embodiment of the present invention, the service selection entity receives service capability information of service provision entities; the service selection entity obtains service request information of the service requesting entity; and the service selection entity selects a service provision entity of the appropriate service capability for the service requesting entity according to the service request information of the service requesting entity.
The embodiment of the present invention assumes the P2P network has a peer-client structure. Those skilled in the art understand that the embodiment of the present invention is also applicable to other P2P network structures.
A method for selecting a service provision entity in a P2P network according to another embodiment of the present invention is described with reference to FIG. 4 and FIG. 5. In the embodiment, the P2P network has a peer-client structure. The method includes the following steps:
S401. A service selection entity receives service capability information of a service provision entity when the service provision entity publishes content to the service selection entity.
Table 2 shows a key-value-tag table of service provision entities stored on a service selection entity.











TABLE 2







Key
Value
Tag









Key1
Service provision entity 1
C



Key2
Service provision entity 2
S










In the embodiment of the present invention, the tag of a service provision entity indicates the service capability of the service provision entity. The tag “C” indicates a common service provision entity while the tag “S” indicates a stable service provision entity.
S402. A request management entity receives the request information of all service requesting entities that are currently transferring content and generates statistics of the request information of all service requesting entities that are currently transferring content.
The statistics of the request information of all service requesting entities that are currently transferring content include: total number of service requesting entities, and/or delay sensitiveness of each service requesting entity, and/or real-time requirement of each service requesting entity.
Every time a new service requesting entity initiates a service request for key1, the request management entity generates statistics including the total number of service requesting entities that request key1 and the delay sensitiveness of each service requesting entity, and/or the real-time requirement of each service requesting entity, and sends the statistics to the service selection entity.
S403. The service selection entity obtains the statistics of request information of all service requesting entities that are currently transferring content from the request management entity.
S404. The service selection entity decides an evaluated grade of the data stream currently transferring content according to the request information statistics of all service requesting entities.
The service selection entity records a key-grade table, where the grade indicates the evaluated importance of the data stream currently transferring content.
S405. The service selection entity selects a service provision entity of the appropriate service capability to provide a service for the service requesting entity, according to the service capability information of the service provision entities and the service request information of the service requesting entity.
When the evaluated grade of the data stream currently transferring content is above a first threshold, the service selection entity selects a new service provision entity that has a higher service capability than the current service provision entity; when the evaluated grade of the data stream currently transferring content is below a second threshold, the service selection entity selects a service provision entity that has a lower service capability than the current service provision entity; the first threshold is larger than or equal to the second threshold.
The first threshold or the second threshold is set according to actual service needs.
The service selection entity compares the grade in the key-grade table with the first threshold and the second threshold and judges whether to initiate active source switching. If the active source switching condition is met, the service selection entity queries the local key-value-tag table and selects a service provision entity of the appropriate service capability. Then, the service selection entity returns the query result to a service management entity and the service management entity triggers an active source switching procedure.
S406. The service management entity switches the data stream currently transferring content from the current service provision entity to the selected new service provision entity.
If the current data stream is decided as important, the service management entity may switch the data stream to a stable service provision entity to assure the stability required by the client; if the current data stream is decided as not so important, the service management entity may switch the data stream to a service provision entity of a common service capability so that resources are more reasonably allocated.
Optionally, before the switching of the data stream currently transferring content from the current service provision entity to the selected new service provision entity, the method further includes: judging whether the current service provision entity is faulty and if so, switching the data stream to the new service provision entity. In the embodiment of the present invention, the service selection entity records the evaluated grade of the data stream currently transferring content but does not judge whether it is necessary to change the service provision entity. The service provision entity is changed only when the current service provision entity is found faulty. In the process of selecting the service provision entity, if the service management entity decides that the service data stream is important, the service management entity triggers a source switching procedure to switch to a stable service provision entity; if the service management entity decides that the service data stream is a common data stream, the service management entity triggers the switching to a new common service provision entity. Thereby, a service provision entity of the appropriate service capability is selected according to the needs of the client.
In the embodiment of the present invention, different grades are decided for different service data streams and differentiated maintenance is provided for service data streams of different grades. An important data stream is actively switched to a service provision entity of a higher service capability, thus avoiding the delay caused by source fault detection which is necessary if a data stream is switched only after a source fault is detected. In addition, a reliable service provision entity is selected for an important service request or an important data stream, which avoids frequent change of the service provision entity due to the instability of the service provision entity.
A method for selecting a service provision entity in a P2P network according to another embodiment of the present invention is described with reference to FIG. 6 and FIG. 7. In this embodiment, the P2P network has a peer-client structure. The method includes the following steps:
S601. A service selection entity receives service capability information of a service provision entity from a service management entity, and the service management entity stores the service capability information of the service provision entity locally. The service provision entity belongs to a peer managed by the service management entity.
When the service provision entity publishes content to the service selection entity, the service provision entity also publishes its service capability.
Table 3 shows a service capability table of service provision entities, namely, a key-value-tag table, stored on a service selection entity.











TABLE 3







Key
Value
Tag









Key1
Service provision entity 1
C



Key2
Service provision entity 2
S










S602. A request management entity receives the request information of all service requesting entities that are transferring content and generates statistics of the request information of all service requesting entities that are transferring content.
The statistics of the request information of all service requesting entities that are currently transferring content include: total number of service requesting entities, and/or delay sensitiveness of each service requesting entity, and/or real-time requirement of each service requesting entity.
S603. The service management entity obtains the statistics of request information of all service requesting entities that are currently transferring content from the request management entity.
S604. The service management entity decides an evaluated grade of the data stream currently transferring content according to the request information statistics of all service requesting entities.
This embodiment differs from the preceding embodiment in that the service management entity records the key-grade table, where the grade indicates the evaluated importance of the data stream currently transferring content.
S605. The service management entity requests the service selection entity to select a service provision entity of an appropriate service capability according to the evaluated grade of the data stream currently transferring content.
The service management entity compares the grade in the key-grade table with a first threshold and a second threshold and judges whether it is necessary to initiate active source switching.
When the evaluated grade of the data stream currently transferring content is above the first threshold, the service management entity requests the service selection entity to select a new service provision entity that has a higher service capability than the current service provision entity.
When the evaluated grade of the data stream currently transferring content is below the second threshold, the service management entity requests the service selection entity to select a new service provision entity that has a lower service capability than the current service provision entity. The first threshold is larger than or equal to the second threshold.
Optionally, when all service provision entities currently transferring content belong to one peer managed by the service management entity, the service management entity selects a service provision entity of the appropriate service capability directly according to the locally stored service capability information of service provision entities, thus reducing the delay caused by changing of the service provision entity.
S606. The service selection entity selects a service provision entity of the appropriate service capability to provide a service for the service requesting entity, according to the service capability information of the service provision entities and the service request information of the service requesting entity.
S607. The service management entity switches the data stream currently transferring content from the current service provision entity to the selected new service provision entity.
In the embodiment of the present invention, different grades are decided for different service data streams and differentiated maintenance is provided for service data streams of different grades. An important data stream is actively switched to a service provision entity of a higher service capability, thus avoiding the delay caused by source fault detection which is necessary if a data stream is switched only after a source fault is detected. In addition, a reliable service provision entity is selected for an important service request or an important data stream, which avoids frequent change of the service provision entity due to the instability of the service provision entity.
Optionally, before the switching of the data stream currently transferring content from the current service provision entity to the selected new service provision entity, the method further includes: judging whether the current service provision entity is faulty and if so, switching the data stream to the new service provision entity. In the embodiment of the present invention, the service management entity records the evaluated grade of the data stream currently transferring content in the key-grade table but does not judge whether it is necessary to change the service provision entity. The service provision entity is changed only when the current service provision entity is found faulty. In the process of selecting the service provision entity, if the service management entity decides that the service data stream is important, the service management entity triggers a source switching procedure to switch to a stable service provision entity; if the service management entity decides that the service data stream is a common data stream, the service management entity triggers the switching to a new common service provision entity.
Those skilled in the art understand that all or part of steps in the methods provided according to the preceding embodiments of the present invention can be implemented by hardware under the instruction of a software program. The software program may be stored in a computer readable medium, such as a read only memory (ROM), a random access memory (RAM), a magnetic disk, or a compact disk-read only memory (CD-ROM).
FIG. 8 illustrates a P2P network system provided according to an embodiment of the present invention. The system includes:
at least one service provision entity, configured to publish respective service capability information;
a service requesting entity, configured to send service request information; and
a service selection entity, configured to receive the service capability information of the at least one service provision entity and the service request information of the service requesting entity, and select a service provision entity of an appropriate service capability according to the service capability information of the at least one service provision entity and the service request information of the service requesting entity.
In the P2P network system of the embodiment of the present invention, the service provision entities publish respective service capability information; the service requesting entity sends service request information; the service selection entity receives the service capability information of the service provision entities and the service request information of the service requesting entity, and selects a service provision entity of the appropriate service capability according to the service request information of the service requesting entity. Thereby, heterogeneous service provision entities can be selected for different service requesting entities in the P2P network.
Optionally, as shown in FIG. 9, the P2P network system further includes:
a request management entity, configured to receive the request information of all service requesting entities that are currently transferring content and generate statistics of the request information of all service requesting entities that are currently transferring content;
a service management entity, configured to switch the data stream currently transferring content from the current service provision entity to the selected new service provision entity; and
the service selection entity, further configured to: obtain the statistics of request information of all service requesting entities that are currently transferring content, decide an evaluated grade of the data stream currently transferring content according to the statistics of request information of all service requesting entities that are currently transferring content, and select a new service provision entity of the appropriate service capability according to the evaluated grade of the data stream currently transferring content.
The P2P network system of the embodiment of the present invention decides different grades for different service data streams and provides differentiated maintenance for the service data steams of different grades. The system selects a reliable service provision entity for an important service request or an important data stream and thereby avoids frequent switching of a data stream from one service provision entity to another due to the instability of the service provision entity.
Optionally, the P2P network system of the embodiment of the present invention further includes:
a request management entity, configured to receive the request information of all service requesting entities that are currently transferring content and generate statistics of the request information of all service requesting entities that are currently transferring content;
a service management entity, configured to: obtain the statistics of the request information of all service requesting entities that are currently transferring content from the request management entity, decide an evaluated grade of the data stream currently transferring content according to the statistics of the request information of all service requesting entities, request the service selection entity to select a service provision entity of the appropriate service capability according to the evaluated grade of the data stream currently transferring content, and switch the data stream currently transferring content from the current service provision entity to the selected new service provision entity; and
the service selection entity, further configured to select a new service provision entity of the appropriate service capability according to the request of the service management entity.
Optionally, when the P2P network has a peer-client structure, as shown in FIG. 10, the P2P network includes: at least one service provision entity, a service requesting entity, a service selection entity, a service management entity, and a request management entity, where each service provision entity belongs to a peer managed by the service management entity and the service requesting entity belongs to a peer managed by the request management entity. The service management entity is configured to: receive service capability information of service provision entities from the service provision entities, send the service capability information of the service provision entities to the service selection entity, and store the service capability information of the service provision entities locally. When all service provision entities currently transferring content belong to one peer managed by the service management entity, the service management entity selects a service provision entity of the appropriate service capability according to the locally stored service capability information of the service provision entities, and thereby, reduces the delay caused by selection of a service provision entity by the service selection entity. The request management entity is configured to receive service request information from the service requesting entity and send the request information to the service selection entity.
FIG. 11 illustrates a service selection entity provided according to an embodiment of the present invention. The service selection entity includes:
a receiving unit 111, configured to receive service capability information published by service provision entities and a service type requested by a service requesting entity; and
a selecting unit 112, configured to select a service provision entity of an appropriate service capability according to the service capability information of service provision entities and the service request information of the service requesting entity.
In the service selection entity of the embodiment of the present invention, the receiving unit receives service capability information published by service provision entities and the service type requested by a service requesting entity; the selecting unit selects a service provision entity of the appropriate service capability according to the service request information of the service requesting entity. Thus, the service selection entity is able to select a service provision entity that meets the need of a client from the heterogeneous service provision entities in the P2P network.
Optionally, as shown in FIG. 12, the service selection entity of the embodiment of the present invention further includes: a deciding unit 113, configured to decide an evaluated grade for a data stream currently transferring content according to statistics of request information of all service requesting entities; the receiving unit 111, further configured to receive the statistics of request information of all service requesting entities currently transferring content; and the selecting unit 112, further configured to select a new service provision entity of the appropriate service capability according to the evaluated grade of the data stream currently transferring content. The service selection entity of the embodiment of the present invention decides different grades for different service data streams and provides differentiated maintenance for service data streams of different grades.
A request management entity according to an embodiment of the present invention includes:
a receiving unit, configured to receive requests of all service requesting entities currently transferring content;
a statistics unit, configured to generate statistics of request information of all service requesting entities currently transferring content; and
a sending unit, configured to send the statistics of request information of all service requesting entities.
In the request management entity of the embodiment of the present invention, the receiving unit receives the requests of all service requesting entities currently transferring content; the statistics unit generates statistics of the request information of all service requesting entities currently transferring content; and the sending unit sends the statistics of the request information of all service requesting entities. Thus, the request management entity is able to generate statistics related to the requests of service requesting entities currently transferring content and thereby provides a reference for the decision of the grade of the data stream currently transferring content.
FIG. 13 illustrates a service management entity provided according to an embodiment of the present invention. The service management entity includes:
a receiving unit 131, configured to receive statistics of request information of all service requesting entities;
a deciding unit 132, configured to decide an evaluated grade of a data stream currently transferring content according to the request information statistics of all service requesting entities; and
a requesting unit 133, configured to request the service selection entity to select a service provision entity of an appropriate service capability according to the evaluated grade of the data stream currently transferring content.
The service management entity of the embodiment of the present invention decides different grades for different service data streams and provides differentiated maintenance for the service data steams of different grades. The service management entity requests the service selection entity to select a reliable service provision entity for an important service request or an important data stream and thereby avoids frequent switching of a data stream from one service provision entity to another due to the instability of the service provision entity.
Optionally, as shown in FIG. 14, the service management entity of the embodiment of the present invention further includes:
a judging unit 134, configured to judge whether the current service provision entity is faulty; and
a switching unit 135, configured to switch the data stream currently transferring content from the current service provision entity to the selected new service provision entity when the current service provision entity is faulty.
In the case of an important data stream, or when the current service provision entity is faulty, the data stream is switched to a service provision entity of a higher service capability. Thus, a reliable service provision entity is selected for an important service request or an important data stream, which avoids the frequent switching of a data stream from one service provision entity to another due to the instability of the service provision entity. The service management entity of the embodiment of the present invention may include no judging unit and the switching unit initiates a switching procedure directly, thus avoiding the delay caused by source fault detection which is necessary if a data stream is switched only after a source fault is detected.
Optionally, as shown in FIG. 14, the service management entity of the embodiment of the present invention further includes:
a transit unit 136, configured to receive the service capability information of service provision entities and send the service capability information to a storing unit 137;
the storing unit 137, configured to store the service capability information of service provision entities; and
a selecting unit 138, configured to select a service provision entity of the appropriate service capability according to locally stored service capability information of service provision entities when all service provision entities currently transferring content belong to one peer managed by the service management entity.
When the P2P network has a peer-client structure, the transit unit receives the service capability information of service provision entities and sends the information to the storing unit; the storing unit stores the service capability information of service provision entities; and when all service provision entities currently transferring content belong to one peer managed by the service management entity, the selecting unit selects a service provision entity of the appropriate service capability according to locally stored service capability information of service provision entities, thus reducing the delay caused by the selection of a service provision entity by the service selection entity.
A service provision entity according to an embodiment of the present invention includes:
a providing unit, configured to provide service content; and
a sending unit, configured to publish service capability information of the service provision entity.
In the service provision entity of the embodiment of the present invention, the sending unit publishes the service capability information of the service provision entity when publishing content. Thus, different service provision entities can be selected for different client needs according to the different service capabilities provided by the service provision entities.
The embodiments of the present invention are applicable to P2P overlay networks with a peer-client structure and also applicable to unstructured P2P networks with a non-peer-client structure.
In conclusion, the above are merely preferred embodiments of the present invention. However, the scope of the present invention is not limited thereto. Changes or replacements readily apparent to persons skilled in the prior art within the technical scope of the present invention should fall within the scope of the present invention. Therefore, the scope of the present invention is subject to the appended claims.

## Claims

1. A method for selecting a service provision entity in a peer-to-peer (P2P) network, comprising:
receiving service capability information of service provision entities;
obtaining service request information of a service requesting entity, wherein obtaining the service request information of the service requesting entity comprises:
obtaining, by a service selection entity, statistics of request information of all service requesting entities that are currently transferring content from a request management entity; and
deciding, by the service selection entity, an evaluated grade of a data stream currently transferring content according to the request information statistics of all service requesting entities; and

selecting a service provision entity of an appropriate service capability to provide a service for the service requesting entity according to the service capability information of service provision entities and the service request information of the service requesting entity; wherein selecting the service provision entity of the appropriate to the service capability information of service provision entities and the service request information of the service requesting entity comprises:
selecting a new service provision entity that has a higher service capability than a current service provision entity when the evaluated grade of the data stream currently transferring content is above a first threshold; and
selecting a new service provision entity that has a lower service capability than the current service provision entity when the evaluated grade of the data stream currently transferring content is below a second threshold, wherein the first threshold is larger than or equal to the second threshold.

2. The method of claim 1, further comprising: switching the data stream currently transferring content from the current service provision entity to the selected new service provision entity.

3. The method of claim 2, further comprising: switching the data stream currently transferring content from the current service provision entity to the selected new service provision entity when judging that the current service provision entity is faulty.

4. A method for selecting a service provision entity in a peer-to-peer (P2P) network, comprising:
receiving service capability information of service provision entities;
obtaining service request information of a service requesting entity; wherein obtaining the service request information of the service requesting entity comprises:
obtaining, by a service management entity, statistics of request information of all service requesting entities that are currently transferring content from a request management entity; and
by the service management entity, deciding an evaluated grade of a data stream currently transferring content according to the request information statistics of all service requesting entities, and requesting a service selection entity to select a service provision entity of an appropriate service capability according to the evaluated grade of the data stream currently transferring content; and
selecting a service provision entity of an appropriate service capability to provide a service for the service requesting entity according to the service capability information of service provision entities and the service request information of the service requesting entity; and

wherein, when the P2P network has a peer-client structure:
receiving service capability information of service provision entities comprises: receiving the service capability information of service provision entities via the service management entity and storing, by the service management entity, the service capability information of service provision entities locally, wherein each service provision entity belongs to a peer managed by the service management entity;
obtaining the service request information of the service requesting entity is comprises: obtaining the service request information of the service requesting entity via the request management entity, wherein the service requesting entity belongs to a peer managed by the request management entity; and
requesting the service selection entity to select the service provision entity of the appropriate service capability according to the evaluated grade of the data stream currently transferring content is comprises: by the service management entity, selecting the service provision entity of the appropriate service capability according to the locally stored service capability information of service provision entities when all service provision entities currently transferring content belong to one peer managed by the service management entity.

5. A peer-to-peer (P2P) network system, comprising:
at least one service provision entity, configured to publish respective service capability information;
a service requesting entity, configured to send service request information; and
a service selection entity, configured to receive the service capability information of the at least one service provision entity and the service request information of the service requesting entity, and select a service provision entity of an appropriate service capability according to the service capability information of the at least one service provision entity and the service request information of the service requesting entity;
a request management entity, configured to receive request information of all service requesting entities currently transferring content and generate statistics of the request information of all service requesting entities currently transferring content;
a service management entity, configured to: obtain the request information statistics of all service requesting entities currently transferring content from the request management entity, decide an evaluated grade of a data stream currently transferring content according to the request information statistics of all service requesting entities, request the service selection entity to select a service provision entity of an appropriate service capability according to the evaluated grade of the data stream currently transferring content, and switch the data stream currently transferring content from a current service provision entity to a selected new service provision entity; and
the service selection entity, further configured to select the new service provision entity of the appropriate service capability according to the request of the service management entity;
wherein:
when the P2P network has a peer-client structure, the service management entity is further configured to: receive service capability information of service provision entities from the service provision entities, send the service capability information to the service selection entity, and store the service capability information of service provision entities locally, wherein each service provision entity belongs to a peer managed by the service management entity; when all service provision entities currently transferring content belong to one peer managed by the service management entity, the service management entity selects a service provision entity of an appropriate service capability according to the locally stored service capability information of service provision entities; and
the request management entity is further configured to receive the service request information from the service requesting entity and send the service request information to the service selection entity, wherein the service requesting entity belongs to a peer managed by the request management entity.