Data distribution method and device and storage medium
By constructing a multi-level data distribution path in the live HLS stream, and distributing data between nodes through reservation information, the problems of CDN bandwidth pressure and low P2P distribution efficiency are solved, achieving efficient data distribution and low-latency live streaming.
Patent Information
- Application Number
- CN202510974733.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-15
- Publication Date
- 2025-11-14
AI Technical Summary
In live HLS streaming, all user nodes simultaneously request the latest produced data blocks, which increases CDN bandwidth pressure and bandwidth costs. Furthermore, the low efficiency of P2P distribution leads to high live streaming latency.
The node that requests the latest data block from the CDN is designated as the reservation initiating node. Reservation information is generated, and a multi-level data distribution path is constructed through a reservation loop strategy. Data transmission channels between nodes are established, and data is distributed between nodes through the reservation information.
It reduces the bandwidth pressure on CDN, improves data distribution efficiency, reduces live streaming latency, and enhances user experience.
Smart Images

Figure CN120956983A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of data distribution, and more specifically, to a data distribution method, apparatus, and storage medium. Background Technology
[0002] When streaming HLS (HTTP Live Streaming, a streaming media network transmission protocol based on HTTP), in order to reduce playback latency, all user nodes are requesting the latest generated data blocks. Since the request progress of each user node is almost the same, most nodes can only request the latest generated data blocks from the CDN (Content Delivery Network), which increases the bandwidth pressure on the CDN and increases bandwidth costs. As a result, in the scenario of the target live HLS stream, the data distribution efficiency is low, resulting in high live streaming latency. Summary of the Invention
[0003] This application provides a data distribution method, device, and storage medium, aiming to improve data distribution efficiency.
[0004] In a first aspect, embodiments of this application provide a data distribution method, the method comprising: The node that requests the latest data block from the CDN is designated as the reservation initiating node. The reservation initiating node generates reservation information for the latest data block, which is used to indicate that the reservation initiating node has requested the latest data block from the CDN. Based on the reservation information of the latest data block, a reservation loop strategy is executed to determine the multi-level data distribution path corresponding to the reservation initiating node. The reservation loop strategy is used to distribute the reservation information of the latest data block multiple times among the nodes to construct the multi-level data distribution path corresponding to the reservation initiating node. Each node in the multi-level data distribution path has a data transmission channel established by transmitting the reservation information of the latest data block with the node at the next higher level. When the reservation initiating node receives the latest data block, it distributes the latest data block on the multi-level data distribution path corresponding to the reservation initiating node.
[0005] Optionally, the node that requests the latest data block in the data stream from the CDN is designated as the reservation initiating node, including: The first node to request the latest data block from the CDN will be designated as the reservation initiating node; Alternatively, among multiple nodes that request the latest data block from the CDN within a preset time interval, at least one node may be selected as the reservation initiating node.
[0006] Optionally, based on the reservation information of the latest data block, a reservation loop strategy is executed to determine the multi-level data distribution path corresponding to the reservation initiating node, including: Set the reservation initiating node as the current node, and set the reservation level carried by the reservation information of the latest data block to 0; The reservation cycle strategy is executed, and the reservation cycle strategy includes: When the reservation level of the latest data block's reservation information is less than the reservation level threshold, the current node executes a single-level reservation strategy to determine at least one next-level node of the current node; the single-level reservation strategy is used to distribute the reservation information of the latest data block to multiple nodes, determine the next-level node of the current node among the multiple nodes; update any next-level node to the current node, and increment the prediction level in the reservation information of the latest data block by 1; The reservation loop strategy is stopped when the prediction level in the reservation information of the latest data block is equal to the reservation level threshold, and the multi-level data distribution path corresponding to the reservation initiation node is determined.
[0007] Optionally, a single-tier reservation strategy is implemented, including: The current node sends the reservation information for the latest data block to multiple nodes; In response to the reservation information of the latest data block, any one of the plurality of nodes sends a reservation request to the current node; After responding to the reservation request sent by the current node, the current node adds the current node as the next level node to its own list of reservation nodes and returns a reservation request response to the current node.
[0008] Optionally, after any one of the plurality of nodes sends a reservation request to the current node in response to the reservation information of the latest data block, the method further includes: If any node does not receive a reservation request response from the current node within a first preset time interval, that node sends a reservation cancellation request to the current node. After receiving the reservation cancellation request, the current node deletes the node from the reservation node list it maintains.
[0009] Optionally, the reservation information generated by the reservation initiating node for the latest data block includes: After the reservation initiating node requests the latest data block from the CDN, it sets each bit in the bitmap corresponding to the latest data block to 1 to obtain the reservation bitmap of the latest data block, and uses the reservation bitmap of the latest data block as the reservation information of the latest data block.
[0010] Optionally, when the reservation initiating node receives the latest data block, it distributes the latest data block on the multi-level data distribution path corresponding to the reservation initiating node, including: During the process of the reservation initiating node receiving and downloading the latest data block, the reservation initiating node distributes the data block on the multi-level data distribution path every time it downloads a data block of the target size. In this process, after any node on the multi-level data distribution path receives and downloads the data block from the node at the next higher level, the node sends the data block to the node at the next lower level.
[0011] Optionally, the data is divided into blocks and distributed along the multi-level data distribution path, including: When any node on the multi-level data distribution path does not receive the latest data block sent by its corresponding upper-level node within the second preset time interval, or when the latest data block received by any node is not the latest data block sent by its corresponding upper-level node, it sends a reservation cancellation request to its corresponding upper-level node. The upper-level node is used to stop sending the latest data block to the node after responding to the reservation cancellation request.
[0012] In a second aspect, embodiments of this application provide a computer device, including: at least one processor and a memory, the memory storing a computer program executable on the processor, wherein the processor executes the computer program to perform the data distribution method described in the first aspect of the embodiments.
[0013] Thirdly, embodiments of this application provide a non-volatile readable storage medium storing a computer program, wherein the computer program, when executed by a processor, performs the data distribution method described in the first aspect of the embodiment.
[0014] Beneficial effects: In this embodiment, after the reservation initiating node requests the latest data block from the CDN, the reservation initiating node generates reservation information indicating that it has requested the latest data block from the CDN. Then, based on the reservation information of the latest data block, the reservation loop strategy is executed to distribute the reservation information of the latest data block multiple times among the nodes, which can pre-build a multi-level data distribution path corresponding to the reservation initiating node.
[0015] When the reservation initiating node receives the latest data block, it distributes the latest data block on the multi-level data distribution path corresponding to the reservation initiating node. Nodes in the multi-level data distribution path no longer need to request the latest data block from the CDN, reducing the bandwidth pressure on the CDN.
[0016] Furthermore, compared to the point-to-point transmission method where a node downloads the entire latest data block and then notifies other nodes, and other nodes establish a data transmission channel with that node to obtain the latest data block, this embodiment, after the reservation initiating node requests the latest data block from the CDN but before receiving the latest data block, establishes a data transmission channel between any node at each level in the multi-level data distribution path and the node at the next higher level by transmitting the reservation information of the latest data block. Based on the data transmission channel between nodes established according to the reservation information, the node can promptly send the received latest data block to the next level node, improving data distribution efficiency. Attached Figure Description
[0017] To more clearly illustrate the technical solutions of the embodiments of this application, the drawings used in the description of the embodiments of this application will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0018] Figure 1 This is a flowchart of the steps of a data distribution method proposed in an embodiment of this application; Figure 2 This is a swimlane diagram of a data distribution method proposed in an embodiment of this application; Figure 3 This is a reservation topology diagram provided in one embodiment of this application; Figure 4 This is a functional block diagram of a data distribution device proposed in an embodiment of this application; Figure 5 This is a schematic diagram of a computer device according to an embodiment of this application; Figure 6 This is a schematic diagram of a non-volatile readable storage medium provided in an embodiment of this application. Detailed Implementation
[0019] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0020] P2P: Peer to Peer, also known as peer-to-peer or end-to-end, refers to a peer-to-peer network, a distributed application architecture that distributes tasks and workloads among peers. It is a networking or network form of peer-to-peer computing model at the application layer. CDN: Content Delivery Network. Its basic idea is to avoid bottlenecks and links on the Internet that may affect the speed and stability of data transmission, so as to make content transmission faster and more stable. HLS: HTTP Live Streaming is an HTTP-based streaming media network transmission protocol. Its basic working principle is to divide the entire stream into small HTTP-based files for download, downloading only a portion at a time.
[0021] In live streaming scenarios, such as live HLS streaming, to reduce playback latency, all user nodes are requesting the latest produced data block. Currently, nodes obtain the latest produced data block by obtaining it from the CDN or by requesting it from other nodes that have already downloaded the latest produced data block. However, this process of requesting the latest produced data block may cause the following two problems: Firstly, because the request progress of each node is almost the same, the amount of P2P resources that can be obtained is small. At this time, most nodes can only request data from the CDN, which puts pressure on CDN bandwidth and increases bandwidth costs. Secondly, the distribution time is short. In P2P data distribution, a node needs to download the complete data block before it can publish the data block to other nodes. Only then can other nodes establish a data transmission channel with that node to obtain the data block from it. This slows down the efficiency of P2P distribution and causes other nodes to time out while waiting.
[0022] Therefore, in order to improve data distribution efficiency, this application provides a data distribution method.
[0023] Reference Figure 1 The diagram illustrates a flowchart of a data distribution method according to an embodiment of this application. The method may specifically include the following steps: S101: The node that requests the latest data block from the CDN is designated as the reservation initiating node. The reservation initiating node generates reservation information for the latest data block, which is used to indicate that the reservation initiating node has requested the latest data block from the CDN.
[0024] In a live HLS stream, each node will know whether the latest data block has been produced. For example, the latest data block information can be distributed to each node based on M3U8 technology. The M3U8 file is a text-based playlist file format used to describe the information of the latest data block, including its name, size, position, and order.
[0025] CDN is used to distribute data to multiple nodes during live streaming. Since most nodes have the same request progress, once each node knows that the latest data block has been produced, multiple nodes are requesting the latest data block from the CDN.
[0026] In this embodiment, the node that requests the latest data block from the CDN is designated as the reservation initiating node, so as to construct a multi-level data distribution path for the reservation initiating node.
[0027] In one feasible implementation, when the node requesting the latest data block from the CDN is designated as the reservation initiating node, the first node to request the latest data block from the CDN can be designated as the reservation initiating node; thus, the first node to request the latest data block from the CDN can quickly establish a reservation relationship for the latest data block with other nodes.
[0028] In another feasible implementation, when the node that requests the latest data block from the CDN is used as the reservation initiating node, at least one node can be selected from multiple nodes that request the latest data block from the CDN within a preset time interval as the reservation initiating node.
[0029] The size of the preset time interval, the number of reservation initiation nodes, and the method of selecting reservation initiation nodes can be selected according to the actual application requirements, and this application embodiment does not impose any restrictions.
[0030] For example, the preset time interval can be 1 second. Suppose there are 5 nodes requesting the latest data block from the CDN within 1 second. You can randomly select one or more nodes from the 5 nodes as the reservation initiating node; or select the node with the best current network status as the reservation initiating node.
[0031] After the reservation initiating node is determined, the reservation initiating node generates reservation information for the latest data block. The reservation information for the latest data block is used to indicate that the reservation initiating node has requested the latest data block from the CDN. The reservation information for the latest data block is a reservation invitation sent by the reservation initiating node to other nodes for peer-to-peer transmission of the latest data block.
[0032] Sending the reservation information for the latest data block to other nodes can inform them that the reservation initiating node has requested the latest data block from the CDN. Other nodes can choose not to request the latest data block from the CDN, but instead establish a reservation relationship with the reservation initiating node and obtain the latest data block through the reservation initiating node.
[0033] In actual implementation, the reservation information of the latest data block may include the identifier of any latest data block. Since each node has already learned that the latest data block has been produced, for example, each node already has the information of the latest data block through the M3U8 file, including name, size, position and order. Therefore, the reservation information of the latest data block may include at least one of name, size, position and order to identify that the reservation information is the reservation information of the latest data block.
[0034] In one feasible implementation, the reservation initiating node generates the reservation information for the latest data block by including: After the reservation initiating node requests the latest data block from the CDN, it sets each bit in the bitmap corresponding to the latest data block to 1 to obtain the reservation bitmap of the latest data block, and uses the reservation bitmap of the latest data block as the reservation information of the latest data block.
[0035] Bitmaps are an efficient data structure that uses a single binary bit (1 bit) to represent a fixed size of data. The fixed size of the data corresponding to 1 bit can be selected according to the needs of the actual application. For example, 1 bit can represent 512k of data.
[0036] The bitmap of the latest data block; the size of the latest data block can be represented by the number of bits in the bitmap.
[0037] In actual implementation, when a node downloads a data block, it sets each bit in the bitmap of the data block to 1 to obtain the data bitmap of the data block. The data bitmap indicates that the node has received the data block.
[0038] The reservation bitmap and the data bitmap have the same format, but the reservation bitmap for the latest data block is obtained by setting each bit in the bitmap corresponding to the latest data block to 1 before the reservation initiating node receives the latest data block.
[0039] In actual implementation, an identifier can be set to distinguish between the reservation bitmap and the data bitmap. When the reservation initiating node requests the latest data block, the data bitmap corresponding to the latest data block is empty, that is, all bits in the data bitmap of the latest data block are 0, while the bits in the reservation bitmap of the latest data block are 1.
[0040] When the reservation bitmap of the latest data block is used as reservation information, the data transmission volume of the reservation bitmap is relatively small. Therefore, the reservation bitmap of the latest data block is more efficient when it is distributed among nodes, which can shorten the time for nodes to establish the reservation relationship of the latest data block.
[0041] S102: Based on the reservation information of the latest data block, execute the reservation loop strategy to determine the multi-level data distribution path corresponding to the reservation initiation node.
[0042] The reservation information of the latest data block generated by the reservation initiating node can be regarded as a reservation invitation. The reservation loop strategy is used to distribute the reservation information of the latest data block multiple times among the nodes to construct a multi-level data distribution path corresponding to the reservation initiating node.
[0043] In one feasible implementation, based on the reservation information of the latest data block, a reservation loop strategy is executed to determine the multi-level data distribution path corresponding to the reservation initiating node, including the following steps: A1: Set the reservation initiating node as the current node, and set the reservation level carried by the reservation information of the latest data block to 0.
[0044] The reservation level carried in the reservation information of the latest data block is used to represent the number of levels in the multi-level data distribution path corresponding to the reservation initiating node.
[0045] In practice, the number of levels in a multi-level data distribution path can be limited by setting a reservation level threshold. The size of the reservation level threshold can be customized according to the actual application requirements, but it should be set within a reasonable range. If the reservation level threshold is too large, the CDN will have already distributed the latest data block to most nodes during the process of establishing a multi-level data distribution path. At this time, it is not very meaningful to establish a reservation relationship for the latest data block between nodes. In this case, it is more efficient for nodes to obtain the latest data block by directly requesting it from the CDN or by directly requesting the node with the latest data block for point-to-point transmission. Furthermore, if the reservation level is too large, nodes with larger reservation levels need to wait for nodes at multiple levels to distribute the latest data block in sequence, which reduces the data distribution efficiency.
[0046] A2: Execute the aforementioned reservation loop strategy.
[0047] Specifically, implementing the reservation cycle strategy includes the following steps: A21: When the reservation level of the latest data block reservation information is less than the reservation level threshold, the current node executes a single-level reservation strategy to determine at least one next-level node of the current node.
[0048] The current node first determines whether the reservation level of the latest data block reservation information is less than the reservation level threshold. When the reservation level is less than the reservation level threshold, the current node can execute a single-level reservation strategy to establish a reservation relationship with other nodes corresponding to the latest data block.
[0049] The single-layer reservation strategy is used to distribute the reservation information of the latest data block to multiple nodes, and determine the next-level node of the current node among the multiple nodes.
[0050] A22: Update any next-level node to the current node, and increment the predicted level in the reservation information of the latest data block by 1.
[0051] After the current node executes the single-level reservation strategy to determine its corresponding next-level node, the next-level node can be used as the current node, and the prediction level in the reservation information of the latest data block is updated by incrementing the prediction level by 1. Then, step A21 is executed to determine the next-level node corresponding to the new current node.
[0052] A3: Stop executing the reservation loop strategy when the prediction level in the reservation information of the latest data block is equal to the reservation level threshold, and determine the multi-level data distribution path corresponding to the reservation initiation node.
[0053] In one feasible implementation, the process of determining at least one next-level node of the current node by executing a single-level reservation strategy in step A21 includes the following steps: B1: The current node sends the reservation information of the latest data block to multiple nodes.
[0054] In actual implementation, a target number of next-level nodes corresponding to a node can be preset. The target number can be set according to the actual application requirements. The target number should be set within a reasonable range to avoid increasing bandwidth pressure when the latest data block is distributed to multiple next-level nodes at the same time. For example, the target number can be set to 2.
[0055] When the current node sends reservation information for the latest data block to multiple nodes, the number of multiple nodes can be a preset target number, or the number of multiple nodes can be greater than the target number, because not every node will successfully establish a reservation relationship with the current node.
[0056] For example, if node A sends the latest data block reservation information to node 1, but node 1 has already initiated a request for the latest data block from the CDN, or node 1 has already responded to the latest data block reservation information of another node B and established a reservation relationship, or due to network failure between nodes, node 1 has not received the latest data block reservation information from node A, node 1 will not establish a reservation relationship with node A.
[0057] In practice, the method by which the current node sends the latest data block reservation information to multiple nodes can be selected according to the actual application requirements.
[0058] In one feasible implementation, the current node can select multiple nodes among all nodes to directly send the reservation information for the latest data block. For example, the current node can preferentially select nodes that have already established data transmission channels to send the reservation information for the latest data block, or select nodes within the target distance range to send the reservation information for the latest data block. This application embodiment does not impose any limitations.
[0059] In one feasible implementation, a live streaming service is maintained during the live streaming process. The live streaming service is used to include nodes that join the live streaming into the node cluster. The current node can upload the reservation information of the latest data block to the node scheduling thread in the node cluster. If other nodes in the node cluster need to request the latest data block, they can request to obtain the reservation information of the current node's latest data block during the node scheduling process, and thus the reservation information of the latest data block can also be sent to multiple nodes.
[0060] B2: After responding to the reservation information of the latest data block, any one of the plurality of nodes sends a reservation request to the current node.
[0061] Specifically, when any of the multiple nodes receives the reservation information for the latest data block sent by the current node, it can also detect whether it has the latest data block or is establishing a reservation relationship for the latest data block with other nodes.
[0062] For example, when checking whether it has the latest data block, it can check whether any bit of the data bitmap of its latest data block is 1. When any bit of the data bitmap is 1, it indicates that the node has started to receive the latest data block. When all bits of the data bitmap are 0, it indicates that the node does not have the latest data block.
[0063] To determine whether a node is establishing a reservation relationship for the latest data block with other nodes, one can check whether the node has already sent a reservation request to other nodes. If a reservation request has been sent, the reservation information for the latest data block sent by other nodes can be ignored. Alternatively, one can check whether the node has received a reservation request response from other nodes. If no reservation request response has been received from any node, a node can send reservation requests to multiple nodes.
[0064] When any node among multiple nodes detects that it does not have the latest data block or has not established a reservation relationship with other nodes for the latest data block, that node can send a reservation request to the current node. The reservation request is used to request to establish a reservation relationship for the latest data block with the current node.
[0065] B3: After responding to the reservation request sent by the current node, the current node adds the current node as the next level node to its own list of reservation nodes and returns a reservation request response to the current node.
[0066] After receiving the reservation request sent by the current node, it can check the number of nodes in its own reservation node list. If the number of nodes is less than the target number, it can add the node as the next level node to its own reservation node list and return the reservation request response to the node.
[0067] When a node receives a reservation request response from the current node, it indicates that a reservation relationship has been established between the node and the current node. Based on the reservation request and the reservation request response, the node and the current node have completed the handshake process and successfully established a data transmission channel.
[0068] If the number of nodes equals the target number, the current node may not return any response to the current node, or the current node may return a reservation request failure response to the current node. The reservation request failure response is used to notify the current node that the reservation relationship has failed to be established. After receiving the reservation request failure response, the current node may establish a reservation relationship with other nodes based on the reservation information of the latest data block sent by other nodes, or directly request the latest data block from the CDN.
[0069] In one feasible implementation, after step B2: any node among the plurality of nodes sends a reservation request to the current node in response to the reservation information of the latest data block, the method further includes: If any node does not receive a reservation request response from the current node within a first preset time interval, that node sends a reservation cancellation request to the current node. After receiving the reservation cancellation request, the current node deletes the node from the reservation node list it maintains.
[0070] If a node receives reservation information for the latest data block sent by the current node and sends a reservation request to the current node, and if the node does not receive a reservation request response from the reservation initiating node within the first preset time interval, it may be because the number of nodes in the current node's reservation node list has reached the target number, or due to network transmission failure or other issues. In this case, the node can send a reservation cancellation request to the reservation initiating node. If the node has been added to the current node's reservation node list, the current node will delete the node from its own maintained reservation node list after responding to the reservation cancellation request sent by the current node.
[0071] For example, taking the reservation initiating node as node A, the reservation message of the latest data block as the reservation bitmap, the target number of the next-level nodes corresponding to each node as 2, and the reservation level threshold as 2, the process of constructing the multi-level data distribution path corresponding to the reservation initiating node is as follows: After node A generates the reservation bitmap for the latest data block, it executes the reservation loop strategy, including the following steps C1-C6: C1: Node A is the current node, and the reservation level in the reservation bitmap is set to 0.
[0072] C2: Node A determines that the reservation level in the reservation bitmap is less than 2, executes the single-level reservation strategy, and determines the next level node of node A.
[0073] The process of node A executing a single-level reservation strategy includes: Node A sends the reservation bitmap for the latest data block to Nodes B, C, and D; After responding to the reservation bitmap of the latest data block, if nodes B and C detect that they do not have the latest data block or have not established a reservation relationship with other nodes for the latest data block, they each send a reservation request to node A. Node A adds Node B and Node C to its own list of reserved nodes and returns reservation request responses to Node B and Node C respectively; Once nodes B and C receive a reservation request response, it indicates that a reservation relationship with node A has been established. At this point, node A receives a reservation request from node D, checks that the number of nodes in its own maintained reservation node list is greater than the target number of 2, and does not return any response to node D.
[0074] C3: Nodes B and C are designated as the current nodes, and the reservation level of the reservation bitmap for the latest data block is updated to 1.
[0075] C4: Nodes B and C determine that the reservation level in the reservation bitmap is less than 2, and each executes a single-level reservation strategy to determine the next-level node of node B and the next-level node of node C respectively.
[0076] The process of node B executing the single-level reservation strategy includes: Node B sends the reservation bitmap for the latest data block to nodes D, E, and F; After responding to the reservation bitmap of the latest data block, if nodes D and F detect that they do not have the latest data block or have not established a reservation relationship with other nodes for the latest data block, they each send a reservation request to node B. Node B adds nodes D and F to its own list of reserved nodes and returns reservation request responses to nodes D and F respectively. Once node D receives the reservation request response, it indicates that the reservation relationship with node B is established.
[0077] If node F does not receive a reservation request response within the first preset time interval, node F sends a reservation cancellation request to node B. Node B deletes node F from its own list of reservation nodes. At this time, node B's list of reservation nodes only contains node D. If node B receives a reservation request from node E at this time, it will add node E to its own list of reserved nodes and return a reservation request response to node E. Once node E receives the reservation request response, it indicates that the reservation relationship between node E and node B is established.
[0078] Suppose that after node C implements a single-level reservation strategy, its own list of reservation nodes includes node G.
[0079] C5: Nodes D, E, and G are designated as the current nodes, and the reservation level of the reservation bitmap for the latest data block is updated to 2.
[0080] C6: Nodes D, E, and G determine that the reservation level is equal to 2, and stop executing the single-level reservation strategy.
[0081] At this point, the multi-level data distribution path of the reservation initiating node, i.e., node A, is established. The multi-level data distribution path of node A includes two levels. The first level includes nodes B and C; the second level includes nodes D, E, and G.
[0082] Among them, the next level nodes of node A are node B and node C; The next level nodes of node B are node D and node E; The next level node after node C is node G.
[0083] In this embodiment, when a node initiates a request for the latest data block to the CDN, that node can be designated as a reservation initiating node. The reservation initiating node can then establish reservation relationships with multiple other nodes, constructing a multi-level data distribution path for the reservation initiating node. When the reservation initiating node receives the latest data block from the CDN, it can distribute the latest data block along the constructed multi-level data distribution path. The multi-level data distribution path does not need to request the latest data block from the CDN, reducing the bandwidth pressure on the CDN.
[0084] In current live streaming scenarios, such as the point-to-point transmission process in HLS live streaming, the process is as follows: after a node downloads the complete latest data block from the CDN, the node informs other nodes that it has the latest data block, and the other nodes then request the latest data block from the original node. Compared to this method of downloading the latest data block and then establishing a data transmission channel with other nodes to send the latest data block, in this embodiment, after the reservation initiating node requests the latest data block from the CDN, any node at each level in the constructed multi-level data distribution path already has a data transmission channel established with the node at the next higher level by transmitting reservation information for the latest data block. When the reservation initiating node receives the latest data block from the CDN, it can directly and quickly distribute the latest data block based on the data transmission channel already established between the nodes, reducing data distribution latency and improving data distribution efficiency.
[0085] S103: When the reservation initiating node receives the latest data block, it distributes the latest data block on the multi-level data distribution path corresponding to the reservation initiating node.
[0086] Since a multi-level data distribution path has been established after the reservation initiating node requests the latest data block from the CDN, when the reservation initiating node receives and downloads the latest data block on the CDN, it can distribute the latest data block to each node in the multi-level data distribution path based on the data transmission channel established between any node in the multi-level data distribution path and the node at the next higher level of that node by transmitting the reservation information of the latest data block.
[0087] In one feasible implementation, the process of distributing the latest data block on the multi-level data distribution path corresponding to the reservation initiation node further includes: When the reservation initiating node downloads a data block of the target size, it distributes the data block on the multi-level data distribution path. After any node on the multi-level data distribution path receives and downloads the data block in the previous level node, the node sends the data block to the next level node.
[0088] The target size of the data chunks can be set according to the needs of the actual application. For example, the target size of the data chunks can be set to 16k.
[0089] The node initiating the reservation monitors its local download progress for the latest data block. Every 16KB of data downloaded, it treats this 16KB as a data block and iterates through its own reservation node list, distributing the downloaded data block to each node in the list. On the multi-level data distribution path, once any node receives and downloads a 16KB data block from the node at the next higher level, it sends the 16KB data block to each node in its own reservation node list. This allows point-to-point data transmission between nodes to adopt a pipelined data transmission approach, where data is downloaded and uploaded to other nodes simultaneously. This ensures timely distribution of downloaded data blocks of the latest data block without waiting for nodes to download the complete latest data block before sending it, further improving data distribution efficiency.
[0090] In one feasible implementation, step S103, which involves distributing the data in blocks along the multi-level data distribution path, further includes: When any node on the multi-level data distribution path does not receive the latest data block sent by its corresponding upper-level node within the second preset time interval, or when the latest data block received by any node is not the latest data block sent by its corresponding upper-level node, it sends a reservation cancellation request to its corresponding upper-level node. The upper-level node is used to stop sending the latest data block to the node after responding to the reservation cancellation request.
[0091] If any node on the multi-level data distribution path does not receive the latest data block from its corresponding upper-level node within the second preset time interval, it may be due to network failure or node failure. If the node continues to wait for the upper-level node to send the latest data block, it will also cause a large delay. Therefore, the node can send a reservation cancellation request to cancel the reservation relationship with the upper-level node. In response to the reservation cancellation request, the upper-level node deletes the node from its own maintained reservation node list and will not send the latest data block to the node in the future.
[0092] If any node receives a new data block that is not sent by its corresponding parent node, it indicates that the node has already obtained the new data block through other means. At this time, it can send a reservation cancellation request to cancel the reservation relationship with the parent node and avoid invalid data transmission that would occupy bandwidth.
[0093] After any node on the multi-level data distribution path sends the latest data block completely to the next level node, it deletes the next level node from its own list of reserved nodes, thus preparing for the reservation and distribution of the next data block.
[0094] Reference Figure 2The diagram illustrates a swimlane diagram of the data distribution method provided in this application embodiment. Taking the reservation message of the latest data block as the reservation bitmap, and with the target number of the next-level nodes corresponding to each node being 1 and the reservation level threshold being 2, the data distribution method includes the following process: Node 1 requests the latest data block from the CDN, generates a reservation bitmap for the latest data block, and sets the reservation level of the reservation bitmap to 0; Node 1 sends the reservation bitmap of the latest data block to Node 2 to issue a reservation invitation to Node 2; Node 2 responds to the reservation bitmap and sends a reservation request to Node 1; After responding to the reservation request, Node 1 adds Node 2 as the next-level node to its own list of reservation nodes; Node 1 returns a reservation request response to Node 2; When node 2 receives the reservation request, it indicates that the reservation relationship has been successfully established and updates the reservation level in the reservation bitmap to 1. Node 2 sends a reservation bitmap to Node 3 to send a reservation invitation to Node 3; Node 3 responds to the reservation bitmap and sends a reservation request to Node 2; After responding to the reservation request, node 2 adds node 3 as the next-level node to its own list of reservation nodes; Node 2 returns a reservation request response to Node 3; When node 3 receives the reservation request, it indicates that the reservation relationship has been successfully established and updates the reservation level in the reservation bitmap to 2.
[0095] When node 1 receives the latest data block from the CDN, it sends the latest data block to node 2 while downloading it. For example, after node 1 downloads data blocks of the target size, it sends the data blocks to node 2. After receiving and downloading the data blocks sent by node 1, node 2 sends the data blocks to node 3.
[0096] Reference Figure 3 The diagram illustrates the topology of a multi-level data distribution path provided in this application embodiment. Taking the selection of 4 nodes as reservation initiation nodes among the nodes requesting the latest data block from the CDN, with a target number of 1 next-level node for each node and a reservation level threshold of 4 as an example, multiple multi-level data distribution paths can be constructed when distributing the latest data block.
[0097] For example, the multi-level data distribution path of node 1 includes nodes 5 and 9; the multi-level data distribution path of node 2 includes nodes 6 and 10; the multi-level data distribution path of node 3 includes nodes 7 and 11; and the multi-level data distribution path of node 4 includes nodes 8 and 12.
[0098] When the CDN has the latest data block and starts distributing it, it can send the latest data block to Node 1, Node 2, Node 3 and Node 4 respectively. Node 1, Node 2, Node 3 and Node 4 then perform P2P distribution of the latest data block on their respective multi-level data distribution paths, and send it while downloading, thereby improving data distribution efficiency.
[0099] This method establishes a reservation relationship for the latest data block among nodes by distributing reservation information for the latest data block when a node requests it from the CDN. This constructs a multi-level data distribution path corresponding to the node initiating the reservation. Nodes on this multi-level data distribution path can obtain the latest data block through P2P, reducing the bandwidth pressure on the CDN during live streaming and improving the P2P sharing ratio. Furthermore, because any node at each level in the multi-level data distribution path already has a data transmission channel established by transmitting the reservation information for the latest data block, once the upper-level node receives the latest data block, it can proactively send it to the lower-level node through the established data transmission channel, improving data distribution efficiency. Moreover, the data distribution between nodes in the multi-level data distribution path uses a download-and-send approach, which reduces live streaming latency, improves the user experience, and is suitable for large-scale live streaming scenarios such as HLS live streaming.
[0100] Reference Figure 4 The diagram illustrates a functional block diagram of a data distribution apparatus provided in an embodiment of this application. The apparatus includes: The reservation information generation module 100 takes the node that requests the latest data block from the CDN as the reservation initiating node. The reservation initiating node generates reservation information for the latest data block. The reservation information for the latest data block is used to indicate that the reservation initiating node has requested the latest data block from the CDN. The multi-level data distribution path determination module 200 is used to determine the multi-level data distribution path corresponding to the reservation initiating node by executing a reservation loop strategy based on the reservation information of the latest data block. The reservation loop strategy is used to distribute the reservation information of the latest data block multiple times among the nodes to construct the multi-level data distribution path corresponding to the reservation initiating node. Each node in the multi-level data distribution path has a data transmission channel established by transmitting the reservation information of the latest data block with the node at the next higher level. The data distribution module 300 is used to distribute the latest data block on the multi-level data distribution path corresponding to the reservation initiating node when the reservation initiating node receives the latest data block.
[0101] Optionally, the device further includes: The first reservation initiation node determination module is used to determine the first node that requests the latest data block from the CDN as the reservation initiation node; The second reservation initiation node determination module is used to select at least one node as the reservation initiation node from among multiple nodes that request the latest data block from the CDN within a preset time interval.
[0102] Optionally, the multi-level data distribution path determination module further includes: An initialization unit is used to set the reservation initiating node as the current node and set the reservation level carried by the reservation information of the latest data block to 0; A reservation cycle strategy execution unit, configured to execute the reservation cycle strategy, the reservation cycle strategy comprising: When the reservation level of the latest data block's reservation information is less than the reservation level threshold, the current node executes a single-level reservation strategy to determine at least one next-level node of the current node; the single-level reservation strategy is used to distribute the reservation information of the latest data block to multiple nodes, determine the next-level node of the current node among the multiple nodes; update any next-level node to the current node, and increment the prediction level in the reservation information of the latest data block by 1; The multi-level data distribution path determination unit is used to stop executing the reservation loop strategy and determine the multi-level data distribution path corresponding to the reservation initiation node when the predicted level in the reservation information of the latest data block is equal to the reservation level threshold.
[0103] Optionally, the reservation cycle strategy execution unit further includes: A single-layer reservation strategy execution subunit is used by the current node to send the reservation information of the latest data block to multiple nodes; In response to the reservation information of the latest data block, any one of the plurality of nodes sends a reservation request to the current node; After responding to the reservation request sent by the current node, the current node adds the current node as the next level node to its own list of reservation nodes and returns a reservation request response to the current node.
[0104] Optionally, the device further includes a first appointment cancellation module, used for: If any node does not receive a reservation request response from the current node within a first preset time interval, that node sends a reservation cancellation request to the current node. After receiving the reservation cancellation request, the current node deletes the node from the reservation node list it maintains.
[0105] Optionally, the reservation information generation module includes: The reservation bitmap generation module is used to set each bit in the bitmap corresponding to the latest data block to 1 after the reservation initiating node requests the latest data block from the CDN, so as to obtain the reservation bitmap of the latest data block, and use the reservation bitmap of the latest data block as the reservation information of the latest data block.
[0106] Optionally, the data distribution module includes: The data distribution unit is used to distribute the data blocks on the multi-level data distribution path when the reservation initiating node receives and downloads the latest data block; In this process, after any node on the multi-level data distribution path receives and downloads the data block from the node at the next higher level, the node sends the data block to the node at the next lower level.
[0107] Optionally, the data distribution module further includes: The second appointment cancellation module is used to send an appointment cancellation request to its corresponding upper-level node when any node on the multi-level data distribution path does not receive the latest data block sent by its corresponding upper-level node within a second preset time interval, or when the latest data block received by any node is not the latest data block sent by its corresponding upper-level node. The upper-level node is used to stop sending the latest data block to the node after responding to the appointment cancellation request.
[0108] Reference Figure 5 The diagram illustrates a computer device according to an embodiment of this application, including: at least one processor 501 and a memory 502, wherein the memory 502 stores a computer program that can run on the processor 501, wherein the processor 501 executes the computer program to perform the data distribution method described in the embodiment.
[0109] Reference Figure 6 The diagram illustrates a non-volatile readable storage medium 600 provided in an embodiment of this application. The non-volatile readable storage medium 600 stores a computer program 601, wherein the computer program 601 executes the data distribution method described in the embodiment when executed by a processor.
[0110] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.
[0111] Those skilled in the art will understand that embodiments of this application can be provided as methods, apparatus, or computer program products. Therefore, embodiments of this application can take the form of entirely hardware embodiments, entirely software embodiments, or embodiments combining software and hardware aspects. Furthermore, embodiments of this application can take the form of computer program products implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0112] This application describes embodiments with reference to flowchart illustrations and / or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of this application. It should be understood that each block of the flowchart illustrations and / or block diagrams, as well as combinations of blocks in the flowchart illustrations and / or block diagrams, 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 processor, or other programmable data processing terminal device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal device, generate instructions for implementing the flowchart illustrations. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0113] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing terminal device to operate in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0114] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal equipment, causing a series of operational steps to be performed on the computer or other programmable terminal equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable terminal equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0115] Although preferred embodiments of the present application have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of the embodiments of the present application.
[0116] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or terminal device. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or terminal device that includes said element.
[0117] This document uses specific examples to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the methods and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A data distribution method, characterized in that, The method includes: The node that requests the latest data block from the CDN is designated as the reservation initiating node. The reservation initiating node generates reservation information for the latest data block, which is used to indicate that the reservation initiating node has requested the latest data block from the CDN. Based on the reservation information of the latest data block, a reservation loop strategy is executed to determine the multi-level data distribution path corresponding to the reservation initiating node. The reservation loop strategy is used to distribute the reservation information of the latest data block multiple times among the nodes to construct the multi-level data distribution path corresponding to the reservation initiating node. Each node in the multi-level data distribution path has a data transmission channel established by transmitting the reservation information of the latest data block with the node at the next higher level. When the reservation initiating node receives the latest data block, it distributes the latest data block on the multi-level data distribution path corresponding to the reservation initiating node.
2. The method according to claim 1, characterized in that, The node that requests the latest data block in the data stream from the CDN will be designated as the reservation initiating node, including: The first node to request the latest data block from the CDN will be designated as the reservation initiating node; Alternatively, among multiple nodes that request the latest data block from the CDN within a preset time interval, at least one node may be selected as the reservation initiating node.
3. The method according to claim 1, characterized in that, Based on the reservation information of the latest data block, a reservation loop strategy is executed to determine the multi-level data distribution path corresponding to the reservation initiation node, including: Set the reservation initiating node as the current node, and set the reservation level carried by the reservation information of the latest data block to 0; The reservation cycle strategy is executed, and the reservation cycle strategy includes: When the reservation level of the latest data block's reservation information is less than the reservation level threshold, the current node executes a single-level reservation strategy to determine at least one next-level node of the current node; the single-level reservation strategy is used to distribute the reservation information of the latest data block to multiple nodes, determine the next-level node of the current node among the multiple nodes; update any next-level node to the current node, and increment the prediction level in the reservation information of the latest data block by 1; The reservation loop strategy is stopped when the prediction level in the reservation information of the latest data block is equal to the reservation level threshold, and the multi-level data distribution path corresponding to the reservation initiation node is determined.
4. The method according to claim 3, characterized in that, Implement a single-tier appointment strategy, including: The current node sends the reservation information for the latest data block to multiple nodes; In response to the reservation information of the latest data block, any one of the plurality of nodes sends a reservation request to the current node; After responding to the reservation request sent by the current node, the current node adds the current node as the next level node to its own list of reservation nodes and returns a reservation request response to the current node.
5. The method according to claim 4, characterized in that, After any one of the plurality of nodes responds to the reservation information of the latest data block and sends a reservation request to the current node, the method further includes: If any node does not receive a reservation request response from the current node within a first preset time interval, that node sends a reservation cancellation request to the current node. After receiving the reservation cancellation request, the current node deletes the node from the reservation node list it maintains.
6. The method according to any one of claims 1-5, characterized in that, The reservation information generated by the reservation initiating node for the latest data block includes: After the reservation initiating node requests the latest data block from the CDN, it sets each bit in the bitmap corresponding to the latest data block to 1 to obtain the reservation bitmap of the latest data block, and uses the reservation bitmap of the latest data block as the reservation information of the latest data block.
7. The method according to any one of claims 1-5, characterized in that, When the reservation initiating node receives the latest data block, it distributes the latest data block on the multi-level data distribution path corresponding to the reservation initiating node, including: During the process of the reservation initiating node receiving and downloading the latest data block, the reservation initiating node distributes the data block on the multi-level data distribution path every time it downloads a data block of the target size. In this process, after any node on the multi-level data distribution path receives and downloads the data block from the node at the next higher level, the node sends the data block to the node at the next lower level.
8. The method according to claim 7, characterized in that, Distributing the data in blocks along the multi-level data distribution path includes: When any node on the multi-level data distribution path does not receive the latest data block sent by its corresponding upper-level node within the second preset time interval, or when the latest data block received by any node is not the latest data block sent by its corresponding upper-level node, it sends a reservation cancellation request to its corresponding upper-level node. The upper-level node is used to stop sending the latest data block to the node after responding to the reservation cancellation request.
9. A computer device, characterized in that, include: At least one processor, and a memory storing a computer program executable on the processor, wherein the processor executes the computer program to perform the data distribution method according to any one of claims 1-8.
10. A non-volatile readable storage medium, characterized in that, The non-volatile readable storage medium stores a computer program, wherein the computer program, when executed by a processor, performs the data distribution method according to any one of claims 1-8.