A p2p node sharing method and device

By dividing data streams and node groups into sub-streams and internal and external sharing pools, and dynamically adjusting node weight values, the problem of lag caused by excessive node depth in P2P node sharing is solved, achieving efficient utilization of high-quality nodes and reasonable allocation of resources.

CN115473903BActive Publication Date: 2025-12-05武汉斗鱼鱼乐网络科技有限公司
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202110569612.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-05-25
Publication Date
2025-12-05
Estimated Expiration
2041-05-25

AI Technical Summary

Technical Problem

In the existing P2P node sharing model, excessive node depth can easily lead to lag and prevent the effective utilization of high-quality nodes in the network, resulting in resource waste.

Method used

The data stream is divided into N sub-streams, and the sharing nodes are divided into N node groups, forming an inner sharing pool and an outer sharing pool. The inner sharing pool enables sharing within the group, and the outer sharing pool enables sharing outside the group. The node utilization is dynamically adjusted and optimized using node weight values ​​to avoid forming an excessively deep sharing tree.

Benefits of technology

It reduces node lag, improves the utilization rate of high-quality nodes, avoids node waste, and enhances network sharing efficiency and stability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115473903B_ABST
    Figure CN115473903B_ABST
Patent Text Reader

Abstract

The application discloses a P2P node sharing method and device, wherein the method comprises the following steps: dividing a data stream into N sub-streams, and dividing a sharing node into N node groups; the sub-streams correspond to the node groups one by one; a target group acquires a target sub-stream, and sends the target sub-stream to a node group outside the target group; the target group is any one of the N node groups; the method comprises the following steps: sending the target sub-stream to a first target node; based on the first target node, sharing the target sub-stream to a second node; based on the second node, sharing the target sub-stream to a node group outside the target node group. In the sharing process, an inner sharing pool is formed to realize group sharing, then an outer sharing pool is used to realize sharing of all nodes outside the group, so that a deep sharing tree is not formed, and the problem of lagging caused by too deep nodes is avoided; meanwhile, all nodes in the node group can be effectively used through the inner sharing pool and the outer sharing pool, and node waste is avoided.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of network communication, and in particular to a P2P node sharing method and device. BACKGROUND

[0002] Current p2p (Peer to Peer, peer-to-peer network) technology is widely used in live broadcast, and the grouping mode and the tree mode are common p2p sharing modes. The grouping mode is limited by the grouping size, and the sharing rate has a hard limit. In the tree mode, the sharing rate has no hard limit, but the tree stability is difficult to maintain due to the network quality and the viewing time distribution, the node depth is too deep, the delay is too high, and the stall rate will also rise. With the general improvement of terminal network quality and hardware quality, the ratio of high-quality nodes is continuously increasing, and pure use of the grouping mode cannot maximize the use of high-quality nodes. Using the existing grouping mode and tree mode can easily cause waste of high-quality nodes.

[0003] Therefore, the current traditional technology has the disadvantage that the node depth is too deep and is prone to stall, and the high-quality nodes in the network cannot be effectively utilized. SUMMARY

[0004] In view of the above problems, the present application provides a P2P node sharing method and device, which does not make the node depth too large, reduces the node stall, and improves the utilization rate of high-quality nodes.

[0005] In a first aspect, the present application provides the following technical solutions through an embodiment:

[0006] A P2P node sharing method, comprising:

[0007] dividing a data stream into N sub-streams, and dividing sharing nodes into N node groups; the sub-streams and the node groups correspond one by one; a target group obtains a target sub-stream, and sends the target sub-stream to a node group outside the target group; the target group is any one of the N node groups; a plurality of sharing nodes in the target group form an inner sharing pool and an outer sharing pool, the inner sharing pool includes a plurality of first nodes, and the outer sharing pool includes a plurality of second nodes; the target group obtains a target sub-stream, and sends the target sub-stream to a node group outside the target group, comprising: sending the target sub-stream to a first target node; wherein the first target node belongs to the first node; based on the first target node, sharing the target sub-stream to the second node; based on the second node, sharing the target sub-stream to a node group outside the target node group.

[0008] Optionally, before the target sub-stream is sent to the first target node, it further comprises:

[0009] Obtaining a weight value of each of the first nodes; determining the first node with the largest weight value as the first target node.

[0010] Optionally, before the obtaining of the weight value of each of the first nodes, the method further comprises:

[0011] Updating the weight value of the first node based on a running time length, a listened time length and a number of times of reporting of freezing of the first node every preset time length.

[0012] Optionally, the updating of the weight value of the first node based on the running time length, the listened time length and the number of times of reporting of freezing of the first node every preset time length comprises:

