Content distribution method, client, electronic device, and storage medium
By utilizing sharing rate and saving rate in the KAD network, and combining CDN and P2P network resources, the problem of excessive resource consumption in the PCDN network is solved, and efficient content distribution is achieved.
Patent Information
- Application Number
- CN202211484131.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-24
- Publication Date
- 2025-08-22
- Estimated Expiration
- 2042-11-24
AI Technical Summary
During the content distribution process of existing PCDN networks, P2P transmission is unstable, resulting in excessive resource consumption, which puts a burden on the client, especially when managing and transmitting large amounts of fragmented files.
The cache strategy is determined through the sharing rate and saving rate of the KAD network, and critical video data is preferred from the content distribution network CDN, buffered video data is pulled from the KAD network, and combined with the resource utilization of CDN and P2P networks, data prefetching and sharing are optimized.
Effectively utilize client resources, reduce CDN network pressure, and avoid excessive consumption of client resources, and achieve efficient content distribution.
Smart Images

Figure CN115834597B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of content distribution, and in particular to a content distribution method, a client, an electronic device, and a storage medium. Background Art
[0002] As the number and size of videos are growing exponentially, distributing content through traditional CDN networks incurs higher bandwidth and storage costs. Therefore, the PCDN network, which combines the P2P model with the CDN network, has emerged.
[0003] The current PCDN network mainly uses a method of content pre-distribution combined with dispatch center control for content distribution. That is, an autonomous domain supporting the P2P protocol is added to the CDN network's external network. The nodes within the domain are dedicated P2P nodes or some P2P nodes selected from various clients. These nodes receive pre-distributed content. When users subsequently request videos, they can obtain the pre-distributed content from these nodes through the dispatch service.
[0004] However, due to the instability of P2P, the content transmitted through P2P should not be too large, so the video file needs to be split into multiple fragments for transmission. Therefore, these nodes need to manage a large number of fragments and match requests, which consumes too much resources and puts a heavy burden on these clients. Summary of the Invention
[0005] Based on the above-mentioned deficiencies of the existing technology, the present application provides a content distribution method and a client, an electronic device, and a storage medium to solve the problem that the existing technology consumes too much client resources and causes a great burden to the client.
[0006] In order to achieve the above objectives, this application provides the following technical solutions:
[0007] In a first aspect, the present application provides a content distribution method, which is applied to a target client, where the target client is any client. The content distribution method includes:
[0008] When prefetching video data is required, the target video data to be prefetched is determined according to the cache data range indicated by the buffering policy of the current target client; wherein the cache policy of the current target client is determined according to the sharing rate and saving rate of the current target client; the sharing rate is the proportion of data shared by the client through the KAD network in a unit time; the saving rate is the proportion of data pulled from the KAD network by the client in a unit time; the KAD network is composed of each of the clients;
[0009] According to the network request ratio in the cache strategy of the target client, determine the video fragment data relatively close to the playback point among the video fragment data of the target video data as critical video data, and determine the remaining video fragment data of the target data as currently buffered video data;
[0010] Pulling each of the critical video data from the content delivery network CDN, and pulling each of the currently buffered video data from the KAD network.
[0011] Optionally, in the above content distribution method, the method further includes:
[0012] When going online or switching networks, the node identifier, IP address, and port information of the target client are submitted to a node query server, and a list of neighboring clients of the target client is queried through the node query server;
[0013] Establishing a connection between the target client and the neighboring clients of the target client based on the neighboring client information list of the target client;
[0014] By splitting the index hash value table DHT stored by the adjacent client, the target client is allowed to join the KAD network;
[0015] Initialize the sharing rate and saving rate of the target client.
[0016] Optionally, in the above-mentioned content distribution method, pulling each of the currently buffered video data from the KAD network includes:
[0017] Updating the information of each of the currently buffered video data into the request list of the target client;
[0018] Broadcasting the target client's request list and the latest target client's bill to each currently connected client; wherein the bill includes at least the sharing rate and the saving rate;
[0019] For each of the currently buffered video data, addressing is performed in the KAD network based on the hash value of the buffered video data to find a client storing the buffered video data;
[0020] Connecting to a client storing the cached video data, and sending the request list of the target client and the latest bill of the target client to the client;
[0021] The currently buffered video data fed back by each currently interactive client is received in real time; wherein the currently interactive client refers to each client currently connected to the target client; the currently interactive client feeds back the currently buffered video data in the locally stored request list belonging to the target client based on the bill of the target client.
[0022] Optionally, in the above content distribution method, the method further includes:
[0023] receiving in real time the request lists and bills of each of the current interactive clients sent by each of the current interactive clients;
[0024] sorting the request lists of the respective current interactive clients according to the sharing rate and the saving rate in the bills of the respective current interactive clients;
[0025] When the request list of any one of the current interactive clients is polled, the video segment data belonging to the request list of the current interactive client among the locally stored video segment data are fed back to the current interactive client.
[0026] Optionally, in the above content distribution method, the method further includes:
[0027] At each preset time interval, based on the current sharing rate and saving rate of the target client and the amount of data interaction between each current interactive client and the target client in the current preset time period, the maintenance proportion of each current interactive client is calculated;
[0028] sorting the currently interacting clients in descending order according to the maintenance proportions to obtain a current sorting result;
[0029] Disconnecting from each of the currently interacting clients ranked after N in the current ranking result.
[0030] Optionally, in the above content distribution method, the method further includes:
[0031] When the target client adds or deletes any of the video fragment data, the information of the video fragment data is sent to the current nearest client in the KAD network based on the hash value of the video fragment data, so as to trigger the current nearest client to update the locally stored index hash value table DHT using the information of the video fragment data; wherein the current nearest client refers to the client whose corresponding hash value is closest to the hash value of the video fragment data.
[0032] Optionally, in the above content distribution method, the method further includes:
[0033] At each preset unit time interval, the total amount of data pulled in the current unit time is obtained;
[0034] Determine whether the total amount of pulled data is greater than a preset reference amount;
[0035] If it is determined that the total amount of pulled data is greater than the preset benchmark amount, the amount of data shared through the KAD network in the current unit time and the total amount of pulled data are calculated to obtain the latest sharing rate of the target client, and the amount of data pulled from the KAD network in the current unit time and the total amount of pulled data are calculated to obtain the latest saving rate of the target client;
[0036] The buffering strategy of the target client is adjusted according to the latest sharing rate and saving rate of the target client.
[0037] A second aspect of the present application provides a client, wherein the client is a target client, the target client is any one of the clients, and the client includes:
[0038] a data determination unit, configured to determine, when prefetching video data is required, target video data to be prefetched based on a cached data range indicated by a buffering policy of the target client; wherein the cache policy of the target client is determined based on a sharing rate and a saving rate of the target client; the sharing rate is a percentage of data shared by the client via the KAD network per unit time; the saving rate is a percentage of data pulled from the KAD network by the client per unit time; and the KAD network is composed of the clients;
[0039] a dividing unit, configured to determine, according to a network request ratio in a cache strategy of the target client, respective video fragments of the target video data that are relatively close to a playback point as critical video data, and to determine the remaining video fragments of the target data as currently buffered video data;
[0040] A first pulling unit, configured to pull each of the critical video data from a content delivery network CDN;
[0041] The second pulling unit is used to pull each of the currently buffered video data from the KAD network.
[0042] Optionally, the above client further includes:
[0043] A submitting unit, configured to submit the node identification, IP address, and port information of the target client to a node query server when going online or switching networks, and query the node query server for a list of neighboring clients of the target client;
[0044] A first connecting unit, configured to establish a connection between the target client and the adjacent clients of the target client based on the adjacent client information list of the target client;
[0045] A joining unit, configured to enable the target client to join the KAD network by splitting the index hash value table DHT stored by the adjacent client;
[0046] The initialization unit is configured to initialize the sharing rate and saving rate of the target client.
[0047] Optionally, in the above client, the second pulling unit includes:
[0048] A first updating unit, configured to update information of each of the currently buffered video data to a request list of the target client;
[0049] A first broadcasting unit is configured to broadcast the request list of the target client and the latest bill of the target client to each currently connected client; wherein the bill includes at least the sharing rate and the saving rate;
[0050] An addressing unit, configured to address each of the currently buffered video data in the KAD network based on a hash value of the buffered video data, and find a client storing the buffered video data;
[0051] a second connecting unit, configured to connect to a client storing the cached video data, and send the request list of the target client and the latest bill of the target client to the client;
[0052] The first receiving unit is configured to receive, in real time, the currently buffered video data fed back by each currently interactive client; wherein the currently interactive client refers to each client currently connected to the target client; and the currently interactive client feeds back the currently buffered video data in the locally stored request list belonging to the target client based on the bill of the target client.
[0053] Optionally, the above client further includes:
[0054] A second receiving unit is configured to receive in real time a request list and a bill of each current interactive client sent by each current interactive client;
[0055] a first sorting unit, configured to sort the request lists of the respective current interactive clients according to the sharing rate and the saving rate in the bills of the respective current interactive clients;
[0056] The feedback unit is configured to feed back the video segment data belonging to the request list of the current interactive client among the locally stored video segment data to the current interactive client when polling the request list of any one of the current interactive clients.
[0057] Optionally, the above client further includes:
[0058] a first calculation unit, configured to calculate, at intervals of a preset time period, a maintenance ratio of each of the current interactive clients based on a sharing rate and a saving rate of the current target client and an amount of data interaction between each of the current interactive clients and the target client in the current preset time period;
[0059] a second sorting unit, configured to sort the currently interacting clients in descending order according to the maintenance proportions to obtain a current sorting result;
[0060] The disconnection unit is configured to disconnect the connection with each of the current interactive clients ranked after N in the current ranking result.
[0061] Optionally, the above client further includes:
[0062] A sending unit is used to send information of the video fragment data to the current nearest client in the KAD network based on the hash value of the video fragment data when the target client adds or deletes any of the video fragment data, so as to trigger the current nearest client to update the locally stored index hash value table DHT using the information of the video fragment data; wherein the current nearest client refers to the client whose corresponding hash value is closest to the hash value of the video fragment data.
[0063] Optionally, the above client further includes:
[0064] An acquiring unit, configured to acquire a total amount of pulled data within a current unit time at intervals of a preset unit time;
[0065] A judging unit, configured to judge whether the total amount of pulled data is greater than a preset reference amount;
[0066] a second calculation unit configured to, when it is determined that the total amount of pulled data is greater than a preset benchmark amount, calculate the amount of data shared through the KAD network within the current unit time and the total amount of pulled data to obtain a latest sharing rate of the target client, and calculate the amount of data pulled from the KAD network within the current unit time and the total amount of pulled data to obtain a latest saving rate of the target client;
[0067] The adjusting unit is configured to adjust the buffering strategy of the target client according to the latest sharing rate and saving rate of the target client.
[0068] A third aspect of the present application provides an electronic device, including:
[0069] memory and processor;
[0070] Wherein, the memory is used to store programs;
[0071] The processor is used to execute the program, and when the program is executed, it is specifically used to implement any one of the content distribution methods described above.
[0072] In a fourth aspect, the present application provides a computer storage medium for storing a computer program, wherein when the computer program is executed, the computer storage medium is used to implement the content distribution method as described in any one of the above items.
[0073] The present application provides a content distribution method, which is applied to a target client, and the target client is any client, and is no longer limited to some clients. The content distribution method determines the caching strategy of the current target client through the sharing rate and saving rate of the current target client. Among them, the sharing rate is the proportion of data shared by the client through the KAD network per unit time. The saving rate is the proportion of data pulled from the KAD network by the client per unit time. The KAD network is composed of various clients. Therefore, when it is necessary to pre-fetch video data, the current target video data to be pre-fetched is determined according to the cache data range indicated by the buffering strategy of the current target client. Then, according to the network request ratio in the cache strategy of the target client, the video segment data relatively close to the playback point in the various video segment data of the target video data is determined as critical video data, and the remaining video segment data of the target data is determined as currently buffered video data. Finally, each critical video data is pulled from the content distribution network CDN, and each currently buffered video data is pulled from the KAD network. This can reflect the sharing rate and saving rate of the client sharing and pulling data from the KAD network through P2P, determine the size of the data pulled by the client and the proportion from the content distribution network CDN, and thus maximize the use of capable client resources for data pre-fetching and sharing, reducing the pressure on the CDN network without excessively consuming the client's resources and placing too much burden on it. BRIEF DESCRIPTION OF THE DRAWINGS
[0074] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are merely embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without any creative work.
[0075] Figure 1 A flowchart of a content distribution method provided in an embodiment of the present application;
[0076] Figure 2 A flowchart of a method for a target client to join a KAD network provided in an embodiment of the present application;
[0077] Figure 3 A flowchart of a cache policy update method provided in an embodiment of the present application;
[0078] Figure 4 A flowchart of a method for pulling each currently buffered video data from a KAD network provided in an embodiment of the present application;
[0079] Figure 5 A flowchart of a method for maintaining a connection provided in an embodiment of the present application;
[0080] Figure 6 A flowchart of a method for sharing data provided in an embodiment of the present application;
[0081] Figure 7 A schematic diagram of the architecture of a client provided in an embodiment of the present application;
[0082] Figure 8 A schematic diagram of the architecture of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0083] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0084] In this application, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article, or apparatus comprising the element.
[0085] The embodiment of the present application provides a content distribution method, which is applied to a target client, which is any client. Figure 1 As shown, the content distribution method provided in the embodiment of the present application includes:
[0086] S101 : When video data needs to be pre-fetched, target video data to be pre-fetched is determined according to a cache data range indicated by a buffering strategy of a current target client.
[0087] It should be noted that pre-fetching video data is generally necessary when a user plays a video or advertisement on a target client, or in other situations. Another situation is hotspot pre-fetching, which means that when the target client's sharing rate and saving rate are extremely high, the target client pre-fetches hotspot data in advance to facilitate sharing with other clients.
[0088] The KAD network is composed of individual clients. KAD is a P2P overlay network transmission protocol, so the KAD network in the embodiments of this application is a P2P network composed of individual clients. Therefore, in the embodiments of this application, each client can interact with other clients to obtain required data from other clients or share its own data with other clients. In order for a client to interact with other clients in the KAD network, it must first join the KAD network.
[0089] Optionally, the embodiment of the present application provides a method for a target client to join a KAD network, such as Figure 2 Shown, including:
[0090] S201. When going online or switching networks, the node identification, IP and port information of the target client are submitted to the node query server, and the node query server is used to query the target client's adjacent client information list.
[0091] It should be noted that, in the embodiment of the present application, the way in which the client joins the KAD network is somewhat different from the traditional way. In the embodiment of the present application, a node query server is also set up in the KAD network to facilitate information query through the server, and the node query server can be used as a penetration server, thereby effectively improving processing efficiency. Therefore, when the target client goes online or switches networks, the node identification, IP and port information of the target client are submitted to the node query server so that this information can be used to connect to the target client later. The target client's adjacent client information list is then queried through the node query server.
[0092] S202: Establish a connection between the target client and its adjacent clients based on the adjacent client information list of the target client.
[0093] S203: Split the index hash table DHT stored in the adjacent client so that the target client joins the KAD network.
[0094] The key idea behind DHT is to maintain a massive indexed hash table across the entire network. Entries in this hash table are formatted as key-value pairs. The key in the key-value pair is typically the hash value of the data using a specific hash algorithm, but it can also be a file name or content description. The value in the key-value pair is the IP address where the data is stored. Therefore, when performing a query, only the key is required to retrieve the address of the storage node from the table and return it to the querying node. This hash table is then divided into smaller pieces and distributed to nodes across the network according to specific algorithms and rules. Each node only needs to maintain a small piece of the hash table. This allows nodes to simply route the query message to the appropriate node when searching for a file. In other words, DHT offloads content addressing from a central location to P2P nodes. Therefore, the indexed hash table DHT needs to be split when a new client is added.
[0095] It should be noted that after the index hash table DHT stored by the adjacent client is split, the subsequent steps for the target client to join the KAD network are consistent with the existing method, so it will not be repeated here.
[0096] S204: Initialize the sharing rate and saving rate of the target client.
[0097] Since the target client has not yet exchanged data through the KAD network, it is necessary to initialize the target client's sharing rate and saving rate. Specifically, they can be set to pre-set initial values.
[0098] The caching strategy for the current target client is determined based on the client's sharing rate and saving rate. The sharing rate is the percentage of data shared by the client via the KAD network per unit time. Specifically, it is the ratio of the amount of data shared via the KAD network to the total amount of data downloaded to the client per unit time. The saving rate is the percentage of data pulled from the KAD network per unit time. Specifically, it is the ratio of the amount of data pulled from the KAD network to the total amount of data downloaded to the client per unit time.
[0099] Therefore, a higher client's sharing rate indicates that the client is sharing more data with other clients per unit time. This means that the client is more likely to be located and connected to, and the resources it receives are likely to be hotspots. Furthermore, the client is willing to share data, so investment should be increased to enable it to quickly access resources. A higher savings rate indicates that the client's environment is able to effectively utilize P2P resources. Therefore, the client should use P2P more frequently to pull data from the KAD network, reducing the burden on the CDN network.
[0100] Optionally, an embodiment of the present application provides a method for updating a cache strategy, such as Figure 3 Shown, including:
[0101] S301: Obtain the total amount of pulled data in the current unit time at every preset unit time interval.
[0102] S302: Determine whether the total amount of pulled data is greater than a preset reference amount.
[0103] It should be noted that, in order to avoid frequent updates, the present embodiment updates the policy based on both the time window and the received data benchmark. Therefore, not only must the unit time interval requirement be met, but the received data benchmark must also be met. Therefore, if it is determined that the total amount of pulled data is greater than the preset benchmark, step S303 is executed.
[0104] S303. Calculate the amount of data shared through the KAD network and the total amount of data pulled in the current unit time to obtain the latest target client's sharing rate, and calculate the amount of data pulled from the KAD network and the total amount of data pulled in the current unit time to obtain the latest target client's saving rate.
[0105] S304: Adjust the buffering strategy of the target client according to the latest sharing rate and saving rate of the target client.
[0106] It should be noted that the buffering strategy of the target client is determined according to the sharing rate and saving rate of the target client. Specifically, the amount of data that needs to be pre-fetched each time and the proportion of data that needs to be pulled from the CDN network can be determined according to the sharing rate and saving rate of the target client. In addition, the target client will continuously update its own sharing rate and saving rate, and then continuously update its own caching strategy, so as to maximize the use of capable client resources for data pre-fetching and sharing, reduce the pressure on the CDN network, and at the same time will not bring too much burden to the client.
[0107] Optionally, a caching strategy can be determined based on the sharing ratio and the savings ratio. For clients with a high sharing ratio, their cache scope can be expanded, while a higher CDN request share can be allocated to them, allowing them to quickly cache more resources. For clients with a low sharing ratio but a high savings ratio, greater cache prefetch permissions, longer P2P resource response wait times, and a lower CDN request share can be allocated, allowing them to primarily pull data from the KAD network. For clients with neither a high sharing ratio nor a high savings ratio, a smaller cache area and a higher CDN request share can be allocated to ensure data availability. For example, when the sharing ratio is above a threshold, typically 3, an aggressive cache management strategy can be adopted, caching larger amounts of data and increasing the CDN request share. When the savings ratio exceeds a threshold, typically 0.7, an aggressive cache management strategy can also be adopted, but to fully utilize the KAD network, the CDN request share can be reduced. For clients with lower sharing ratios and savings ratios, conservative cache management can be used. Furthermore, the connection maintenance ratio can be reduced, eliminating the need for long-term connections with other clients. For clients with extremely high sharing rates, such as when the sharing rate is greater than or equal to 6, hotspot prefetching can be enabled. That is, when the user does not request it, the data required by multiple other clients will be prefetched, and after the prefetch is successful, it will be shared with the clients in need.
[0108] Therefore, in an embodiment of the present application, when it is necessary to prefetch video data, the target video data to be prefetched is determined based on the cache data range indicated by the buffering strategy of the current target client. Specifically, the amount of data to be cached can be determined based on parameters such as the cache range in the cache strategy, and the target video data to be prefetched can be further determined based on the amount of cached data. For example, if the current video time is 1 minute and 00 seconds, 5 minutes of data needs to be prefetched, so the data from 1 to 6 minutes is used as the target video data to be prefetched. If the local sharing rate is high, the buffering strategy will be aggressive, and the buffering time will be extended to 10 minutes, then the data from 1 to 11 minutes will be used as the target video data to be prefetched.
[0109] S102: According to the network request ratio in the cache strategy of the target client, determine the video fragment data relatively close to the playback point among the video fragment data of the target video data as critical video data, and determine the remaining video fragment data of the target data as currently buffered video data.
[0110] A relatively large target video data is composed of a plurality of video fragment data.
[0111] It should be noted that the network request ratio refers to the ratio of data pulled from the content distribution network CDN. Pulling data from the content distribution network CDN is relatively fast and relatively secure. The closer the video data is to the playback point, the higher the time requirement. Therefore, in the embodiment of the present application, according to the network request ratio in the cache strategy of the target client, the video fragment data relatively close to the playback point in the various video fragment data of the target video data is determined as critical video data, and the video fragment close to the playback point in the content distribution network CDN is selected. The remaining video fragment data is determined as the current buffered video data that needs to be pulled from the KAD network.
[0112] For example, if the network request ratio is 10%, then according to the time point of the video, the first 10% of the target video data is determined as critical video data, and the remaining 90% is determined as current buffered video data.
[0113] S103: Pull each critical video data from the content delivery network CDN, and pull each currently buffered video data from the KAD network.
[0114] It should be noted that for each currently buffered video data, if it cannot be pulled from the KAD network, it can be pulled from the CDN. Similarly, for critical video data, if it cannot be pulled from the CDN, it can also be pulled from the KAD network.
[0115] Optionally, since the data stored in the target client changes when data is pulled or deleted, the index hash value table needs to be updated in a timely manner so that other clients can obtain the required data from the target client or avoid requesting the target client for its deleted data. Therefore, in an embodiment of the present application, the following steps are further included:
[0116] When the target client adds or deletes any video segment data, the information of the video segment data is sent to the current nearest client in the KAD network based on the hash value of the video segment data, so as to trigger the current nearest client to update the locally stored index hash value table DHT using the information of the video segment data.
[0117] The current most recent client refers to a client whose corresponding hash value is closest to the hash value of the video segment data.
[0118] Optionally, in another embodiment of the present application, a specific implementation method of pulling each current buffered video data from the KAD network in step 103 is as follows: Figure 4 As shown, the following steps are included:
[0119] S401: Update the information of each currently buffered video data into the request list of the target client.
[0120] It should be noted that in this embodiment of the present application, all information currently required for data from the KAD network is aggregated into a request list and sent to other clients in the KAD network, thereby obtaining the required data from other KADs. Therefore, when a target client adds a new request, it is necessary to update the new request to the request list, that is, to update the information of each currently buffered video data to the target client's request list. Correspondingly, when the required data is obtained, the request list can also be updated accordingly.
[0121] It should also be noted that the P2P interaction method of the embodiment of the present application is different from the existing P2P interaction method of sending a request list that only includes information about the video data that currently needs to be addressed for addressing. In the embodiment of the present application, the target client has only one request list, so the request list not only includes information about the currently buffered video data that currently needs to be addressed, but also includes information about the video data that previously needed to be pulled from the KAD network, that is, it includes information about all video data that needs to be pulled from the KAD network. Therefore, when the target client has a new demand to pull from the KAD network, for example, when the client switches to another video to play and needs to pull video data for another video, or needs to pull more video data for the currently playing video, it is necessary to update the request list of the target client accordingly, and broadcast the updated request list of the target client, that is, execute Figure 4 The method shown is to pull the newly required video data from the KAD network instead of generating a new request list that only includes the newly required video data information.
[0122] S402: Broadcast the target client's request list and the latest target client's bill to each currently connected client.
[0123] The bill includes at least the sharing rate and the saving rate. Of course, in order to facilitate the subsequent maintenance of the connection, the bill may also include a record of the data shared with the other party, that is, how many bytes were received from the other party and how many bytes were sent.
[0124] It should be noted that since adjacent video data usually exists in a client, in the embodiment of the present application, after a client is connected, the connection will be maintained according to the corresponding logic. Therefore, when the target client previously obtained other data, it may have already connected with other clients, and these clients may also store the data currently required. Therefore, in the embodiment of the present application, the updated request list of the target client will be broadcast to each currently connected client. Since other clients need to use the target client's bill when feeding data back to the target client, the current bill needs to be broadcast to each connected client as well.
[0125] Optionally, an embodiment of the present application provides a method for maintaining a connection, such as Figure 5 Shown, including:
[0126] S501 . Calculate the maintenance proportion of each current interactive client at each preset time interval based on the sharing rate and saving rate of the current target client and the data interaction volume between each current interactive client and the target client in the current preset time interval.
[0127] S502: Sort the current interactive clients in descending order according to their maintenance proportions to obtain a current sorting result.
[0128] S503: Disconnect the connection with each current interactive client ranked after N in the current ranking result.
[0129] Here, N can be a variable and can also be adjusted accordingly according to the sharing rate and saving rate of the target client.
[0130] S403 : For each currently buffered video data, addressing is performed in the KAD network based on the hash value of the buffered video data to find the client storing the buffered video data.
[0131] It should be noted that, since previously connected clients may not necessarily store the currently required data, and in order to quickly obtain the data, while broadcasting the target client's request list to each currently connected client, each currently buffered video data is also addressed. Therefore, the execution order of the embodiment of the present application is only one of the optional orders. Addressing and broadcasting to currently connected clients are independent, so other execution orders can also be used.
[0132] Alternatively, addressing in the KAD network can be performed using existing methods, namely, calculating the hash value of the cached video data, then finding the node ID with the shortest distance to the hash value, connecting to client C corresponding to the node ID, and determining client B storing the cached video data from the index hash value table DHT stored by client C. Alternatively, client C can be directly found through the node query server.
[0133] S404: Connect to the client storing the cached video data, and send the target client's request list and the latest target client's bill to the client.
[0134] S405: Receive the current buffered video data fed back by each current interactive client in real time.
[0135] The current interactive client refers to each client currently connected to the target client.
[0136] The current interactive client feeds back the currently buffered video data that is stored locally and belongs to the request list of the target client based on the bill of the target client.
[0137] Optionally, in an embodiment of the present application, after the target client is connected to another client, it can not only request data from the client, but also share the data required by the client with the client. Optionally, an embodiment of the present application provides a method for sharing data, such as Figure 6 Shown, including:
[0138] S601: Receive in real time the request list and bill of each current interactive client sent by each current interactive client.
[0139] S602: Sort the request lists of the current interactive clients according to the sharing rate and the saving rate in the bills of the current interactive clients.
[0140] Since the higher the sharing rate and saving rate, the larger the amount of data obtained, and the greater the probability of sharing with other clients, data should be fed back to them first. Therefore, the higher the sharing rate and saving rate, the higher the sorting order.
[0141] S603: When the request list of any current interactive client is polled, the video segment data belonging to the request list of the current interactive client among the locally stored video segment data is fed back to the current interactive client.
[0142] It should be noted that, as to whether the target client feeds back the data it needs to the current interactive client, corresponding logic may be set to process it, and the data needed by the current interactive client must be fed back if it is stored there.
[0143] An embodiment of the present application provides a content distribution method, which is applied to a target client, and the target client is any client and is no longer limited to some clients. The content distribution method determines the caching strategy of the current target client through the sharing rate and saving rate of the current target client. Among them, the sharing rate is the proportion of data shared by the client through the KAD network per unit time. The saving rate is the proportion of data pulled from the KAD network by the client per unit time. The KAD network is composed of various clients. Therefore, when it is necessary to pre-fetch video data, the current target video data to be pre-fetched is determined according to the cache data range indicated by the buffering strategy of the current target client. Then, according to the network request ratio in the cache strategy of the target client, the video segment data relatively close to the playback point in the various video segment data of the target video data is determined as critical video data, and the remaining video segment data of the target data is determined as currently buffered video data. Finally, each critical video data is pulled from the content distribution network CDN, and each currently buffered video data is pulled from the KAD network. This can reflect the sharing rate and saving rate of the client sharing and pulling data from the KAD network through P2P, determine the size of the data pulled by the client and the proportion from the content distribution network CDN, and thus maximize the use of capable client resources for data pre-fetching and sharing, reducing the pressure on the CDN network without excessively consuming the client's resources and placing too much burden on it.
[0144] Another embodiment of the present application provides a client, the client is a target client, and the target client is any client. Figure 7 As shown, the client provided in the embodiment of the present application includes:
[0145] The data determining unit 701 is configured to determine target video data to be pre-fetched according to a cache data range indicated by a buffering strategy of a current target client when pre-fetching video data is required.
[0146] The caching strategy for the current target client is determined by the client's sharing rate and saving rate. The sharing rate is the percentage of data shared by the client through the KAD network per unit time. The saving rate is the percentage of data pulled from the KAD network per unit time. The KAD network is composed of various clients.
[0147] The division unit 702 is used to determine the video fragment data relatively close to the playback point in the various video fragment data of the target video data as critical video data according to the network request ratio in the cache strategy of the target client, and determine the remaining video fragment data of the target data as currently buffered video data.
[0148] The first pulling unit 703 is configured to pull each critical video data from the content delivery network CDN.
[0149] The second pulling unit 704 is configured to pull each currently buffered video data from the KAD network.
[0150] Optionally, the client provided in another embodiment of the present application further includes:
[0151] The submission unit is used to submit the node identification, IP and port information of the target client to the node query server when going online or switching networks, and query the target client's adjacent client information list through the node query server.
[0152] The first connecting unit is configured to establish a connection between the target client and the adjacent clients of the target client based on the adjacent client information list of the target client.
[0153] The joining unit is used to split the index hash value table DHT stored by the adjacent client so that the target client can join the KAD network.
[0154] The initialization unit is used to initialize the sharing rate and saving rate of the target client.
[0155] Optionally, in the client provided in another embodiment of the present application, the second pulling unit includes:
[0156] The first updating unit is configured to update information of each currently buffered video data into a request list of a target client.
[0157] The first broadcast unit is configured to broadcast the request list of the target client and the latest bill of the target client to each currently connected client.
[0158] The bill shall include at least the sharing rate and the saving rate.
[0159] The addressing unit is used to address each currently buffered video data in the KAD network based on the hash value of the buffered video data, and find the client storing the buffered video data.
[0160] The second connection unit is configured to connect to a client storing cached video data and send a request list of a target client and a latest bill of the target client to the client.
[0161] The first receiving unit is configured to receive in real time the currently buffered video data fed back by each currently interactive client.
[0162] The current interactive client refers to each client currently connected to the target client. The current interactive client feeds back the currently buffered video data in the local storage belonging to the request list of the target client based on the bill of the target client.
[0163] Optionally, the client provided in another embodiment of the present application further includes:
[0164] The second receiving unit is configured to receive in real time the request list and bill of each current interactive client sent by each current interactive client.
[0165] The first sorting unit is configured to sort the request lists of the current interactive clients according to the sharing rate and the saving rate in the bills of the current interactive clients.
[0166] The feedback unit is configured to feed back the video segment data belonging to the request list of the current interactive client among the locally stored video segment data to the current interactive client when polling the request list of any current interactive client.
[0167] Optionally, the client provided in another embodiment of the present application further includes:
[0168] The first calculation unit is configured to calculate the maintenance proportion of each current interactive client at each preset time interval based on the sharing rate and saving rate of the current target client and the data interaction volume between each current interactive client and the target client in the current preset time interval.
[0169] The second sorting unit is configured to sort the current interactive clients in descending order according to the maintenance proportions to obtain a current sorting result.
[0170] The disconnection unit is used to disconnect the connection with each current interactive client ranked after N in the current sorting result.
[0171] Optionally, the client provided in another embodiment of the present application further includes:
[0172] The sending unit is used to send the information of the video segment data to the current nearest client in the KAD network based on the hash value of the video segment data when the target client adds or deletes any video segment data, so as to trigger the current nearest client to update the locally stored index hash value table DHT using the information of the video segment data.
[0173] The current most recent client refers to a client whose corresponding hash value is closest to the hash value of the video segment data.
[0174] Optionally, the client provided in another embodiment of the present application further includes:
[0175] The acquisition unit is used to obtain the total amount of pulled data in the current unit time at intervals of a preset unit time.
[0176] The judgment unit is used to judge whether the total amount of pulled data is greater than a preset reference amount.
[0177] The second calculation unit is used to calculate the amount of data shared through the KAD network and the total amount of pulled data in the current unit time when it is determined that the total amount of pulled data is greater than the preset benchmark amount, to obtain the latest sharing rate of the target client, and to calculate the amount of data pulled from the KAD network and the total amount of pulled data in the current unit time to obtain the latest saving rate of the target client.
[0178] The adjustment unit is used to adjust the buffer strategy of the target client according to the latest sharing rate and saving rate of the target client.
[0179] It should be noted that the specific working process of each unit provided in the above embodiments of the present application can refer to the corresponding steps in the above method embodiments, and will not be repeated here.
[0180] Another embodiment of the present application provides an electronic device, such as Figure 8 Shown, including:
[0181] Memory 801 and processor 802 .
[0182] The memory 801 is used to store programs.
[0183] The processor 802 is used to execute a program. When the program is executed, it is specifically used to implement the content distribution method provided in any one of the above embodiments.
[0184] Another embodiment of the present application provides a computer storage medium for storing a computer program. When the computer program is executed, it is used to implement the content distribution method provided in any of the above embodiments.
[0185] Computer storage media includes permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include transitory media such as modulated data signals and carrier waves.
[0186] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the above description has generally described the components and steps of each example according to their functions. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0187] The above description of the disclosed embodiments is intended to enable one skilled in the art to implement or use the present application. Various modifications to these embodiments will be readily apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application is not limited to the embodiments shown herein, but is intended to conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A content distribution method, characterized in that: Applied to a target client, where the target client is any client, the content distribution method includes: When prefetching video data is required, the target video data to be prefetched is determined according to the cache data range indicated by the buffering policy of the current target client; wherein the cache policy of the current target client is determined according to the sharing rate and saving rate of the current target client; the sharing rate is the proportion of data shared by the client through the KAD network in a unit time; the saving rate is the proportion of data pulled from the KAD network by the client in a unit time; the KAD network is composed of each of the clients; According to the network request ratio in the cache strategy of the target client, the video fragment data relatively close to the playback point among the video fragment data of the target video data are determined as critical video data, and the remaining video fragment data of the target video data are determined as currently buffered video data; wherein the network request ratio is the ratio of data pulled from the content delivery network CDN; Pulling each of the critical video data from the content delivery network CDN, and pulling each of the currently buffered video data from the KAD network.
2. The method according to claim 1, characterized in that Also includes: When going online or switching networks, the node identifier, IP address, and port information of the target client are submitted to a node query server, and a list of neighboring clients of the target client is queried through the node query server; Establishing a connection between the target client and the neighboring clients of the target client based on the neighboring client information list of the target client; By splitting the index hash value table DHT stored by the adjacent client, the target client is allowed to join the KAD network; Initialize the sharing rate and saving rate of the target client.
3. The method according to claim 1, characterized in that Pulling each of the currently buffered video data from the KAD network includes: Updating the information of each currently buffered video data into the request list of the target client; Broadcasting the target client's request list and the latest target client's bill to each currently connected client; wherein the bill includes at least the sharing rate and the saving rate; For each currently buffered video data, addressing in the KAD network based on the hash value of the currently buffered video data, and finding a client storing the currently buffered video data; Connecting to a client storing the currently buffered video data, and sending the target client's request list and the latest target client's bill to the client; The currently buffered video data fed back by each currently interactive client is received in real time; wherein the currently interactive client refers to each client currently connected to the target client; the currently interactive client feeds back the currently buffered video data in the locally stored request list belonging to the target client based on the bill of the target client.
4. The method according to claim 3, characterized in that Also includes: receiving in real time the request lists and bills of each of the current interactive clients sent by each of the current interactive clients; sorting the request lists of the respective current interactive clients according to the sharing rate and the saving rate in the bills of the respective current interactive clients; When the request list of any one of the current interactive clients is polled, the video segment data belonging to the request list of the current interactive client among the locally stored video segment data are fed back to the current interactive client.
5. The method according to claim 3, characterized in that Also includes: At each preset time interval, based on the current sharing rate and saving rate of the target client and the amount of data interaction between each current interactive client and the target client in the current preset time period, the maintenance proportion of each current interactive client is calculated; sorting the currently interacting clients in descending order according to the maintenance proportions to obtain a current sorting result; Disconnecting from each of the currently interacting clients ranked after N in the current ranking result.
6. The method according to claim 1, characterized in that Also includes: When the target client adds or deletes any of the video fragment data, the information of the video fragment data is sent to the current nearest client in the KAD network based on the hash value of the video fragment data, so as to trigger the current nearest client to update the locally stored index hash value table DHT using the information of the video fragment data; wherein the current nearest client refers to the client whose corresponding hash value is closest to the hash value of the video fragment data.
7. The method according to claim 1, characterized in that Also includes: At each preset unit time interval, the total amount of pulled data in the current unit time is obtained; Determining whether the total amount of pulled data is greater than a preset reference amount; If it is determined that the total amount of pulled data is greater than the preset benchmark amount, the amount of data shared through the KAD network in the current unit time and the total amount of pulled data are calculated to obtain the latest sharing rate of the target client, and the amount of data pulled from the KAD network in the current unit time and the total amount of pulled data are calculated to obtain the latest saving rate of the target client; The buffering strategy of the target client is adjusted according to the latest sharing rate and saving rate of the target client.
8. A client, characterized in that: The client is a target client, the target client is any one of the clients, and the client includes: a data determination unit, configured to determine, when prefetching video data is required, target video data to be prefetched based on a cached data range indicated by a buffering policy of the target client; wherein the cache policy of the target client is determined based on a sharing rate and a saving rate of the target client; the sharing rate is a percentage of data shared by the client via the KAD network per unit time; the saving rate is a percentage of data pulled from the KAD network by the client per unit time; and the KAD network is composed of the clients; a dividing unit, configured to determine, according to a network request ratio in a cache strategy of the target client, respective video fragments of the target video data that are relatively close to a playback point as critical video data, and to determine the remaining video fragments of the target video data as currently buffered video data; wherein the network request ratio is a ratio of data pulled from a content delivery network (CDN); A first pulling unit, configured to pull each critical video data from a content delivery network CDN; The second pulling unit is used to pull each of the currently buffered video data from the KAD network.
9. An electronic device, characterized in that: include: memory and processor; Wherein, the memory is used to store programs; The processor is used to execute the program, and when the program is executed, it is specifically used to implement the content distribution method according to any one of claims 1 to 7.
10. A computer storage medium, characterized in that Used to store a computer program, which, when executed, is used to implement the content distribution method according to any one of claims 1 to 7.
Citation Information
Patent Citations
P2P data download method and device
CN105721889A
Method and electronic device for sending CDN address
US20170180470A1