File downloading method, device, computer equipment and storage medium
By integrating the communication delay information and download delay information of candidate nodes, the target download priority parameters are determined and efficient nodes are selected for file download, which solves the problem that cannot guarantee the quality of file download in traditional download methods and achieves efficient and reliable file download .
Patent Information
- Application Number
- CN202110528363.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-05-14
- Publication Date
- 2025-02-14
- Estimated Expiration
- 2041-05-14
AI Technical Summary
Traditional file download methods cannot guarantee the obtaining of reliable target nodes, thus the quality of file download cannot be guaranteed.
By obtaining the file download request, obtaining the candidate node information set corresponding to the file identification to be downloaded, obtaining the node communication information set of each candidate node corresponding to the candidate node information set, including communication delay information and download delay information, and communication information for the same node The node communication information in the set is fused to obtain the target download priority parameters corresponding to each candidate node. Based on these parameters, the target node is determined from each candidate node, and the target file corresponding to the file to be downloaded is obtained from the target node.
By integrating communication delay information and download delay information to evaluate nodes, nodes with excellent performance in communication and download can be selected from each candidate node as the target node, and downloading the target file from the target node can effectively ensure the download of the target file Success rate and download speed, thereby improving the download quality of target files.
Smart Images

Figure CN115348251B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a file downloading method, device, computer equipment and storage medium. Background Art
[0002] With the development of Internet technology and smart terminals, terminals such as mobile phones and tablets have become indispensable items in people's daily life and work. People can download and install various applications through terminals for work, life and entertainment. In the process of using applications, there will be situations where files need to be downloaded from nodes.
[0003] In traditional technology, when downloading a file, the terminal will randomly determine a target node from the available nodes and download the file from the target node. However, the random determination of the node download method cannot guarantee a reliable target node, and thus cannot guarantee the quality of the file download. Summary of the invention
[0004] Based on this, it is necessary to provide a file downloading method, device, computer equipment and storage medium that can improve the quality of file downloading in response to the above technical problems.
[0005] A file downloading method, the method comprising:
[0006] Obtain a file download request, the file download request carries an identifier of the file to be downloaded;
[0007] Obtain a candidate node information set corresponding to the identifier of the file to be downloaded;
[0008] Obtaining a node communication information set of each candidate node corresponding to the candidate node information set, wherein the node communication information in the node communication information set is obtained by communicating with the corresponding candidate node, and the node communication information includes communication delay information generated by establishing communication and download delay information generated by file downloading;
[0009] The node communication information in the same node communication information set is integrated to obtain the target download priority parameter corresponding to each candidate node;
[0010] A target node is determined from each candidate node based on the target download priority parameter, and a target file corresponding to the to-be-downloaded file identifier is obtained from the target node.
[0011] In one embodiment, the method is executed by a unified processing module to obtain a file download request, including:
[0012] The unified processing module receives a file download request sent by a target application through a preset interface;
[0013] After obtaining the target file corresponding to the to-be-downloaded file identifier from the target node, the method further includes:
[0014] The unified processing module sends the target file to the target application through a preset interface.
[0015] In one embodiment, obtaining a candidate node information set corresponding to the identifier of the file to be downloaded includes:
[0016] Generate a node query request based on the current location information and the identifier of the file to be downloaded;
[0017] Sending a node query request to a query server so that the query server obtains an initial node information set, and filtering the initial node information set based on the current location information to obtain a candidate node information set, wherein the initial node corresponding to the initial node information set stores the target file;
[0018] Receive the candidate node information set returned by the query server.
[0019] In one embodiment, obtaining a node communication information set of each candidate node corresponding to the candidate node information set includes:
[0020] When the candidate node is a node with which a communication connection has been established in the past, the corresponding historical communication information set is acquired according to the node identifier in the candidate node information set as the corresponding node communication information set.
[0021] In one embodiment, determining a target node from each candidate node based on a target download priority parameter includes:
[0022] Determine the target download priority corresponding to each candidate node based on the target download priority parameter;
[0023] The candidate node with the highest target download priority is selected as the target node.
[0024] In one embodiment, the method further comprises:
[0025] When the target file is not obtained within the preset download time, obtaining resource node information corresponding to the identifier of the file to be downloaded;
[0026] Get the target file from the resource node corresponding to the resource node information.
[0027] A file downloading device, comprising:
[0028] A request acquisition module is used to acquire a file download request, where the file download request carries an identifier of a file to be downloaded;
[0029] A node information acquisition module is used to obtain a candidate node information set corresponding to the identifier of the file to be downloaded;
[0030] A communication information acquisition module is used to acquire a node communication information set of each candidate node corresponding to the candidate node information set. The node communication information in the node communication information set is obtained by communicating with the corresponding candidate node. The node communication information includes communication delay information generated by establishing communication and download delay information generated by file downloading.
[0031] An information fusion module is used to fuse the node communication information in the same node communication information set to obtain the target download priority parameters corresponding to each candidate node;
[0032] The file download module is used to determine a target node from each candidate node based on a target download priority parameter, and obtain a target file corresponding to the to-be-downloaded file identifier from the target node.
[0033] A computer device comprises a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:
[0034] Obtain a file download request, the file download request carries an identifier of the file to be downloaded;
[0035] Obtain a candidate node information set corresponding to the identifier of the file to be downloaded;
[0036] Obtaining a node communication information set of each candidate node corresponding to the candidate node information set, wherein the node communication information in the node communication information set is obtained by communicating with the corresponding candidate node, and the node communication information includes communication delay information generated by establishing communication and download delay information generated by file downloading;
[0037] The node communication information in the same node communication information set is integrated to obtain the target download priority parameter corresponding to each candidate node;
[0038] A target node is determined from each candidate node based on the target download priority parameter, and a target file corresponding to the to-be-downloaded file identifier is obtained from the target node.
[0039] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the following steps:
[0040] Obtain a file download request, the file download request carries an identifier of the file to be downloaded;
[0041] Obtain a candidate node information set corresponding to the identifier of the file to be downloaded;
[0042] Obtaining a node communication information set of each candidate node corresponding to the candidate node information set, wherein the node communication information in the node communication information set is obtained by communicating with the corresponding candidate node, and the node communication information includes communication delay information generated by establishing communication and download delay information generated by file downloading;
[0043] The node communication information in the same node communication information set is integrated to obtain the target download priority parameter corresponding to each candidate node;
[0044] A target node is determined from each candidate node based on the target download priority parameter, and a target file corresponding to the to-be-downloaded file identifier is obtained from the target node.
[0045] The above-mentioned file download method, device, computer equipment and storage medium obtain a file download request, the file download request carries the identifier of the file to be downloaded, obtains a candidate node information set corresponding to the identifier of the file to be downloaded, obtains a node communication information set of each candidate node corresponding to the candidate node information set, the node communication information in the node communication information set is obtained by communicating with the corresponding candidate node, the node communication information includes the communication delay information generated by establishing communication and the download delay information generated by file downloading, the node communication information in the same node communication information set is merged, the target download priority parameter corresponding to each candidate node is obtained, the target node is determined from each candidate node based on the target download priority parameter, and the target file corresponding to the identifier of the file to be downloaded is obtained from the target node. In this way, the node is evaluated by integrating the communication delay information and the download delay information, and the node with excellent performance in communication and downloading can be selected from each candidate node as the target node, and the target file is downloaded from the target node, which can effectively guarantee the download success rate and download speed of the target file, thereby improving the download quality of the target file. Further, considering the download delay information when evaluating the node can also effectively avoid repeated selection of the same download failure node for downloading by continuous download tasks, further improving the download quality of the target file. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] Figure 1 An application environment diagram of a file downloading method in an embodiment;
[0047] Figure 2 A schematic diagram of a process flow of a file downloading method in one embodiment;
[0048] Figure 3 A schematic diagram of a process for integrating communication delay information and download delay information in one embodiment;
[0049] Figure 4A A schematic diagram of an application scenario of a file downloading method in an embodiment;
[0050] Figure 4B A schematic diagram of an application scenario of a file downloading method in another embodiment;
[0051] Figure 5 A schematic diagram of a process of distributed downloading of a target file in one embodiment;
[0052] Figure 6 A schematic diagram of a process of distributed downloading of a target file in another embodiment;
[0053] Fig. 7A is a timing diagram of file downloading in one embodiment;
[0054] Figure 7B is a timing diagram of file downloading in another embodiment;
[0055] Figure 7C A schematic diagram of a process of distributed downloading of a target file in another embodiment;
[0056] Figure 8 A structural block diagram of a file downloading device in an embodiment;
[0057] Fig. 9 is an internal structure diagram of a computer device in one embodiment;
[0058] Fig.10 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0059] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0060] Cloud technology is a general term for network technology, information technology, integration technology, management platform technology, application technology, etc. based on the cloud computing business model. It can form a resource pool, which can be used on demand and is flexible and convenient. Cloud computing technology will become an important support. The backend services of the technical network system require a large amount of computing and storage resources, such as video websites, picture websites and more portal websites. With the rapid development and application of the Internet industry, in the future, each item may have its own identification mark, which needs to be transmitted to the backend system for logical processing. Data of different levels will be processed separately. All kinds of industry data need strong system backing support, which can only be achieved through cloud computing.
[0061] Cloud storage is a new concept that extends and develops from the concept of cloud computing. A distributed cloud storage system (hereinafter referred to as storage system) refers to a storage system that uses cluster applications, grid technology, and distributed storage file systems to bring together a large number of different types of storage devices (storage devices are also called storage nodes) in the network through application software or application interfaces to work together and provide external data storage and business access functions.
[0062] At present, the storage method of the storage system is: create a logical volume, and when creating a logical volume, allocate physical storage space for each logical volume. The physical storage space may be composed of disks of a storage device or several storage devices. The client stores data on a logical volume, that is, stores the data on the file system. The file system divides the data into many parts, each of which is an object. The object contains not only data but also additional information such as data identification (ID, ID entity). The file system writes each object into the physical storage space of the logical volume, and the file system records the storage location information of each object, so that when the client requests to access the data, the file system can allow the client to access the data according to the storage location information of each object.
[0063] The process of the storage system allocating physical storage space to a logical volume is as follows: based on the estimated capacity of the objects stored in the logical volume (this estimate often has a large margin relative to the actual capacity of the objects to be stored) and the grouping of independent redundant disk arrays (RAID, Redundant Array of Independent Disks), the physical storage space is pre-divided into stripes. A logical volume can be understood as a stripe, thereby allocating physical storage space to the logical volume.
[0064] The target file in this application can be stored on at least one storage node in the network, and the storage node includes a CDN server and a fog node.
[0065] The file download method provided by this application can be applied to Figure 1In the application environment shown. Among them, the computer device 102 can be a server or a terminal. The candidate node 106 can be a server or a terminal. The computer device 102, the query server 104 and the candidate node 106 can be directly or indirectly connected by wired or wireless communication, and this application is not limited here. The server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. The terminal can be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart watch, a router, etc., but is not limited to this.
[0066] The computer device obtains a file download request, and the file download request carries an identifier of a file to be downloaded. The computer device can obtain a candidate node information set corresponding to the identifier of the file to be downloaded from a query server according to the file download request. The computer device can obtain a node communication information set of each candidate node corresponding to the candidate node information set, and the node communication information in the node communication information set is obtained by communicating with the corresponding candidate node, and the node communication information includes communication delay information generated by establishing communication and download delay information generated by file downloading. The computer device merges the node communication information in the same node communication information set to obtain the target download priority parameters corresponding to each candidate node, determines the target node from each candidate node based on the target download priority parameters, and obtains the target file corresponding to the identifier of the file to be downloaded from the target node.
[0067] In one embodiment, Figure 2 As shown, a file download method is provided, which is applied to Figure 1 The computer device in the example is used to illustrate, including the following steps:
[0068] Step S202: Obtain a file download request, where the file download request carries an identifier of a file to be downloaded.
[0069] The file download request is used to request the download of a file. The file identifier to be downloaded refers to the file identifier corresponding to the target file to be downloaded. The file identifier is an identifier used to uniquely identify a file, and specifically may include a string of at least one of letters, numbers, and symbols. The target file may be data displayed in at least one of the forms of text, pictures, audio, and video, and the target file is data that can be transmitted on the network.
[0070] Specifically, the computer device can obtain a file download request generated locally. An application is running on the computer device, and the computer device can receive a trigger operation performed by a user on an interface related to the application to generate a file download request, and the file download request carries an identifier of a file to be downloaded. The computer device can download the target file from the corresponding node according to the file download request. For example, when a user wants to watch a movie offline through an audio-visual application on a computer device, the user can trigger a download control on the playback page corresponding to the target movie (target file) in the audio-visual application, and the computer device generates a file download request carrying an identifier of a file to be downloaded corresponding to the target movie based on the trigger operation. When a user wants to watch a live broadcast online through a live broadcast application on a computer device, the user can trigger a viewing control on the playback page corresponding to the target live room (target file) in the live broadcast application, and the computer device generates a file download request carrying an identifier of a file to be downloaded corresponding to the target live room based on the trigger operation. It can be understood that the computer device can also obtain a file download request sent by other terminals or servers. For example, the terminal obtains a file download request generated locally, and sends the file download request to the computer device, so that the computer device downloads the corresponding target file according to the file download request.
[0071] In one embodiment, before responding to a file download request, the computer device may perform a security check on the file download request. When the file download request fails the security check, the file download request is not responded to; when the file download request passes the security check, the file download request is responded to and subsequent steps are executed. Performing a security check on the file download request may specifically be to query whether the application identifier corresponding to the application that triggers the file download request is recorded in the whitelist, that is, to query whether the application that triggers the file download request is a trustworthy application with a high security factor. The whitelist records the application identifiers of trusted applications. An application identifier is an identifier that is used to uniquely identify an application, and may specifically include a character string of at least one of letters, numbers, and symbols.
[0072] Step S204: obtaining a candidate node information set corresponding to the identifier of the file to be downloaded.
[0073] The candidate node information set includes node information corresponding to multiple candidate nodes. A candidate node refers to a node storing a target file corresponding to a file identifier to be downloaded. A node can be a server or a terminal device. The node information can include information such as a node identifier, a node address, and a node bandwidth corresponding to the candidate node. The computer device can communicate with the corresponding candidate node based on the node information. It can be understood that the same file can be stored on multiple nodes, and different nodes can store different files.
[0074] Specifically, the computer device needs to download the target file from the node storing the target file, so the computer device needs to first know which nodes store the target file. The computer device can obtain the candidate node information set corresponding to the identifier of the file to be downloaded from the query server. The query server records the file data stored in each node, and the computer device can send a node query request to the query server, so that the query server returns the candidate node information set composed of the node information of each candidate node storing the target file according to the node query request.
[0075] In one embodiment, the candidate node can be a resource node in a CDN (Content Delivery Network) or a fog node. A resource node refers to an ordinary data cache server in a CDN, i.e., a CDN server. A fog node refers to an edge device in a CDN, such as a router, an edge server, etc. Compared to traditional resource nodes, fog nodes are usually closer to users and have a large amount of idle, high-quality, and low-cost bandwidth. When the candidate node is a fog node, the computer device can obtain the target file from the fog node more quickly, and downloading the target file from the fog node can also effectively reduce the bandwidth pressure of the resource node.
[0076] In one embodiment, once the computer device obtains the candidate node information set, the computer device can establish communication with each candidate node corresponding to the candidate node information set. Correspondingly, after the computer device downloads the target file, the computer device can immediately disconnect the communication with each candidate node. In this way, the waste of resources of the computer device can be avoided. The computer device can also continue to communicate with each candidate node for a period of time after downloading the target file. If the computer device does not receive a new file download request or the candidate node does not store a new target file to be downloaded during this period of time, the computer device will disconnect the communication with each candidate node. In this way, there is no need to repeatedly establish a communication connection with the same candidate node before the adjacent file download request, which can effectively reduce the time for processing subsequent file download requests and improve efficiency.
[0077] Step S206, obtaining a node communication information set of each candidate node corresponding to the candidate node information set, wherein the node communication information in the node communication information set is obtained by communicating with the corresponding candidate node, and the node communication information includes communication delay information generated by establishing communication and download delay information generated by file downloading.
[0078] Among them, one candidate node corresponds to one node communication information set. The node communication information in the node communication information set is obtained by the computer device communicating with the candidate node. The node communication information can be obtained by the computer device and the candidate node based on historical communication, or it can be obtained by the computer device and the candidate node based on current communication, or it can be obtained by the computer device and the candidate node based on historical communication and current communication. During the communication process, the computer device can just maintain the communication connection with the candidate node, and the computer device can also download file data from the candidate node. The node communication information includes communication delay information and download delay information, and can further include information obtained during the communication process such as download speed information, download packet loss information, and node concurrent number information. The communication delay information is data related to the communication time generated by the computer device in order to establish a communication connection with the candidate node, for example, the communication delay information is calculated based on the time difference between at least one heartbeat request for establishing a communication connection and the corresponding heartbeat reply. The download delay information is data related to the download time generated by the computer device downloading files from the candidate node, for example, the download delay information is calculated based on the time difference between the request sending time corresponding to at least one historical download request sent to the candidate node and the initial request reply time. Download speed information is data related to speed generated when a computer device downloads a file from a candidate node. For example, the download speed information is calculated based on the amount of requested download data and the download time corresponding to at least one download of the file. Download packet loss information is data related to lost data packets generated when a computer device downloads a file from a candidate node. For example, the download packet loss information is calculated based on the packet loss rate corresponding to at least one download of the file. Node concurrency information is obtained based on the number of computer devices that the candidate node can connect to at the same time.
[0079] Specifically, the computer device can obtain the node communication information set of each candidate node corresponding to the candidate node information set. At any time, the computer device can record and store the generated node communication information during the communication process with the candidate node, and store the node communication information and the corresponding node identification of the candidate node in association. If the candidate node and the computer device have communicated at a historical time, the computer device can obtain the corresponding historical communication information set as the node communication information set of the candidate node based on the node identification of the candidate node, or generate the node communication information set corresponding to the candidate node based on the current communication information and historical communication information set of the computer device and the candidate node. If the candidate node and the computer device have not communicated at a historical time, the computer device can determine the node communication information set corresponding to the candidate node as empty, or generate the node communication information set corresponding to the candidate node based on the current communication information of the computer device and the candidate node. That is, the computer device can directly determine the target node from the candidate nodes that have communicated with the history, or it can determine the target node from each candidate node after communicating with each candidate node for a period of time.
[0080] It is understandable that if the heartbeat RTT (Round-Trip Time) used to generate communication delay information is not updated in time, node evaluation will be inaccurate only based on communication delay information. The heartbeat RTT is obtained based on the time difference between the heartbeat request and the corresponding heartbeat reply. Normally, a heartbeat request is sent every 3 seconds, that is, the heartbeat RTT is updated every 3 seconds. According to the existing network data, the size of the target file requested for download is 800KB on average, the download speed is 1200KBps on average, and the average download time is 750ms, so 4 to 6 download tasks can usually be completed in 3 seconds. Since the heartbeat RTT is not updated in time (3s VS 750ms), node evaluation is only based on communication delay information, which will cause the same node to be selected for continuous task downloads. When a task times out and fails, it will also cause repeated downloads of files to the failed node. At this time, integrating communication delay information and download delay information to conduct node evaluation can effectively solve the above problems. Download delay information is the download delay information generated by file downloading. Download delay information can make up for the defect of untimely update of communication delay information to a certain extent, and effectively avoid continuous download tasks repeatedly selecting the same download failed node for downloading, thereby effectively improving the accuracy of node evaluation and further improving the quality of file download.
[0081] In one embodiment, the data communication between the computer device and the candidate node can be established based on an unreliable protocol. The computer device and the candidate node can communicate based on the UDP protocol (User Datagram Protocol), which is a transport layer protocol that provides a simple, transaction-oriented, unreliable information transmission service. Since the UDP protocol is an unreliable protocol, the data packet sent by the node to the computer device may be lost. Under the UDP protocol, the transport layer will not actively retransmit the data packet, nor will it send more than one other data packet. Therefore, when the computer device and the candidate node communicate based on the UDP protocol, downloading packet loss information can also be used as an important indicator to measure node performance.
[0082] In one embodiment, the data communication between the computer device and the candidate node can be established based on a reliable protocol. The computer device and the candidate node can communicate based on the cable protocol, which is a transport layer protocol that adds a reliable transmission module on the basis of the UDP protocol. Under the cable protocol, the transport layer will actively send data packets such as ack (acknowledge character) and probe (probe). These redundant data packets are mainly used to ensure the reliability of the transmission protocol. Therefore, when the computer device and the candidate node communicate based on the cable protocol, the computer device will receive other data packets except the data packets corresponding to the target file, and the computer device cannot accurately calculate the packet loss rate. At this time, in order to improve the accuracy of node evaluation, the node communication information set obtained by the computer device may not include download packet loss information.
[0083] Step S208: Amalgamate the node communication information in the same node communication information set to obtain the target download priority parameter corresponding to each candidate node.
[0084] The target download priority parameter is data used to determine the target download priority corresponding to the candidate node. The target download priority parameter can be specifically presented in the form of a score. It can be understood that the higher the target download priority of the candidate node, the more reliable the candidate node is, and downloading files from the candidate node can effectively guarantee the download success rate and download speed of the file.
[0085] Specifically, the computer device can fuse the node communication information in a node communication information set to obtain the target download priority parameters of the corresponding candidate nodes, and fuse the node communication information in each node communication information set respectively, and finally obtain the target download priority parameters corresponding to each candidate node.
[0086] In one embodiment, in the same node communication information set, the computer device can fuse the communication delay information and the download delay information to obtain the target delay information, and obtain the corresponding target download priority parameter based on the target delay information. When fusing the communication delay information and the download delay information, it can be an equal-proportional fusion, that is, when fusing the communication delay information and the download delay information, the attention weights corresponding to the communication delay information and the download delay information are both 50%, that is, the target delay information = 0.5*communication delay information + 0.5*download delay information. Of course, it can also be a non-equal-proportional fusion, for example, the target delay information = 0.4*communication delay information + 0.6*download delay information.
[0087] If the node communication information set also includes other node communication information, in the same node communication information set, the computer device can first perform a preliminary fusion of the node communication information of the same dimension, and then perform an advanced fusion of the node communication information corresponding to each dimension after the preliminary fusion. For example, the computer device can first fuse the communication delay information and the download delay information to obtain the target delay information, and then obtain the corresponding target download priority parameter based on the target delay information and the node communication information of other dimensions. It can be understood that because the communication delay information and the download delay information are both time-related node communication information, the communication delay information and the download delay information are first fused, and then the node communication information of other dimensions is fused.
[0088] Step S210: determining a target node from each candidate node based on the target download priority parameter, and obtaining a target file corresponding to the to-be-downloaded file identifier from the target node.
[0089] The target node refers to at least one candidate node with a higher target download priority.
[0090] Specifically, after obtaining the target download priority parameter, the computer device can determine the target download priority corresponding to each candidate node based on the target download priority parameter, determine the target node from each candidate node based on the target download priority, and then obtain the target file corresponding to the file identifier to be downloaded from the target node.
[0091] In one embodiment, determining a target node from each candidate node based on a target download priority parameter includes:
[0092] The target download priority corresponding to each candidate node is determined based on the target download priority parameter; and the candidate node with the highest target download priority is used as the target node.
[0093] Specifically, the target node may be a candidate node. The computer device may determine the target download priority corresponding to each candidate node based on the target download priority parameter. For example, when the target download priority parameter is larger, it means the node performance is worse. The computer device may sort the target download priority parameters from small to large, and determine the target download priority corresponding to each candidate node based on the sorting result. The candidate node corresponding to the target download priority parameter with a higher ranking has a higher target download priority. The computer device may use the candidate node with the highest target download priority as the target node, and download the complete target file from the target node with the best node performance.
[0094] Of course, the target node can also be multiple candidate nodes. In order to increase the download speed, the computer device can adopt distributed download. The computer device can divide the target file into multiple sub-segments, determine the target nodes corresponding to each sub-segment from each candidate node based on the target download priority parameter, and then obtain the corresponding sub-segment from each target node. For example, the computer device divides the target file into sub-segment 1, sub-segment 2 and sub-segment 3, and the computer device uses the three candidate nodes with the highest target download priority as the target nodes corresponding to sub-segment 1, sub-segment 2 and sub-segment 3, respectively, and obtains sub-segment 1, sub-segment 2 and sub-segment 3 from the three target nodes. Among them, the download process of the sub-segments can be processed in parallel, for example, sub-segment 1, sub-segment 2 and sub-segment 3 are downloaded in parallel at the same time. The computer device may also first determine the target node corresponding to the first sub-segment from each candidate node based on the target download priority parameter. In the process of downloading the first sub-segment, the corresponding node communication information set is updated based on the current communication information generated by the current communication between the computer device and each candidate node. The computer device obtains the updated download priority parameters corresponding to each candidate node based on the updated node communication information set, and determines the target node corresponding to the next sub-segment from each candidate node based on the updated download priority parameters. By analogy, the computer device always downloads the corresponding sub-segment from the most reliable candidate node at the moment.
[0095] In the above-mentioned file download method, by obtaining a file download request, the file download request carries the identifier of the file to be downloaded, obtaining a candidate node information set corresponding to the identifier of the file to be downloaded, obtaining a node communication information set of each candidate node corresponding to the candidate node information set, the node communication information in the node communication information set is obtained by communicating with the corresponding candidate node, the node communication information includes the communication delay information generated by establishing communication and the download delay information generated by file downloading, the node communication information in the same node communication information set is merged, the target download priority parameter corresponding to each candidate node is obtained, the target node is determined from each candidate node based on the target download priority parameter, and the target file corresponding to the identifier of the file to be downloaded is obtained from the target node. In this way, the node is evaluated by integrating the communication delay information and the download delay information, and the node with excellent performance in communication and downloading can be selected from each candidate node as the target node, and the target file is downloaded from the target node, which can effectively guarantee the download success rate and download speed of the target file, thereby improving the download quality of the target file. Further, considering the download delay information when evaluating the node can also effectively avoid repeated selection of the same download failure node for downloading by continuous download tasks, further improving the download quality of the target file.
[0096] In one embodiment, obtaining a node communication information set of each candidate node corresponding to the candidate node information set includes:
[0097] The request sending time and the initial request reply time corresponding to the historical download request sent to the candidate node are obtained; based on the request sending time and the initial request reply time corresponding to the same candidate node, the download delay information corresponding to the candidate node is obtained.
[0098] Among them, the historical download request refers to a data download request sent to the candidate node before the current round of node evaluation, which is used to request the download of file data. The historical download request can be file data for requesting the download of the entire file, or it can be file data for requesting the download of a partial file fragment. The request sending time refers to the time when the computer device sends the historical download request. The initial request reply time refers to the time when the computer device first receives the request reply corresponding to the historical download request. For example, the computer device sends a data download request to the candidate node to request the download of 200KB of file data. After receiving the data download request, the candidate node will gradually send 200KB of file data to the computer device in the form of data packets. The computer device can use the reception time of the first received data packet as the initial request reply time.
[0099] Specifically, before the computer device performs the current round of node evaluation, it may have sent a data download request to each candidate node corresponding to the candidate node information set. If the computer device has sent a data download request to the candidate node, the computer device can count the corresponding download delay information. After the computer device obtains the candidate node information set, the computer device can query whether a data download request has been sent to each candidate node corresponding to the candidate node information set. If there is a candidate node that has sent a data download request, the computer device can obtain the request sending time and the initial request reply time corresponding to the historical download request sent to the candidate node to calculate the download delay information. It can be understood that the same candidate node can correspond to at least one historical download request, then the computer device can calculate the first packet RTT based on the request sending time and the initial request reply time corresponding to the same candidate node and the same historical download request, obtain the first packet RTT corresponding to the same candidate node, and obtain the corresponding download delay information based on the first packet RTT corresponding to the same candidate node. For example, for candidate node 1, the computer device counts the last 20 first packet RTTs and calculates the average value as the download delay information of candidate node 1.
[0100] In one embodiment, in addition to obtaining the download delay information based on the first packet RTT, the download delay information may also be obtained based on the first packet RTT and the download RTT.
[0101] In one embodiment, obtaining a node communication information set of each candidate node corresponding to the candidate node information set includes:
[0102] A heartbeat request is sent to each candidate node respectively, and a response message returned by each candidate node based on the heartbeat request is received. The heartbeat request is used to establish communication with the corresponding candidate node; based on the heartbeat request and response message corresponding to the same candidate node, the communication delay information corresponding to each candidate node is obtained.
[0103] Wherein, the heartbeat request is a request for the computer device to establish communication with the candidate node. The response message is the heartbeat reply sent by the candidate node to the computer device after receiving the heartbeat request. Once the computer device obtains the node information of the node, the computer device can send a heartbeat request to the node based on the node information to establish a communication connection with the node. The communication connection between the computer device and the candidate node can be activated and maintained by a timed heartbeat request, so the computer device can send a heartbeat request to the candidate node at a regular time, and the candidate node can also send a heartbeat request to the computer device at a regular time. The time interval of the regular time can be set according to actual needs, for example, a heartbeat request is sent once every 3s, and a heartbeat request is sent once every 5s.
[0104] Specifically, after obtaining the candidate node information set, the computer device can establish a communication connection with each candidate node based on a heartbeat request. The computer device can evaluate the candidate nodes directly based on the historical communication data without considering the data generated by the current communication, and determine the target node therefrom. Of course, in order to improve the accuracy of node evaluation and select the more reliable node at present, the computer device can also first establish a communication connection with each candidate node, and after the preset communication time, generate a node communication information set based on the data generated by the current communication, or generate a node communication information set based on the data generated by the current communication and the historical communication data. Among them, the preset time can be set as needed, for example, 15s.
[0105] The node communication information set includes communication delay information, which is calculated by sending and receiving heartbeat related data. The computer device can generate communication delay information based on the heartbeat request and response message corresponding to the same candidate node. The computer device can calculate the time difference between the sending time of the heartbeat request and the receiving time of the corresponding response message as the heartbeat RTT, and calculate the average value of several heartbeat RTTs as the communication delay information. For example, for candidate node 1, the computer device counts the last 20 heartbeat RTTs and calculates the average value as the communication delay information of candidate node 1.
[0106] In one embodiment, the computer device may divide the target file into multiple sub-segments. If each candidate node is a new node that has never established a communication connection with the computer device, the computer device may randomly determine a candidate node from multiple candidate nodes as a target node to download the first sub-segment. Then, the computer device calculates the target download priority parameters corresponding to each candidate node based on the heartbeat RTT and the first packet RTT generated during the download of the first sub-segment, determines a new target node from each candidate node based on the target download priority parameters, and downloads the remaining sub-segments from the new target node.
[0107] In this embodiment, a node communication information set is generated based on the data generated by the current communication, which can effectively ensure the accuracy and timeliness of the node evaluation. The computer device actively obtains real-time node communication information through heartbeat requests. These node communication information can reflect the "busyness" of the candidate nodes. Based on these node communication information, the candidate nodes can be evaluated, and the more reliable nodes can be selected as the target nodes, thereby improving the speed of obtaining the target file from the target node.
[0108] In one embodiment, the node communication information further includes download speed information, and obtaining the node communication information set of each candidate node corresponding to the candidate node information set includes:
[0109] Obtain the requested download data volume, request sending time and target request reply time corresponding to the historical download requests sent to the candidate nodes; obtain the historical download speed corresponding to each historical download request based on the requested download data volume, request sending time and target request reply time corresponding to the same historical download request; obtain the download speed information corresponding to the candidate node based on the historical download speed corresponding to the same candidate node.
[0110] The requested download data volume refers to the data volume of the file data requested to be downloaded from the candidate node. The request sending time refers to the time when the computer device sent the historical download request. The target request reply time refers to the time when the computer device received the request reply corresponding to the historical download request for the last time. For example, the computer device sends a data download request to the candidate node to request to download 200KB of file data. After the candidate node receives the data download request, it will gradually send 200KB of file data to the computer device in the form of data packets. The computer device can use the reception time of the last received data packet as the target request reply time.
[0111] Specifically, after the computer device obtains the candidate node information set, the computer device can query whether a data download request has been sent to each candidate node corresponding to the candidate node information set. If there is a candidate node that has sent a data download request, the computer device can obtain the requested download data volume, request sending time and target request reply time corresponding to the historical download request sent to the candidate node to calculate the download speed information. The computer device can calculate the download RTT based on the request sending time and target request reply time, and obtain the download speed information based on the requested download data volume and download RTT. It can be understood that the same candidate node can correspond to at least one historical download request, then the computer device can calculate the download RTT based on the request sending time and target request reply time corresponding to the same candidate node and the same historical download request, obtain the corresponding download RTT of the same candidate node, obtain the corresponding download speed based on the requested download data volume and download RTT corresponding to the same historical download request, and obtain the download speed information based on the corresponding download speeds of the same candidate node. For example, for candidate node 1, the computer device counts the download speeds of the last 20 times and calculates the average value as the download speed information of candidate node 1.
[0112] In one embodiment, the download speed information may only include the historical successful download speed. The historical successful download speed is obtained based on the download speed corresponding to the historical download request for successfully downloading the file data. The download speed information may also include the historical successful download speed and the historical failed download speed. The historical failed download speed is obtained based on the download speed corresponding to the historical download request for failing to download the file data. After the computer device sends a data download request to the node, the node will send the file data to the computer device according to the data download request. If the computer device does not receive the file data within the specified download time, that is, the computer device downloads the file timeout, the computer device can determine that the download of the file data has failed, and mark the corresponding data download request as a failure to download the file data; if the computer device receives the file data within the specified download time, the computer device can determine that the download of the file data is successful, and mark the corresponding data download request as a successful download of the file data. The computer device can calculate the historical successful download speed based on the request download data volume, request sending time and target request reply time corresponding to the historical download request for successfully downloading the file data, and calculate the historical failed download speed based on the request download data volume, request sending time and target request reply time corresponding to the historical download request for failing to download the file data. Then, the computer device fuses the historical successful download speed and the historical failed download speed corresponding to the same node to obtain the download speed information. The fusion weight can be set as needed, for example, set to equal proportion fusion.
[0113] In one embodiment, the download speed information includes historical successful download speeds and historical download failure times. Since the target request reply time is unstable when downloading file data fails, that is, the time difference between the download RTT and the specified download time may be large or small. In order to reduce the computing pressure of the computer device, the computer device may not calculate the historical failed download speeds, but only count the historical download failure times.
[0114] In this embodiment, the historical download speed can reflect the transmission link status of the node. Therefore, obtaining the download speed information based on the historical download speed and using the download speed information as another dimension of data in the node communication information set can further improve the accuracy and reliability of the node evaluation.
[0115] In one embodiment, Figure 3 As shown, the node communication information in the same node communication information set is merged to obtain the target download priority parameters corresponding to each candidate node, including:
[0116] Step S302, obtaining the slice information corresponding to the target file, where the slice information is used to determine the segment size when downloading the target file in segments.
[0117] The slicing information is used to determine the segment size when the target file is downloaded in segments. The slicing information can specifically be the slicing data volume, and the computer device can slicing the target file based on the slicing data volume. For example, when the slicing data volume is 128KB, when the file size corresponding to file 1 is 512KB, the computer device can slicing file 1 into 4 sub-segments (4*128KB=512KB) based on the slicing data volume.
[0118] Specifically, in order to increase the speed of file downloading, the computer device may adopt a distributed downloading mode when downloading the target file. The computer device may segment the target file into multiple sub-segments and download each sub-segment from at least one target node.
[0119] In one embodiment, the computer device can segment files of different sizes based on a unified segmentation data amount. For example, the preset data amount is 128KB, when the file size corresponding to file 1 is 512KB, the computer device can segment file 1 into 4 sub-segments (4*128KB=512KB), and when the file size corresponding to file 2 is 256KB, the computer device can segment file 1 into 2 sub-segments (2*128KB=256KB). The computer device can also set the segmentation data amounts corresponding to different file formats. Then, after obtaining the file download request, the computer device can determine the target file format corresponding to the target file based on the file identifier to be downloaded, and segment the target file based on the segmentation data amount corresponding to the target file format. For example, a larger segmentation data amount can be set for a file in a video format, and a smaller segmentation data amount can be set for a file in an audio format.
[0120] Step S304, when the slice information is greater than or equal to the slice threshold, the communication delay information and the download delay information in the communication information set of the same node are fused based on the first attention information to obtain the target delay information corresponding to each candidate node. In the first attention information, the attention intensity corresponding to the communication delay information is less than the attention intensity corresponding to the download delay information.
[0121] Step S306, when the slice information is less than the slice threshold, the communication delay information and the download delay information in the same node communication information set are fused based on the second attention information to obtain the target delay information corresponding to each candidate node. In the second attention information, the attention intensity corresponding to the communication delay information is greater than or equal to the attention intensity corresponding to the download delay information.
[0122] The attention information is used to selectively and focusedly integrate the communication delay information and the download delay information. The attention information includes the attention intensity corresponding to the communication delay information and the download delay information, that is, the attention information includes the attention weights corresponding to the communication delay information and the download delay information, that is, the attention intensity refers to the attention weight.
[0123] Specifically, the target delay information is obtained by weighted calculation of the communication delay information and the download delay information. The target delay information can also be called the smooth network delay SRTT (Smooth Round-Trip Time). SRTT is to balance the differences between different RTTs and make the RTT changes look smoother. SRTT = (a*heartbeat RTT) + ((1-a)*first packet RTT), a∈[0,1.0]. Heartbeat RTT represents the communication delay information, and first packet RTT represents the download delay information. When evaluating a node, the reference value of the first packet RTT is greater than the reference value of the heartbeat RTT. In addition, as long as the computer device and the node maintain communication, the heartbeat RTT will continue to be generated, and the heartbeat RTT data will be more. When the slice information is greater than or equal to the slice threshold, that is, when the sub-segment corresponding to the target file is relatively large, the download delay information related to the download is more referenced to evaluate the node, so that the target node finally selected can effectively guarantee the speed and success rate of downloading the sub-segment corresponding to the target file. Therefore, when the slice information is greater than or equal to the slice threshold, the computer device can obtain the first attention information, and based on the first attention information, the communication delay information and the download delay information in the same node communication information set are merged to obtain the target delay information corresponding to each candidate node. In the first attention information, the attention intensity corresponding to the communication delay information is less than the attention intensity corresponding to the download delay information. For example, when the slice information is greater than or equal to the slice threshold, the attention intensity corresponding to the communication delay information is 0.3, and the attention intensity corresponding to the download delay information is 0.7, then the target delay information = 0.3*communication delay information + 0.7*download delay information.
[0124] Correspondingly, when the slice information is less than the slice threshold, the computer device can obtain the second attention information, and fuse the communication delay information and download delay information in the same node communication information set based on the second attention information to obtain the target delay information corresponding to each candidate node. In the second attention information, the attention intensity corresponding to the communication delay information is greater than or equal to the attention intensity corresponding to the download delay information. For example, when the slice information is less than the slice threshold, the attention intensity corresponding to the communication delay information is 0.5, and the attention intensity corresponding to the download delay information is 0.5, then the target delay information = 0.5*communication delay information + 0.5*download delay information.
[0125] Step S308: obtaining a target download priority parameter corresponding to each candidate node based on the target delay information corresponding to each candidate node.
[0126] Specifically, the computer device can obtain the target download priority parameters corresponding to each candidate node based on the target delay information corresponding to each candidate node. The computer device can specifically normalize the target delay information corresponding to each candidate node, obtain the target communication score corresponding to each candidate node, use the target communication score as the target download priority parameter, and finally obtain the target download priority parameter corresponding to each candidate node. For example, the computer device calculates the delay score based on the target delay information, and uses the delay score corresponding to each candidate node as the target download priority parameter corresponding to each candidate node. Among them, the specific method for normalizing the target delay information can refer to the method described in the subsequent related embodiments, which will not be repeated here.
[0127] In one embodiment, if both the communication delay information and the download delay information are non-zero, then the computer device can fuse the communication delay information and the download delay information based on the first attention information or the second attention information to obtain the target delay information. If the communication delay information is 0, the computer device can obtain the target delay information based only on the download delay information. If the download delay information is 0, the computer device can obtain the target delay information based only on the communication delay information. For example, if the heartbeat RTT and the first packet RTT are 40ms and 60ms respectively, then SRTT = 40ms*0.5+60ms*0.5 = 50ms. If there is no first packet RTT and the heartbeat RTT is 40ms, then SRTT = 40ms.
[0128] In this embodiment, different fusion schemes are adopted for communication delay information and download delay information for different slice information, which can effectively improve the reliability of target delay information, thereby improving the reliability of node evaluation and the reliability of file downloading.
[0129] In one embodiment, the node communication information in the same node communication information set is merged to obtain the target download priority parameters corresponding to each candidate node, including:
[0130] In the same node communication information set, the communication delay information and the download delay information are fused to obtain the target delay information; the node communication information of each dimension in the same node communication information set is normalized to obtain the node communication score corresponding to each candidate node in each dimension; the node communication scores corresponding to the same candidate node are fused to obtain the target communication score corresponding to each candidate node; based on the target communication score corresponding to each candidate node, the target download priority parameter corresponding to each candidate node is obtained.
[0131] Among them, the normalization process is used to map the node communication information of the same dimension between different candidate nodes into the same numerical range to facilitate subsequent data fusion and data comparison.
[0132] Specifically, the node communication information set may include node communication information of multiple dimensions. The communication delay information and the download delay information belong to the node communication information of the same dimension, and both belong to the node communication information of the time dimension. Before fusing the node communication information of different dimensions, the computer device may first fuse the communication delay information and the download delay information in the same node communication information set to obtain the target delay information. Then, the computer device normalizes the node communication information of each dimension in the same node communication information set to obtain the node communication scores corresponding to each candidate node in each dimension. Specifically, the normalization process may be performed by a traditional method. For example, the candidate nodes include candidate node 1, candidate node 2, and candidate node 3. The node communication information of the first dimension corresponding to candidate node 1 is A, the node communication information of the first dimension corresponding to candidate node 2 is B, and the node communication information of the first dimension corresponding to candidate node 3 is C. Then, the node communication score of the first dimension corresponding to candidate node 1 may be A / (A+B+C). Normalization processing can also be performed through a preset table, which records the correlation between node communication information and node communication scores. The node communication score corresponding to a certain node communication information can be obtained by looking up the table.
[0133] After obtaining the node communication scores corresponding to each candidate node in each dimension, the computer device can fuse the node communication scores corresponding to the same candidate node to obtain the target communication scores corresponding to each candidate node. For example, the node communication scores corresponding to a candidate node are weighted and summed to obtain the target communication score corresponding to the candidate node. Specifically, it can be an equal-proportional weighted summation or a non-equal-proportional weighted summation. For example, target communication score = (b*smoothed delay score) + ((1-b)*speed score), b∈[0,1.0]. Finally, the computer device uses the target communication score corresponding to the candidate node as the target download priority parameter corresponding to the candidate node to obtain the target download priority parameters corresponding to each candidate node.
[0134] In one embodiment, the file download request carries the target application identifier corresponding to the request triggering application, and the computer device can fuse the node communication scores corresponding to the same candidate node based on the target attention information corresponding to the target application identifier to obtain the corresponding target communication score. The target attention information is used to determine the node communication information that the request triggering application pays more attention to. The target attention information includes the attention weights corresponding to the node communication scores of each dimension. The sum of all attention weights in the attention information can be 1. It can be understood that the higher the attention weight corresponding to the node communication score of a certain dimension, the more the application pays attention to the node performance reflected by the node communication information of that dimension. For example, the live broadcast application pays more attention to the node communication information of the time dimension.
[0135] It can be understood that the fusion of communication delay information and download delay information can refer to the method described in the aforementioned related embodiments, which will not be repeated here.
[0136] In this embodiment, the node communication information of each dimension in the same node communication information set is normalized and then fused to obtain the target communication score, which can effectively ensure the reliability and effectiveness of the target communication score and facilitate the subsequent determination of the target node from various candidate nodes based on the target download priority parameters.
[0137] In one embodiment, the node communication information of each dimension in the same node communication information set is normalized to obtain the node communication scores of each candidate node in each dimension, including:
[0138] The association relationship information corresponding to each dimension is obtained, the association relationship information represents the association relationship between the node communication information and the node communication score, the association relationship information includes a plurality of intervals arranged in order corresponding to the node communication information of the same dimension, each interval has corresponding communication score reference information, and the communication score reference information shows a monotonically changing trend according to the arrangement order of the intervals; the current node communication information corresponding to the current candidate node in the current dimension is obtained, and the interval range corresponding to each interval is obtained from the association relationship information corresponding to the current dimension; the current node communication information is decomposed according to the interval range corresponding to each interval to obtain the current communication sub-information corresponding to each interval; the node communication score corresponding to the current candidate node in the current dimension is obtained based on the current communication sub-information corresponding to the same interval and the communication score reference information.
[0139] Among them, the association relationship information is used to characterize the association relationship between the node communication information and the node communication score, and the computer device can determine the node communication score corresponding to a certain node communication information based on the association relationship information. The association relationship information includes multiple sequentially arranged intervals corresponding to the node communication information of the same dimension, and each interval has corresponding communication score reference information, and the communication score reference information shows a monotonically changing trend according to the arrangement order of the interval. An interval corresponds to a local range of node communication information, for example, 0-10 is one interval, and 10-20 is another interval. The interval ranges between different intervals may include overlapping data, and the interval ranges between different intervals may not overlap, and the spans of the interval ranges between different intervals may be the same or different. The communication score reference information corresponding to an interval is used to calculate the reference communication score corresponding to the node communication information falling into the interval. The communication score reference information can be a formula or specific data. The monotonic change trend can be monotonically increasing or monotonically decreasing. The monotonic change trend can be a uniform change or an accelerated change, for example, exponential change. Different dimensions correspond to different association relationship information. The association relationship information can be presented in the form of a table. The current communication sub-information refers to the node communication sub-information in which the current node communication information falls within a certain interval.
[0140] Specifically, the computer device can obtain the association relationship information corresponding to each dimension, and determine the node communication score corresponding to each dimension of the candidate node based on the association relationship information. Taking the calculation of the node communication score corresponding to the current candidate node in the current dimension as an example, the computer device can obtain the current node communication information corresponding to the current candidate node in the current dimension, obtain the interval range corresponding to each interval from the association relationship information corresponding to the current dimension, decompose the current node communication information according to the interval range corresponding to each interval, and obtain the current communication sub-information corresponding to each interval. For example, the association relationship information corresponding to the current dimension includes interval 1 (0-10), interval 2 (10-30), interval 3 (30-60), and the current node communication information is 40. Because 40>10, the current communication sub-information corresponding to interval 1 obtained by decomposing the communication information of the current node is 10 (10-0=10); 40>30, the current communication sub-information corresponding to interval 2 obtained by decomposing the communication information of the current node is 20 (30-10=20); 40<60, the current communication sub-information corresponding to interval 3 obtained by decomposing the communication information of the current node is 10 (40-30=10). Furthermore, the computer device can obtain the node communication score corresponding to the current candidate node in the current dimension based on the current communication sub-information and communication score reference information corresponding to the same interval. For example, the communication score reference information corresponding to interval 1 is 2, the communication score reference information corresponding to interval 2 (10-30) is 4, and the communication score reference information corresponding to interval 3 (30-60) is 8. The current node communication information is 40, then the node communication score corresponding to the current node communication information is 98 (10*2+20*4+10*8=98). Similarly, the computer device can obtain the node communication scores corresponding to the current candidate node in other dimensions, and the computer device can obtain the node communication scores corresponding to other candidate nodes in various dimensions.
[0141] In one embodiment, the association relationship information corresponding to the target delay information is shown in Table 1.
[0142] Table 1
[0143] Smooth network delay SRTT information (ms) Corresponding communication score reference information (i.e. corresponding score) 0<=SRTT<50 1 50<=SRTT<75 2 50<=SRTT<75 3 100<=SRTT<150 6 150<=SRTT 8
[0144] The reason why the SRTT interval is set to 50-75-100-150: By analyzing the current network data, 80% of the SRTT is in [0,50ms] and 10% of the SRTT is in [50ms,100ms], so a gradient change of 50-75-100 is set here. At this time, the scores corresponding to each interval may not be designed according to a linear ratio, because in general, when the SRTT is 100ms, it indicates that the network condition is not bad, so the scores of 0<=SRTT<50, 50<=SRTT<75, 50<=SRTT<75 are not much different (1->2->3). When the SRTT exceeds 150ms, it indicates that the network condition is relatively poor, so the scores corresponding to the two intervals of 100<=SRTT<150 and 150<=SRTT are significantly higher than other intervals (6->8).
[0145] For example, if the SRTT is 20ms, the delay score is 20*1=20. If the SRTT is 70ms, the smooth delay score is 50*1+(70-50)*2=90. If the SRTT is 160ms, the smooth delay score is 50*1+(75-50)*2+(100-75)*3+(150-100)*6+(160-150)*8=555.
[0146] It can be understood that the interval settings and score settings in Table 1 can be changed according to actual needs.
[0147] In this embodiment, the node communication information is normalized based on the association relationship information, which can effectively ensure that the node communication score obtained by the normalization process accurately and reliably reflects the node performance.
[0148] In one embodiment, when the node communication information is download speed information corresponding to the speed dimension, the normalization process of the download speed information includes the following steps:
[0149] A first download speed threshold and a second download speed threshold corresponding to the speed dimension are obtained, wherein the first download speed threshold is less than the second download speed threshold; when the current download speed information corresponding to the current candidate node is less than the first download speed threshold, the node communication score corresponding to the current candidate node in the speed dimension is calculated based on the first relational expression, and the node communication score corresponding to the current candidate node in the speed dimension increases as the current download speed information decreases and is a positive number; when the current download speed information is greater than or equal to the first download speed threshold and less than or equal to the second download speed threshold, the node communication score corresponding to the current candidate node in the speed dimension is calculated based on the second relational expression, and the node communication score corresponding to the current candidate node in the speed dimension increases or remains unchanged as the current download speed information increases; when the current download speed information is greater than the second download speed threshold, the node communication score corresponding to the current candidate node in the speed dimension is calculated based on the third relational expression, and the node communication score corresponding to the current candidate node in the speed dimension decreases as the current download speed information increases and is a negative number.
[0150] Specifically, in addition to normalizing the download speed information based on the association relationship information corresponding to the speed dimension, the computer device can also normalize the download speed information based on the first download speed threshold and the second download speed threshold. The first download speed threshold is less than the second download speed threshold. Taking the calculation of the download speed information corresponding to the current candidate node in the speed dimension as an example, the computer device can obtain the current download speed information corresponding to the current candidate node, and compare the first download speed threshold, the second download speed threshold and the current download speed information. If the current download speed information is less than the first download speed threshold, that is, the current download speed information is relatively slow, indicating that the node performance corresponding to the speed dimension of the current candidate node is poor, then the current candidate node is penalized to improve the node communication score corresponding to the speed dimension of the current candidate node. The higher the node communication score corresponding to the speed dimension of the current candidate node, the worse the node performance of the current candidate node. The computer device can specifically calculate the node communication score corresponding to the speed dimension of the current candidate node based on the first relational expression. In the first relational expression, the node communication score corresponding to the speed dimension of the current candidate node increases as the current download speed information decreases, and the node communication score is a positive number. That is, if the current download speed information is less than the first download speed threshold, the smaller the current download speed information is, the larger the corresponding node communication score is, and the further away the corresponding node communication score is from zero.
[0151] If the current download speed information is greater than or equal to the first download speed threshold and less than or equal to the second download speed threshold, that is, the current download speed information is between the first download speed threshold and the second download speed threshold, it indicates that the node performance corresponding to the current candidate node in terms of speed is normal. Then, no penalty processing is performed on the current candidate node, nor is any reward processing performed on the current candidate node. Specifically, the computer device can calculate the node communication score corresponding to the current candidate node in terms of speed based on the second relationship. In the second relationship, the node communication score corresponding to the current candidate node in terms of speed remains unchanged as the current download speed information increases. That is, if the current download speed information is between the first download speed threshold and the second download speed threshold, the greater the current download speed information, the fixed the corresponding node communication score. In the second relationship, the node communication score corresponding to the current candidate node in terms of speed increases as the current download speed information increases. That is, if the current download speed information is between the first download speed threshold and the second download speed threshold, the greater the current download speed information, the greater the corresponding node communication score. It can be understood that the increasing speed of the node communication score in the second relationship is less than that in the first relationship.
[0152] If the current download speed information is greater than the second download speed threshold, that is, the current download speed information is relatively fast, it indicates that the node performance corresponding to the current candidate node in terms of speed is good. Then, reward processing is performed on the current candidate node, and the node communication score corresponding to the current candidate node in terms of speed is reduced. Specifically, the computer device can calculate the node communication score corresponding to the current candidate node in terms of speed based on the third relationship. In the third relationship, the node communication score corresponding to the current candidate node in terms of speed decreases as the current download speed information increases and is negative. That is, if the current download speed information is greater than the second download speed threshold, the smaller the current download speed information, the greater the corresponding node communication score, and the closer the corresponding node communication score is to zero.
[0153] For example, the computer device can set a target download speed (targetSpeed) according to the first download speed threshold and the second download speed threshold, and the target download speed is used to represent the target expected speed. Based on the target download speed, calculate the speed ratio ratio = (speed / targetSpeed) * 100 corresponding to the current download speed information.
[0154] (1) If ratio < speedRatio1, the speed score is (100 - ratio) * speedScore1
[0155] (2) If ratio >= speedRatio1 and ratio <= speedRatio2, the speed score is ratio * speedScore2
[0156] (3) If ratio > speedRatio2, the speed score is -1 * ratio * speedScore3
[0157] Among them, 0 < speedRatio1 < speedRatio2 <= 100. For example, if speedRatio1 is 75, speedRatio2 is 100, and targetSpeed is 400 kbps, then the first download speed threshold is 300 kbps, and the second download speed threshold is 400 kbps. speedScore1 > speedScore3 >= speedScore2 >= 0, speedScore1 >= 2 * speedScore3. For example, speedScore1 is 4, speedScore2 is 0, and speedScore3 is 1.
[0158] Assume that targetSpeed is 400 KBps, speedRatio1 is 75, speedRatio2 is 100, speedScore1 is 4, speedScore2 is 0, and speedScore3 is 1.
[0159] If the calculated current download speed information is 200 KBps, then ratio = (200 KBps / 400 KBps) * 100 = 50, ratio = 50 < speedRatio1 = 75. At this time, the speed score is = (100 - 50) * 4 = 200. If the calculated current download speed information is 400 KBps, then ratio = (400 KBps / 400 KBps) * 100 = 100, ratio = 100 < speedRatio2 = 100. At this time, the speed score is = 100 * 0 = 0. If the calculated current download speed information is 800 KBps, then ratio = (800 KBps / 400 KBps) * 100 = 200, ratio = 200 > speedRatio2 = 100. At this time, the speed score is = -1 * 200 * 1 = -200.
[0160] In this embodiment, the larger the node communication score corresponding to the speed dimension of the candidate node, the worse the quality of the candidate node. The smaller the node communication score corresponding to the speed dimension of the candidate node, the better the quality of the candidate node. Finally, the computer device can select the candidate node with the smallest target communication score as the target node. In the case where the node communication score corresponding to the speed dimension of the candidate node is negative, this just shows that the candidate node has a fast download speed and is worthy of priority scheduling of download files.
[0161] In one embodiment, obtaining a first download speed threshold and a second download speed threshold corresponding to the speed dimension includes:
[0162] Obtain a reference download speed set, the reference download speed set including multiple reference download speeds; obtain slice information corresponding to a target file, the slice information being used to determine a segment size when downloading the target file in segments; determine a first download speed threshold and a second download speed threshold based on the reference download speed set and the slice information.
[0163] The reference download speed includes at least one of a historical download speed obtained by statistics of a computer device and a historical download speed obtained by statistics of other devices.
[0164] Specifically, the computer device may determine the first download speed threshold and the second download speed threshold by comprehensively considering the reference download speed and the slice size of the target file, so as to improve the accuracy of the first download speed threshold and the second download speed threshold. The computer device may obtain a reference download speed set including a plurality of reference download speeds, obtain the slice information corresponding to the target file, and determine the first download speed threshold and the second download speed threshold based on the reference download speed set and the slice information. For example, the reference download speed carries the corresponding requested download data volume, and the computer device obtains the reference download speed matching the requested download data volume and the slice information from the reference download speed set as the intermediate download speed, performs cluster analysis on the intermediate download speed, and divides the intermediate download speed into a first category of download speed and a second category of download speed, wherein the first category of download speed is less than the second category of download speed, and uses the statistical value of the first category of download speed as the first download speed threshold, and uses the statistical value of the second category of download speed as the second download speed threshold. The intermediate download speed may be a reference download speed having the same requested download data volume and slice information, a reference download speed having a difference between the requested download data volume and slice information within a preset threshold, and the like. The computer device may also pre-set speed adjustment information corresponding to different slice information, the computer device calculates the statistical value of the reference download speed set as the intermediate download speed, obtains the corresponding target speed adjustment information based on the slice information corresponding to the target file, and adjusts the intermediate download speed based on the target speed adjustment information to obtain the first download speed threshold and the second download speed threshold. For example, the larger the slice information, the larger the first download speed threshold and the second download speed threshold. When the amount of segmented data is 256KB, the speed adjustment information is to use 75% of the intermediate download speed as the first download speed threshold and 100% of the intermediate download speed as the second download speed threshold. When the amount of segmented data is 512KB, the speed adjustment information is to use 80% of the intermediate download speed as the first download speed threshold and 110% of the intermediate download speed as the second download speed threshold. The statistical value may be a median value, an average value, etc.
[0165] In one embodiment, the computer device may further determine the first download speed threshold and the second download speed threshold in combination with the node bandwidth of the candidate node. It is understandable that the larger the node bandwidth of the candidate node, the larger the first download speed threshold and the second download speed threshold. The larger the node bandwidth of the candidate node, the stronger the initial data transmission capability of the candidate node. For example, the first download speed threshold and the second download speed threshold are calculated by a custom formula based on the reference download speed set, the slice information and the node bandwidth.
[0166] In this embodiment, the first download speed threshold and the second download speed threshold are determined based on the reference download speed set and slice information, which can improve the accuracy and reliability of the first download speed threshold and the second download speed threshold, thereby improving the accuracy of node evaluation and improving the quality of file downloads.
[0167] In one embodiment, when the node communication information is download speed information corresponding to the speed dimension, the download speed information includes a historical successful download speed and a historical download failure number, and the normalization processing of the download speed information includes the following steps:
[0168] Based on the first download speed threshold and the second download speed threshold corresponding to the speed dimension, the historical successful download speed in the current download speed information corresponding to the current candidate node is normalized to obtain a first communication score; the preset communication score corresponding to the historical number of failed downloads in the current download speed information is obtained as the second communication score; based on the first communication score and the second communication score, the node communication score corresponding to the current candidate node in the speed dimension is obtained.
[0169] Specifically, when the download speed information includes the historical successful download speed and the historical download failure number, the computer device can calculate the communication scores corresponding to the historical successful download speed and the historical download failure number respectively, and obtain the node communication score corresponding to the node in the speed dimension by combining the communication scores of the two. Taking the current candidate node as an example, the computer device can normalize the historical successful download speed in the current download speed information corresponding to the current candidate node based on the first download speed threshold and the second download speed threshold to obtain the first communication score. For the historical failed download number, the computer device can punish the current candidate node to improve the node communication score corresponding to the speed dimension of the current candidate node. The more historical failed downloads, the higher the node communication score corresponding to the current candidate node in the speed dimension. The preset communication scores corresponding to each historical failed download number can be pre-set. For example, if the historical failed download number is 1, the corresponding preset communication score is 50, if the historical failed download number is 2, the corresponding preset communication score is 100, and if the historical failed download number is 3, the corresponding preset communication score is 150. The computer device can obtain the preset communication score corresponding to the number of historical failed downloads in the current download speed information as the second communication score, and obtain the node communication score corresponding to the speed dimension of the current candidate node based on the first communication score and the second communication score. For example, the sum of the first communication score and the second communication score is used as the node communication score, and the first communication score and the second communication score are weighted and summed to obtain the node communication score.
[0170] It can be understood that the specific process of normalizing the historical successful download speeds in the current download speed information corresponding to the current candidate node based on the first download speed threshold and the second download speed threshold can refer to the method described in the aforementioned related embodiments.
[0171] In this embodiment, the communication scores corresponding to the historical successful download speed and the historical download failure times are calculated respectively, and the node communication score corresponding to the node in the speed dimension is obtained by combining the communication scores of the two. This can improve the reliability of the node communication score corresponding to the speed dimension, thereby improving the accuracy of node evaluation and improving the quality of file downloads.
[0172] In one embodiment, the file download method of the present application can be executed by a unified processing module. Wherein, obtaining a file download request includes: the unified processing module receiving a file download request sent by a target application through a preset interface; after obtaining a target file corresponding to a file identifier to be downloaded from a target node, the method further includes: the unified processing module sending the target file to the target application through a preset interface.
[0173] Among them, the preset interface is a calling interface of the unified processing module, which is used for data interaction between the unified processing module and the target application.
[0174] Specifically, each application can share a unified processing module, and each step of file downloading is executed by the unified processing module on the computer device. When the user triggers the generation of a file download request on the application, the application calls the preset interface and sends the file download request to the unified processing module, and the file download request carries the identifier of the file to be downloaded. The unified processing module obtains the candidate node information set corresponding to the identifier of the file to be downloaded according to the file download request, obtains the node communication information set of each candidate node corresponding to the candidate node information set, and fuses the node communication information in the same node communication information set to obtain the target download priority parameters corresponding to each candidate node. The unified processing module determines the target node from each candidate node based on the target download priority parameter, and obtains the target file corresponding to the identifier of the file to be downloaded from the target node. After obtaining the target file, the unified processing module can return the target file to the application through the preset interface, and then the application can display the target file.
[0175] refer to Figure 4AThe unified processing module can be a Peer Content Delivery Network Software Development Kit (PCDN SDK) based on the content distribution network, which is responsible for downloading data for multiple business applications. Various business apps are installed on the computer device, such as live broadcast apps, video apps, and audio apps. Each business app is integrated with an audio and video player / download component, and each business app can share a PCDN SDK. The audio and video player / download component is the file download request channel of the business app. The PCDN SDK is used to download the target file and interact with the audio and video player / download component. CDN download refers to downloading the target file through the CDN server. Fog node download refers to downloading the target file through the fog node.
[0176] The PCDN SDK can be responsible only for downloading the target file from the fog node. For example, when the user triggers a file download request on the business app, the audio and video player / download component of the business app can obtain the file download request and send the file download request to the PCDN SDK through a preset interface to request to download the target file from the fog node. The PCDN SDK queries the available fog nodes that store the target file, evaluates each fog node based on the node communication information set corresponding to each fog node, obtains the target download priority parameter corresponding to each fog node, and downloads the target file to the most reliable fog node based on the target download priority parameter. The target file downloaded by the PCDN SDK is sent to the audio and video player / download component of the business app through a preset interface, and the target file is displayed on the business app through the audio and video player / download component. If the download of the target file from the fog node times out, the PCDN SDK can notify the business app that the file download from the fog node failed, so that the business app can download the target file from the CDN server that stores the target file instead.
[0177] The PCDN SDK can also be responsible for downloading the target file from the CDN server. For example, when the PCDN SDK receives a file download request, the PCDN SDK first queries the available fog nodes that store the target file, and determines the most reliable fog node from the available fog nodes to download the target file. If the download of the target file from the fog node times out, the PCDN SDK can further query the CDN server that stores the target file, and download the target file from the CDN server.
[0178] In this embodiment, various application programs can share a unified processing module, and the unified processing module executes various steps of file downloading. The application programs themselves do not need to download files, which can reduce the storage pressure of computer devices.
[0179] In one embodiment, the file downloading method of the present application can be executed by a special processing module.
[0180] Each application has its own special processing module integrated inside. When the user triggers a file download request on the application, the special processing module in the application can obtain the file download request carrying the identifier of the file to be downloaded, obtain the candidate node information set corresponding to the identifier of the file to be downloaded, obtain the node communication information set of each candidate node corresponding to the candidate node information set, merge the node communication information in the same node communication information set, obtain the target download priority parameters corresponding to each candidate node, determine the target node from each candidate node, and obtain the target file corresponding to the identifier of the file to be downloaded from the target node.
[0181] refer to Figure 4B , the special processing module can be a PCDN SDK, a software development kit based on the content distribution network, which is responsible for downloading data for specific business applications. When the user triggers a file download request on the business app, the audio and video player / download component of the business app can obtain the file download request and send the file download request to PCDNSDK to request to download the target file from the fog node. PCDN SDK queries the available fog nodes that store the target file, evaluates each fog node based on the node communication information set corresponding to each fog node, obtains the target download priority parameter corresponding to each fog node, and downloads the target file to the most reliable fog node based on the target download priority parameter. The target file downloaded by the PCDN SDK is thrown to the audio and video player / download component, and the target file is displayed on the business app through the audio and video player / download component. It can be understood that in addition to being specifically responsible for fog node downloads, PCDN SDK can also be responsible for CDN downloads.
[0182] In one embodiment, obtaining a candidate node information set corresponding to the identifier of the file to be downloaded includes:
[0183] Generate a node query request based on current location information and the identifier of the file to be downloaded; send the node query request to the query server so that the query server obtains an initial node information set, and screens the initial node information set based on the current location information to obtain a candidate node information set, wherein the initial node corresponding to the initial node information set stores the target file; receive the candidate node information set returned by the query server.
[0184] The current location information refers to the location information of the current geographical location of the computer device. The node query request is used to query the candidate nodes storing the target file. The query server is a server used to query the nodes storing the required files. The initial node refers to all nodes storing the target file, including resource nodes and fog nodes.
[0185] Specifically, the candidate node can specifically refer to the fog node. After the computer device obtains the file download request, it can generate a node query request based on its own current location information and the identifier of the file to be downloaded in the file download request, and send the node query request to the query server. After receiving the node query request, the query server can obtain the initial node information set according to the node query request, and the initial nodes corresponding to the initial node information set all store the target file. Furthermore, because the fog node is closer to the computer device, downloading the target file from the fog node can be faster and reduce the bandwidth pressure of the resource node, so the query server can further filter the initial node information set based on the current location information to obtain the candidate node information set. At this time, the candidate node corresponding to the candidate node information set is a fog node. The query server can specifically use the initial node whose location distance from the current location information is within a preset threshold as a candidate node, and generate a candidate node information set based on the node information corresponding to the candidate node. After obtaining the candidate node information set, the query server can return the candidate node information set to the computer device.
[0186] In one embodiment, obtaining a node communication information set of each candidate node corresponding to the candidate node information set includes:
[0187] When the candidate node is a node with which a communication connection has been established in the past, the corresponding historical communication information set is acquired according to the node identifier in the candidate node information set as the corresponding node communication information set.
[0188] The historical communication information set is generated based on the data generated by the computer device and the candidate node in the historical communication process.
[0189] Specifically, the candidate nodes corresponding to the candidate node information set may include old nodes that have established communication connections with the computer device in the past, and may also include new nodes that have never established communication connections with the computer device. In order to be able to evaluate the candidate nodes, the computer device may store the node communication information generated during the communication process with the candidate nodes locally, and associate and store the node communication information corresponding to the candidate nodes and the node identifier corresponding to the candidate nodes. Then, when the candidate node is a node that has established a communication connection in the past, the computer device may obtain the corresponding historical communication information set as the corresponding node communication information set based on the node identifier in the candidate node information set. The computer device performs node evaluation based on the historical communication information set and determines the target node from each candidate node.
[0190] In one embodiment, when each candidate node corresponding to the candidate node information set includes both new nodes and old nodes, the node communication information set corresponding to the new node may be empty. After determining each candidate node, the computer device may only determine the target node from the old nodes that have a historical communication information set, because the node communication information set of the new node is empty. In this embodiment, the computer device considers that the old node is more reliable than the new node, and further selects a more reliable node from the old node as the target node.
[0191] In one embodiment, when each candidate node corresponding to the candidate node information set includes both new nodes and old nodes, after determining each candidate node, the computer device can obtain the historical communication information set corresponding to the old node as the node communication information set corresponding to the old node, and fuse the node communication information in the node communication information set corresponding to the old node to obtain the target download priority parameter corresponding to the old node. In addition, the computer device can obtain the default download priority parameter as the target download priority parameter corresponding to the new node. Among them, the default download priority parameter is used to characterize the node performance of a general node and represents the average level. The default download priority parameter can be set manually or obtained based on big data analysis. For example, the default download priority parameter is obtained by averaging the target download priority parameter obtained by historical calculation. In this embodiment, the computer device defaults to a new node as a node with medium performance, and selects a more reliable node from the new node and the old node as the target node.
[0192] In one embodiment, in order to reduce the storage pressure of the computer device, the computer device can clean the historical communication information set. For example, the computer device can limit the maximum storage data volume of the historical communication information of each dimension in the historical communication information set. When the current storage data volume of the historical communication information of a certain dimension exceeds the maximum storage data volume, the oldest historical communication information is deleted to reduce the current storage data volume. The computer device can also limit the storage of communication data generated by a preset number of historical communications closest to the current time in the historical communication information set.
[0193] In this embodiment, the historical communication information set corresponding to the candidate node is obtained as the corresponding node communication information set, which can make full use of the historical communication data and more accurately evaluate the node, thereby improving the quality of file downloading.
[0194] In one embodiment, Figure 5 As shown, obtaining the target file corresponding to the file identifier to be downloaded from the target node includes:
[0195] Step S502: Download the first sub-segment corresponding to the target file from the target node, where the first sub-segment is the first sub-segment in the sub-segment sequence obtained by segmenting the target file.
[0196] The sub-segment sequence is a sequence composed of multiple sub-segments obtained by segmenting the target file. Each sub-segment can be arranged in chronological order. For example, multiple video segments are obtained by segmenting the target video, and each video segment is arranged in chronological order from early to late to obtain a video segment sequence. The first sub-segment refers to the sub-segment ranked first in the sub-segment sequence, that is, the sub-segment with the highest priority for downloading.
[0197] Specifically, the computer device can download the entire target file from one target node at one time. The computer device can also download sub-segments of the target file from different target nodes in batches, and compose the target file with the downloaded sub-segments, that is, download the target file in a distributed download manner. When performing distributed download, in order to further improve the quality of file download, the computer device can update the node communication information set based on the communication data generated in real time when downloading the current sub-segment, and further re-evaluate each candidate node in combination with the real-time communication data, and select the most reliable candidate node from each candidate node as the target node to download the next sub-segment. In this way, the computer device can always download each sub-segment of the target file with the most reliable node based on the latest data statistical analysis, thereby improving the quality of file download.
[0198] It can be understood that the specific process of determining the target node can refer to the methods described in the aforementioned related embodiments.
[0199] Step S504: during the downloading process of the current sub-segment, based on the current communication information generated by the current communication with each candidate node, the node communication information set corresponding to each candidate node is updated.
[0200] Step S506: The node communication information in the updated node communication information set corresponding to the same candidate node is merged to obtain the update download priority parameter corresponding to each candidate node.
[0201] Step S508, based on the update download priority parameter, determine the update node corresponding to the next sub-segment of the current sub-segment from each candidate node, obtain the next sub-segment from the update node, use the next sub-segment as the new current sub-segment, and return to the step of updating the node communication information set corresponding to each candidate node based on the current communication information generated by the current communication with each candidate node during the download process of the current sub-segment, until all sub-segments in the sub-segment sequence are downloaded.
[0202] The update download priority parameter refers to the updated target download priority parameter. The update node refers to the target node corresponding to the next sub-segment of the current sub-segment.
[0203] Specifically, during the download process of the current sub-segment, the computer device can update the node communication information set corresponding to each candidate node based on the current communication information generated by the current communication with each candidate node. For example, during the download process of the current sub-segment, the computer device sends a new heartbeat request to each candidate node and receives a corresponding response message. The computer device can update the communication delay information in the node communication information set based on the new heartbeat request and response message. If the target node corresponding to the current sub-segment is node A, during the download process of the current sub-segment, the computer device can update the download delay information and download speed information of node A. In this way, before downloading the next sub-segment of the current sub-segment, the computer device can merge the node communication information in the updated node communication information set corresponding to the same candidate node to obtain the update download priority parameters corresponding to each candidate node. The computer device determines the update node corresponding to the next sub-segment of the current sub-segment from each candidate node based on the update download priority parameter, and obtains the next sub-segment from the update node. Similarly, the computer device can use the next sub-segment as the new current sub-segment, and return to the step of updating the node communication information set corresponding to each candidate node based on the current communication information generated by the current communication with each candidate node during the download process of the current sub-segment, until all sub-segments in the sub-segment sequence are downloaded. That is, after each sub-segment is downloaded, the computer device re-evaluates each candidate node in combination with the latest current communication information and the original node communication information, and determines the target node corresponding to the next sub-segment, until all sub-segments in the sub-segment sequence are downloaded.
[0204] For example, the sub-segment sequence of the target file includes sub-segment 1, sub-segment 2 and sub-segment 3, and the candidate nodes include candidate nodes 1-5. Before downloading sub-segment 1, the computer device determines that candidate node 1 is the target node corresponding to sub-segment 1 based on the node communication information set of each candidate node, and the computer device downloads sub-segment 1 from candidate node 1. In the process of downloading sub-segment 1, the computer device always maintains communication with each candidate node. In the process of downloading sub-segment 1, the computer device can update the node communication information set corresponding to each candidate node based on the current communication information generated by the current communication with each candidate node. Before downloading sub-segment 2, the computer device determines that candidate node 2 is the target node corresponding to sub-segment 2 based on the updated node communication information set corresponding to each candidate node, and the computer device downloads sub-segment 2 from candidate node 2. In the process of downloading sub-segment 2, the computer device always maintains communication with each candidate node. In the process of downloading sub-segment 2, the computer device can further update the node communication information set corresponding to each candidate node based on the current communication information generated by the current communication with each candidate node. Before downloading sub-segment 3 , the computer device determines candidate node 2 as the target node corresponding to sub-segment 3 based on the latest node communication information set corresponding to each candidate node, and the computer device downloads sub-segment 3 from candidate node 2 .
[0205] In this embodiment, the sub-segment corresponding to the target file is always downloaded from the most reliable node obtained based on the latest data statistical analysis, which can improve the download speed of the target file and thus improve the download quality of the target file.
[0206] In one embodiment, Figure 6 As shown, a target node is determined from each candidate node based on a target download priority parameter, and a target file corresponding to the file identifier to be downloaded is obtained from the target node, including:
[0207] Step S602: segment the target file to obtain multiple sub-segments corresponding to the target file.
[0208] Step S604: determining the target nodes corresponding to the sub-segments from the candidate nodes based on the target download priority parameter.
[0209] Step S606: Obtain corresponding sub-segments from each target node in parallel.
[0210] Specifically, when performing distributed downloading, the computer device can adopt a parallel downloading method to further improve the speed of file downloading. The computer device can segment the target file, and segment a large target file into multiple small sub-segments. Furthermore, the computer device determines the target nodes corresponding to each sub-segment from each candidate node based on the target download priority parameter, and obtains the corresponding sub-segment from each target node in parallel.
[0211] In one embodiment, the computer device can segment files of different sizes based on a unified segmentation data amount. The computer device can also set segmentation data amounts corresponding to different file formats. For example, a larger segmentation data amount can be set for a file in a video format, and a smaller segmentation data amount can be set for a file in an audio format. Since files in a video format are usually larger, setting a larger segmentation data amount can effectively limit the number of sub-segments and prevent the computer device from downloading data from too many target nodes.
[0212] In one embodiment, the computer device can set a maximum concurrency number, which is used to control the number of sub-segments that the computer device can download in parallel at the same time. For example, if the maximum concurrency number is 4, the computer device can download up to 4 sub-segments in parallel to 4 fog nodes at the same time. In this way, the stability of file download can be effectively controlled by the maximum concurrency number, avoiding a single fog node from receiving too many slice download requests and affecting the file download speed.
[0213] In one embodiment, in the first round of node evaluation, the computer device may determine the maximum number of concurrent target nodes from each candidate node based on the target download priority parameter, and then start the first round of sub-segment downloads, and obtain the corresponding sub-segments from each target node in parallel. If the sub-segments of the target file have not been completely downloaded, the computer device updates the node communication information set based on the communication data generated by the first round of sub-segment downloads, and then starts a new round of node evaluation, determines a new maximum number of concurrent target nodes from each candidate node, starts a new round of sub-segment downloads, and obtains the corresponding sub-segments from each target node in parallel, and so on, until all the sub-segments of the target file are downloaded.
[0214] In this embodiment, the speed of file downloading can be increased by multi-line parallel downloading of data, and downloading data from a target node with higher reliability can further increase the speed and success rate of file downloading, thereby improving the quality of file downloading.
[0215] In one embodiment, the method further comprises:
[0216] When the target file is not obtained within the preset time, the resource node information corresponding to the identifier of the file to be downloaded is obtained; and the target file is obtained from the resource node corresponding to the resource node information.
[0217] The resource node refers to the CDN server, and the preset time refers to the time limit for obtaining the target file from the candidate node.
[0218] Specifically, there is a time limit for the computer device to obtain the target file from the fog node. If the computer device fails to obtain the target file within the preset time, it can be determined that the computer device fails to obtain the target file from the fog node, and the computer device can obtain the target file from the CDN server instead. When the target file is not obtained within the preset time, the computer device can obtain the resource node information corresponding to the identifier of the file to be downloaded from the query server, and obtain the target file from the resource node corresponding to the resource node information.
[0219] In one embodiment, when there are multiple fog nodes, after failing to obtain the target file from the fog node corresponding to the highest target download priority, the computer device can obtain the target file from the fog node corresponding to the next target download priority. Therefore, after failing to obtain the target file from all fog nodes, the computer device can turn to the CDN server to obtain the target file. The computer device can also turn to the CDN server to obtain the target file after failing to obtain the target file from each fog node whose target download priority parameter is greater than a preset threshold.
[0220] In one embodiment, different preset times may be set for target files of different sizes. For example, when the target file is small, a smaller preset time is set, and when the target file is large, a larger preset time is set.
[0221] In this embodiment, when the target file is not obtained from the target node, the target file can be obtained from the resource node, thereby ensuring the flexibility of file downloading.
[0222] In a specific embodiment, Fig. 7A As shown, the file download method includes the following steps:
[0223] 1. The target application sends a file download request to the PCDN SDK
[0224] The audio and video player / download component of the target application may obtain the file download request generated by the user trigger, and the audio and video player / download component may send the file download request to the PCDN SDK, where the file download request carries the identifier of the file to be downloaded.
[0225] 2. PCDN SDK sends fog node query request to query server
[0226] After receiving the fog node query request, the query server can query the fog node storing the target file corresponding to the file identifier to be downloaded according to the fog node query request, and generate a candidate fog node information set based on the node information of the queried fog node.
[0227] 3. The query server returns the candidate fog node information set to the PCDN SDK
[0228] 4. PCDN SDK establishes communication with the candidate fog node corresponding to the candidate fog node information set
[0229] 4-1. The PCDN SDK periodically sends a heartbeat request to each candidate fog node. Upon receiving the heartbeat request, the candidate fog node sends a heartbeat reply (i.e., a response message) to the PCDN SDK.
[0230] 4-2. Each candidate fog node sends a heartbeat request to the PCDN SDK at a fixed time. After receiving the heartbeat request, the PCDN SDK sends a heartbeat reply (i.e., a response message) to the candidate fog node.
[0231] 5. PCDN SDK evaluates fog nodes and determines the target fog node from various candidate fog nodes
[0232] The PCDN SDK obtains the node communication information set corresponding to each candidate fog node, merges the node communication information in the same node communication information set, obtains the target download priority parameters corresponding to each candidate fog node, and determines the target fog node from each candidate fog node based on the target download priority parameters. Among them, the node communication information set corresponding to the candidate fog node may include node communication information such as communication delay information generated by establishing communication, download delay information generated by file downloading, and download speed information. The PCDN SDK can evaluate all available fog nodes based on information such as communication RTT, first packet RTT, and download speed, and then hand over the target file to the most reliable fog node for download.
[0233] 6. PCDN SDK downloads the target file to the target fog node
[0234] The PCDN SDK can determine a target fog node from each candidate fog node based on the target download priority parameter, and download the complete target file to the target fog node.
[0235] The PCDN SDK can segment the target file into multiple sub-segments, determine the target fog nodes corresponding to each sub-segment from each candidate fog node based on the target download priority parameter, and download the corresponding sub-segments to each target fog node in parallel.
[0236] 7. PCDN SDK sends the target file to the target application
[0237] If the download fails due to download timeout, you can request the CDN server to download the target file.
[0238] In the above embodiment, selecting fog nodes to download files can make full use of the bandwidth of fog nodes and ensure the stability of file downloading. By evaluating each fog node and selecting the fog node with the best node performance as the target fog node, downloading files from the target fog node can not only improve the speed of file downloading, but also reduce the occurrence of download failures, reduce retransmission bandwidth, reduce billing bandwidth, and further save costs.
[0239] In a specific embodiment, Figure 7B As shown, the file download method includes the following steps:
[0240] 1. The target application sends a file download request to the PCDN SDK
[0241] 2. PCDN SDK sends fog node query request to query server
[0242] 3. The query server returns the candidate fog node information set to the PCDN SDK
[0243] 4. PCDN SDK establishes communication with the candidate fog node corresponding to the candidate fog node information set
[0244] 5. PCDN SDK obtains the node communication information set, performs fog node evaluation based on the node communication information set, and determines the target fog node corresponding to the first sub-segment from each candidate fog node.
[0245] The PCDN SDK divides the target file into sub-segment sequences. The PCDN SDK obtains the node communication information sets corresponding to each candidate fog node, merges the node communication information in the same node communication information set, obtains the target download priority parameters corresponding to each candidate fog node, and determines the target fog node corresponding to the first sub-segment from each candidate fog node based on the target download priority parameters.
[0246] 6. PCDN SDK downloads the first sub-segment to the target fog node
[0247] 7. PCDN SDK updates the node communication information set, re-evaluates the fog nodes, and determines the target fog node corresponding to the second sub-segment from each candidate fog node.
[0248] Since the PCDN SDK maintains a communication connection with each candidate fog node during the process of downloading the first sub-segment, and generates new communication data, the PCDN SDK can update the node communication information set based on the new communication data. Then, when downloading the second sub-segment, the PCDN SDK can re-evaluate each candidate fog node based on the new node communication information set, determine the target fog node corresponding to the second sub-segment from each candidate fog node, and download the second sub-segment from the target fog node corresponding to the second sub-segment, and so on, until all sub-segments in the sub-segment sequence are downloaded.
[0249] refer to Figure 7C , PCDN SDK and each candidate fog node continuously perform heartbeat interaction to maintain communication connection. PCDNSDK evaluates all available fog nodes based on node communication information such as communication RTT, first packet RTT and download speed, and then sends the current sub-segment to the most reliable fog node for download. PCDN SDK can request fog nodes to download sub-segment data. Fog nodes send sub-segment data through data packets. PCDN SDK will continue to receive all data packets until the download of the current sub-segment is completed. During the download process of the current sub-segment, PCDN SDK will store the newly generated node communication information, such as the new heartbeat RTT, first packet RTT and download speed, re-evaluate the fog nodes, and select the most reliable fog node to start the data download of the next sub-segment until all sub-segments in the sub-segment sequence are downloaded and PCDN SDK obtains the target file.
[0250] 8. PCDN SDK sends the target file to the target application
[0251] In the above embodiment, the real-time information of the transmission link of the fog node is taken into consideration, and different slice downloads can be allocated as reasonably and fairly as possible, thereby ensuring the high availability of the download service and improving the quality of file downloads.
[0252] It should be understood that although Figure 2 , 3 The steps in the flowcharts of , 5, and 6 are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 2 , 3 At least part of the steps in , 5, and 6 may include multiple steps or multiple stages. These steps or stages do not necessarily have to be executed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily one by one, but can be executed in turn or alternately with other steps or at least part of the steps or stages in other steps.
[0253] In one embodiment, Figure 8 As shown, a file downloading device is provided, which can adopt a software module or a hardware module, or a combination of the two to become a part of a computer device. The device specifically includes: a request acquisition module 802, a node information acquisition module 804, a communication information acquisition module 806, an information fusion module 808 and a file downloading module 810, wherein:
[0254] The request acquisition module 802 is used to acquire a file download request, where the file download request carries an identifier of a file to be downloaded;
[0255] The node information acquisition module 804 is used to acquire a candidate node information set corresponding to the identifier of the file to be downloaded;
[0256] The communication information acquisition module 806 is used to acquire the node communication information set of each candidate node corresponding to the candidate node information set. The node communication information in the node communication information set is obtained by communicating with the corresponding candidate node. The node communication information includes the communication delay information generated by establishing communication and the download delay information generated by file downloading.
[0257] The information fusion module 808 is used to fuse the node communication information in the same node communication information set to obtain the target download priority parameter corresponding to each candidate node;
[0258] The file download module 810 is used to determine a target node from each candidate node based on a target download priority parameter, and obtain a target file corresponding to the to-be-downloaded file identifier from the target node.
[0259] In one embodiment, the communication information acquisition module is also used to obtain the request sending time and initial request reply time corresponding to the historical download requests sent to the candidate node, and based on the request sending time and initial request reply time corresponding to the same candidate node, obtain the download delay information corresponding to the candidate node.
[0260] In one embodiment, the communication information acquisition module is also used to send a heartbeat request to each candidate node respectively, and receive a response message returned by each candidate node based on the heartbeat request. The heartbeat request is used to establish communication with the corresponding candidate node, and based on the heartbeat request and response message corresponding to the same candidate node, the communication delay information corresponding to each candidate node is obtained.
[0261] In one embodiment, the node communication information also includes download speed information, and the communication information acquisition module is also used to obtain the requested download data volume, request sending time and target request reply time corresponding to the historical download requests sent to the candidate node, and based on the requested download data volume, request sending time and target request reply time corresponding to the same historical download request, the historical download speed corresponding to each historical download request is obtained, and based on the historical download speed corresponding to the same candidate node, the download speed information corresponding to the candidate node is obtained.
[0262] In one embodiment, the information fusion module is also used to obtain slice information corresponding to the target file, and the slice information is used to determine the fragment size when downloading the target file in fragments. When the slice information is greater than or equal to the slice threshold, the communication delay information and the download delay information in the communication information set of the same node are fused based on the first attention information to obtain the target delay information corresponding to each candidate node. In the first attention information, the attention intensity corresponding to the communication delay information is less than the attention intensity corresponding to the download delay information. When the slice information is less than the slice threshold, the communication delay information and the download delay information in the communication information set of the same node are fused based on the second attention information to obtain the target delay information corresponding to each candidate node. In the second attention information, the attention intensity corresponding to the communication delay information is greater than or equal to the attention intensity corresponding to the download delay information. Based on the target delay information corresponding to each candidate node, the target download priority parameter corresponding to each candidate node is obtained.
[0263] In one embodiment, the information fusion module includes:
[0264] The delay information fusion unit is used to fuse the communication delay information and the download delay information in the same node communication information set to obtain the target delay information;
[0265] An information normalization unit, used to normalize the node communication information of each dimension in the same node communication information set, to obtain the node communication score corresponding to each candidate node in each dimension;
[0266] A communication score fusion unit is used to fuse the communication scores of each node corresponding to the same candidate node to obtain a target communication score corresponding to each candidate node;
[0267] The download priority parameter determination unit is used to obtain the target download priority parameter corresponding to each candidate node based on the target communication score corresponding to each candidate node.
[0268] In one embodiment, the information normalization unit is also used to obtain the association relationship information corresponding to each dimension, the association relationship information represents the association relationship between the node communication information and the node communication score, the association relationship information includes multiple intervals arranged in order corresponding to the node communication information of the same dimension, each interval has corresponding communication score reference information, the communication score reference information shows a monotonically changing trend according to the arrangement order of the intervals, the current node communication information corresponding to the current candidate node in the current dimension is obtained, the interval range corresponding to each interval is obtained from the association relationship information corresponding to the current dimension, the current node communication information is decomposed according to the interval range corresponding to each interval, and the current communication sub-information corresponding to each interval is obtained, and the node communication score corresponding to the current candidate node in the current dimension is obtained based on the current communication sub-information corresponding to the same interval and the communication score reference information.
[0269] In one embodiment, when the node communication information is the download speed information corresponding to the speed dimension, the information normalization unit is further used to obtain a first download speed threshold and a second download speed threshold corresponding to the speed dimension, the first download speed threshold is less than the second download speed threshold, when the current download speed information corresponding to the current candidate node is less than the first download speed threshold, the node communication score corresponding to the current candidate node in the speed dimension is calculated based on the first relational expression, the node communication score corresponding to the current candidate node in the speed dimension increases with the decrease of the current download speed information and is a positive number, when the current download speed information is greater than or equal to the first download speed threshold and less than or equal to the second download speed threshold, the node communication score corresponding to the current candidate node in the speed dimension is calculated based on the second relational expression, the node communication score corresponding to the current candidate node in the speed dimension increases or remains unchanged with the increase of the current download speed information, when the current download speed information is greater than the second download speed threshold, the node communication score corresponding to the current candidate node in the speed dimension is calculated based on the third relational expression, the node communication score corresponding to the current candidate node in the speed dimension decreases with the increase of the current download speed information and is a negative number.
[0270] In one embodiment, the information normalization unit is also used to obtain a reference download speed set, the reference download speed set includes multiple reference download speeds, obtain slice information corresponding to the target file, the slice information is used to determine the segment size when downloading the target file in segments, and determine the first download speed threshold and the second download speed threshold based on the reference download speed set and the slice information.
[0271] In one embodiment, when the node communication information is the download speed information corresponding to the speed dimension, the download speed information includes the historical successful download speed and the historical number of download failures. The information normalization unit is also used to normalize the historical successful download speed in the current download speed information corresponding to the current candidate node based on the first download speed threshold and the second download speed threshold corresponding to the speed dimension to obtain a first communication score, obtain a preset communication score corresponding to the historical number of failed downloads in the current download speed information as the second communication score, and obtain the node communication score corresponding to the speed dimension of the current candidate node based on the first communication score and the second communication score.
[0272] In one embodiment, the file downloading device further includes a unified processing module, which can be used to execute operations corresponding to the request acquisition module, the node information acquisition module, the communication information acquisition module, the information fusion module, and the file downloading module. The unified processing module is used to receive a file download request sent by a target application through a preset interface, and the unified processing module is used to send the target file to the target application through the preset interface.
[0273] In one embodiment, the node information acquisition module is also used to generate a node query request based on the current location information and the identifier of the file to be downloaded, and send the node query request to the query server so that the query server obtains an initial node information set, and filters the initial node information set based on the current location information to obtain a candidate node information set, the initial node corresponding to the initial node information set stores the target file, and receives the candidate node information set returned by the query server.
[0274] In one embodiment, the communication information acquisition module is further used to acquire the corresponding historical communication information set as the corresponding node communication information set according to the node identifier in the candidate node information set when the candidate node is a node that has established a communication connection in the past.
[0275] In one embodiment, the file download module is further used to determine the target download priority corresponding to each candidate node based on the target download priority parameter, and use the candidate node with the highest target download priority as the target node.
[0276] In one embodiment, the file download module is also used to download the first sub-segment corresponding to the target file from the target node, the first sub-segment being the sub-segment ranked first in the sub-segment sequence obtained by segmenting the target file, and during the download process of the current sub-segment, based on the current communication information generated by the current communication with each candidate node, the node communication information set corresponding to each candidate node is updated, the node communication information in the updated node communication information set corresponding to the same candidate node is merged to obtain the update download priority parameter corresponding to each candidate node, and based on the update download priority parameter, the update node corresponding to the next sub-segment of the current sub-segment is determined from each candidate node, the next sub-segment is obtained from the update node, and the next sub-segment is used as the new current sub-segment, and the step of updating the node communication information set corresponding to each candidate node based on the current communication information generated by the current communication with each candidate node during the download process of the current sub-segment is returned until all the sub-segments in the sub-segment sequence are downloaded.
[0277] In one embodiment, the file download module is also used to split the target file to obtain multiple sub-segments corresponding to the target file; determine the target nodes corresponding to each sub-segment from each candidate node based on the target download priority parameter; and obtain the corresponding sub-segment from each target node in parallel.
[0278] In one embodiment, the file download module is further used to obtain resource node information corresponding to the identifier of the file to be downloaded when the target file is not obtained within a preset time, and obtain the target file from the resource node corresponding to the resource node information.
[0279] The above-mentioned file downloading device obtains a file download request, the file download request carries the identifier of the file to be downloaded, obtains a candidate node information set corresponding to the identifier of the file to be downloaded, obtains a node communication information set of each candidate node corresponding to the candidate node information set, the node communication information in the node communication information set is obtained by communicating with the corresponding candidate node, the node communication information includes the communication delay information generated by establishing communication and the download delay information generated by file downloading, the node communication information in the same node communication information set is merged, the target download priority parameter corresponding to each candidate node is obtained, the target node is determined from each candidate node based on the target download priority parameter, and the target file corresponding to the identifier of the file to be downloaded is obtained from the target node. In this way, the node is evaluated by integrating the communication delay information and the download delay information, and the node with excellent performance in communication and downloading can be selected from each candidate node as the target node, and the target file is downloaded from the target node, which can effectively guarantee the download success rate and download speed of the target file, thereby improving the download quality of the target file. Further, considering the download delay information when evaluating the node can also effectively avoid repeated selection of the same download failure node for downloading by continuous download tasks, further improving the download quality of the target file.
[0280] The specific definition of the file downloading device can be found in the definition of the file downloading method above, which will not be repeated here. Each module in the above-mentioned file downloading device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0281] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Fig. 9 As shown. The computer device includes a processor, a memory and a network interface connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data such as communication delay information, download delay information, download speed information, node communication information set, historical communication information set, etc. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a file download method is implemented.
[0282] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Fig.10 As shown. The computer device includes a processor, a memory, a communication interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be achieved through WIFI, an operator network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a file download method is implemented. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covered on the display screen, or a button, trackball or touchpad set on the computer device housing, or an external keyboard, touchpad or mouse, etc.
[0283] Those skilled in the art will understand that Fig. 9 , 10The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0284] In one embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiments when executing the computer program.
[0285] In one embodiment, a computer-readable storage medium is provided, storing a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0286] In one embodiment, a computer program product or computer program is provided, the computer program product or computer program includes computer instructions, the computer instructions are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the steps in the above-mentioned method embodiments.
[0287] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory or optical memory, etc. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).
[0288] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0289] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. A file downloading method, characterized in that: The method comprises: Obtain a file download request, wherein the file download request carries an identifier of a file to be downloaded; Obtain a candidate node information set corresponding to the identifier of the file to be downloaded; Acquire a node communication information set of each candidate node corresponding to the candidate node information set, wherein the node communication information in the node communication information set is obtained by communicating with the corresponding candidate node, and the node communication information includes communication delay information generated by establishing communication and download delay information generated by file downloading; The node communication information in the same node communication information set is integrated to obtain the target download priority parameter corresponding to each candidate node; A target node is determined from the candidate nodes based on the target download priority parameter, and a target file corresponding to the to-be-downloaded file identifier is acquired from the target node.
2. The method according to claim 1, characterized in that The acquiring of the node communication information set of each candidate node corresponding to the candidate node information set includes: Get the request sending time and initial request reply time corresponding to the historical download request sent to the candidate node; Based on the request sending time and the initial request reply time corresponding to the same candidate node, the download delay information corresponding to the candidate node is obtained.
3. The method according to claim 1, characterized in that The acquiring of the node communication information set of each candidate node corresponding to the candidate node information set includes: Send a heartbeat request to each candidate node respectively, and receive a response message returned by each candidate node based on the heartbeat request, wherein the heartbeat request is used to establish communication with the corresponding candidate node; Based on the heartbeat request and response messages corresponding to the same candidate node, the communication delay information corresponding to each candidate node is obtained.
4. The method according to claim 1, characterized in that The node communication information also includes download speed information. The acquiring of the node communication information set of each candidate node corresponding to the candidate node information set includes: Obtain the requested download data volume, request sending time, and target request reply time corresponding to the historical download requests sent to the candidate node; Based on the requested download data volume, request sending time and target request reply time corresponding to the same historical download request, the historical download speed corresponding to each historical download request is obtained; Based on the historical download speed corresponding to the same candidate node, the download speed information corresponding to the candidate node is obtained.
5. The method according to claim 1, characterized in that The node communication information in the same node communication information set is merged to obtain the target download priority parameter corresponding to each candidate node, including: Acquire slice information corresponding to the target file, where the slice information is used to determine the size of the segments when downloading the target file in segments; When the slice information is greater than or equal to the slice threshold, the communication delay information and the download delay information in the communication information set of the same node are merged based on the first attention information to obtain the target delay information corresponding to each candidate node, and in the first attention information, the attention intensity corresponding to the communication delay information is less than the attention intensity corresponding to the download delay information; When the slice information is less than the slice threshold, the communication delay information and the download delay information in the communication information set of the same node are merged based on the second attention information to obtain the target delay information corresponding to each candidate node, and in the second attention information, the attention intensity corresponding to the communication delay information is greater than or equal to the attention intensity corresponding to the download delay information; The target download priority parameter corresponding to each candidate node is obtained based on the target delay information corresponding to each candidate node.
6. The method according to claim 1, characterized in that The node communication information in the same node communication information set is merged to obtain the target download priority parameter corresponding to each candidate node, including: In the same node communication information set, the communication delay information and the download delay information are merged to obtain the target delay information; Normalize the node communication information of each dimension in the same node communication information set to obtain the node communication score corresponding to each candidate node in each dimension; The communication scores of each node corresponding to the same candidate node are merged to obtain the target communication score corresponding to each candidate node; The target download priority parameter corresponding to each candidate node is obtained based on the target communication score corresponding to each candidate node.
7. The method according to claim 6, characterized in that The node communication information of each dimension in the same node communication information set is normalized to obtain the node communication score corresponding to each candidate node in each dimension, including: Acquire association relationship information corresponding to each dimension, wherein the association relationship information represents the association relationship between the node communication information and the node communication score, and the association relationship information includes a plurality of sequentially arranged intervals corresponding to the node communication information of the same dimension, each interval has corresponding communication score reference information, and the communication score reference information presents a monotonically changing trend according to the arrangement order of the intervals; Obtaining the current node communication information corresponding to the current candidate node in the current dimension, and obtaining the interval range corresponding to each interval from the association relationship information corresponding to the current dimension; Decomposing the current node communication information according to the interval ranges corresponding to the respective intervals to obtain the current communication sub-information corresponding to the respective intervals; The node communication score corresponding to the current candidate node in the current dimension is obtained based on the current communication sub-information and the communication score reference information corresponding to the same interval.
8. The method according to claim 6, characterized in that When the node communication information is download speed information corresponding to the speed dimension, the normalization processing of the download speed information includes the following steps: Acquire a first download speed threshold and a second download speed threshold corresponding to the speed dimension, wherein the first download speed threshold is less than the second download speed threshold; When the current download speed information corresponding to the current candidate node is less than the first download speed threshold, a node communication score corresponding to the current candidate node in the speed dimension is calculated based on the first relational expression, and the node communication score corresponding to the current candidate node in the speed dimension increases as the current download speed information decreases and is a positive number; When the current download speed information is greater than or equal to the first download speed threshold and less than or equal to the second download speed threshold, a node communication score corresponding to the current candidate node in the speed dimension is calculated based on a second relational expression, and the node communication score corresponding to the current candidate node in the speed dimension increases or remains unchanged as the current download speed information increases; When the current download speed information is greater than the second download speed threshold, the node communication score corresponding to the current candidate node in the speed dimension is calculated based on the third relationship, and the node communication score corresponding to the current candidate node in the speed dimension decreases as the current download speed information increases and is a negative number.
9. The method according to claim 8, characterized in that The obtaining of the first download speed threshold and the second download speed threshold corresponding to the speed dimension includes: Acquire a reference download speed set, where the reference download speed set includes a plurality of reference download speeds; Acquire slice information corresponding to the target file, where the slice information is used to determine the size of the segments when downloading the target file in segments; The first download speed threshold and the second download speed threshold are determined based on the reference download speed set and the slice information.
10. The method according to claim 6, characterized in that When the node communication information is download speed information corresponding to the speed dimension, the download speed information includes a historical successful download speed and a historical number of download failures, and the normalization processing of the download speed information includes the following steps: Based on a first download speed threshold and a second download speed threshold corresponding to the speed dimension, normalizing the historical successful download speed in the current download speed information corresponding to the current candidate node to obtain a first communication score; Obtaining a preset communication score corresponding to the number of historical failed downloads in the current download speed information as a second communication score; A node communication score corresponding to the current candidate node in the speed dimension is obtained based on the first communication score and the second communication score.
11. The method according to any one of claims 1 to 10, characterized in that: The step of obtaining the target file corresponding to the to-be-downloaded file identifier from the target node includes: downloading a first sub-segment corresponding to the target file from the target node, where the first sub-segment is the first sub-segment in a sub-segment sequence obtained by segmenting the target file; During the downloading process of the current sub-segment, based on the current communication information generated by the current communication with each candidate node, the node communication information set corresponding to each candidate node is updated; The node communication information in the updated node communication information set corresponding to the same candidate node is merged to obtain the update download priority parameter corresponding to each candidate node; Based on the update download priority parameter, determine the update node corresponding to the next sub-segment of the current sub-segment from the candidate nodes, obtain the next sub-segment from the update node, use the next sub-segment as the new current sub-segment, and return to the step of updating the node communication information set corresponding to each candidate node based on the current communication information generated by the current communication with each candidate node during the download process of the current sub-segment, until all sub-segments in the sub-segment sequence are downloaded.
12. The method according to any one of claims 1 to 10, characterized in that: The step of determining a target node from each of the candidate nodes based on the target download priority parameter, and acquiring a target file corresponding to the to-be-downloaded file identifier from the target node includes: Segmenting the target file to obtain multiple sub-segments corresponding to the target file; Determining target nodes corresponding to the sub-segments from the candidate nodes based on the target download priority parameter; Get the corresponding sub-fragments from each target node in parallel.
13. A file downloading device, characterized in that: The device comprises: A request acquisition module, used to acquire a file download request, wherein the file download request carries an identifier of a file to be downloaded; A node information acquisition module, used to acquire a candidate node information set corresponding to the identifier of the file to be downloaded; a communication information acquisition module, used to acquire a node communication information set of each candidate node corresponding to the candidate node information set, wherein the node communication information in the node communication information set is obtained by communicating with the corresponding candidate node, and the node communication information includes communication delay information generated by establishing communication and download delay information generated by file downloading; An information fusion module is used to fuse the node communication information in the same node communication information set to obtain the target download priority parameters corresponding to each candidate node; The file download module is used to determine a target node from the candidate nodes based on the target download priority parameter, and obtain a target file corresponding to the to-be-downloaded file identifier from the target node.
14. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 12 are implemented.
15. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 12 are implemented.
Citation Information
Patent Citations
File transmission method and system, computer equipment and storage medium
CN109981751A
Resource downloading method, device and system, electronic equipment and storage medium
CN110830565A