[0013] Correcting the running time length and the listened time length based on the number of times of reporting of freezing; updating the weight value of the first node based on a first logarithm and a second logarithm every preset time length; wherein the first logarithm is a logarithm of the corrected running time length, and the second logarithm is a logarithm of the corrected listened time length.

[0014] Optionally, the correcting of the running time length and the listened time length based on the number of times of reporting of freezing comprises:

[0015] Correcting the running time length based on dlive = dlive * m1 every time the freezing is reported; wherein dlive represents the running time length, and m1 is a correction coefficient; correcting the listened time length based on dlisten = dlisten (0, n) * m2 every time the freezing is reported; wherein dlisten represents the listened time length, m2 is a correction coefficient, and n is a number of nodes listening to the first node.

[0016] Optionally, the updating of the weight value of the first node based on the first logarithm and the second logarithm every preset time length comprises:

[0017] Updating the weight value of the first node based on weigh_live = ln (dlive) * k1 and weigh_listen = ln (dlisten) * k2 every preset time length; wherein weight = weigh_live + weigh_listen, and k1 and k2 are adjustment coefficients.

[0018] Optionally, the sharing of the target sub-stream to the second node based on the first target node comprises:

[0019] ​determining whether the sharing number of the first target node reaches an upper limit; if not, sharing the target sub-stream to the second node based on the first target node; if yes, disconnecting the sharing relationship between the first target node and the second target node; wherein the second target node is a node in a node group other than the target group; sharing the target sub-stream to the second node based on the first target node, and sharing the target sub-stream to the second target node based on the second target node.

[0020] In a second aspect, based on the same inventive concept, an embodiment of the present application provides the following technical scheme:

[0021] A P2P node sharing device, comprising:

[0022] a division module, configured to divide a data stream into N sub-streams and divide sharing nodes into N node groups; the sub-streams correspond to the node groups one by one; a sharing module, configured to acquire a target sub-stream by a target group and send the target sub-stream to a node group other than the target group; the target group is any one of the N node groups; a plurality of sharing nodes in the target group form an inner sharing pool and an outer sharing pool; the inner sharing pool contains a plurality of first nodes, and the outer sharing pool contains a plurality of second nodes; the sharing module comprises: a first inner sharing unit, configured to send the target sub-stream to a first target node; wherein the first target node belongs to the first nodes; a second inner sharing unit, configured to share the target sub-stream to the second nodes based on the first target node; and an outer sharing unit, configured to share the target sub-stream to a node group other than the target node group based on the second nodes.

[0023] Optionally, the sharing module further comprises a third inner sharing unit, configured to perform the following operations before the target sub-stream is sent to the first target node:

[0024] acquire a weight value of each first node; and determine the first node with the largest weight value as the first target node.

[0025] In a third aspect, based on the same inventive concept, an embodiment of the present application provides the following technical scheme:

[0026] A computer readable storage medium, having stored thereon a computer program, the program being executed by a processor to implement the steps of the method of any one of the above first aspect.

[0027] The P2P node sharing method and device provided in the embodiment of the present application, by dividing a data stream into N sub-streams and dividing the sharing nodes into N node groups, the sub-streams correspond to the node groups one by one. Then, a target group acquires a target sub-stream and sends the target sub-stream to the node groups outside the target group, thereby realizing sharing, the target group being any one of the N node groups. And the plurality of sharing nodes in the target group can form an inner sharing pool and an outer sharing pool, the inner sharing pool containing a plurality of first nodes and the outer sharing pool containing a plurality of second nodes; the target group acquires a target sub-stream and sends the target sub-stream to the node groups outside the target group, including: sending the target sub-stream to a first target node; wherein the first target node belongs to the first nodes; then, based on the first target node, sharing the target sub-stream to the second nodes; finally, based on the second nodes, sharing the target sub-stream to the node groups outside the target group. The embodiment of the present application forms an inner sharing pool to realize group sharing in the process of sharing, and then realizes sharing of all nodes outside the group through an outer sharing pool, without forming a deep sharing tree, avoiding the problem of lag caused by too deep nodes; at the same time, through the inner sharing pool and the outer sharing pool, all nodes in the node group can be effectively utilized, avoiding node waste.

[0028] The above description is only a summary of the technical solutions of the present application, in order to more clearly understand the technical means of the present application, the content of the specification can be implemented, and in order to make the above and other purposes, characteristics and advantages of the present application more obvious and easy to understand, the specific embodiments of the present application are described as follows. BRIEF DESCRIPTION OF DRAWINGS

[0029] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed in the embodiment description will be briefly introduced as follows. Obviously, the drawings in the following description are some embodiments of the present application, and those skilled in the art can also obtain other drawings according to these drawings without creating any creative labor. In the drawings:

[0030] Figure 1 A flow chart of a P2P node sharing method provided by the first embodiment of the present application is shown;

[0031] Figure 2 A flow chart of the specific implementation method of step S20 in Figure 1

[0032] Figure 3 A schematic diagram of the sharing principle of an exemplary p2p sharing node in the first embodiment of the present application is shown;

[0033] Figure 4 A structural schematic diagram of a P2P node sharing device provided by the second embodiment of the present application is shown. DETAILED DESCRIPTION​

[0034] Exemplary embodiments of the present disclosure will be described in greater detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it is understood that the present disclosure can be embodied in various forms and should not be limited by the embodiments set forth herein. Rather, these embodiments are provided so that the present disclosure will be thoroughly and completely understood, and will fully convey the scope of the present disclosure to those skilled in the art.

[0035] First Embodiment

[0036] Referring to Figure 1 , a flow chart of a P2P node sharing method provided by the first embodiment of the present disclosure is shown. The steps of the method are as follows:

[0037] Step S10: Dividing a data stream into N sub-streams, and dividing sharing nodes into N node groups; the sub-streams and the node groups correspond to each other one by one.

[0038] In step S10, after grouping the data stream and the sharing nodes, each sharing node corresponds to a sub-stream, which facilitates flexible scheduling of the nodes under a sub-stream, and is conducive to improving sharing efficiency. In the present embodiment, N should be greater than or equal to 2, to ensure that the data stream can be divided into multiple sub-streams to realize data stream sharing after passing through the sharing nodes. The number of sharing nodes in each node group can be the same or different, and is not limited.

[0039] Step S20: A target group acquires a target sub-stream, and sends the target sub-stream to a node group outside the target group; the target group is any one of the N node groups.

[0040] In step S20, since the target group contains multiple sharing nodes, the target sub-stream is acquired by the sharing nodes in the target group from a CDN (Content Delivery Network). Then, the target sub-stream is shared by the sharing nodes in the target group to a node group outside the target group. Since the target group is any one of the node groups, the above sharing process is applicable to any node group, thereby realizing data stream sharing and saving bandwidth resources.

[0041] In the embodiment, the sharing pool can be constructed based on the plurality of sharing nodes in the target group, and the sharing pool includes an inner sharing pool and an outer sharing pool. The inner sharing pool is used for sharing the target substream by the nodes in the target group, and the outer sharing pool is used for sharing the target substream by the nodes in other groups. The nodes in the inner sharing pool and the outer sharing pool can be partially the same. For example, each sharing node corresponds to an updatable weight value, the outer sharing pool includes all the sharing nodes in the target group that do not reach the upper limit of the sharing quantity, and the sharing nodes in the inner sharing pool are the top 20% of the sharing nodes in the target group with the largest weight values, and the number of nodes in the inner sharing pool can be adaptively adjusted according to requirements. The weight value of the sharing node is described in detail below. For convenience of description, the nodes in the inner sharing pool are referred to as first nodes, and the nodes in the outer sharing pool are referred to as second nodes; that is, the inner sharing pool includes a plurality of first nodes, and the outer sharing pool includes a plurality of second nodes.

[0042] Referring to Figure 2 , step S20 includes the following implemented substeps:

[0043] Step S21: sending the target substream to a first target node; wherein the first target node belongs to the first nodes.

[0044] In step S21, the first target node is determined from the plurality of first nodes. That is, before step S21, the weight value of each first node can be obtained first; then, the first node with the largest weight value is determined as the first target node. In the embodiment, the larger the weight value is, the longer the running time of the node is and the better the network state during the running is. Selecting the first node with the largest weight value as the target node can ensure that the target substream is not limited by the running time and the network state during the sharing process, and can improve the sharing efficiency of the target substream and the sharing rate of the entire network.

[0045] Due to the real-time fluctuations of the network state and the different working environments of different clients, in order to ensure the sharing quality of the target substream, the weight value of each first node is configured in the embodiment to monitor the running quality of each first node, so that the high-quality sharing nodes can be effectively utilized. In the embodiment, the weight value updating process of the first node is as follows:

[0046] The weight value of the first node is updated based on the running time, the listening time and the number of times of reporting the lag of the first node every preset time length.

[0047] The preset time length can be freely set. However, according to the running state of the sharing node in the embodiment, the preset time length can be set to 3-10s, and can be 3s, 5s, 6s, 9s, etc. Preferably, the preset time length is 5s, which can ensure timely state updating of the node and avoid large calculation overhead; that is, the weight value of the first node is updated every 5s. When updating, if the state of the node is good, the weight value of the node is increased, and if the state of the node is poor, the weight value of the node is decreased. The updating process is as follows:

[0048] First, the running time length and the listened time length are corrected based on the number of times of reporting the lag.

[0049] Specifically, if a first node lags, the other sharing nodes that listen to the first node report the lag, or the other sharing nodes that subscribe to the first node report the lag. When the first node lags, it indicates that the network quality of the first node is low, and the weight value of the first node should be reduced to avoid the first node as an intermediate sharing node.

[0050] In the embodiment, the weight value is determined by the running time length and the listened time length of the first node. Therefore, the weight value of the first node can be reduced by correcting the running time length and the listened time length. Specifically, the running time length is corrected based on dlive=dlive*m1 at each time of reporting the lag; wherein dlive represents the running time length, and m1 is a correction coefficient; and the listened time length is corrected based on dlisten=dlisten(0,n)*m2; wherein dlisten represents the listened time length, dlisten(0,n) represents the sum of the listened time lengths of n nodes, m2 is a correction coefficient, and n is the number of nodes listening to the first node. m1 and m2 can be the same or different; m1 and m2 can be in the range of 0.6-0.9, for example, 0.7, 0.75, 0.8, etc.; preferably, m1 and m2 can be 0.75, which can ensure that the weight of the first node can be reasonably reduced when lagging, and the high-quality node with occasional lagging is not missed; if the value is too large, the weight of the low-quality node can not be quickly reduced; if the value is too small, some high-quality nodes can not be effectively utilized.

[0051] The advantage of using the above algorithm of multiplying a constant when the lagging decays in the embodiment is that the weight can be quickly reduced when the lagging occurs continuously, and the weight is not reduced too quickly when the lagging occurs occasionally, which is beneficial to using long-term online high-quality nodes.

[0052] Then, every preset time length, the weight value of the first node is updated based on the first logarithm and the second logarithm; wherein the first logarithm is the logarithm of the corrected running time length, and the second logarithm is the logarithm of the corrected listening time length.

[0053] Specifically, the base of the first logarithm and the second logarithm is not limited. In the embodiment, the weight value updating can be performed in the following form: every preset time length, the weight value is updated based on weigh_live = ln(dlive) * k1 and The weight value of the first node is updated; wherein the weight value of the first node weight = weigh_live + weight_listen, k1 and k2 are adjustment coefficients, and weight can be an integer value, and the integer taking manner is not limited. For example, the integer taking manner can be rounding or rounding off. k1 and k2 can be set to larger values in the case that the overall network condition is good, so as to ensure that the weight value of the first node quickly reaches a stable state, and to reflect the real running quality of the current node. k1 and k2 can be set to smaller values in the case that the overall network condition is poor, so as to ensure that the weight value of the first node can truly reflect the running condition of the current node, and to avoid that the weight value fluctuates too much. Specifically, k1 and k2 can be set to 15-25, and more preferably, k1 and k2 can be set to 20, so as to ensure that the obtained weight value has a proper value size. k1 and k2 can have the same value or different values. By using the natural logarithm and correcting and adjusting by k1 and k2, it can be ensured that the weight value of the first node can be quickly updated and changed at the initial start, and can tend to be stable after running for a period of time, so that the weight value can accurately reflect the running quality of the first node.

[0054] Step S22: sharing the target sub-flow to the second node based on the first target node.

[0055] In step S22, the first target node belongs to the internal sharing pool, and the first target node can also belong to the external sharing pool. Due to the performance limitation, the number of shares of a node has an upper limit. When the number of shares of the first target node reaches the upper limit, the first target node cannot be subscribed and listened to by other nodes again. Therefore, step S22 in the embodiment specifically includes the following sub-steps:

[0056] Step S221: judging whether the number of shares of the first target node reaches the upper limit.

[0057] In step S221, the number of shares of the first target node can be set by the server or set by the node itself, and is not limited. For example, the upper limit of the number of shares can be set to 6, 8, 10, 12, etc. At the same time, the hardware performance and network bandwidth of the node can be monitored, and the upper limit of the number of shares can be set to be larger when the hardware performance is better and the network bandwidth is larger.

[0058] Step S222: If no, then share the target sub-stream to the second node based on the first target node.

[0059] In step S222, if the number of sharing of the first target node does not reach the upper limit, the second node other than the first target node can directly subscribe to the first target node, and the first target node shares the sub-stream to the second node.

[0060] Step S223: If yes, disconnect the sharing relationship between the first target node and the second target node; wherein the second target node is a sharing node in the node group other than the target group.

[0061] In step S223, if the number of sharing of the first target node has reached the upper limit, no new listening node can be added to the first target node. At this time, in order to ensure that other nodes in the target group can directly obtain data from the first target node to improve the sharing rate of data, the second target node in the other node group that listens to the first target node can be disconnected. The number of disconnected second target nodes is the same as the number of second nodes that need to subscribe to the first target node. There are two ways to determine the second target node: one is to randomly determine a node from the nodes that listen to the first target node and belong to the other node group as the second target node; the other is to determine a node with the smallest weight value from the nodes that listen to the first target node and belong to the other node group as the second target node. This way can place the worst node at the end node, effectively improving the sharing rate of the network.

[0062] Step S224: Share the target sub-stream to the second node based on the first target node, and share the target sub-stream to the second target node based on the second node.

[0063] In step S224, since the first target node disconnects the sharing relationship with the second target node, the first target node vacates a sharing position and does not reach the upper limit of the number of sharing. At this time, the target sub-stream can be shared to the second node through the first target node, and the second node can share the target sub-stream to the second target node, that is, replace the subscription object of the second target node. If the second target node is a node with a lower weight value, the worst node can be placed at the end node, which can improve the sharing rate of the network. In this embodiment, each second node accessing the network can subscribe to the first target node in the above-mentioned manner.

[0064] Step S23: Share the target sub-stream to the node group other than the target node group based on the second node.

[0065] In step S23, when the second nodes share the target sub-flow to the node groups outside the target node group, the sharing can be performed in sequence according to the weight values between the second nodes from large to small. For example, the weight values of the nodes A, B and C in the outer sharing pool decrease in sequence, and then the node A is preferentially used for sharing. When the sharing quantity of the node A reaches the upper limit, the node whose sharing quantity reaches the upper limit is removed from the outer sharing pool, and then the nodes B and C are sequentially used for sharing. When sharing, the nodes in the other node groups can be shared in sequence according to the login sequence of the nodes.

[0066] The advantage of sequentially sharing based on the weight values is that the high-quality second nodes are preferentially used for sharing, and the sharing rate of the entire network is improved. When the second nodes are shared to all the nodes in the other node groups, the formation of a too deep sharing tree is avoided, and the delay and lag of the network are reduced.

[0067] In the embodiment, a specific example is provided to illustrate the steps of the method, as follows.

[0068] Please refer to Figure 3 In an example, the network nodes are divided into four node groups: Peer1, Peer2, Peer3 and Peer4, and each node group contains five sharing nodes: 0, 1, 2, 3 and 4. The CDN divides the data logic into four equal parts, i.e., four sub-flows: sub-flow 1, sub-flow 2, sub-flow 3 and sub-flow 4. Then, the inner sharing pool Poo1_In and the outer sharing pool Poo1_Out are defined for each node.

[0069] When the node Peer1_0 enters the p2p sharing, the maximum subscription number of the node Peer1_0 is 8, the node Peer1_0 is added to Poo1_Out and Poo1_In, and the subscription number of the first sub-flow is independently calculated for Poo1_In. Within a certain limit, the node Peer1_0 runs with time and the subscription of the sharing node, and the weight value of the sharing node is updated every 5s according to the preset time length. The other node clients of the subscription node Peer1_0 report the lag. The weight value is updated as follows:

[0070] With the increase of the running time dlive (unit: second), the first weight corresponding to the running time is updated every 5s as follows:

[0071] weigh_live = ln(dlive) * 20

[0072] With the increase of the listening time dlisten(n) of the node Peer1_0 (unit: second), the second weight corresponding to the listening time is updated every 5s as follows:

[0073]

[0074] The node of the listening node Peer1_0 generates a cumulative amount decay every time it reports a stall, and corrects the running time dlive and the listened time dlisten(n) as follows:

[0075] dlive = dlive * 0.75

[0076] dlisten = dlisten(0, n) * 0.75

[0077] Finally, the weight value of the node Peer1_0 is:

[0078] weight = weight_live + weight_listen

[0079] The weight value is rounded as the weight value. Since each node in Peer1 has a weight value, Poo1_In and Poo1_Out can be divided according to the weight value. The above weight value generation uses a logarithmic algorithm, which can quickly change and adjust at the beginning of node login, and remain stable after running for a period of time, which is beneficial to the screening of high-quality nodes. The stall decay uses a constant algorithm, which can quickly reduce the weight when continuous stalls occur; when an accidental stall occurs, the weight will not decrease too quickly, which is beneficial to the use of long-term online high-quality nodes.

[0080] Further, if the weight value of the node Peer1_0 is the highest, the node Peer1_0 pulls the data of substream 1 from the CDN. When the node Peer1_1 in the sharing group Peer1 enters the p2p sharing, the node with the highest weight value Peer1_0 is taken out from Poo1_In. If the subscription number is full, a sharing node in the groups Peer2-Peer4 is selected, the subscription relationship of which is changed to the node Peer1_1, and the node Peer1_1 subscribes to the node Peer1_0. The node Peer1_1 receives the notification of establishing a p2p connection with the node Peer1_0, and starts p2p hole punching; after the node Peer1_1 and the node Peer1_0 successfully punch a hole, a p2p channel is established, and data transmission is started. The node Peer1_0 real-time pulls back the data of substream 1 from the CDN, and sends it to the node Peer1_1 through the p2p channel, completing the intra-substream sharing.

[0081] Since the node Peer1_1 starts with a low weight value (the initial weight value of a node can be set to 0), the node Peer1_1 joins Poo1_Out for external sharing. The nodes Peer1_2 to Peer1_4 perform the same as the node Peer1_1 in terms of the p2p sharing principle, and all of them acquire the data of substream 1 by subscribing to the node Peer1_0. Thus, a single-layer subscription tree from the node Peer1_0 to the nodes Peer1_1 to Peer1_4 is formed. When each node joins the internal sharing pool and the external sharing pool, the number of Poo1_In nodes can be controlled according to a fixed ratio. If the number of Poo1_In nodes is insufficient, the node with the highest weight in Poo1_Out is selected to join. For example, when the node Peer1_0 is offline, the node with the highest weight in Poo1_Out is selected to join.

[0082] Further, when the node Peer2_0 in the node group Peer2 logs in, the in-group sharing process of the node Peer2_0 can refer to the description of the node Peer1_0 in the sharing group Peer1. The process of sharing the data of substream 1 to the node Peer2_0 is as follows: the node with the highest weight value in Poo1_Out is taken out, and if the subscription number of the node Peer1_0 with the highest weight value reaches the upper limit, the node Peer1_0 is removed from Poo1_Out; the node Peer1_1 with the highest weight value in Poo1_Out is taken out, and the listening number is increased. The information of the node Peer1_1 is sent to the client of the node Peer2_0, and the node Peer2_0 starts to punch a hole and establish a p2p channel. After the p2p connection is established, the node Peer1_1 starts to send the data of substream 1 to the node Peer2_0. Similarly, the nodes Peer2_1, Peer2_2, Peer2_3 and Peer2_4 acquire the data of substream 1 by listening to the sharing nodes corresponding to substream 1.

[0083] Through the intra-substream and inter-substream sharing, the theoretical value of the data sharing rate of substream 1 can reach 95%. Similarly, substream 2, substream 3 and substream 4 can also use the above sharing mode, so that the theoretical value of the overall sharing rate of substream 1 to substream 4 can reach 95%. In the node sharing process, the use of a proper node weight tree control algorithm can better ensure that high-quality nodes are used and effectively improve the sharing rate.

[0084] To sum up, the P2P node sharing method provided in the embodiment divides a data stream into N sub-streams, and divides sharing nodes into N node groups; the sub-streams correspond to the node groups one by one. Then, a target group acquires a target sub-stream, and sends the target sub-stream to a node group outside the target group, so as to realize sharing, and the target group is any one of the N node groups. Moreover, a plurality of sharing nodes in the target group can form an inner sharing pool and an outer sharing pool, the inner sharing pool includes a plurality of first nodes, and the outer sharing pool includes a plurality of second nodes; the target group acquires a target sub-stream, and sends the target sub-stream to a node group outside the target group, including: sending the target sub-stream to a first target node; wherein the first target node belongs to the first nodes; then, based on the first target node, the target sub-stream is shared to the second nodes; finally, based on the second nodes, the target sub-stream is shared to a node group outside the target node group. In the process of sharing, the inner sharing pool is formed to realize sharing in the group, and then all nodes outside the group are shared through the outer sharing pool, so that a deep sharing tree is not formed, and the problem of lag caused by too deep nodes is avoided; at the same time, all nodes in the node group can be effectively utilized through the inner sharing pool and the outer sharing pool, and node waste is avoided.

[0085] Second embodiment

[0086] Based on the same inventive concept, the second embodiment of the present application provides a P2P node sharing device 300. Figure 4 The structure diagram of the P2P node sharing device 300 provided by the second embodiment of the present application is shown. The P2P node sharing device 300 comprises:

[0087] The dividing module 31 is configured to divide a data stream into N sub-streams, and divide sharing nodes into N node groups; the sub-streams correspond to the node groups one by one; the sharing module 32 is configured to acquire a target sub-stream by a target group, and send the target sub-stream to a node group outside the target group; the target group is any one of the N node groups; a plurality of sharing nodes in the target group form an inner sharing pool and an outer sharing pool, the inner sharing pool includes a plurality of first nodes, and the outer sharing pool includes a plurality of second nodes; the sharing module 32 comprises: a first inner sharing unit 321, configured to send the target sub-stream to a first target node; wherein the first target node belongs to the first nodes; a second inner sharing unit 322, configured to share the target sub-stream to the second nodes based on the first target node; and an outer sharing unit 323, configured to share the target sub-stream to a node group outside the target node group based on the second nodes.

[0088] As an optional implementation, the third inner sharing unit is further configured to, before the target sub-stream is sent to the first target node:

[0089] obtaining a weight value of each of the first nodes; determining the first node with the largest weight value as the first target node.

[0090] As an optional implementation, the method further includes a weight updating unit configured to, before the obtaining of the weight value of each of the first nodes:

[0091] updating the weight value of the first node based on a running time length, a listened time length and a number of times of reporting a lag of the first node every preset time length.

[0092] As an optional implementation, the weight updating unit is further configured to:

[0093] correcting the running time length and the listened time length based on the number of times of reporting the lag; and updating the weight value of the first node based on a first logarithm and a second logarithm every preset time length, wherein the first logarithm is a logarithm of the corrected running time length, and the second logarithm is a logarithm of the corrected listened time length.

[0094] As an optional implementation, the weight updating unit is further configured to:

[0095] correcting the running time length based on dlive = dlive * m1 every time the lag is reported, wherein dlive represents the running time length, and m1 is a correction coefficient; and correcting the listened time length based on dlisten = dlisten(0, n) * m2 every time the lag is reported, wherein dlisten represents the listened time length, m2 is a correction coefficient, and n is a number of nodes listening to the first node.

[0096] As an optional implementation, the weight updating unit is further configured to:

[0097] updating the weight value of the first node based on weigh_live = ln(dlive) * k1 and weigh_listen = ln(dlisten) * k2 every preset time length, wherein the weight value of the first node is weight = weigh_live + weight_listen, and k1 and k2 are adjustment coefficients.

[0098] As an optional implementation, the second internal sharing unit 322 is specifically configured to:

[0099] ​determining whether the sharing quantity of the first target node reaches an upper limit; if not, sharing the target sub-flow to the second node based on the first target node; if yes, disconnecting the sharing relationship between the first target node and the second target node; wherein the second target node is a node in a node group other than the target group; sharing the target sub-flow to the second node based on the first target node, and sharing the target sub-flow to the second target node based on the second target node.

[0100] It should be noted that the P2P node sharing device 300 provided by the embodiment of the present application has the same specific implementation and technical effects as the foregoing method embodiments, and for brief description, the part not mentioned in the device embodiment can be referred to the corresponding content in the foregoing method embodiments.

[0101] Third embodiment

[0102] Based on the same inventive concept, the third embodiment of the present application further provides a computer readable storage medium, which stores a computer program, and the program is executed by a processor to implement the steps of the method in any one of the foregoing method embodiments.

[0103] It should be noted that in the computer readable storage medium provided by the embodiment of the present application, the specific implementation of each step and the technical effects generated when the program is executed by the processor are the same as those of the foregoing method embodiments, and for brief description, the part not mentioned in the present embodiment can be referred to the corresponding content in the foregoing method embodiments.

[0104] The term "and / or" appearing in the present text merely describes the association relationship of the associated objects, which means that there can be three relationships, for example, A and / or B, which can represent the three cases of A alone, A and B together, and B alone. In addition, the character " / " in the present text generally represents an "or" relationship between the front and rear associated objects; the word "comprising" does not exclude the existence of elements or steps not listed in the claims. The word "one" or "a" before an element does not exclude the existence of multiple such elements. The present application can be implemented by means of hardware including a plurality of different elements and by means of a properly programmed computer. In a unit claim in which a plurality of means are recited, several of these means can be embodied by one and the same hardware item. The use of the words first, second, and third, etc. does not indicate any order. These words can be interpreted as names.

[0105] Those skilled in the art will appreciate that embodiments of the present application can be devised for a variety of applications. It is therefore intended that the present application cover all such modifications and variations of the application disclosed herein provided they come within the scope of the appended claims and their equivalents. It is intended to

[0106] The present application is described in reference to the drawings using a flowchart and / or a block diagram of the method, apparatus (system) and computer program product according to embodiments of the application. It will be understood that each block of the flowchart and / or block diagram, and combinations of blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general purpose computer, special purpose computer, embedded processing device or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart and / or block diagram block or blocks. Figure 1 one or more functions specified in the flowchart and / or block diagram block or blocks. Figure 1 one or more functions specified in the flowchart and / or block diagram block or blocks.

[0107] These computer program instructions can also be stored in a computer- readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instructions which implement the function specified in the flowchart and / or block diagram block or blocks. Figure 1 one or more functions specified in the flowchart and / or block diagram block or blocks. Figure 1 one or more functions specified in the flowchart and / or block diagram block or blocks.

[0108] These computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart and / or block diagram block or blocks. Figure 1 one or more functions specified in the flowchart and / or block diagram block or blocks. Figure 1 one or more functions specified in the flowchart and / or block diagram block or blocks.

[0109] While the preferred embodiments of the application have been described, additional variations and modifications can be employed by those skilled in the art. Therefore, the appended claims are intended to cover all such modifications and variations as fall within the scope of the present application.

[0110] It will be apparent to those skilled in the art that various modifications and variations can be made to the present application without departing from the spirit or scope of the application. Thus, it is intended that the present application cover modifications and variations of this application provided they come within the scope of the appended claims and their equivalents.

Claims

1. A P2P node sharing method, characterized in that, The application relates to a data sharing method and device. The data stream is divided into N sub-streams, and the sharing nodes are divided into N node groups; The sub-streams correspond to the node groups one by one; A target group obtains a target sub-stream and sends the target sub-stream to a node group outside the target group; the target group is any one of the N node groups; A plurality of sharing nodes in the target group form an inner sharing pool and an outer sharing pool; the inner sharing pool comprises a plurality of first nodes, and the outer sharing pool comprises a plurality of second nodes; the target group obtains a target sub-stream and sends the target sub-stream to a node group outside the target group, which comprises: The target sub-stream is sent to a first target node; wherein the first target node belongs to the first nodes; Based on the first target node, the target sub-stream is shared to the second nodes; Based on the second nodes, the target sub-stream is shared to the node groups outside the target group; Before the target sub-stream is sent to the first target node, the method further comprises: obtaining a weight value of each first node; determining the first node with the largest weight value as the first target node; Before the weight value of each first node is obtained, the method further comprises: updating the weight value of the first node based on the running time length, the listened time length and the number of times of reporting the lag of the first node every preset time length.

2. The method of claim 1, wherein, The method of updating the weight value of the first node based on the running time length, the listened time length and the number of times of reporting the lag of the first node every preset time length comprises: correcting the running time length and the listened time length based on the number of times of reporting the lag; updating the weight value of the first node based on the first logarithm and the second logarithm every preset time length; wherein the first logarithm is the logarithm of the corrected running time length, and the second logarithm is the logarithm of the corrected listened time length.

3. The method of claim 2, wherein, The method of correcting the running time length and the listened time length based on the number of times of reporting the lag comprises: correcting the running time length based on dlive=dlive*m1 every time the lag is reported; wherein dlive represents the running time length, and m1 is a correction coefficient; correcting the listened time length based on dlisten=dlisten(0,n)*m2 every time the lag is reported; wherein dlisten represents the listened time length, m2 is a correction coefficient, and n is the number of nodes listening to the first node.

4. The method of claim 2, wherein, The method of updating the weight value of the first node based on the first logarithm and the second logarithm every preset time length comprises: every preset time length, based on weigh_live = ln(dlive) * k1 and updating the weight value of the first node; wherein weigh_live is a weight corresponding to the running time length of the first node, weight_listen is a weight corresponding to the listening time length of the first node, the weight value weight of the first node is weight_live + weight_listen, and k1 and k2 are adjustment coefficients.

5. The method of claim 2, wherein, The method of sharing the target sub-stream to the second nodes based on the first target node comprises: judging whether the number of sharing of the first target node reaches an upper limit; if not, sharing the target sub-stream to the second nodes based on the first target node; if yes, disconnecting the sharing relationship between the first target node and a second target node; wherein the second target node is a node in a node group outside the target group; sharing the target sub-stream to the second nodes based on the first target node, and sharing the target sub-stream to the second target node based on the second nodes.

6. A computer-readable storage medium having stored thereon a computer program, characterized in that, The program, when executed by the processor, implements the steps of the method of any one of claims 1-5.

Citation Information

Patent Citations

  • Data distribution method, data distribution network construction method, device and equipment, and storage medium

    CN111182036A