WO2022021357A1 - File block download method and apparatus - Google Patents

File block download method and apparatus Download PDF

Info

Publication number
WO2022021357A1
WO2022021357A1 PCT/CN2020/106280 CN2020106280W WO2022021357A1 WO 2022021357 A1 WO2022021357 A1 WO 2022021357A1 CN 2020106280 W CN2020106280 W CN 2020106280W WO 2022021357 A1 WO2022021357 A1 WO 2022021357A1
Authority
WO
WIPO (PCT)
Prior art keywords
node
storage
storage node
nodes
index
Prior art date
Application number
PCT/CN2020/106280
Other languages
French (fr)
Chinese (zh)
Inventor
徐聪
袁庭球
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Priority to CN202080024741.7A priority Critical patent/CN114375565B/en
Priority to PCT/CN2020/106280 priority patent/WO2022021357A1/en
Publication of WO2022021357A1 publication Critical patent/WO2022021357A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/104Peer-to-peer [P2P] networks
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/06Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1097Protocols in which an application is distributed across nodes in the network for distributed storage of data in networks, e.g. transport arrangements for network file system [NFS], storage area networks [SAN] or network attached storage [NAS]
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/50Reducing energy consumption in communication networks in wire-line communication networks, e.g. low power modes or reduced link rate

Definitions

  • the present invention mainly relates to the technical field of network communication, and in particular, to a file block downloading method and device.
  • P2P peer-to-peer
  • P2P technology Through P2P technology, Internet users can effectively use a large number of network nodes with storage functions scattered in the Internet to distribute files to all network nodes. Each network node can use its free storage space to perform storage tasks, so as to achieve mass storage. Purpose. After the file is stored in the P2P network, when the user requests to download the file on a certain network node in the P2P network, the file needs to be downloaded based on the storage principle of the P2P network.
  • a file is divided into multiple file blocks and then stored in the P2P network. Therefore, the process for downloading the file is equivalent to the process of downloading the file blocks of the file multiple times.
  • the user sends a download request to download the target file block to the requesting node in the P2P network, he can find all the storage nodes that store the target file block through the index node in the P2P network.
  • the requesting node initiates the download to each storage node at the same time.
  • the download process is completed on a certain storage node, the download request is completed. It can be seen that this method of file downloading will cause a lot of waste of bandwidth resources.
  • the present application provides a method and device for downloading file blocks, so as to improve the downloading speed of files.
  • the present invention provides a method for downloading file blocks, which is applied to a P2P network, where the P2P network includes a requesting node and an indexing node, and the method includes: the indexing node receives a download request sent by the requesting node, The download request is used to download the target file block; the index node obtains all storage nodes corresponding to the target file block in the sub-distributed hash table DHT according to the download request, and the sub-DHT corresponds to the P2P network The part of the DHT stored in the index node in the DHT of the index node; the index node selects a plurality of preselected storage nodes from all the storage nodes; the index node sends the plurality of preselected storage nodes to the request node; The requesting node obtains a storage node list, and the storage nodes in the storage node list are used to form a storage node set together with the preselected storage node; the requesting node downloads
  • the index node may select a plurality of preselected storage nodes from all the storage nodes in a random selection manner. In this way, by iteratively selecting the target storage node based on the storage nodes in the storage node list, the selected target storage node can be made closer and closer to the globally optimal storage node with the best performance among all the storage nodes storing the target file block. , that is, the global optimal solution is obtained, thereby improving the download efficiency and download quality of file blocks.
  • the present invention provides a method for downloading file blocks, which is applied to an index node in a P2P network.
  • the method includes: receiving a download request sent by a requesting node, where the download request is used to download target file blocks;
  • the download request obtains all the storage nodes corresponding to the target file block in the sub-distributed hash table DHT, and the sub-DHT is the part of the DHT stored in the index node in the DHT corresponding to the P2P network; Selecting multiple preselected storage nodes from the storage nodes; sending the multiple preselected storage nodes to the requesting node.
  • the index node may select a plurality of preselected storage nodes from all the storage nodes in a random selection manner. In this way, the index node can randomly select a part of the storage nodes for the requesting node to select a suitable storage node to download the target file block, thereby reducing the number and time for the requesting node to detect the performance of the storage node and improving the download speed of the target file block.
  • the download request is sent to an adjacent index node, and the adjacent index node obtains the data with the target file block.
  • All storage nodes corresponding to the target file block, wherein the adjacent index nodes are index nodes in the P2P network that have a specified algorithmic relationship with the index nodes.
  • the sending the plurality of preselected storage nodes to the requesting node includes: generating a local DHT, where the local DHT includes the plurality of preselected storage nodes; sending the local DHT to all the preselected storage nodes the requesting node.
  • the index node can send the pre-selected storage nodes to the requesting node in the form of local DHT, to ensure the integrity and standardization of the node information of these pre-selected storage nodes, and it is convenient for the requesting node to perform performance testing on the pre-selected storage nodes later.
  • the method further includes: clearing the storage nodes in the local DHT.
  • the index node can write the corresponding preselected storage node in the local DHT when it receives a download request next time, so as to avoid confusion with the preselected storage node corresponding to the previous download request.
  • the present invention provides a method for downloading file blocks, which is applied to a requesting node in a P2P network, the method comprising: receiving a preselected storage node sent by an index node, where the preselected storage node is a slave sub-distributed hash table
  • the storage node selected from all the storage nodes corresponding to the target file block in the DHT, the sub-DHT is a part of the DHT stored in the index node in the DHT corresponding to the P2P network; obtain the storage node list of the requesting node,
  • the storage nodes in the storage node list are used to form a storage node set together with the preselected storage nodes; the target file block is downloaded based on the storage node set.
  • the requesting node can detect the performance of each pre-selected storage node, and select some pre-selected storage nodes with the best performance to download the target file block, thereby reducing the number of storage nodes that download the target file block in parallel and increasing the number of storage nodes for downloading the target file block.
  • the quality of the storage node for file blocks At the same time, during the download process of each target file block, the storage node set composed of the storage nodes in the storage node list in the request node and the pre-selected storage nodes will be used as the basis for the selection of the target storage node.
  • the storage nodes in the storage node list are the storage nodes whose preset performance indicators selected after the last file block download operation conform to the preset performance index range and store the target file blocks.
  • the storage nodes in the storage node list can be used as the basis for iteration, so as to improve the fit between the determined target storage node and the storage node with the best performance among the global storage nodes.
  • the method before the acquiring the storage node list of the requesting node, the method further includes: detecting whether the storage node list exists; if the storage node list does not exist, the preselected The storage nodes constitute a collection of storage nodes.
  • the downloading the target file block based on the storage node set includes: testing a preset performance index of each storage node in the storage node set; obtaining at least one test result that meets a preset performance index threshold node information of the target storage node; download the target file block according to the node information of the target storage node.
  • one or more storage nodes whose performance meets the standard can be selected as the target storage node from the storage node set as required to download the target file block.
  • multiple target storage nodes may be selected for parallel download.
  • the method further includes: selecting a storage node from the storage node set, and the selected storage node is a preset performance index in the storage node set.
  • the preset performance index is one or a combination of transmission delay, round-trip delay, and available bandwidth.
  • one or several suitable performance indicators can be selected to test the performance of the storage node.
  • the present invention provides an index node, the index node includes: a receiver, a processor, a memory and a transmitter, the receiver, the processor, the memory and the transmitter are coupled;
  • the processor invokes the program instructions in the memory, so that the index node executes the following method: receiving a download request sent by a requesting node, the download request being used to download a target file block; obtaining a sub-distribution according to the download request All storage nodes corresponding to the target file block in the formula hash table DHT, and the sub-DHT is a part of the DHT stored in the index node in the DHT corresponding to the P2P network; Preselecting storage nodes; sending the plurality of preselected storage nodes to the requesting node.
  • the index node may select a plurality of preselected storage nodes from all the storage nodes in a random selection manner. In this way, the index node can select a part of the storage nodes for the requesting node to select a suitable storage node to download the target file block, thereby reducing the number and time for the requesting node to detect the performance of the storage node and improving the download speed of the target file block.
  • the method performed by the index node further includes: if the index node does not have a storage node corresponding to the target file block, sending the download request to an adjacent index node, and All storage nodes corresponding to the target file block are acquired from the adjacent index nodes, wherein the adjacent index nodes are index nodes in the P2P network that have a specified algorithmic relationship with the index nodes.
  • the method performed by the index node further includes: generating a local DHT, where the local DHT includes the plurality of preselected storage nodes; and sending the local DHT to the requesting node.
  • the index node can send the pre-selected storage nodes to the requesting node in the form of local DHT, to ensure the integrity and standardization of the node information of these pre-selected storage nodes, and it is convenient for the requesting node to perform performance testing on the pre-selected storage nodes later.
  • the method performed by the index node further includes: after the sending the local storage node list to the requesting node, clearing the storage nodes in the local DHT.
  • the index node can write the corresponding preselected storage node in the local DHT when it receives a download request next time, so as to avoid confusion with the preselected storage node corresponding to the previous download request.
  • the present invention provides a requesting node, the requesting node comprising: a receiver, a processor, a memory and a transmitter, the receiver, the processor, the memory and the transmitter being coupled;
  • the processor invokes the program instructions in the memory, so that the requesting node executes the following method: receiving a preselected storage node sent by the index node, where the preselected storage node is the target file block from the sub-distributed hash table DHT.
  • the storage node selected from all the corresponding storage nodes, the sub-DHT is the part of the DHT stored in the index node in the DHT corresponding to the P2P network; obtain the storage node list of the request node, in the storage node list
  • the storage node is used to form a storage node set together with the preselected storage node; the target file block is downloaded based on the storage node set.
  • the requesting node can detect the performance of each preselected storage node, and select some preselected storage nodes with the best performance to download the target file block, thereby reducing the number of storage nodes that download the target file block in parallel, and at the same time, increasing the number of storage nodes used for downloading the target file block in parallel.
  • the quality of the storage node that downloads the target file chunks At the same time, during the download process of each target file block, the storage node corresponding to the download process of the previous target file block will be used as the basis for the selection of the target storage node.
  • the storage node is only a part of the storage nodes in all the storage nodes, and it can also realize the storage node with the best performance in the whole file download process, that is, the effect of converging to the global optimal solution, thereby improving the file download efficiency and quality.
  • the storage nodes in the storage node list are the storage nodes whose preset performance indicators selected after the last file block download operation conform to the preset performance index range and store the target file blocks.
  • the method performed by the requesting node further includes: before acquiring the storage node list of the requesting node, detecting whether the storage node list exists; if the storage node list does not exist, Then, a set of storage nodes is formed by the preselected storage nodes.
  • the method performed by the requesting node further includes: testing the preset performance indicators of each storage node in the storage node set; acquiring at least one target storage node whose test result meets the preset performance indicator threshold. Node information; download the target file block according to the node information of the target storage node.
  • one or more storage nodes whose performance meets the standard can be selected as the target storage node from the storage node set as required to download the target file block.
  • the method performed by the requesting node further includes: if acquiring node information of a plurality of target storage nodes whose test results meet a preset performance indicator threshold, performing the method according to the number of the preselected storage nodes and the The number of storage nodes in the storage node list determines the number of the target storage nodes.
  • multiple target storage nodes may be selected for parallel download.
  • the method performed by the requesting node further includes: after downloading the target file block, selecting a storage node from the storage node set, where the selected storage node is one of the storage node sets The ranking of the preset performance index is greater than or equal to the storage node of the preset ranking; the storage node in the storage node list is updated by using the selected storage node.
  • the preset performance index is one or a combination of transmission delay, round-trip delay, and available bandwidth.
  • one or several suitable performance indicators can be selected to test the performance of the storage node.
  • the present invention provides a P2P network, characterized in that it includes at least one request node and at least one index node, wherein the index node is used to execute a related file block downloading method, and the request node is used to Execute the relevant file block download method.
  • the index node can obtain the storage node corresponding to the target file block according to the download request sent by the requesting node, and randomly select a plurality of preselected storage nodes to send to the requesting node, so as to reduce the number of storage nodes that the requesting node needs to test the performance of.
  • the download efficiency of the requesting node is improved.
  • the requesting node determines the target storage node for downloading the target file block by testing the performance of the pre-selected storage node and the optimal storage node, because during the downloading process of each target file block, the data of the previous target file block will be changed.
  • the storage node corresponding to the download process is used as the basis for the selection of the target storage node.
  • the target storage node that downloads each target file block in time is only a partial storage node in all storage nodes, and the overall file download can also be realized.
  • the process corresponds to the storage node with the best performance, that is, the effect of converging to the global optimal solution, thereby improving the download efficiency and quality of the file.
  • FIG. 1 is a schematic structural diagram of a P2P network according to an embodiment of the present invention.
  • FIG. 2 is a schematic structural diagram of a P2P network according to an embodiment of the present invention.
  • FIG. 3 is a schematic structural diagram of a request node according to an embodiment of the present invention.
  • FIG. 4 is a schematic structural diagram of an index node according to an embodiment of the present invention.
  • FIG. 5 is a schematic flowchart of a method for downloading a file according to an embodiment of the present invention.
  • FIG. 6 is a schematic structural diagram of a sub-DHT of an index node according to an embodiment of the present invention.
  • FIG. 7 is a schematic structural diagram of a local DHT provided by an embodiment of the present invention.
  • FIG. 8 is a schematic structural diagram of a storage node list according to an embodiment of the present invention.
  • FIG. 9 is a simulation diagram for selecting a target storage node and a globally optimal storage node according to an embodiment of the present invention.
  • FIG. 1 is a schematic structural diagram of a P2P network according to an embodiment of the present invention.
  • the P2P network includes nodes 1 to 4, and these nodes all have the ability to store file blocks. Therefore, these nodes may also be called storage nodes.
  • a file is divided into multiple file blocks and stored on each storage node.
  • There is a global DHT in the P2P network which is used to store the file block name and the node information of the storage node corresponding to the file block name.
  • the block name can be represented by a resource identifier (Object ID).
  • the resource identifier can be a hash value generated by the file block name through a hash operation, which is unique.
  • the node information of the storage node can include the index address of the storage node, storage Node ID of the node, etc.
  • Each storage node in the P2P network stores a part of the global DHT.
  • the part of the global DHT stored on each storage node can be called a sub-DHT, and each storage node can pass some specific algorithms, such as Tapestry, Pastry, Chord, Kademlia, etc. to determine in which sub-DHT the corresponding information between the file block name and the storage node is stored, that is, on which storage node is stored.
  • One or several storage nodes in the P2P network can download the target file block by initiating a download request to the adjacent node, that is, query the storage node corresponding to the target file block through the adjacent node, and pass the data of the storage node corresponding to the target file block.
  • the storage node that initiates the download request is the request node
  • the adjacent node refers to the storage node that has a specified algorithm relationship with the request node.
  • the specified algorithm usually refers to the information used to determine the corresponding information between the file block name and the storage node.
  • the algorithm of the storage location as shown in Figure 1, if node 1 is the requesting node, then the adjacent node is node 2.
  • the adjacent node When the adjacent node receives the download request, it will query the node information of the storage node corresponding to the target file block in the sub-DHT stored locally. At this time, the adjacent node is responsible for indexing the node information of the storage node of the target file block. work, therefore, adjacent nodes can also be called index nodes. If there is no node information of the storage node of the target file block in the adjacent node, then it is necessary to query the node information of the storage node of the target file block through the adjacent node of the adjacent node. The adjacent node is the index node, and the above process is repeated until the node information of the storage node of the target file block is queried.
  • each node in the P2P network can be a storage node and an index node, that is, it is responsible for the work of storing the target file block and the work of querying the node information of the storage node of the target file block.
  • FIG. 2 is a schematic structural diagram of a P2P network provided by an embodiment of the present invention, and a download request may be initiated by multiple request nodes at the same time. As shown in FIG. Node 1 and requesting node 2 initiate a download request at the same time, wherein requesting node 1 and requesting node 2 can download the same target file block; or, requesting node 1 and requesting node 2 can download different target file blocks.
  • index nodes there can be one or more index nodes.
  • node 2 undertakes the query work, there is one index node. If the node information of the storage node of the target file block cannot be queried in node 2, Then node 3 and node 4 undertake the query work, then, there are 2 index nodes.
  • the number of index nodes of requesting node 1 is 2; for requesting node 2, when node 4 undertakes the query work, the request Node 2 has one index node. At this time, for the P2P network, there are two index nodes in total.
  • the following embodiments describe a certain request node and an index node corresponding to the request node in the P2P network. For the situation that there are multiple request nodes and multiple index nodes in the P2P network, reference may be made to the following embodiments. method.
  • the request node may be a terminal device with functions such as data storage, data query, and data processing, such as a computer, a mobile phone, a tablet computer, a server, and a cloud server.
  • the requesting node may include at least one receiver, at least one processor, at least one memory and at least one transmitter, taking FIG. 3 as an example, the requesting node includes a receiver 101, a processor 102, a memory 103 and a transmitter 104, wherein , the receiver 101, the processor 102, the memory 103 and the transmitter 104 are coupled, and program instructions are stored in the memory 103.
  • the processor 102 can call the program instructions in the memory 103 to make the requesting node execute the relevant file download method, for example , generate download requests, detect node performance, generate optimal node lists, etc.
  • An index node may be a terminal device with functions such as data storage, data query, and data processing, such as a computer, a mobile phone, a tablet computer, a server, and a cloud server.
  • An index node may include at least one receiver, at least one processor, at least one memory and at least one transmitter, taking FIG.
  • the index node includes a receiver 201, a processor 202, a memory 203 and a transmitter 204, wherein , the receiver 201, the processor 202, the memory 203 and the transmitter 204 are coupled, and program instructions are stored in the memory 203, and the processor 202 can call the program instructions in the memory 203 to make the index node execute the relevant file download method, for example , query the node information of the storage node of the target file block, randomly select the pre-selected storage node, generate a local DHT, etc.
  • the receivers and transmitters mentioned in the embodiments of the present invention may be communication interfaces on a terminal device, and the communication interfaces may be one or more optical fiber link interfaces, Ethernet interfaces, microwave link interfaces, or copper wire interfaces, etc. .
  • the communication interface may include a network adapter (network adapter), a network card (network interface card), a local area network receiver (LAN adapter), a network interface controller (network interface controller, NIC), a modem (modem), and the like.
  • the communication interface may be an independent device, and may also be partially or fully integrated or packaged in the processor to become a part of the processor.
  • the processor mentioned in the embodiments of the present invention may include one or more processing units, such as a system on a chip (SoC), a central processing unit (CPU), a microcontroller (microcontroller, MCU), memory controller, etc. Wherein, different processing units may be independent devices, or may be integrated in one or more processors.
  • SoC system on a chip
  • CPU central processing unit
  • MCU microcontroller
  • memory controller etc.
  • different processing units may be independent devices, or may be integrated in one or more processors.
  • the memory mentioned in the embodiments of the present invention may include one or more storage units, for example, may include volatile memory (volatile memory), such as: dynamic random access memory (dynamic random access memory, DRAM), static random access memory Access memory (static random access memory, SRAM), etc.; can also include non-volatile memory (non-volatile memory, NVM), such as: read-only memory (read-only memory, ROM), flash memory (flash memory), etc.
  • volatile memory such as: dynamic random access memory (dynamic random access memory, DRAM), static random access memory Access memory (static random access memory, SRAM), etc.
  • NVM non-volatile memory
  • different storage units may be independent devices, or may be integrated or packaged in one or more processors or communication interfaces, and become part of the processors or communication interfaces.
  • FIG. 5 is a schematic flowchart of a file downloading method provided by an embodiment of the present invention. As shown in FIG. 5 , the method includes:
  • the requesting node sends a download request to the index node.
  • the requesting node generates a corresponding download request by receiving relevant operations initiated by the user, such as the file download instruction input by the user in the requesting node, the file downloading instruction initiated by the user through clicking and other operations in the requesting node, etc.
  • relevant operations initiated by the user such as the file download instruction input by the user in the requesting node, the file downloading instruction initiated by the user through clicking and other operations in the requesting node, etc.
  • the process of storing a file in a P2P network is to first split the file into multiple file blocks, and then store each file block separately. It can be seen that the file download process should also be downloaded separately. process for each file block of the file.
  • the requesting node receives the user's file download instruction, it can first determine the file name corresponding to the file name according to the file name corresponding to the download instruction, such as the hash value corresponding to the file name calculated by the hash algorithm.
  • the requesting node can know all the file blocks to be downloaded by the user to complete the file download process, and generate a download request for each file block, wherein each file block can be called a target file during the download process. piece. Further, when downloading each file block, it needs to go through two processes of querying the node information of the storage node where the file block is located and using the node information to download the file block.
  • the download request usually includes the file block name of the target file block, such as the Object ID mentioned above, etc.
  • a download request corresponds to one target file block.
  • the requesting node can generate a download request for the next target file block to be downloaded after a target file block is downloaded, or can generate a download request for all target file blocks at the same time after receiving a file download instruction from the user.
  • the requesting node may determine which file block to download first according to a certain priority or weight.
  • the index node receives the download request sent by the requesting node, where the download request is used to download the target file block.
  • the index node After receiving the download request, the index node can obtain the file block name, download priority and other information of the target file block included in the download request by parsing the download request.
  • the index node obtains all storage nodes corresponding to the target file block in the sub-distributed hash table DHT according to the download request, where the sub-DHT is the part of the DHT corresponding to the P2P network that is stored in the index node DHT.
  • FIG. 6 is a schematic structural diagram of a sub-DHT of an index node provided by an embodiment of the present invention, as shown in FIG.
  • the sub-DHT includes the file block name and the node information of the storage node corresponding to the file block name.
  • the sub-DHT includes M file block names and the node information of the storage node. Hash is used to identify the file block name, and Peer is used to identify the file block name. Identify the node identifier of the storage node corresponding to the file block, and use add_ to identify the index location of the storage node.
  • the inode can determine whether the inode stores the node information of the storage node corresponding to the target file block by matching the file block name of the target file block with the file block name in the sub-DHT.
  • the storage nodes corresponding to the file block name with the same file block name as the target file block in FIG. 6 are Peer a1 and Peer a2 respectively. , Peer a3, Peer z5, etc. Assuming that the number of storage nodes corresponding to the file block name with the same file block name as the target file name is N, then N ⁇ M. In this way, all storage nodes corresponding to the target file block can be obtained from the sub-DHT corresponding to the index node.
  • the index node selects a plurality of preselected storage nodes from all the storage nodes.
  • the index node needs to select multiple pre-selected storage nodes from all the obtained storage nodes. For example, m pre-selected storage nodes are selected from the above N storage nodes, where 1 ⁇ m ⁇ N, and the specific number of m can be set by the user according to experience, or set by the index node through a related algorithm.
  • the setting method of m is limited.
  • a preselected storage node may be selected by random selection to reduce the chance of selection.
  • the pre-selected storage node can be specially identified in the sub-DHT. line for coloring, etc.
  • a separate DHT that is, a local DHT, is generated for the preselected storage node.
  • FIG. 7 is a schematic structural diagram of a local DHT provided in this embodiment. As shown in FIG. 7 , the local DHT at least includes node identifiers of m preselected storage nodes and file block names of corresponding target file blocks.
  • the local DHT may also include The index address of the pre-selected storage node, that is, the content in the local DHT can be exactly the same as the corresponding content of the pre-selected storage node in the sub-DHT. It can be written by copying or other methods, or it can be part of the content of the pre-selected storage node in the sub-DHT. Select Rewrite Local DHT. 1 to m in Peer 1 to Peer m in FIG. 7 represent the number of pre-selected storage nodes in the pre-selected storage nodes, and do not represent specific node identifiers. Among them, the local DHT can be a table pre-established as an index node.
  • the information such as the node identifier, file block name, index address and other information corresponding to the pre-selected storage node can be directly written into the index node. table to generate the final local DHT, which can effectively improve the generation efficiency of the local DHT.
  • the index node sends the plurality of preselected storage nodes to the requesting node.
  • the index node can directly send to the requesting node according to the node information corresponding to the preselected storage node in the sub-DHT, such as the node identification, index address and other information.
  • the index node can also directly send the generated local DHT to the requesting node. In this way, it is not easy to miss the node information of the pre-selected storage node and save the time of querying the node information of the pre-selected storage node from the sub-DHT. Node information with a certain standard format is received, which is convenient for requesting nodes to perform subsequent data processing.
  • the index node if the index node generates a local DHT, after the index node sends the local DHT to the requesting node, the node information of the storage node in the local DHT can be cleared, so that if the index node receives a new download request, it can The node information of the preselected storage node corresponding to the new download request is written into the local DHT to form a new local DHT, thereby realizing the reusability of the local DHT.
  • the requesting node receives the preselected storage node sent by the index node, where the preselected storage node is a storage node randomly selected from all storage nodes corresponding to the target file block in the sub-distributed hash table DHT, and the sub-DHT is the Part of the DHT stored in the index node in the DHT corresponding to the P2P network.
  • the requesting node can receive the pre-selected storage nodes corresponding to the download request sent by the index node, such as node information, such as the node information of Peer 1 to Peer m in the above example.
  • node information such as the node information of Peer 1 to Peer m in the above example.
  • the requesting node will also receive As shown in the local DHT in FIG. 7 , the node information of each preselected storage node can be clearly browsed in the local DHT, and the node information of each preselected storage node can be quickly and accurately obtained.
  • the requesting node obtains a storage node list, where the storage nodes in the storage node list are used to form a storage node set together with the preselected storage nodes.
  • the requesting node downloads the target file block based on the storage node set.
  • the requesting node After receiving the pre-selected storage nodes sent by the index node, the requesting node does not directly download the target file blocks from all the pre-selected storage nodes, but needs to test the performance of each pre-selected storage node.
  • the performance of each storage node in the storage node list in the requesting node is tested, wherein the above-mentioned storage node is the preset performance index selected after the last file block download operation that meets the preset performance index range, and stores the target. Storage node for file blocks.
  • the download request corresponding to the file block download operation on the requesting node is A1
  • the first file block a1 in the file a is requested to be downloaded
  • the index node will give the download request A1 to
  • the requesting node sends the node information of m pre-selected storage nodes.
  • the requesting node since the requesting node is the first file block in the downloaded file a, the requesting node does not have a record of the storage node related to the file block in the downloaded file a. Therefore, , the requesting node only needs to test the preset performance indicators of the m preselected storage nodes.
  • FIG. 8 is a schematic structural diagram of a storage node list provided by an embodiment of the present invention.
  • 1 to n in Peer 1 to Peer n represent the number of storage nodes in the storage node list, and do not represent specific node identifiers. .
  • the index node will send the node information of m preselected storage nodes to the requesting node again according to the download request A2.
  • the requesting node can not only download the file block a2 from the m preselected storage nodes, but also download the file block a2 from the above A file block a2 is downloaded from the n storage nodes recorded after a file block download operation.
  • the requesting node needs to select n storage nodes with the best performance from the m pre-selected storage nodes and the performance of the n storage nodes and record them in the storage node list.
  • the storage node A in the P2P network stores the file a, that is, all the file blocks corresponding to the storage file a, then the node information of the storage node corresponding to these file blocks will correspond to the node information of the storage node A. .
  • the requesting node initiates a download request A for the target file block a1 (the target file block a1 is a file block of file a), and receives the feedback from the index node, the pre-selected storage nodes include storage node A, and through the performance of each storage node
  • the test obtains multiple optimal storage nodes, including storage node A, then, when the requesting node continues to request to download other file blocks in file a, such as file block a2, storage node A includes file block a2, therefore, in When requesting the node to download the file block a2, the storage node A can still be used as a storage node for downloading the file block a2, and there is no problem that the target file block cannot be downloaded in the optimal storage node.
  • the range of storage nodes is valid.
  • the downloading process in (2) can be repeated.
  • the requesting node can replace the node information in the storage node list with the node information of the n storage nodes to update the storage node list.
  • OPT_index and OPT_metric can be used to represent the storage nodes in the storage node list, where OPT_index can be the hash value (node identifier) corresponding to the storage node, and OPT_metric is used to identify the load of the transmission path from the requesting node to the storage node. .
  • the requesting node After the requesting node receives the node information of the preselected storage node sent by the index node, it needs to first detect whether the requesting node stores a storage node list. In an implementation manner, the requesting node pre-establishes a table of storage node lists before downloading a file, and writes the node information of the selected storage node into the table of the storage node list after each download of the target file block. , at this time, it can be determined whether there is a storage node list stored in the request node by detecting whether there are characters in the table, or whether there are characters related to node information.
  • the current file download operation of the requesting node corresponds to the first file block in the downloaded file.
  • the requesting node After each download of the target file block, the requesting node generates a storage node list from the node information of the selected storage node. At this point, it can be directly detected whether the requesting node has a storage node list.
  • a preset performance index test is performed on each storage node in the storage node set, where the preset performance index may be one or a combination of transmission delay, round-trip delay, and available bandwidth.
  • the PING tool to detect the transmission delay from the request node to each storage node
  • the IPerf tool to detect the available bandwidth from the request node to each storage node.
  • the tested storage node can be recorded as Peer(Hash), Hash_metric, where Peer is the storage node, Hash is the hash value that identifies the storage node, and Hash_metric is the load status of the transmission path that identifies the request node to the storage node .
  • the requesting node may test the performance of each storage node in the storage node set for each download request.
  • the requesting node can also choose to periodically test the performance of the storage nodes in the storage node list, and can directly refer to the storage node list when the performance test of the storage nodes in the storage node list is not required. The performance of the storage node as documented in .
  • the requesting node can also choose to test the performance of the storage nodes in the storage node list when the state changes of the storage nodes are received. , you can directly refer to the storage node performance recorded in the storage node list.
  • the requesting node can obtain the test results of the preset performance indicators corresponding to each storage node through the above test. In this way, according to these test results, a storage node that meets the preset performance indicator threshold can be selected as the target storage node for the final download of the target file block. .
  • a storage node with the best performance may be selected from all storage nodes as a target storage node, so that the download speed can be effectively improved and the resource occupation of each storage node by the download operation can be reduced.
  • the method of selecting only one target storage node for downloading is prone to the problem that the target storage node fails and cannot be downloaded.
  • multiple target storage nodes can be selected. For example, the number of target storage nodes is determined according to the number of preselected storage nodes and the number of storage nodes in the storage node list.
  • the requesting node can select from m preselected storage nodes according to the following formula. Select N target storage nodes from the n storage nodes in the node and storage node list,
  • the requesting node can use the N storage nodes with the best performance as the target storage nodes. Further, in this implementation manner, the requesting node may select n storage nodes to update the storage node list, where n may be equal to N, that is, the N target storage nodes are directly recorded as storage nodes; n may not be equal to N, that is, select n target storage nodes with the best performance as storage nodes for recording.
  • the requesting node downloads the target file block according to the node information of the target storage node.
  • the requesting node only needs to obtain the index address of the target storage node, and download the target file block according to the index address.
  • the requesting node needs to obtain the index address of each target storage node, and download the target file blocks from the corresponding target storage node according to these index addresses.
  • the node completes the download from any target storage node, the overall download process ends.
  • the download process of each target file block is an iterative selection process, which can have the effect of selecting a storage node with better performance from storage nodes with excellent performance, and at the same time, the index node continues to add new options In order to ensure the updateability of storage node selection, it can expand the selection range of target storage nodes to a certain extent.
  • the target storage node corresponding to each file block will get closer and closer to the global optimal storage node with the best performance among all the storage nodes storing the target file block, that is, the global optimal solution is obtained. It can be seen that, for the entire file downloading process, the file downloading method provided by the embodiment of the present invention can provide a target storage node with relatively high performance for each file block, thereby improving the downloading efficiency and downloading quality of the file block.
  • N The total number of storage nodes corresponding to each file block, or the maximum concurrent download requests for the same file block
  • ⁇ i the mean value of the download request sending rate on the i-th requesting node
  • ⁇ j the mean value of the arrival rate of download requests on the jth storage node
  • the overall file download time is used as the performance index, and the global and local optimal storage nodes are compared.
  • the global optimal storage node refers to the storage node with the best performance among all the storage nodes corresponding to the target file block;
  • the performance storage node refers to the target storage node corresponding to the target file block.
  • each storage node processes a download request corresponding to one file block in the request cache queue at most.
  • the probability that the i-th storage node has a file block download request arrives as follows:
  • the probability that the jth storage node has a download request successfully transmitted is:
  • the maximum probability that the download request is scheduled to the Nth storage node is: m/N. Therefore, the maximum possible request arrival rate for the Nth storage node is:
  • the minimum download request arrival rate sum is:
  • the download request generation and processing rates only satisfy:
  • the specific mean value distribution can be made uneven, so a set of input and output rate distributions can be found to satisfy:
  • the average rate distribution of download request arrival and processing satisfying (1) is easy to construct.
  • the quadratic Lyapunov function V is constructed, and the convergence of the algorithm is demonstrated by proving that the Lyapunov function has a negative expected single-step drift.
  • the Lyapunov function is constructed as follows:
  • each storage node can accommodate at most K download requests scheduled at the same time at the same time, there are:
  • each storage node processes at most one download request at the same time, so there are:
  • the inferences from the queuing model are:
  • V(t) V1(t)+V2(t)
  • at least one of V1(t) and V2(t) is extremely large.
  • the Lyapunov function has a negative expectation drift, that is, the local optimal storage node download strategy converges to the global optimal storage node, which contradicts the assumption. Therefore, V1(t) will not have a very large value.
  • the Lyapunov function has a negative expectation drift, which contradicts the hypothesis. Therefore, V2(t) will not have a very large value.
  • the Lyapunov function has a negative expectation drift, which contradicts the hypothesis. Therefore, V2(t) will not have a very large value.
  • a P2P storage network composed of 50 storage nodes is simulated to download the first 100 file blocks in a file download scenario.
  • the changes of the download delay of the target storage node and the download delay of the global optimal storage node are shown in Figure 9. It can be seen that, after downloading about the 60th file block, the target storage node selected by the present invention and the global optimal storage node have completely overlapped. Therefore, the target storage node selected by the embodiment of the present invention may converge to the globally optimal storage node.
  • the file download method provided by the embodiment of the present invention selects the storage node with the best performance by comprehensively considering the previous file download operation, and the performance of the newly added preselected storage node in this file download operation. , select the target storage node that will eventually be used to download the target file block. Through the iterative process, the target storage node corresponding to each file block will get closer and closer to the global optimal storage node with the best performance among all the storage nodes storing the target file block, that is, the global optimal solution is obtained. It can be seen that, for the entire file downloading process, the file downloading method provided by the embodiment of the present invention can provide a target storage node with relatively high performance for each file block, thereby improving the downloading efficiency and downloading quality of the file block.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The present invention provides a file block download method. In a P2P network, an index node sends, to a requesting node according to a download request sent from the requesting node, preselected storage nodes that are selected, and then the requesting node selects, from a storage node set formed by the preselected storage nodes and storage nodes in a storage node list, a target storage node for downloading a target file block. In the file download method provided by the present invention, on the basis of the storage nodes in the storage node list, the iterative selection of the target storage node enables the selected target storage node to get closer to a global optimal storage node having the best performance among all the storage nodes storing a target file block, so as to obtain a global optimal solution, thereby improving download efficiency and download quality of file blocks.

Description

一种文件块下载方法及装置A file block downloading method and device 技术领域technical field
本发明主要涉及网络通信技术领域,尤其涉及一种文件块下载方法及装置。The present invention mainly relates to the technical field of network communication, and in particular, to a file block downloading method and device.
背景技术Background technique
随着高速互联网的普及、个人计算机计算和存储能力的提升,对等计算(Peer to Peer,P2P)技术逐渐得到广泛应用。互联网用户通过P2P技术可以有效地利用互联网中散布的大量具有存储功能的网络节点,将文件分布到所有网络节点上,各网络节点可以利用其空闲的存储空间,执行存储任务,从而达到海量存储的目的。当文件被存储至P2P网络中后,用户在该P2P网络中的某一网络节点上请求下载该文件时,就需要基于该P2P网络的存储原理来下载文件。With the popularization of high-speed Internet and the improvement of personal computer computing and storage capabilities, peer-to-peer (P2P) technology has gradually been widely used. Through P2P technology, Internet users can effectively use a large number of network nodes with storage functions scattered in the Internet to distribute files to all network nodes. Each network node can use its free storage space to perform storage tasks, so as to achieve mass storage. Purpose. After the file is stored in the P2P network, when the user requests to download the file on a certain network node in the P2P network, the file needs to be downloaded based on the storage principle of the P2P network.
通常,一个文件会被拆分为多个文件块后存储至P2P网络中,因此,用于下载文件的过程,相当于多次下载该文件的文件块的过程。用户在P2P网络中的请求节点上下发下载目标文件块的下载请求之后,可以通过P2P网络中的索引节点找到存储有目标文件块的全部存储节点,此时,请求节点同时向各个存储节点发起下载请求,当在某一个存储节点完成下载过程时,该下载请求执行完毕。可见,这种文件下载的方法会造成大量带宽资源的浪费。为了降低带宽资源的占用率,可以先对各个存储节点进行性能测试,并选出性能最优的存储节点作为执行下载请求的目标。但是,对大量的存储节点的性能测试会耗费大量的时间和开销,这样,反而会降低文件块的下载速度。Usually, a file is divided into multiple file blocks and then stored in the P2P network. Therefore, the process for downloading the file is equivalent to the process of downloading the file blocks of the file multiple times. After the user sends a download request to download the target file block to the requesting node in the P2P network, he can find all the storage nodes that store the target file block through the index node in the P2P network. At this time, the requesting node initiates the download to each storage node at the same time. When the download process is completed on a certain storage node, the download request is completed. It can be seen that this method of file downloading will cause a lot of waste of bandwidth resources. In order to reduce the occupancy rate of bandwidth resources, you can first perform a performance test on each storage node, and select the storage node with the best performance as the target for executing the download request. However, the performance test of a large number of storage nodes will consume a lot of time and overhead, which will reduce the download speed of file blocks.
发明内容SUMMARY OF THE INVENTION
本申请提供了一种文件块下载方法及装置,以提高文件的下载速度。The present application provides a method and device for downloading file blocks, so as to improve the downloading speed of files.
第一方面,本发明提供了一种文件块下载方法,应用于P2P网络,所述P2P网络包括请求节点和索引节点,所述方法包括:所述索引节点接收所述请求节点发送的下载请求,所述下载请求用于下载目标文件块;所述索引节点根据所述下载请求获取子分布式散列表DHT中与所述目标文件块对应的全部存储节点,所述子DHT为所述P2P网络对应的DHT中存储于所述索引节点的部分DHT;所述索引节点从所述全部存储节点中选取多个预选存储节点;所述索引节点将所述多个预选存储节点发送至所述请求节点;所述请求节点获取存储节点列表,所述存储节点列表中的存储节点用于与所述预选存储节点共同构成存储节点集合;所述请求节点基于所述存储节点集合下载所述目标文件块。In a first aspect, the present invention provides a method for downloading file blocks, which is applied to a P2P network, where the P2P network includes a requesting node and an indexing node, and the method includes: the indexing node receives a download request sent by the requesting node, The download request is used to download the target file block; the index node obtains all storage nodes corresponding to the target file block in the sub-distributed hash table DHT according to the download request, and the sub-DHT corresponds to the P2P network The part of the DHT stored in the index node in the DHT of the index node; the index node selects a plurality of preselected storage nodes from all the storage nodes; the index node sends the plurality of preselected storage nodes to the request node; The requesting node obtains a storage node list, and the storage nodes in the storage node list are used to form a storage node set together with the preselected storage node; the requesting node downloads the target file block based on the storage node set.
通常,索引节点可以采取随机选取的方式从所述全部存储节点中选取多个预选存储节点。这样,通过以存储节点列表中的存储节点为基础,迭代选择目标存储节点,可以令选择的目标存储节点越来越接近存储有目标文件块的全部存储节点中性能最优的全局最优存储节点,即得到全局最优解,从而提高文件块的下载效率和下载质量。Generally, the index node may select a plurality of preselected storage nodes from all the storage nodes in a random selection manner. In this way, by iteratively selecting the target storage node based on the storage nodes in the storage node list, the selected target storage node can be made closer and closer to the globally optimal storage node with the best performance among all the storage nodes storing the target file block. , that is, the global optimal solution is obtained, thereby improving the download efficiency and download quality of file blocks.
第二方面,本发明提供了一种文件块下载方法,应用于P2P网络中的索引节点,所述方法包括:接收请求节点发送的下载请求,所述下载请求用于下载目标文件块;根据所述下载请求获取子分布式散列表DHT中与所述目标文件块对应的全部存储节点,所述子DHT为所述P2P网络对应的DHT中存储于所述索引节点的部分DHT;从所述全部存储节点中选取多个预选存储节点;将所述多个预选存储节点发送至所述请求节点。In a second aspect, the present invention provides a method for downloading file blocks, which is applied to an index node in a P2P network. The method includes: receiving a download request sent by a requesting node, where the download request is used to download target file blocks; The download request obtains all the storage nodes corresponding to the target file block in the sub-distributed hash table DHT, and the sub-DHT is the part of the DHT stored in the index node in the DHT corresponding to the P2P network; Selecting multiple preselected storage nodes from the storage nodes; sending the multiple preselected storage nodes to the requesting node.
通常,索引节点可以采取随机选取的方式从所述全部存储节点中选取多个预选存储节点。这样,索引节点可以随机挑选出一部分存储节点供请求节点从中选择合适的存储节点来下载目标文件块,从而缩小请求节点检测存储节点性能的数量及时间,提高目标文件块下载速度。Generally, the index node may select a plurality of preselected storage nodes from all the storage nodes in a random selection manner. In this way, the index node can randomly select a part of the storage nodes for the requesting node to select a suitable storage node to download the target file block, thereby reducing the number and time for the requesting node to detect the performance of the storage node and improving the download speed of the target file block.
在一种实现方式中,如果所述索引节点不存在与所述目标文件块对应的存储节点,则将所述下载请求发送至相邻索引节点,并由所述相邻索引节点获取与所述目标文件块对应的全部存储节点,其中,所述相邻索引节点为所述P2P网络中与所述索引节点具有指定算法关系的索引节点。In an implementation manner, if the index node does not have a storage node corresponding to the target file block, the download request is sent to an adjacent index node, and the adjacent index node obtains the data with the target file block. All storage nodes corresponding to the target file block, wherein the adjacent index nodes are index nodes in the P2P network that have a specified algorithmic relationship with the index nodes.
这样,可以保证请求节点能够获得与目标文件块对应的存储节点,从而保证目标文件块的可下载性。In this way, it can be ensured that the requesting node can obtain the storage node corresponding to the target file block, thereby ensuring the downloadability of the target file block.
在一种实现方式中,所述将所述多个预选存储节点发送至所述请求节点包括:生成局部DHT,所述局部DHT包括所述多个预选存储节点;将所述局部DHT发送至所述请求节点。In one implementation, the sending the plurality of preselected storage nodes to the requesting node includes: generating a local DHT, where the local DHT includes the plurality of preselected storage nodes; sending the local DHT to all the preselected storage nodes the requesting node.
这样,索引节点可以以局部DHT的形式将预选存储节点发送给请求节点,保证这些预选存储节点的节点信息的完整性和规范性,便于请求节点后续对预选存储节点进行性能检测。In this way, the index node can send the pre-selected storage nodes to the requesting node in the form of local DHT, to ensure the integrity and standardization of the node information of these pre-selected storage nodes, and it is convenient for the requesting node to perform performance testing on the pre-selected storage nodes later.
在一种实现方式中,在所述将所述局部存储节点列表发送至所述请求节点之后,所述方法还包括:清空所述局部DHT中的存储节点。In an implementation manner, after the sending the local storage node list to the requesting node, the method further includes: clearing the storage nodes in the local DHT.
这样,索引节点可以在下一次收到下载请求时,在局部DHT中写入对应的预选存储节点,避免与上一下载请求对应的预选存储节点混淆。In this way, the index node can write the corresponding preselected storage node in the local DHT when it receives a download request next time, so as to avoid confusion with the preselected storage node corresponding to the previous download request.
第三方面,本发明提供了一种文件块下载方法,应用于P2P网络中的请求节点,所述方法包括:接收索引节点发送的预选存储节点,所述预选存储节点为从子分布式散列表DHT中与目标文件块对应的全部存储节点中选取的存储节点,所述子DHT为所述P2P网络对应的DHT中存储于所述索引节点的部分DHT;获取所述请求节点的存储节点列表,所述存储节点列表中的存储节点用于与所述预选存储节点共同构成存储节点集合;基于所述存储节点集合下载所述目标文件块。In a third aspect, the present invention provides a method for downloading file blocks, which is applied to a requesting node in a P2P network, the method comprising: receiving a preselected storage node sent by an index node, where the preselected storage node is a slave sub-distributed hash table The storage node selected from all the storage nodes corresponding to the target file block in the DHT, the sub-DHT is a part of the DHT stored in the index node in the DHT corresponding to the P2P network; obtain the storage node list of the requesting node, The storage nodes in the storage node list are used to form a storage node set together with the preselected storage nodes; the target file block is downloaded based on the storage node set.
这样,请求节点可以对各个预选存储节点的性能进行检测,并从中选择性能最优的部分预选存储节点来下载目标文件块,从而减少并行下载目标文件块的存储节点的数量,提高用于下载目标文件块的存储节点的质量。同时,每一个目标文件块的下载过程中,均会以请求节点中的存储节点列表中的存储节点以及预选存储节点共同构成的存储节点集合作为目标存储节点的选择基础,基于上述迭代过程,可以保证即使下载每一个目标文件块的目标存储节点只是全部存储节点中的部分存储节点,也可以实现整体文件下载过程均对应性能最优的存储节点,即收敛于全局最优解的效果,从而 提高文件的下载效率和质量。In this way, the requesting node can detect the performance of each pre-selected storage node, and select some pre-selected storage nodes with the best performance to download the target file block, thereby reducing the number of storage nodes that download the target file block in parallel and increasing the number of storage nodes for downloading the target file block. The quality of the storage node for file blocks. At the same time, during the download process of each target file block, the storage node set composed of the storage nodes in the storage node list in the request node and the pre-selected storage nodes will be used as the basis for the selection of the target storage node. Based on the above iterative process, it is possible to It is guaranteed that even if the target storage node that downloads each target file block is only a part of the storage nodes in all the storage nodes, it is possible to achieve the storage node with the best performance for the entire file download process, that is, the effect of converging to the global optimal solution, thereby improving the File download efficiency and quality.
在一种实现方式中,所述存储节点列表中的存储节点为上一文件块下载操作后选取的预设性能指标符合预设性能指标范围,且存储有所述目标文件块的存储节点。In an implementation manner, the storage nodes in the storage node list are the storage nodes whose preset performance indicators selected after the last file block download operation conform to the preset performance index range and store the target file blocks.
这样,可以将存储节点列表中的存储节点作为迭代的基础,以提高所确定的目标存储节点与全局存储节点中性能最优的存储节点的贴合度。In this way, the storage nodes in the storage node list can be used as the basis for iteration, so as to improve the fit between the determined target storage node and the storage node with the best performance among the global storage nodes.
在一种实现方式中,在所述获取所述请求节点的存储节点列表之前,所述方法还包括:检测是否存在所述存储节点列表;如果不存在所述存储节点列表,则由所述预选存储节点构成存储节点集合。In an implementation manner, before the acquiring the storage node list of the requesting node, the method further includes: detecting whether the storage node list exists; if the storage node list does not exist, the preselected The storage nodes constitute a collection of storage nodes.
这样,对于下载首个目标文件块,由于其不存在存储节点列表,因此,只需对预选存储节点进行性能测试即可。In this way, for downloading the first target file block, since there is no storage node list, it is only necessary to perform a performance test on the pre-selected storage nodes.
在一种实现方式中,所述基于所述存储节点集合下载所述目标文件块包括:测试所述存储节点集合中各存储节点的预设性能指标;获取至少一个测试结果符合预设性能指标阈值的目标存储节点的节点信息;根据所述目标存储节点的节点信息下载所述目标文件块。In an implementation manner, the downloading the target file block based on the storage node set includes: testing a preset performance index of each storage node in the storage node set; obtaining at least one test result that meets a preset performance index threshold node information of the target storage node; download the target file block according to the node information of the target storage node.
这样,可以根据需要从存储节点集合中选取性能符合标准的一个或者多个存储节点作为目标存储节点,以下载目标文件块。In this way, one or more storage nodes whose performance meets the standard can be selected as the target storage node from the storage node set as required to download the target file block.
在一种实现方式中,如果获取多个测试结果符合预设性能指标阈值的目标存储节点的节点信息,则根据所述预选存储节点的数量以及所述存储节点列表中存储节点的数量确定所述目标存储节点的数量。In an implementation manner, if the node information of a plurality of target storage nodes whose test results meet the preset performance indicator threshold are obtained, the determination of the The number of target storage nodes.
这样,为了进一步提高用于下载目标文件块的存储节点的质量,可以选择多个目标存储节点并行下载。In this way, in order to further improve the quality of the storage nodes for downloading target file blocks, multiple target storage nodes may be selected for parallel download.
在一种实现方式中,在下载所述目标文件块之后,所述方法还包括:从所述存储节点集合中选取存储节点,所选取的存储节点为所述存储节点集合中预设性能指标的排名大于或者等于预设排名的存储节点;利用所述选取的存储节点更新所述存储节点列表中的存储节点。In an implementation manner, after downloading the target file block, the method further includes: selecting a storage node from the storage node set, and the selected storage node is a preset performance index in the storage node set. A storage node whose ranking is greater than or equal to a preset ranking; and the storage node in the storage node list is updated by using the selected storage node.
这样,为了在迭代的过程中优化最优存储节点,因此,需要在每一次下载目标文件块之后,对最优存储节点列表进行更新,以提高最优存储节点列表中各最优存储节点的性能。In this way, in order to optimize the optimal storage node in the iterative process, it is necessary to update the optimal storage node list after each download of the target file block to improve the performance of each optimal storage node in the optimal storage node list. .
在一种实现方式中,所述预设性能指标为传输时延、往返时延、可用带宽中的一种或者几种的组合。In an implementation manner, the preset performance index is one or a combination of transmission delay, round-trip delay, and available bandwidth.
这样,可以根据实际需要,选择合适的一种或者几种性能指标来测试存储节点的性能。In this way, according to actual needs, one or several suitable performance indicators can be selected to test the performance of the storage node.
第四方面,本发明提供了一种索引节点,所述索引节点包括:接收器、处理器、存储器和发送器,所述接收器、所述处理器、所述存储器和所述发送器耦合;所述处理器调用所述存储器中的程序指令,以使所述索引节点执行如下方法:接收请求节点发送的下载请求,所述下载请求用于下载目标文件块;根据所述下载请求获取子分布式散列表DHT中与所述目标文件块对应的全部存储节点,所述子DHT为所述P2P网络对应的DHT中存储于所述索引节点的部分DHT;从所述全部存储节点中选取多个预选存储节点;将所述多个预选存储节点发送至所述请求节点。In a fourth aspect, the present invention provides an index node, the index node includes: a receiver, a processor, a memory and a transmitter, the receiver, the processor, the memory and the transmitter are coupled; The processor invokes the program instructions in the memory, so that the index node executes the following method: receiving a download request sent by a requesting node, the download request being used to download a target file block; obtaining a sub-distribution according to the download request All storage nodes corresponding to the target file block in the formula hash table DHT, and the sub-DHT is a part of the DHT stored in the index node in the DHT corresponding to the P2P network; Preselecting storage nodes; sending the plurality of preselected storage nodes to the requesting node.
通常,索引节点可以采取随机选取的方式从所述全部存储节点中选取多个预选存储节点。这样,索引节点可以挑选出一部分存储节点供请求节点从中选择合适的存储节点来下载目标文件块,从而缩小请求节点检测存储节点性能的数量及时间,提高目标文件块下载速度。Generally, the index node may select a plurality of preselected storage nodes from all the storage nodes in a random selection manner. In this way, the index node can select a part of the storage nodes for the requesting node to select a suitable storage node to download the target file block, thereby reducing the number and time for the requesting node to detect the performance of the storage node and improving the download speed of the target file block.
在一种实现方式中,所述索引节点所执行的方法还包括:如果所述索引节点不存在与所述目标文件块对应的存储节点,则将所述下载请求发送至相邻索引节点,并由所述相邻索引节点获取与所述目标文件块对应的全部存储节点,其中,所述相邻索引节点为所述P2P网络中与所述索引节点具有指定算法关系的索引节点。In an implementation manner, the method performed by the index node further includes: if the index node does not have a storage node corresponding to the target file block, sending the download request to an adjacent index node, and All storage nodes corresponding to the target file block are acquired from the adjacent index nodes, wherein the adjacent index nodes are index nodes in the P2P network that have a specified algorithmic relationship with the index nodes.
这样,可以保证请求节点能够获得与目标文件块对应的存储节点,从而保证目标文件块的可下载性。In this way, it can be ensured that the requesting node can obtain the storage node corresponding to the target file block, thereby ensuring the downloadability of the target file block.
在一种实现方式中,所述索引节点所执行的方法还包括:生成局部DHT,所述局部DHT包括所述多个预选存储节点;将所述局部DHT发送至所述请求节点。In an implementation manner, the method performed by the index node further includes: generating a local DHT, where the local DHT includes the plurality of preselected storage nodes; and sending the local DHT to the requesting node.
这样,索引节点可以以局部DHT的形式将预选存储节点发送给请求节点,保证这些预选存储节点的节点信息的完整性和规范性,便于请求节点后续对预选存储节点进行性能检测。In this way, the index node can send the pre-selected storage nodes to the requesting node in the form of local DHT, to ensure the integrity and standardization of the node information of these pre-selected storage nodes, and it is convenient for the requesting node to perform performance testing on the pre-selected storage nodes later.
在一种实现方式中,所述索引节点所执行的方法还包括:在所述将所述局部存储节点列表发送至所述请求节点之后,清空所述局部DHT中的存储节点。In an implementation manner, the method performed by the index node further includes: after the sending the local storage node list to the requesting node, clearing the storage nodes in the local DHT.
这样,索引节点可以在下一次收到下载请求时,在局部DHT中写入对应的预选存储节点,避免与上一下载请求对应的预选存储节点混淆。In this way, the index node can write the corresponding preselected storage node in the local DHT when it receives a download request next time, so as to avoid confusion with the preselected storage node corresponding to the previous download request.
第五方面,本发明提供了一种请求节点,所述请求节点包括:接收器、处理器、存储器和发送器,所述接收器、所述处理器、所述存储器和所述发送器耦合;所述处理器调用所述存储器中的程序指令,以使所述请求节点执行如下方法:接收索引节点发送的预选存储节点,所述预选存储节点为从子分布式散列表DHT中与目标文件块对应的全部存储节点中选取的存储节点,所述子DHT为所述P2P网络对应的DHT中存储于所述索引节点的部分DHT;获取所述请求节点的存储节点列表,所述存储节点列表中的存储节点用于与所述预选存储节点共同构成存储节点集合;基于所述存储节点集合下载所述目标文件块。In a fifth aspect, the present invention provides a requesting node, the requesting node comprising: a receiver, a processor, a memory and a transmitter, the receiver, the processor, the memory and the transmitter being coupled; The processor invokes the program instructions in the memory, so that the requesting node executes the following method: receiving a preselected storage node sent by the index node, where the preselected storage node is the target file block from the sub-distributed hash table DHT. The storage node selected from all the corresponding storage nodes, the sub-DHT is the part of the DHT stored in the index node in the DHT corresponding to the P2P network; obtain the storage node list of the request node, in the storage node list The storage node is used to form a storage node set together with the preselected storage node; the target file block is downloaded based on the storage node set.
这样,请求节点可以对各个预选存储节点的性能进行检测,并从中选择性能最优的部分预选存储节点来下载目标文件块,从而减少并行下载目标文件块的存储节点的数量,同时,提高用于下载目标文件块的存储节点的质量。同时,每一个目标文件块的下载过程中,均会以上一目标文件块的下载过程对应的存储节点作为目标存储节点的选择基础,基于上述迭代过程,可以保证即使下载每一个目标文件块的目标存储节点只是全部存储节点中的部分存储节点,也可以实现整体文件下载过程均对应性能最优的存储节点,即收敛于全局最优解的效果,从而提高文件的下载效率和质量。In this way, the requesting node can detect the performance of each preselected storage node, and select some preselected storage nodes with the best performance to download the target file block, thereby reducing the number of storage nodes that download the target file block in parallel, and at the same time, increasing the number of storage nodes used for downloading the target file block in parallel. The quality of the storage node that downloads the target file chunks. At the same time, during the download process of each target file block, the storage node corresponding to the download process of the previous target file block will be used as the basis for the selection of the target storage node. The storage node is only a part of the storage nodes in all the storage nodes, and it can also realize the storage node with the best performance in the whole file download process, that is, the effect of converging to the global optimal solution, thereby improving the file download efficiency and quality.
在一种实现方式中,所述存储节点列表中的存储节点为上一文件块下载操作后选取的预设性能指标符合预设性能指标范围,且存储有所述目标文件块的存储节点。In an implementation manner, the storage nodes in the storage node list are the storage nodes whose preset performance indicators selected after the last file block download operation conform to the preset performance index range and store the target file blocks.
在一种实现方式中,所述请求节点所执行的方法还包括:在所述获取所述请求节点的存储节点列表之前,检测是否存在所述存储节点列表;如果不存在所述存储节点列表,则由所述预选存储节点构成存储节点集合。In an implementation manner, the method performed by the requesting node further includes: before acquiring the storage node list of the requesting node, detecting whether the storage node list exists; if the storage node list does not exist, Then, a set of storage nodes is formed by the preselected storage nodes.
这样,对于下载首个目标文件块,由于其不存在最优存储节点列表,因此,只需对预选存储节点进行性能测试即可。In this way, for downloading the first target file block, since there is no optimal storage node list, it is only necessary to perform a performance test on the preselected storage nodes.
在一种实现方式中,所述请求节点所执行的方法还包括:测试所述存储节点集合中各存储节点的预设性能指标;获取至少一个测试结果符合预设性能指标阈值的目标存储节点的节点信息;根据所述目标存储节点的节点信息下载所述目标文件块。In an implementation manner, the method performed by the requesting node further includes: testing the preset performance indicators of each storage node in the storage node set; acquiring at least one target storage node whose test result meets the preset performance indicator threshold. Node information; download the target file block according to the node information of the target storage node.
这样,可以根据需要从存储节点集合中选取性能符合标准的一个或者多个存储节点作为目标存储节点,以下载目标文件块。In this way, one or more storage nodes whose performance meets the standard can be selected as the target storage node from the storage node set as required to download the target file block.
在一种实现方式中,所述请求节点所执行的方法还包括:如果获取多个测试结果符合预设性能指标阈值的目标存储节点的节点信息,则根据所述预选存储节点的数量以及所述存储节点列表中存储节点的数量确定所述目标存储节点的数量。In an implementation manner, the method performed by the requesting node further includes: if acquiring node information of a plurality of target storage nodes whose test results meet a preset performance indicator threshold, performing the method according to the number of the preselected storage nodes and the The number of storage nodes in the storage node list determines the number of the target storage nodes.
这样,为了进一步提高用于下载目标文件块的存储节点的质量,可以选择多个目标存储节点并行下载。In this way, in order to further improve the quality of the storage nodes for downloading target file blocks, multiple target storage nodes may be selected for parallel download.
在一种实现方式中,所述请求节点所执行的方法还包括:在下载所述目标文件块之后,从所述存储节点集合中选取存储节点,所选取的存储节点为所述存储节点集合中预设性能指标的排名大于或者等于预设排名的存储节点;利用所述选取的存储节点更新所述存储节点列表中的存储节点。In an implementation manner, the method performed by the requesting node further includes: after downloading the target file block, selecting a storage node from the storage node set, where the selected storage node is one of the storage node sets The ranking of the preset performance index is greater than or equal to the storage node of the preset ranking; the storage node in the storage node list is updated by using the selected storage node.
这样,为了在迭代的过程中优化最优存储节点,因此,需要在每一次下载目标文件块之后,对存储节点列表进行更新,以保证存储节点列表中各存储节点的性能最优。In this way, in order to optimize the optimal storage node in the iterative process, it is necessary to update the storage node list after each download of the target file block to ensure the optimal performance of each storage node in the storage node list.
在一种实现方式中,所述预设性能指标为传输时延、往返时延、可用带宽中的一种或者几种的组合。In an implementation manner, the preset performance index is one or a combination of transmission delay, round-trip delay, and available bandwidth.
这样,可以根据实际需要,选择合适的一种或者几种性能指标来测试存储节点的性能。In this way, according to actual needs, one or several suitable performance indicators can be selected to test the performance of the storage node.
第六方面,本发明提供了一种P2P网络,其特征在于,包括至少一个请求节点和至少一个索引节点,其中,所述索引节点用于执行相关的文件块下载方法,所述请求节点用于执行相关的文件块下载方法。In a sixth aspect, the present invention provides a P2P network, characterized in that it includes at least one request node and at least one index node, wherein the index node is used to execute a related file block downloading method, and the request node is used to Execute the relevant file block download method.
这样,索引节点可以根据请求节点发送的下载请求,获取与目标文件块对应的存储节点,并从中随机选取多个预选存储节点发送至请求节点,以减少请求节点需要测试性能的存储节点的数量,从而提高请求节点的下载效率。进一步地,请求节点通过测试预选存储节点和最优存储节点的性能,来确定用于下载目标文件块的目标存储节点,由于每一个目标文件块的下载过程中,均会以上一目标文件块的下载过程对应的存储节点作为目标存储节点的选择基础,因此,基于上述迭代过程,可以保证及时下载每一个目标文件块的目标存储节点只是全部存储节点中的部分存储节点,也可以实现整体文件下载过程均对应性能最优的存储节点,即收敛于全局最优解的效果,从而提高文件的下载效率和质量。In this way, the index node can obtain the storage node corresponding to the target file block according to the download request sent by the requesting node, and randomly select a plurality of preselected storage nodes to send to the requesting node, so as to reduce the number of storage nodes that the requesting node needs to test the performance of. Thus, the download efficiency of the requesting node is improved. Further, the requesting node determines the target storage node for downloading the target file block by testing the performance of the pre-selected storage node and the optimal storage node, because during the downloading process of each target file block, the data of the previous target file block will be changed. The storage node corresponding to the download process is used as the basis for the selection of the target storage node. Therefore, based on the above iterative process, it can be ensured that the target storage node that downloads each target file block in time is only a partial storage node in all storage nodes, and the overall file download can also be realized. The process corresponds to the storage node with the best performance, that is, the effect of converging to the global optimal solution, thereby improving the download efficiency and quality of the file.
附图说明Description of drawings
图1为本发明实施例提供的一种P2P网络的结构示意图;1 is a schematic structural diagram of a P2P network according to an embodiment of the present invention;
图2为本发明实施例提供的一种P2P网络的结构示意图;FIG. 2 is a schematic structural diagram of a P2P network according to an embodiment of the present invention;
图3为本发明实施例提供的一种请求节点的结构示意图;3 is a schematic structural diagram of a request node according to an embodiment of the present invention;
图4为本发明实施例提供的一种索引节点的结构示意图;FIG. 4 is a schematic structural diagram of an index node according to an embodiment of the present invention;
图5为本发明实施例提供的一种文件下载方法的流程示意图;5 is a schematic flowchart of a method for downloading a file according to an embodiment of the present invention;
图6为本发明实施例提供的一种索引节点的子DHT的结构示意图;6 is a schematic structural diagram of a sub-DHT of an index node according to an embodiment of the present invention;
图7为本发明实施例提供的一种局部DHT的结构示意图;7 is a schematic structural diagram of a local DHT provided by an embodiment of the present invention;
图8为本发明实施例提供的一种存储节点列表的结构示意图;8 is a schematic structural diagram of a storage node list according to an embodiment of the present invention;
图9为本发明实施例提供的一种目标存储节点和全局最优存储节点的选取仿真图。FIG. 9 is a simulation diagram for selecting a target storage node and a globally optimal storage node according to an embodiment of the present invention.
具体实施方式detailed description
图1为本发明实施例提供的一种P2P网络的结构示意图,如图1所示,P2P网络包括节点1~4,这些节点均具有存储文件块的能力,因此这些节点也可以称为存储节点,通常,一份文件会拆分成多个文件块存储于各个存储节点上,P2P网络存在一个全局DHT,用于存储文件块名称及与文件块名称对应的存储节点的节点信息,其中,文件块名称可以用资源标识符(Object ID)表示,资源标识符可以为文件块名称通过散列运算产生的一个哈希值,具有唯一性,存储节点的节点信息可以包括存储节点的索引地址、存储节点的节点标识(Node ID)等。P2P网络中的每一个存储节点上均会存储全局DHT中的一部分,可以将每个存储节点上存储的部分全局DHT称为子DHT,而每个可以通过一些特定的算法,例如Tapestry、Pastry、Chord、Kademlia等来确定文件块名称与存储节点的对应信息被存储于哪一份子DHT中,也就是被存储于哪一个存储节点上。FIG. 1 is a schematic structural diagram of a P2P network according to an embodiment of the present invention. As shown in FIG. 1 , the P2P network includes nodes 1 to 4, and these nodes all have the ability to store file blocks. Therefore, these nodes may also be called storage nodes. , usually, a file is divided into multiple file blocks and stored on each storage node. There is a global DHT in the P2P network, which is used to store the file block name and the node information of the storage node corresponding to the file block name. The block name can be represented by a resource identifier (Object ID). The resource identifier can be a hash value generated by the file block name through a hash operation, which is unique. The node information of the storage node can include the index address of the storage node, storage Node ID of the node, etc. Each storage node in the P2P network stores a part of the global DHT. The part of the global DHT stored on each storage node can be called a sub-DHT, and each storage node can pass some specific algorithms, such as Tapestry, Pastry, Chord, Kademlia, etc. to determine in which sub-DHT the corresponding information between the file block name and the storage node is stored, that is, on which storage node is stored.
P2P网络中某一个或者某几个存储节点可以通过向相邻节点发起下载请求来下载目标文件块,即通过相邻节点查询目标文件块对应的存储节点,并通过目标文件块对应的存储节点的节点信息下载目标文件块。其中,发起下载请求的存储节点即为请求节点,相邻节点是指与请求节点之间具有指定算法关系的存储节点,所述指定算法通常是指用于确定文件块名称与存储节点的对应信息存储位置的算法,如图1所示,如果节点1为请求节点,那么相邻节点即为节点2。One or several storage nodes in the P2P network can download the target file block by initiating a download request to the adjacent node, that is, query the storage node corresponding to the target file block through the adjacent node, and pass the data of the storage node corresponding to the target file block. Node information download target file block. Among them, the storage node that initiates the download request is the request node, and the adjacent node refers to the storage node that has a specified algorithm relationship with the request node. The specified algorithm usually refers to the information used to determine the corresponding information between the file block name and the storage node. The algorithm of the storage location, as shown in Figure 1, if node 1 is the requesting node, then the adjacent node is node 2.
当相邻节点接收到下载请求之后,会在本地存储的子DHT中查询与目标文件块对应的存储节点的节点信息,此时,相邻节点承担索引目标文件块的存储节点的节点信息的索引工作,因此,相邻节点又可以称为索引节点。如果相邻节点内没有目标文件块的存储节点的节点信息,那么,就需要通过该相邻节点的相邻节点来查询目标文件块的存储节点的节点信息,此时,该相邻节点的相邻节点即为索引节点,重复上述过程直至查询到目标文件块的存储节点的节点信息。可见,P2P网络中的每一个节点都可以为存储节点和索引节点,即承担存储目标文件块的工作和查询目标文件块的存储节点的节点信息的工作。When the adjacent node receives the download request, it will query the node information of the storage node corresponding to the target file block in the sub-DHT stored locally. At this time, the adjacent node is responsible for indexing the node information of the storage node of the target file block. work, therefore, adjacent nodes can also be called index nodes. If there is no node information of the storage node of the target file block in the adjacent node, then it is necessary to query the node information of the storage node of the target file block through the adjacent node of the adjacent node. The adjacent node is the index node, and the above process is repeated until the node information of the storage node of the target file block is queried. It can be seen that each node in the P2P network can be a storage node and an index node, that is, it is responsible for the work of storing the target file block and the work of querying the node information of the storage node of the target file block.
进一步地,图2为本发明实施例提供的一种P2P网络的结构示意图,可以同时由多个请求节点发起下载请求,如图2所示,同时存在请求节点1和请求节点2,并由请求节点1和请求节点2同时发起下载请求,其中,请求节点1和请求节点2可以下载相同的目标文件块;或者,请求节点1和请求节点2可以下载不同的目标文件块。Further, FIG. 2 is a schematic structural diagram of a P2P network provided by an embodiment of the present invention, and a download request may be initiated by multiple request nodes at the same time. As shown in FIG. Node 1 and requesting node 2 initiate a download request at the same time, wherein requesting node 1 and requesting node 2 can download the same target file block; or, requesting node 1 and requesting node 2 can download different target file blocks.
同时,索引节点可以为一个或者多个,如图1所示,如果节点2承担查询工作时,则索引节点为1个,如果节点2中无法查询到目标文件块的存储节点的节点信息时,则节点3和节点4承担查询工作,那么,索引节点为2个。如图2所示,对于请求节点1来说,当节点3和节点4承担查询工作时,请求节点1的索引节点为2个,对于请求节点2来说,当节点4承担查询工作时,请求节点2的索引节点为1个,此时,对于P2P网络来说,一共有2个索引节点。At the same time, there can be one or more index nodes. As shown in Figure 1, if node 2 undertakes the query work, there is one index node. If the node information of the storage node of the target file block cannot be queried in node 2, Then node 3 and node 4 undertake the query work, then, there are 2 index nodes. As shown in Figure 2, for requesting node 1, when node 3 and node 4 undertake the query work, the number of index nodes of requesting node 1 is 2; for requesting node 2, when node 4 undertakes the query work, the request Node 2 has one index node. At this time, for the P2P network, there are two index nodes in total.
以下实施例针对P2P网络中的某一个请求节点和与该请求节点对应的一个索引节点进行说明,对于P2P网络中存在多个请求节点和多个索引节点的情况,可以参照以下实施例中提供的方法。The following embodiments describe a certain request node and an index node corresponding to the request node in the P2P network. For the situation that there are multiple request nodes and multiple index nodes in the P2P network, reference may be made to the following embodiments. method.
图3为本发明实施例提供的一种请求节点的结构示意图,请求节点可以为计算机、手机、平板电脑、服务器、云服务器等具有数据存储、数据查询、数据处理等功能的终端设备。请求节点可以包括至少一个接收器、至少一个处理器、至少一个存储器和至少一个发送器,以图3作为示例,所述请求节点包括接收器101、处理器102、存储器103和发送器104,其中,接收器101、处理器102、存储器103和发送器104耦合,存储器103中存储有程序指令,处理器102可以通过调用存储器103中的程序指令,以使请求节点执行相关的文件下载方法,例如,生成下载请求、检测节点性能、生成最优节点列表等。3 is a schematic structural diagram of a request node according to an embodiment of the present invention. The request node may be a terminal device with functions such as data storage, data query, and data processing, such as a computer, a mobile phone, a tablet computer, a server, and a cloud server. The requesting node may include at least one receiver, at least one processor, at least one memory and at least one transmitter, taking FIG. 3 as an example, the requesting node includes a receiver 101, a processor 102, a memory 103 and a transmitter 104, wherein , the receiver 101, the processor 102, the memory 103 and the transmitter 104 are coupled, and program instructions are stored in the memory 103. The processor 102 can call the program instructions in the memory 103 to make the requesting node execute the relevant file download method, for example , generate download requests, detect node performance, generate optimal node lists, etc.
图4为本发明实施例提供的一种索引节点的结构示意图,索引节点可以为计算机、手机、平板电脑、服务器、云服务器等具有数据存储、数据查询、数据处理等功能的终端设备。索引节点可以包括至少一个接收器、至少一个处理器、至少一个存储器和至少一个发送器,以图4作为示例,所述索引节点包括接收器201、处理器202、存储器203和发送器204,其中,接收器201、处理器202、存储器203和发送器204耦合,存储器203中存储有程序指令,处理器202可以通过调用存储器203中的程序指令,以使索引节点执行相关的文件下载方法,例如,查询目标文件块的存储节点的节点信息、随机选取预选存储节点、生成局部DHT等。4 is a schematic structural diagram of an index node according to an embodiment of the present invention. An index node may be a terminal device with functions such as data storage, data query, and data processing, such as a computer, a mobile phone, a tablet computer, a server, and a cloud server. An index node may include at least one receiver, at least one processor, at least one memory and at least one transmitter, taking FIG. 4 as an example, the index node includes a receiver 201, a processor 202, a memory 203 and a transmitter 204, wherein , the receiver 201, the processor 202, the memory 203 and the transmitter 204 are coupled, and program instructions are stored in the memory 203, and the processor 202 can call the program instructions in the memory 203 to make the index node execute the relevant file download method, for example , query the node information of the storage node of the target file block, randomly select the pre-selected storage node, generate a local DHT, etc.
在本发明实施例中所提及的接收器和发送器可以为终端设备上的通信接口,通信接口可以为一个或者多个光纤链路接口、以太网接口、微波链路接口或者铜线接口等。具体地,通信接口可以包括网络适配器(network adapter)、网卡(network interface card)、局域网接收器(LAN adapter)、网络接口控制器(network interface controller,NIC)、调制解调器(modem)等。其中,通信接口可以是独立的器件,也可以部分或者全部地集成或者封装在处理器中,成为处理器的一部分。The receivers and transmitters mentioned in the embodiments of the present invention may be communication interfaces on a terminal device, and the communication interfaces may be one or more optical fiber link interfaces, Ethernet interfaces, microwave link interfaces, or copper wire interfaces, etc. . Specifically, the communication interface may include a network adapter (network adapter), a network card (network interface card), a local area network receiver (LAN adapter), a network interface controller (network interface controller, NIC), a modem (modem), and the like. Wherein, the communication interface may be an independent device, and may also be partially or fully integrated or packaged in the processor to become a part of the processor.
在本发明实施例中所提及的处理器可以包括一个或者多个处理单元,例如系统芯片(system on a chip,SoC)、中央处理器(central processing unit,CPU)、微控制器(microcontroller,MCU)、存储控制器等。其中,不同的处理单元可以是独立的器件,也可以集成在一个或多个处理器中。The processor mentioned in the embodiments of the present invention may include one or more processing units, such as a system on a chip (SoC), a central processing unit (CPU), a microcontroller (microcontroller, MCU), memory controller, etc. Wherein, different processing units may be independent devices, or may be integrated in one or more processors.
在本发明实施例中所提及的存储器可以包括一个或者多个存储单元,例如可以包括易失性存储器(volatile memory),如:动态随机存取存储器(dynamic random access memory,DRAM)、静态随机存取存储器(static random access memory,SRAM)等;还可以包括非易失性存储器(non-volatile memory,NVM),如:只读存储器(read-only memory,ROM)、闪存(flash memory)等。其中,不同的存储单元可以是独立的器件,也可以集成或者封装在一个或者多个处理器或者通信接口中,成为处理器或者通信接口的一部分。The memory mentioned in the embodiments of the present invention may include one or more storage units, for example, may include volatile memory (volatile memory), such as: dynamic random access memory (dynamic random access memory, DRAM), static random access memory Access memory (static random access memory, SRAM), etc.; can also include non-volatile memory (non-volatile memory, NVM), such as: read-only memory (read-only memory, ROM), flash memory (flash memory), etc. . Wherein, different storage units may be independent devices, or may be integrated or packaged in one or more processors or communication interfaces, and become part of the processors or communication interfaces.
图5为本发明实施例提供的一种文件下载方法的流程示意图,如图5所示,所述方法包括:FIG. 5 is a schematic flowchart of a file downloading method provided by an embodiment of the present invention. As shown in FIG. 5 , the method includes:
S1、请求节点向索引节点发送下载请求。S1. The requesting node sends a download request to the index node.
请求节点通过接收用户发起的相关操作,例如用户在请求节点中输入的文件下载 指令、用户在请求节点中通过点击等操作发起的文件下载指令等,生成相应的下载请求。由上文可知,文件在P2P网络中进行存储的过程是首先将该文件拆分为多个文件块,然后再分别存储每一个文件块,由此可知,文件的下载过程,也应该是分别下载该文件的每一个文件块的过程。当请求节点接收到用户的文件下载指令之后,可以根据该下载指令对应的文件名,例如通过哈希算法计算出的文件名对应的哈希值,首先确定出该文件名对应的全部文件块的名称,这样,请求节点就可以获知用户完成文件下载过程所要下载的全部文件块,并生成关于每一个文件块的下载请求,其中,每一个文件块在下载的过程中,均可以称为目标文件块。进一步地,下载每一个文件块时都需要经历查询文件块所在的存储节点的节点信息和利用节点信息下载文件块两个过程,如果请求节点中已经存储有部分文件块,则可以通过查询请求节点自身的数据库或者文件日志等确定已经存储在本地的文件块(无需下载的文件块),请求节点仅生成关于其余文件块的下载请求即可,这样,可以有效节省文件块的查询时间和下载时间,从而可以提高文件下载的整体效率。The requesting node generates a corresponding download request by receiving relevant operations initiated by the user, such as the file download instruction input by the user in the requesting node, the file downloading instruction initiated by the user through clicking and other operations in the requesting node, etc. As can be seen from the above, the process of storing a file in a P2P network is to first split the file into multiple file blocks, and then store each file block separately. It can be seen that the file download process should also be downloaded separately. process for each file block of the file. When the requesting node receives the user's file download instruction, it can first determine the file name corresponding to the file name according to the file name corresponding to the download instruction, such as the hash value corresponding to the file name calculated by the hash algorithm. Name, in this way, the requesting node can know all the file blocks to be downloaded by the user to complete the file download process, and generate a download request for each file block, wherein each file block can be called a target file during the download process. piece. Further, when downloading each file block, it needs to go through two processes of querying the node information of the storage node where the file block is located and using the node information to download the file block. If some file blocks are already stored in the request node, you can query the request node by Its own database or file log determines the file blocks that have been stored locally (file blocks that do not need to be downloaded), and the requesting node only needs to generate download requests for the remaining file blocks, which can effectively save the query time and download time of file blocks , which can improve the overall efficiency of file downloads.
下载请求通常包括目标文件块的文件块名称,如上文所述的Object ID等,通常一条下载请求对应一个目标文件块。请求节点可以在一个目标文件块完成下载之后,再生成下一个需要下载的目标文件块的下载请求,也可以在接收到用户的文件下载指令之后,同时生成全部目标文件块的下载请求。其中,请求节点可以根据一定的优先级或者权重来确定优先下载哪一个文件块。The download request usually includes the file block name of the target file block, such as the Object ID mentioned above, etc. Usually, a download request corresponds to one target file block. The requesting node can generate a download request for the next target file block to be downloaded after a target file block is downloaded, or can generate a download request for all target file blocks at the same time after receiving a file download instruction from the user. The requesting node may determine which file block to download first according to a certain priority or weight.
S2、索引节点接收请求节点发送的下载请求,所述下载请求用于下载目标文件块。S2. The index node receives the download request sent by the requesting node, where the download request is used to download the target file block.
索引节点接收到下载请求之后,可以通过解析该下载请求,获得下载请求中包括的目标文件块的文件块名称、下载优先级等信息。After receiving the download request, the index node can obtain the file block name, download priority and other information of the target file block included in the download request by parsing the download request.
S3、索引节点根据所述下载请求获取子分布式散列表DHT中与所述目标文件块对应的全部存储节点,所述子DHT为所述P2P网络对应的DHT中存储于所述索引节点的部分DHT。S3. The index node obtains all storage nodes corresponding to the target file block in the sub-distributed hash table DHT according to the download request, where the sub-DHT is the part of the DHT corresponding to the P2P network that is stored in the index node DHT.
由上文可知,索引节点中存储有P2P网络对应的DHT中的部分DHT,即子DHT,图6为本发明实施例提供的一种索引节点的子DHT的结构示意图,如图6所示,子DHT包括文件块名称及与文件块名称对应的存储节点的节点信息,具体地,子DHT包括M个文件块名称以及存储节点的节点信息,其中,用Hash来标识文件块名称,用Peer来标识文件块对应的存储节点的节点标识,用add_来标识存储节点的索引地。由此,索引节点可以通过匹配目标文件块的文件块名称与子DHT中的文件块名称,判断索引节点中是否存储有与目标文件块对应的存储节点的节点信息。As can be seen from the above, the index node stores part of the DHT in the DHT corresponding to the P2P network, that is, the sub-DHT. FIG. 6 is a schematic structural diagram of a sub-DHT of an index node provided by an embodiment of the present invention, as shown in FIG. The sub-DHT includes the file block name and the node information of the storage node corresponding to the file block name. Specifically, the sub-DHT includes M file block names and the node information of the storage node. Hash is used to identify the file block name, and Peer is used to identify the file block name. Identify the node identifier of the storage node corresponding to the file block, and use add_ to identify the index location of the storage node. Thus, the inode can determine whether the inode stores the node information of the storage node corresponding to the target file block by matching the file block name of the target file block with the file block name in the sub-DHT.
在一种查询结果中,如果目标文件块的文件块名称用Hash a来标识,则图6中存在与目标文件块的文件块名称相同的文件块名称对应的存储节点分别为Peer a1、Peer a2、Peer a3、Peer z5等,假设与目标文件名的文件块名称相同的文件块名称对应的存储节点的数量为N个,则N≤M。这样,就可以从索引节点对应的子DHT中获取到与目标文件块对应的全部存储节点。In a query result, if the file block name of the target file block is identified by Hash a, the storage nodes corresponding to the file block name with the same file block name as the target file block in FIG. 6 are Peer a1 and Peer a2 respectively. , Peer a3, Peer z5, etc. Assuming that the number of storage nodes corresponding to the file block name with the same file block name as the target file name is N, then N≤M. In this way, all storage nodes corresponding to the target file block can be obtained from the sub-DHT corresponding to the index node.
在一种查询结果中,如果目标文件块的文件块名称用Hash c来标识,则图6中显然不存在与目标文件块的文件块名称相同的文件块名称,这样也就无法从索引节点中查询到存储有目标文件块的存储节点的节点信息。此时,索引节点需要将下载请求发 送至相邻节点,在相邻节点中查询目标文件块的存储节点的节点信息,其中,由于相邻节点承担了查询工作,因此,相邻节点又可以称为相邻索引节点。重复上述过程,直至某一相邻索引节点查询到目标文件块的存储节点的节点信息为止,此时,在该相邻索引节点中就可以实现上一种查询结果,即获取到与目标文件块对应的全部存储节点。In a query result, if the file block name of the target file block is identified by Hash c, obviously there is no file block name that is the same as the file block name of the target file block in Fig. 6, so it cannot be retrieved from the index node. Query the node information of the storage node that stores the target file block. At this time, the index node needs to send the download request to the adjacent node, and query the node information of the storage node of the target file block in the adjacent node. Because the adjacent node undertakes the query work, the adjacent node can also be called is the adjacent index node. Repeat the above process until a certain adjacent index node queries the node information of the storage node of the target file block. At this time, the previous query result can be realized in the adjacent index node, that is, the same query result as the target file block is obtained. All corresponding storage nodes.
S4、索引节点从所述全部存储节点中选取多个预选存储节点。S4. The index node selects a plurality of preselected storage nodes from all the storage nodes.
为了可以有效减少进一步由请求节点检测性能的节点数量,因此,索引节点需要从获取到的全部存储节点中选取多个预选存储节点。例如,从上述N个存储节点中选取m个预选存储节点,其中,1≤m≤N,m的具体数量可以由用户根据经验自行设定,或者由索引节点通过相关算法设定,此处不对m的设定方法加以限定。In order to effectively reduce the number of nodes whose performance is further checked by the requesting node, the index node needs to select multiple pre-selected storage nodes from all the obtained storage nodes. For example, m pre-selected storage nodes are selected from the above N storage nodes, where 1≤m≤N, and the specific number of m can be set by the user according to experience, or set by the index node through a related algorithm. The setting method of m is limited.
进一步地,为了提高后续目标存储节点与全部存储节点中性能最优的存储节点的贴合度,可以采用随机选取的方式选取预选存储节点,以降低选择的偶然性。Further, in order to improve the fit between the subsequent target storage node and the storage node with the best performance among all the storage nodes, a preselected storage node may be selected by random selection to reduce the chance of selection.
为了与索引节点中的子DHT加以区分,可以在子DHT中对预选存储节点进行特殊标识,例如,在预选存储节点的节点标识上添加特殊标识,或者,在子DHT中对预选存储节点所在的行进行填色等。本实施例中为了与子DHT加以区分,针对预选存储节点生成一个单独的DHT,即局部DHT。图7为本实施例提供的一种局部DHT的结构示意图,如图7所示,局部DHT至少包含m个预选存储节点的节点标识、对应的目标文件块的文件块名称,局部DHT还可以包含预选存储节点的索引地址,即局部DHT中的内容可以与预选存储节点在子DHT中对应的内容完全相同,通过复制等方式写入,也可以是预选存储节点在子DHT中的部分内容,经过选取再写入局部DHT。图7中Peer 1~Peer m中1~m代表为预选存储节点中的第几个预选存储节点,并不代表具体的节点标识。其中,局部DHT可以为一张预先设立为索引节点中的表格,当索引节点随机选取出预选存储节点之后,可以直接价格预选存储节点对应的节点标识、文件块名称、索引地址等信息写入该表格,以生成最终的局部DHT,这样,可以有效提高局部DHT的生成效率。In order to distinguish it from the sub-DHT in the index node, the pre-selected storage node can be specially identified in the sub-DHT. line for coloring, etc. In this embodiment, in order to distinguish it from the sub-DHT, a separate DHT, that is, a local DHT, is generated for the preselected storage node. FIG. 7 is a schematic structural diagram of a local DHT provided in this embodiment. As shown in FIG. 7 , the local DHT at least includes node identifiers of m preselected storage nodes and file block names of corresponding target file blocks. The local DHT may also include The index address of the pre-selected storage node, that is, the content in the local DHT can be exactly the same as the corresponding content of the pre-selected storage node in the sub-DHT. It can be written by copying or other methods, or it can be part of the content of the pre-selected storage node in the sub-DHT. Select Rewrite Local DHT. 1 to m in Peer 1 to Peer m in FIG. 7 represent the number of pre-selected storage nodes in the pre-selected storage nodes, and do not represent specific node identifiers. Among them, the local DHT can be a table pre-established as an index node. After the index node randomly selects the pre-selected storage node, the information such as the node identifier, file block name, index address and other information corresponding to the pre-selected storage node can be directly written into the index node. table to generate the final local DHT, which can effectively improve the generation efficiency of the local DHT.
S5、索引节点将所述多个预选存储节点发送至所述请求节点。S5. The index node sends the plurality of preselected storage nodes to the requesting node.
索引节点可以直接根据子DHT中预选存储节点对应的节点信息,例如节点标识、索引地址等信息发送至请求节点。索引节点也可以将生成的局部DHT直接发送至请求节点,这样,不仅不容易遗漏预选存储节点的节点信息,节省从子DHT中查询预选存储节点的节点信息的时间,而且,还可以令请求节点接收到带有一定规范格式的节点信息,方便请求节点进行后续数据处理。The index node can directly send to the requesting node according to the node information corresponding to the preselected storage node in the sub-DHT, such as the node identification, index address and other information. The index node can also directly send the generated local DHT to the requesting node. In this way, it is not easy to miss the node information of the pre-selected storage node and save the time of querying the node information of the pre-selected storage node from the sub-DHT. Node information with a certain standard format is received, which is convenient for requesting nodes to perform subsequent data processing.
进一步地,如果索引节点生成了局部DHT,在索引节点向请求节点发送了局部DHT之后,可以清空局部DHT中存储节点的节点信息,这样,该索引节点如果接收到新的下载请求,就可以将对应于新的下载请求的预选存储节点的节点信息写入局部DHT,形成新的局部DHT,从而实现局部DHT的重复利用性。Further, if the index node generates a local DHT, after the index node sends the local DHT to the requesting node, the node information of the storage node in the local DHT can be cleared, so that if the index node receives a new download request, it can The node information of the preselected storage node corresponding to the new download request is written into the local DHT to form a new local DHT, thereby realizing the reusability of the local DHT.
S6、请求节点接收索引节点发送的预选存储节点,所述预选存储节点为从子分布式散列表DHT中与目标文件块对应的全部存储节点中随机选取的存储节点,所述子DHT为所述P2P网络对应的DHT中存储于所述索引节点的部分DHT。S6. The requesting node receives the preselected storage node sent by the index node, where the preselected storage node is a storage node randomly selected from all storage nodes corresponding to the target file block in the sub-distributed hash table DHT, and the sub-DHT is the Part of the DHT stored in the index node in the DHT corresponding to the P2P network.
请求节点可以接收到索引节点发送的对应于下载请求的预选存储节点,例如节点 信息,如上例Peer 1~Peer m的节点信息,当然,如果索引节点生成了局部DHT,那么请求节点也将收到如图7所示的局部DHT,局部DHT中可以清晰地浏览到各预选存储节点的节点信息,并且可以快速准确地获取各预选存储节点的节点信息。The requesting node can receive the pre-selected storage nodes corresponding to the download request sent by the index node, such as node information, such as the node information of Peer 1 to Peer m in the above example. Of course, if the index node generates a local DHT, the requesting node will also receive As shown in the local DHT in FIG. 7 , the node information of each preselected storage node can be clearly browsed in the local DHT, and the node information of each preselected storage node can be quickly and accurately obtained.
S7、请求节点获取存储节点列表,所述存储节点列表中的存储节点用于与所述预选存储节点共同构成存储节点集合。S7. The requesting node obtains a storage node list, where the storage nodes in the storage node list are used to form a storage node set together with the preselected storage nodes.
S8、请求节点基于所述存储节点集合下载所述目标文件块。S8. The requesting node downloads the target file block based on the storage node set.
S9、请求节点测试所述存储节点集合中各存储节点的预设性能指标。S9. Request the node to test the preset performance indicators of each storage node in the storage node set.
请求节点接收到索引节点发送的预选存储节点之后,并非直接从全部预选存储节点中下载目标文件块,而是,需要对各个预选存储节点的性能进行测试,同时,本实施例中还需要对存储于请求节点中的存储节点列表中的各存储节点的性能进行测试,其中,上述存储节点为上一文件块下载操作后选取的预设性能指标符合预设性能指标范围,且存储有所述目标文件块的存储节点。After receiving the pre-selected storage nodes sent by the index node, the requesting node does not directly download the target file blocks from all the pre-selected storage nodes, but needs to test the performance of each pre-selected storage node. The performance of each storage node in the storage node list in the requesting node is tested, wherein the above-mentioned storage node is the preset performance index selected after the last file block download operation that meets the preset performance index range, and stores the target. Storage node for file blocks.
例如,(1)请求节点上一文件块下载操作对应的下载请求为A1,请求下载文件a中的首个文件块a1,则在下载文件块a1的过程中,索引节点会根据下载请求A1给请求节点发送m个预选存储节点的节点信息,此时,由于请求节点是下载文件a中的首个文件块,因此,请求节点中并无下载文件a中文件块的相关存储节点的记录,因此,请求节点只需要测试这m个预选存储节点的预设性能指标即可。当该文件下载操作结束后,请求节点就可以从这m个预选存储节点中选取n个性能最优的存储节点进行记录,以生成存储节点列表,其中,1≤n≤m。图8为本发明实施例提供的一种存储节点列表的结构示意图,图8中Peer 1~Peer n中1~n代表为存储节点列表中的第几个存储节点,并不代表具体的节点标识。For example, (1) the download request corresponding to the file block download operation on the requesting node is A1, and the first file block a1 in the file a is requested to be downloaded, then in the process of downloading the file block a1, the index node will give the download request A1 to The requesting node sends the node information of m pre-selected storage nodes. At this time, since the requesting node is the first file block in the downloaded file a, the requesting node does not have a record of the storage node related to the file block in the downloaded file a. Therefore, , the requesting node only needs to test the preset performance indicators of the m preselected storage nodes. After the file download operation ends, the requesting node can select n storage nodes with the best performance from the m preselected storage nodes for recording, so as to generate a storage node list, where 1≤n≤m. FIG. 8 is a schematic structural diagram of a storage node list provided by an embodiment of the present invention. In FIG. 8, 1 to n in Peer 1 to Peer n represent the number of storage nodes in the storage node list, and do not represent specific node identifiers. .
(2)进一步地,基于上述下载文件块a1的操作,当请求节点的当前文件块下载操作对应的下载请求为A2,请求下载文件a中的第二个文件块a2时,则在下载文件块a2的过程中,索引节点会根据下载请求A2给请求节点再次发送m个预选存储节点的节点信息,此时,请求节点不仅可以从这m个预选存储节点中下载文件块a2,还可以从上一文件块下载操作后记录的n个存储节点中下载文件块a2。因此,此时,需要综合考虑m个预选存储节点和n个存储节点的性能,并从中确定下载文件块a2的存储节点。当该文件下载操作结束后,请求节点需要从m个预选存储节点和n个存储节点的性能中再次选取n个性能最优的存储节点记录于存储节点列表中。(2) Further, based on the above-mentioned operation of downloading the file block a1, when the download request corresponding to the current file block download operation of the requesting node is A2, and when requesting to download the second file block a2 in the file a, then the download file block In the process of a2, the index node will send the node information of m preselected storage nodes to the requesting node again according to the download request A2. At this time, the requesting node can not only download the file block a2 from the m preselected storage nodes, but also download the file block a2 from the above A file block a2 is downloaded from the n storage nodes recorded after a file block download operation. Therefore, at this time, it is necessary to comprehensively consider the performance of the m preselected storage nodes and the performance of the n storage nodes, and determine the storage node from which the file block a2 is downloaded. After the file download operation is completed, the requesting node needs to select n storage nodes with the best performance from the m pre-selected storage nodes and the performance of the n storage nodes and record them in the storage node list.
需要说明的是,如果P2P网络中的存储节点A中存储文件a,也就是对应存储文件a的全部文件块,那么,这些文件块对应的存储节点的节点信息均会对应存储节点A的节点信息。如果请求节点针对目标文件块a1(目标文件块a1为文件a的一个文件块)发起下载请求A,并接收到索引节点反馈的预选存储节点中包括存储节点A,且通过对各存储节点的性能测试得到多个最优存储节点,其中包括存储节点A,那么,当请求节点继续请求下载文件a中的其他文件块时,例如文件块a2,存储节点A中,包括文件块a2,因此,在请求节点下载文件块a2时,仍然可以以存储节点A作为一个下载文件块a2的存储节点,并不会存在在最优存储节点中无法下载目标文件块的问题,因此,上述用于测试性能的存储节点的范围有效。It should be noted that if the storage node A in the P2P network stores the file a, that is, all the file blocks corresponding to the storage file a, then the node information of the storage node corresponding to these file blocks will correspond to the node information of the storage node A. . If the requesting node initiates a download request A for the target file block a1 (the target file block a1 is a file block of file a), and receives the feedback from the index node, the pre-selected storage nodes include storage node A, and through the performance of each storage node The test obtains multiple optimal storage nodes, including storage node A, then, when the requesting node continues to request to download other file blocks in file a, such as file block a2, storage node A includes file block a2, therefore, in When requesting the node to download the file block a2, the storage node A can still be used as a storage node for downloading the file block a2, and there is no problem that the target file block cannot be downloaded in the optimal storage node. The range of storage nodes is valid.
(3)更进一步地,当请求节点继续下载文件a中的其他文件块时,则可以重复(2) 中的下载过程。其中,当再次确定出n个存储节点之后,请求节点就可以利用这n个存储节点的节点信息替换存储节点列表中的节点信息,以更新存储节点列表。通常,可以用OPT_index,OPT_metric来表示存储节点列表中的存储节点,其中,OPT_index可以为存储节点对应的哈希值(节点标识),OPT_metric用于标识请求节点到该存储节点的传输路径的负载情况。(3) Further, when the requesting node continues to download other file blocks in the file a, the downloading process in (2) can be repeated. Wherein, after the n storage nodes are determined again, the requesting node can replace the node information in the storage node list with the node information of the n storage nodes to update the storage node list. Generally, OPT_index and OPT_metric can be used to represent the storage nodes in the storage node list, where OPT_index can be the hash value (node identifier) corresponding to the storage node, and OPT_metric is used to identify the load of the transmission path from the requesting node to the storage node. .
基于上述过程,当请求节点接收到索引节点发送的预选存储节点的节点信息之后,需要首先检测请求节点中是否存储有存储节点列表。在一种实现方式中,请求节点在下载文件之前,预先建立存储节点列表的表格,并在每一次下载目标文件块之后,将所选取的存储节点的节点信息写入该存储节点列表的表格中,此时,可以通过检测该表格中是否存在字符,或者是否存在关于节点信息的字符来判断请求节点中是否存储有存储节点列表,例如,当不存在字符,或者不存在与节点信息有关的字符时,判定不存在存储节点列表,那么请求节点当前文件下载操作对应下载文件中的首个文件块。在另一种实现方式中,请求节点在每一次下载目标文件块之后,将所选取的存储节点的节点信息生成一张存储节点列表。此时,可以直接检测请求节点是否存在存储节点列表。Based on the above process, after the requesting node receives the node information of the preselected storage node sent by the index node, it needs to first detect whether the requesting node stores a storage node list. In an implementation manner, the requesting node pre-establishes a table of storage node lists before downloading a file, and writes the node information of the selected storage node into the table of the storage node list after each download of the target file block. , at this time, it can be determined whether there is a storage node list stored in the request node by detecting whether there are characters in the table, or whether there are characters related to node information. For example, when there are no characters, or there is no character related to node information When it is determined that there is no storage node list, the current file download operation of the requesting node corresponds to the first file block in the downloaded file. In another implementation manner, after each download of the target file block, the requesting node generates a storage node list from the node information of the selected storage node. At this point, it can be directly detected whether the requesting node has a storage node list.
得到存储节点集合之后,对存储节点集合中的各个存储节点进行预设性能指标测试,其中,预设性能指标可以为传输时延、往返时延、可用带宽中的一种或者几种的组合。例如,使用PING工具探测请求节点到各个存储节点的传输时延,使用IPerf工具探测请求节点到各个存储节点的可用带宽等。示例地,测试后的存储节点可以记录为Peer(Hash),Hash_metric,其中,Peer为存储节点,Hash为标识存储节点的哈希值,Hash_metric为标识请求节点到该存储节点的传输路径的负载情况。After the storage node set is obtained, a preset performance index test is performed on each storage node in the storage node set, where the preset performance index may be one or a combination of transmission delay, round-trip delay, and available bandwidth. For example, use the PING tool to detect the transmission delay from the request node to each storage node, and use the IPerf tool to detect the available bandwidth from the request node to each storage node. For example, the tested storage node can be recorded as Peer(Hash), Hash_metric, where Peer is the storage node, Hash is the hash value that identifies the storage node, and Hash_metric is the load status of the transmission path that identifies the request node to the storage node .
在一种实现方式中,请求节点可以针对每一个下载请求,对存储节点集合中的每一个存储节点的性能进行测试。在一种实现方式中,请求节点也可以选择周期性的对存储节点列表中的存储节点的性能进行测试,在不需要对存储节点列表中的存储节点进行性能测试时,可以直接参考存储节点列表中记录的存储节点的性能。在一种实现方式中,请求节点也可以选择在接收到存储节点列表中存储节点发生状态变化时,对这些存储节点的性能进行测试,在不需要对存储节点列表中的存储节点进行性能测试时,可以直接参考存储节点列表中记录的存储节点的性能。In an implementation manner, the requesting node may test the performance of each storage node in the storage node set for each download request. In an implementation manner, the requesting node can also choose to periodically test the performance of the storage nodes in the storage node list, and can directly refer to the storage node list when the performance test of the storage nodes in the storage node list is not required. The performance of the storage node as documented in . In an implementation manner, the requesting node can also choose to test the performance of the storage nodes in the storage node list when the state changes of the storage nodes are received. , you can directly refer to the storage node performance recorded in the storage node list.
S10、请求节点获取至少一个测试结果符合预设性能指标阈值的目标存储节点的节点信息。S10. Request the node to acquire node information of at least one target storage node whose test result meets a preset performance indicator threshold.
请求节点可以通过上述测试得到各个存储节点对应的预设性能指标的测试结果,这样,就可以根据这些测试结果,从中选取符合预设性能指标阈值的存储节点作为最终下载目标文件块的目标存储节点。The requesting node can obtain the test results of the preset performance indicators corresponding to each storage node through the above test. In this way, according to these test results, a storage node that meets the preset performance indicator threshold can be selected as the target storage node for the final download of the target file block. .
在一种实现方式中,可以从全部存储节点中选取性能最优的一个存储节点作为目标存储节点,这样,可以有效提高下载速度,并减少下载操作对各个存储节点的资源占用。In an implementation manner, a storage node with the best performance may be selected from all storage nodes as a target storage node, so that the download speed can be effectively improved and the resource occupation of each storage node by the download operation can be reduced.
在另一种实现方式中,如果P2P网络相对不太稳定,每个存储节点可能随时退出P2P网络,那么仅选取一个目标存储节点进行下载的方式容易出现目标存储节点失效,而无法下载的问题,为了尽可能保证下载过程的可靠性,可以选择多个目标存储节点。 例如,根据预选存储节点的数量和存储节点列表中存储节点的数量确定目标存储节点的数量。例如,假设P2P网络中每个存储节点失效的概率相同,均为p 0,请求节点从存储节点集合中各存储节点获得下载过程的可靠性为P,请求节点可以根据下式从m个预选存储节点和存储节点列表中的n个存储节点中选取N个目标存储节点, In another implementation, if the P2P network is relatively unstable, and each storage node may exit the P2P network at any time, the method of selecting only one target storage node for downloading is prone to the problem that the target storage node fails and cannot be downloaded. In order to ensure the reliability of the download process as much as possible, multiple target storage nodes can be selected. For example, the number of target storage nodes is determined according to the number of preselected storage nodes and the number of storage nodes in the storage node list. For example, assuming that the probability of failure of each storage node in the P2P network is the same, which is p 0 , and the reliability of the download process obtained by the requesting node from each storage node in the storage node set is P, the requesting node can select from m preselected storage nodes according to the following formula. Select N target storage nodes from the n storage nodes in the node and storage node list,
Figure PCTCN2020106280-appb-000001
Figure PCTCN2020106280-appb-000001
基于这种实现方式,请求节点可以将性能最优的N个存储节点作为目标存储节点。进一步地,在这种实现方式中,请求节点可以选取n个存储节点来更新存储节点列表,其中,n可以等于N,即直接将N个目标存储节点作为存储节点进行记录;n也可以不等于N,即选择n个性能最优的目标存储节点作为存储节点进行记录。Based on this implementation, the requesting node can use the N storage nodes with the best performance as the target storage nodes. Further, in this implementation manner, the requesting node may select n storage nodes to update the storage node list, where n may be equal to N, that is, the N target storage nodes are directly recorded as storage nodes; n may not be equal to N, that is, select n target storage nodes with the best performance as storage nodes for recording.
S11、请求节点根据所述目标存储节点的节点信息下载所述目标文件块。S11. The requesting node downloads the target file block according to the node information of the target storage node.
在一种实现方式中,如果目标存储节点只有1个,则请求节点只需要获取该目标存储节点的索引地址,并根据索引地址下载目标文件块即可。In an implementation manner, if there is only one target storage node, the requesting node only needs to obtain the index address of the target storage node, and download the target file block according to the index address.
在一种实现方式中,如果目标存储节点有多个,则请求节点需要获取每个目标存储节点的索引地址,并根据这些索引地址分别从对应的目标存储节点下载目标文件块,其中,当请求节点从任意一个目标存储节点完成下载时,整体下载过程结束。In an implementation manner, if there are multiple target storage nodes, the requesting node needs to obtain the index address of each target storage node, and download the target file blocks from the corresponding target storage node according to these index addresses. When the node completes the download from any target storage node, the overall download process ends.
基于上述选取目标存储节点的过程可知,针对待下载文件中的每一个非首个下载的文件块来说,其对应的目标存储节点均是综合考虑前一文件下载操作选取出的性能最优的存储节点,和本次文件下载操作中新加入的预选存储节点的性能,进行选择的。可见,对于每一个目标文件块的下载过程都是一次迭代选取的过程,可以起到从性能优良的存储节点中选择性能更加优良的存储节点的效果,同时,由索引节点不断加入新的可选项以保证存储节点选择的可更新性,起到对目标存储节点选择范围一定的扩充性。而且,随着迭代过程,各个文件块所对应的目标存储节点会越来越接近存储有目标文件块的全部存储节点中性能最优的全局最优存储节点,即得到全局最优解。可见,对于整个文件的下载过程,本发明实施例提供的文件下载方法可以为各个文件块提供性能相对较高的目标存储节点,从而提高文件块的下载效率和下载质量。Based on the above process of selecting a target storage node, it can be known that for each non-first downloaded file block in the file to be downloaded, the corresponding target storage node is the one with the best performance selected by comprehensively considering the previous file download operation. The storage node and the performance of the newly added pre-selected storage node in this file download operation are selected. It can be seen that the download process of each target file block is an iterative selection process, which can have the effect of selecting a storage node with better performance from storage nodes with excellent performance, and at the same time, the index node continues to add new options In order to ensure the updateability of storage node selection, it can expand the selection range of target storage nodes to a certain extent. Moreover, with the iterative process, the target storage node corresponding to each file block will get closer and closer to the global optimal storage node with the best performance among all the storage nodes storing the target file block, that is, the global optimal solution is obtained. It can be seen that, for the entire file downloading process, the file downloading method provided by the embodiment of the present invention can provide a target storage node with relatively high performance for each file block, thereby improving the downloading efficiency and downloading quality of the file block.
通过上述迭代过程得到全局最优解的过程可以通过结合排队论模型及李雅普诺夫漂移函数进行证明,理论证明相关的模型参数定义如下:The process of obtaining the global optimal solution through the above iterative process can be proved by combining the queuing theory model and the Lyapunov drift function. The relevant model parameters of the theoretical proof are defined as follows:
N:每个文件块对应存储节点的总数,或者同一文件块最大并发的下载请求量N: The total number of storage nodes corresponding to each file block, or the maximum concurrent download requests for the same file block
δ i:第i个请求节点上,下载请求发出速率的均值 δ i : the mean value of the download request sending rate on the i-th requesting node
λ j:第j个存储节点上,下载请求到达速率的均值 λ j : the mean value of the arrival rate of download requests on the jth storage node
μ j:第j个存储节点,下载速率的均值 μ j : the jth storage node, the mean download rate
q k(t):t时刻,第k个存储节点在本发明实施例提供的文件下载方法下所积压的请求量 q k (t): at time t, the amount of requests backlogged by the kth storage node under the file download method provided by the embodiment of the present invention
Figure PCTCN2020106280-appb-000002
t时刻,第i个请求节点在本发明实施例提供的文件下载方法下所选择的目标存储节点的请求积压量
Figure PCTCN2020106280-appb-000002
At time t, the request backlog of the target storage node selected by the i-th requesting node under the file download method provided by the embodiment of the present invention
q *(t):t时刻,全局最优存储节点的请求积压量 q * (t): At time t, the request backlog of the globally optimal storage node
K:同一时刻,每个存储节点最大允许并发到达的下载请求数目K: At the same time, the maximum number of download requests allowed to arrive concurrently for each storage node
本模型以整体文件的下载时间为性能指标,比较全局与局部性能最优存储节点,其中,全局最优存储节点是指目标文件块对应的全部存储节点中性能最优的存储节点; 局部最优性能存储节点是指目标文件块对应的目标存储节点。考察收敛速度最慢的情况:n=m=1,其中,m为预选存储节点的数量,n为下载目标文件块后记录的性能最优存储节点的数量,其中,当n=1时,请求节点记录的局部最优性能存储节点就是目标存储节点,若此时文件下载方法收敛,则其它收敛速度更快的文件下载方法也是收敛的。假设每个时间点,每个存储节点最多处理请求缓存队列中的一个文件块对应的下载请求。根据排队论模型的结果,对于任一时刻,第i个存储节点有文件块下载请求到达的概率为:In this model, the overall file download time is used as the performance index, and the global and local optimal storage nodes are compared. Among them, the global optimal storage node refers to the storage node with the best performance among all the storage nodes corresponding to the target file block; The performance storage node refers to the target storage node corresponding to the target file block. Consider the case with the slowest convergence speed: n=m=1, where m is the number of pre-selected storage nodes, and n is the number of storage nodes with the best performance recorded after downloading the target file block, where, when n=1, the request The local optimal performance storage node recorded by the node is the target storage node. If the file download method converges at this time, other file download methods with faster convergence speed will also converge. It is assumed that at each point in time, each storage node processes a download request corresponding to one file block in the request cache queue at most. According to the results of the queuing theory model, at any moment, the probability that the i-th storage node has a file block download request arrives as follows:
Figure PCTCN2020106280-appb-000003
Figure PCTCN2020106280-appb-000003
同理,第j个存储节点有下载请求被处理的概率为:Similarly, the probability that the jth storage node has a download request processed is:
Figure PCTCN2020106280-appb-000004
Figure PCTCN2020106280-appb-000004
在n=m=1时,本发明方案每次选中全局最优存储节点
Figure PCTCN2020106280-appb-000005
的概率至少为1/N。由于同一时刻每个存储节点最多容纳K个同时调度过来的下载请求;超过K个时则发生请求丢弃。因此有,当j=i时:
When n=m=1, the solution of the present invention selects the global optimal storage node each time
Figure PCTCN2020106280-appb-000005
The probability is at least 1/N. At the same time, each storage node can accommodate at most K download requests that are scheduled at the same time; when more than K, the request will be discarded. Therefore, when j=i:
Figure PCTCN2020106280-appb-000006
Figure PCTCN2020106280-appb-000006
同理,任意时刻,第j个存储节点有下载请求被成功传送过来的概率为:Similarly, at any time, the probability that the jth storage node has a download request successfully transmitted is:
Figure PCTCN2020106280-appb-000007
Figure PCTCN2020106280-appb-000007
假设本发明实施例中不引入上一轮性能最优的存储节点的记录(n=0),则调度策略不收敛,具体证明过程如下:Assuming that the record of the storage node with the best performance in the previous round (n=0) is not introduced in the embodiment of the present invention, the scheduling policy does not converge, and the specific proof process is as follows:
考察第N个存储节点:对于任意一个请求节点,下载请求被调度到第N个存储节点的最大概率为:m/N。因此,第N个存储节点最大可能的请求到达速率为:Consider the Nth storage node: For any requesting node, the maximum probability that the download request is scheduled to the Nth storage node is: m/N. Therefore, the maximum possible request arrival rate for the Nth storage node is:
Figure PCTCN2020106280-appb-000008
Figure PCTCN2020106280-appb-000008
对于余下的N-1个存储节点,下载请求到达速率和的最小值为:For the remaining N-1 storage nodes, the minimum download request arrival rate sum is:
Figure PCTCN2020106280-appb-000009
Figure PCTCN2020106280-appb-000009
如果下式成立,根据排队论模型的结论,可以证明整个调度方案是不收敛的:If the following formula holds, according to the conclusion of the queuing theory model, it can be proved that the whole scheduling scheme is not convergent:
Figure PCTCN2020106280-appb-000010
Figure PCTCN2020106280-appb-000010
而下载请求产生和处理速率仅仅满足:The download request generation and processing rates only satisfy:
Figure PCTCN2020106280-appb-000011
Figure PCTCN2020106280-appb-000011
具体的均值取值分布则可以使不均匀的,因此可以找到一组输入输出速率的分布满足:The specific mean value distribution can be made uneven, so a set of input and output rate distributions can be found to satisfy:
Figure PCTCN2020106280-appb-000012
Figure PCTCN2020106280-appb-000012
显然,满足(1)的下载请求到达和处理均值速率分布很容易构造出来,此时,前N-1个存储节点组成的子系统是不稳定的。因此整个系统也是不稳定的。所以在n=0的情况下,是不收敛的。Obviously, the average rate distribution of download request arrival and processing satisfying (1) is easy to construct. At this time, the subsystem composed of the first N-1 storage nodes is unstable. So the whole system is also unstable. So in the case of n=0, it is not convergent.
下面,继续证明引入了上一文件块下载操作的性能最优的存储节点的记录(n>0),整个随机下载策略是收敛于全局最优存储节点的:Next, continue to prove that the record of the storage node with the best performance of the previous file block download operation (n>0) is introduced, and the entire random download strategy converges to the globally optimal storage node:
构建二次李雅普诺夫函数V,通过证明该李雅普诺夫函数存在一个负期望的单步漂移,说明算法的收敛性。李雅普诺夫函数构造如下:The quadratic Lyapunov function V is constructed, and the convergence of the algorithm is demonstrated by proving that the Lyapunov function has a negative expected single-step drift. The Lyapunov function is constructed as follows:
Figure PCTCN2020106280-appb-000013
Figure PCTCN2020106280-appb-000013
下证明存在ε>0,k>0使得:The following proves that ε > 0, k > 0 such that:
E[V(t+1)-V(t)|V(t)]≤εV(t)+kE[V(t+1)-V(t)|V(t)]≤εV(t)+k
由于同一时刻每个存储节点最多容纳K个同时调度过来的下载请求,因此有:Since each storage node can accommodate at most K download requests scheduled at the same time at the same time, there are:
Figure PCTCN2020106280-appb-000014
Figure PCTCN2020106280-appb-000014
同时,每个存储节点同一时刻最多处理一个下载请求,因此有:At the same time, each storage node processes at most one download request at the same time, so there are:
q *(t)-q *(t+1)≤1   (3) q * (t)-q * (t+1)≤1 (3)
结合(2)(3)有:Combining (2) (3) with:
Figure PCTCN2020106280-appb-000015
Figure PCTCN2020106280-appb-000015
考察李雅普诺夫函数的第一项,令:Examining the first term of the Lyapunov function, let:
Figure PCTCN2020106280-appb-000016
Figure PCTCN2020106280-appb-000016
有(下载请求被调度到存储节点i的概率,乘以队列差平方):There are (probability that a download request is scheduled to storage node i, multiplied by the square of the queue difference):
Figure PCTCN2020106280-appb-000017
Figure PCTCN2020106280-appb-000017
将(4)代入(5),对李雅普诺夫函数进行放缩,得到:Substitute (4) into (5) and scale the Lyapunov function to get:
Figure PCTCN2020106280-appb-000018
Figure PCTCN2020106280-appb-000018
李雅普诺夫函数第一项的上界如下:The upper bound of the first term of the Lyapunov function is as follows:
Figure PCTCN2020106280-appb-000019
Figure PCTCN2020106280-appb-000019
下面继续考察李雅普诺夫函数的第二项,令
Figure PCTCN2020106280-appb-000020
其中,k=i,则有:
Let's continue to examine the second term of the Lyapunov function, let
Figure PCTCN2020106280-appb-000020
Among them, k=i, then there are:
Figure PCTCN2020106280-appb-000021
Figure PCTCN2020106280-appb-000021
根据排队模型的推论有:The inferences from the queuing model are:
Figure PCTCN2020106280-appb-000022
Figure PCTCN2020106280-appb-000022
将(8)代入(7),进一步放缩李雅普诺夫函数,得到:Substituting (8) into (7), and further scaling the Lyapunov function, we get:
Figure PCTCN2020106280-appb-000023
Figure PCTCN2020106280-appb-000023
进一步整理,即有:Further sorting, namely:
Figure PCTCN2020106280-appb-000024
Figure PCTCN2020106280-appb-000024
结合(6)与(9)可得:Combining (6) and (9) we get:
Figure PCTCN2020106280-appb-000025
Figure PCTCN2020106280-appb-000025
接下来,定义:Next, define:
Figure PCTCN2020106280-appb-000026
Figure PCTCN2020106280-appb-000026
Figure PCTCN2020106280-appb-000027
Figure PCTCN2020106280-appb-000027
则有:Then there are:
Figure PCTCN2020106280-appb-000028
Figure PCTCN2020106280-appb-000028
由于q *(t)是全局最优存储节点,因此:q *(t)≤q i(t),进一步有: Since q * (t) is the global optimal storage node, so: q * (t) ≤qi (t), further:
Figure PCTCN2020106280-appb-000029
Figure PCTCN2020106280-appb-000029
排队模型的初始条件为:
Figure PCTCN2020106280-appb-000030
因此有:
The initial conditions of the queuing model are:
Figure PCTCN2020106280-appb-000030
So there are:
Figure PCTCN2020106280-appb-000031
Figure PCTCN2020106280-appb-000031
假设n=m=1时,本发明方案下的目标存储节点没有收敛到全局最优存储节点,则必然存在t,使得当t足够大时,李雅普诺夫函数V(t)的取值极大。由于V(t)=V1(t)+ V2(t),则V1(t)和V2(t)至少有一个取值极大。Assuming that n=m=1, the target storage node under the scheme of the present invention does not converge to the global optimal storage node, then there must be t, so that when t is large enough, the value of the Lyapunov function V(t) is extremely large . Since V(t)=V1(t)+V2(t), at least one of V1(t) and V2(t) is extremely large.
假设V1(t)取值极大,由于
Figure PCTCN2020106280-appb-000032
则说明目标存储节点与全局最优存储节点的偏离程度比较大,且偏离程度不会收敛于一个固定的上界,由于在δ ii取值已知的情况下,c的取值为一个定值:
Assuming that V1(t) is extremely large, since
Figure PCTCN2020106280-appb-000032
Then it shows that the deviation degree between the target storage node and the global optimal storage node is relatively large, and the deviation degree will not converge to a fixed upper bound. Since the values of δ i and μ i are known, the value of c is A fixed value:
Figure PCTCN2020106280-appb-000033
Figure PCTCN2020106280-appb-000033
因此必然存在某一个值t1,使得:Therefore there must be some value t1 such that:
Figure PCTCN2020106280-appb-000034
Figure PCTCN2020106280-appb-000034
此时,将(11),(12),(13)代入(10),可得:At this time, substitute (11), (12), (13) into (10), we can get:
Figure PCTCN2020106280-appb-000035
E[V(t+1)-V(t)|V(t)]<0
Figure PCTCN2020106280-appb-000035
E[V(t+1)-V(t)|V(t)]<0
即存在ε>0,使得:That is, there exists ε>0, such that:
E[V(t+1)-V(t)|V(t)]<-εE[V(t+1)-V(t)|V(t)]<-ε
李雅普诺夫函数存在了一步负期望的漂移,即局部最优存储节点下载策略收敛于全局最优存储节点,与假设矛盾。因此V1(t)不会出现取值极大的情况。The Lyapunov function has a negative expectation drift, that is, the local optimal storage node download strategy converges to the global optimal storage node, which contradicts the assumption. Therefore, V1(t) will not have a very large value.
假设是V2(t)出现了取值极大的情况,则说明必然存在某一个值t2,t≥t 2时全队列负载状况严重,q i(t)取值极大,且在不断增大。假设此时全局最优解q *(t)取值不大,即q *(t)与q i(t)取值相差极大。由于c的取值为一个定值,则有: Assuming that the value of V2(t) is extremely large, it means that there must be a certain value t2. When t≥t 2 , the load condition of the whole queue is serious, and the value of q i (t) is extremely large and keeps increasing. . It is assumed that the value of the global optimal solution q * (t) is not large at this time, that is, the value of q * (t) and q i (t) are very different. Since the value of c is a fixed value, there are:
Figure PCTCN2020106280-appb-000036
Figure PCTCN2020106280-appb-000036
同时根据完全平方式的性质,有:At the same time, according to the properties of the completely flat method, there are:
Figure PCTCN2020106280-appb-000037
Figure PCTCN2020106280-appb-000037
将(12),(14),(15)代入(10)有:Substitute (12), (14), (15) into (10) to have:
Figure PCTCN2020106280-appb-000038
E[V(t+1)-V(t)|V(t)]<0
Figure PCTCN2020106280-appb-000038
E[V(t+1)-V(t)|V(t)]<0
即存在ε>0,使得:That is, there exists ε>0, such that:
E[V(t+1)-V(t)|V(t)]<-εE[V(t+1)-V(t)|V(t)]<-ε
李雅普诺夫函数存在了一步负期望的漂移,与假设矛盾。因此V2(t)不会出现取值极大的情况。The Lyapunov function has a negative expectation drift, which contradicts the hypothesis. Therefore, V2(t) will not have a very large value.
假设此时局最优存储节点q *(t)也取值极大,q *(t)与q i(t)取值相差不大。此时虽然(15)式不会成立,但必然存在t≥t 3使得: Assuming that the optimal storage node q * (t) is also extremely large at this time, the value of q * (t) and q i (t) are not much different. At this time, although the formula (15) will not hold, there must be t≥t 3 such that:
Figure PCTCN2020106280-appb-000039
Figure PCTCN2020106280-appb-000039
将(11),(15),(16)代入(10)可得:Substitute (11), (15), (16) into (10) to get:
Figure PCTCN2020106280-appb-000040
E[V(t+1)-V(t)|V(t)]<0
Figure PCTCN2020106280-appb-000040
E[V(t+1)-V(t)|V(t)]<0
即存在ε>0,使得:That is, there exists ε>0, such that:
E[V(t+1)-V(t)|V(t)]<-εE[V(t+1)-V(t)|V(t)]<-ε
李雅普诺夫函数存在了一步负期望的漂移,与假设矛盾。因此V2(t)不会出现取值极大的情况。The Lyapunov function has a negative expectation drift, which contradicts the hypothesis. Therefore, V2(t) will not have a very large value.
至此,我们排除了所有李雅普诺夫函数不收敛的情况,因此可以论证n=m=1时本方案下的局部最优存储节点是收敛于全局最优存储节点的。更进一步,对于收敛速度更快的(n,m)策略(n>1或m>1)实施例,则收敛性更强。因此本发明实施例中对于每一次文件块下载时所选取的目标存储节点是收敛于全局最优存储节点的,即收敛于全局最优解。So far, we have ruled out the non-convergence of all Lyapunov functions, so it can be demonstrated that when n=m=1, the local optimal storage node under this scheme converges to the global optimal storage node. Further, for the (n, m) policy (n>1 or m>1) embodiment, which converges faster, the convergence is stronger. Therefore, the target storage node selected for each file block download in the embodiment of the present invention converges to the global optimal storage node, that is, to the global optimal solution.
为了进一步说明本发明实施例的技术效果,仿真一个由50个存储节点组成的P2P存储网络,下载文件中前100个文件块的下载场景。我们分别选择全局最优存储节点(忽略性能测量的时间开销)和基于本发明实施例提供的文件下载方法中选择目标存储节点(以n=1,m=2为例),考察本发明所选择的目标存储节点下载时延和全局最优存储节点下载时延的变化,具体如图9所示。可以看到,在下载到大约第60个文件块后,本发明选择的目标存储节点和全局最优存储节点已经完全的重合。因此,本发明实施例所选择的目标存储节点可以收敛至全局最优存储节点。In order to further illustrate the technical effect of the embodiments of the present invention, a P2P storage network composed of 50 storage nodes is simulated to download the first 100 file blocks in a file download scenario. We respectively select the global optimal storage node (ignoring the time overhead of performance measurement) and the target storage node (taking n=1, m=2 as an example) based on the file download method provided by the embodiment of the present invention, and examine the selection of the present invention. The changes of the download delay of the target storage node and the download delay of the global optimal storage node are shown in Figure 9. It can be seen that, after downloading about the 60th file block, the target storage node selected by the present invention and the global optimal storage node have completely overlapped. Therefore, the target storage node selected by the embodiment of the present invention may converge to the globally optimal storage node.
通过上述验证,进一步说明了本发明实施例所提供的文件下载方法通过综合考虑前一文件下载操作选取出的性能最优的存储节点,和本次文件下载操作中新加入的预选存储节点的性能,选择最终用于下载目标文件块的目标存储节点。通过迭代过程,各个文件块所对应的目标存储节点会越来越接近存储有目标文件块的全部存储节点中性能最优的全局最优存储节点,即得到全局最优解。可见,对于整个文件的下载过程,本发明实施例提供的文件下载方法可以为各个文件块提供性能相对较高的目标存储节点,从而提高文件块的下载效率和下载质量。Through the above verification, it is further explained that the file download method provided by the embodiment of the present invention selects the storage node with the best performance by comprehensively considering the previous file download operation, and the performance of the newly added preselected storage node in this file download operation. , select the target storage node that will eventually be used to download the target file block. Through the iterative process, the target storage node corresponding to each file block will get closer and closer to the global optimal storage node with the best performance among all the storage nodes storing the target file block, that is, the global optimal solution is obtained. It can be seen that, for the entire file downloading process, the file downloading method provided by the embodiment of the present invention can provide a target storage node with relatively high performance for each file block, thereby improving the downloading efficiency and downloading quality of the file block.
以上的具体实施方式,对本发明的目的、技术方案和有益效果进行了进一步详细说明,所应理解的是,以上仅为本发明的具体实施方式而已,并不用于限定本发明的保护范围,凡在本发明的技术方案的基础之上,所做的任何修改、等同替换、改进等,均应包括在本发明的保护范围之内。The above specific embodiments further describe the purpose, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above are only specific embodiments of the present invention, and are not intended to limit the protection scope of the present invention. On the basis of the technical solutions of the present invention, any modifications, equivalent replacements, improvements, etc. made shall be included within the protection scope of the present invention.

Claims (19)

  1. 一种文件块下载方法,其特征在于,应用于P2P网络,所述P2P网络包括请求节点和索引节点,所述方法包括:A method for downloading file blocks, characterized in that it is applied to a P2P network, wherein the P2P network includes a request node and an index node, and the method includes:
    所述索引节点接收所述请求节点发送的下载请求,所述下载请求用于下载目标文件块;receiving, by the index node, a download request sent by the requesting node, where the download request is used to download target file blocks;
    所述索引节点根据所述下载请求获取子分布式散列表DHT中与所述目标文件块对应的全部存储节点,所述子DHT为所述P2P网络对应的DHT中存储于所述索引节点的部分DHT;The index node obtains all storage nodes corresponding to the target file block in the sub-distributed hash table DHT according to the download request, where the sub-DHT is the part of the DHT corresponding to the P2P network that is stored in the index node DHT;
    所述索引节点从所述全部存储节点中选取多个预选存储节点;The index node selects a plurality of preselected storage nodes from all the storage nodes;
    所述索引节点将所述多个预选存储节点发送至所述请求节点;sending, by the index node, the plurality of preselected storage nodes to the requesting node;
    所述请求节点接收所述多个预选存储节点;the requesting node receives the plurality of preselected storage nodes;
    所述请求节点获取存储节点列表,所述存储节点列表中的存储节点用于与所述预选存储节点共同构成存储节点集合;obtaining, by the requesting node, a list of storage nodes, where the storage nodes in the storage node list are used to form a storage node set together with the preselected storage nodes;
    所述请求节点基于所述存储节点集合下载所述目标文件块。The requesting node downloads the target file block based on the set of storage nodes.
  2. 一种文件块下载方法,其特征在于,应用于P2P网络中的请求节点,所述方法包括:A method for downloading file blocks, characterized in that it is applied to a requesting node in a P2P network, the method comprising:
    接收索引节点发送的预选存储节点,所述预选存储节点为从子分布式散列表DHT中与目标文件块对应的全部存储节点中选取的存储节点,所述子DHT为所述P2P网络对应的DHT中存储于所述索引节点的部分DHT;Receive a preselected storage node sent by the index node, where the preselected storage node is a storage node selected from all storage nodes corresponding to the target file block in the sub-distributed hash table DHT, and the sub-DHT is the DHT corresponding to the P2P network part of the DHT stored in the index node;
    获取所述请求节点的存储节点列表,所述存储节点列表中的存储节点用于与所述预选存储节点共同构成存储节点集合;obtaining a storage node list of the requesting node, where the storage nodes in the storage node list are used to form a storage node set together with the preselected storage node;
    基于所述存储节点集合下载所述目标文件块。The target file block is downloaded based on the set of storage nodes.
  3. 根据权利要求2所述的方法,其特征在于,所述存储节点列表中的存储节点为上一文件块下载操作后选取的预设性能指标符合预设性能指标范围,且存储有所述目标文件块的存储节点。The method according to claim 2, wherein the storage node in the storage node list is that the preset performance index selected after the last file block download operation conforms to the preset performance index range, and stores the target file Block storage node.
  4. 根据权利要求2或3所述的方法,其特征在于,在所述获取所述请求节点的存储节点列表之前,所述方法还包括:The method according to claim 2 or 3, wherein before the acquiring the storage node list of the requesting node, the method further comprises:
    检测是否存在所述存储节点列表;detecting whether the storage node list exists;
    如果不存在所述存储节点列表,则由所述预选存储节点构成存储节点集合。If the storage node list does not exist, a storage node set is formed by the preselected storage nodes.
  5. 根据权利要求2-4中任一所述的方法,其特征在于,所述基于所述存储节点集合下载所述目标文件块包括:The method according to any one of claims 2-4, wherein the downloading the target file block based on the storage node set comprises:
    测试所述存储节点集合中各存储节点的预设性能指标;testing the preset performance indicators of each storage node in the storage node set;
    获取至少一个测试结果符合预设性能指标阈值的目标存储节点的节点信息;Obtain node information of at least one target storage node whose test result meets the preset performance indicator threshold;
    根据所述目标存储节点的节点信息下载所述目标文件块。The target file block is downloaded according to the node information of the target storage node.
  6. 根据权利要求5所述的方法,其特征在于,如果获取多个测试结果符合预设性能指标阈值的目标存储节点的节点信息,则根据所述预选存储节点的数量以及所述存储节点列表中存储节点的数量确定所述目标存储节点的数量。The method according to claim 5, wherein if the node information of a plurality of target storage nodes whose test results meet the preset performance indicator threshold is obtained, the storage nodes are stored according to the number of the preselected storage nodes and the storage node list. The number of nodes determines the number of target storage nodes.
  7. 根据权利要求5-7中任一所述的方法,其特征在于,在下载所述目标文件块之后,所述方法还包括:The method according to any one of claims 5-7, wherein after downloading the target file block, the method further comprises:
    从所述存储节点集合中选取存储节点,所选取的存储节点为所述存储节点集合中预设性能指标的排名大于或者等于预设排名的存储节点;Selecting a storage node from the storage node set, where the selected storage node is a storage node with a preset performance index ranking greater than or equal to a preset ranking in the storage node set;
    利用所述选取的存储节点更新所述存储节点列表中的存储节点。The storage nodes in the storage node list are updated using the selected storage nodes.
  8. 根据权利要求2-7中任一所述的方法,其特征在于,所述预设性能指标为传输时延、往返时延、可用带宽中的一种或者几种的组合。The method according to any one of claims 2-7, wherein the preset performance index is one or a combination of transmission delay, round-trip delay, and available bandwidth.
  9. 一种请求节点,其特征在于,所述请求节点包括:接收器、处理器、存储器和发送器,所述接收器、所述处理器、所述存储器和所述发送器耦合;所述处理器调用所述存储器中的程序指令,以使所述请求节点执行如下方法:A requesting node, characterized in that the requesting node comprises: a receiver, a processor, a memory and a transmitter, the receiver, the processor, the memory and the transmitter are coupled; the processor Program instructions in the memory are invoked to cause the requesting node to perform the following methods:
    接收索引节点发送的预选存储节点,所述预选存储节点为从子分布式散列表DHT中与目标文件块对应的全部存储节点中选取的存储节点,所述子DHT为所述P2P网络对应的DHT中存储于所述索引节点的部分DHT;Receive a preselected storage node sent by the index node, where the preselected storage node is a storage node selected from all storage nodes corresponding to the target file block in the sub-distributed hash table DHT, and the sub-DHT is the DHT corresponding to the P2P network part of the DHT stored in the index node;
    获取所述请求节点的存储节点列表,所述存储节点列表中的存储节点用于与所述预选存储节点共同构成存储节点集合;obtaining a storage node list of the requesting node, where the storage nodes in the storage node list are used to form a storage node set together with the preselected storage node;
    基于所述存储节点集合下载所述目标文件块。The target file block is downloaded based on the set of storage nodes.
  10. 根据权利要求9所述的请求节点,其特征在于,所述存储节点列表中的存储节点为上一文件块下载操作后选取的预设性能指标符合预设性能指标范围,且存储有所述目标文件块的存储节点。The requesting node according to claim 9, wherein the storage node in the storage node list is a preset performance index selected after a previous file block download operation that conforms to a preset performance index range, and stores the target Storage node for file blocks.
  11. 根据权利要求9或10所述的请求节点,其特征在于,所述请求节点所执行的方法还包括:The requesting node according to claim 9 or 10, wherein the method performed by the requesting node further comprises:
    在所述获取所述请求节点的存储节点列表之前,检测是否存在所述存储节点列表;Before acquiring the storage node list of the requesting node, detecting whether the storage node list exists;
    如果不存在所述存储节点列表,则由所述预选存储节点构成存储节点集合。If the storage node list does not exist, a storage node set is formed by the preselected storage nodes.
  12. 根据权利要求9-11中任一所述的请求节点,其特征在于,所述请求节点所执行的方法还包括:The requesting node according to any one of claims 9-11, wherein the method performed by the requesting node further comprises:
    测试所述存储节点集合中各存储节点的预设性能指标;testing the preset performance indicators of each storage node in the storage node set;
    获取至少一个测试结果符合预设性能指标阈值的目标存储节点的节点信息;Obtain node information of at least one target storage node whose test result meets the preset performance indicator threshold;
    根据所述目标存储节点的节点信息下载所述目标文件块。The target file block is downloaded according to the node information of the target storage node.
  13. 根据权利要求12所述的请求节点,其特征在于,所述请求节点所执行的方法还包括:The requesting node according to claim 12, wherein the method performed by the requesting node further comprises:
    如果获取多个测试结果符合预设性能指标阈值的目标存储节点的节点信息,则根据所述预选存储节点的数量以及所述存储节点列表中存储节点的数量确定所述目标存储节点的数量。If the node information of a plurality of target storage nodes whose test results meet the preset performance indicator threshold is obtained, the number of the target storage nodes is determined according to the number of the preselected storage nodes and the number of storage nodes in the storage node list.
  14. 根据权利要求9-13中任一所述的请求节点,其特征在于,所述请求节点所执行的方法还包括:The requesting node according to any one of claims 9-13, wherein the method executed by the requesting node further comprises:
    在下载所述目标文件块之后,从所述存储节点集合中选取存储节点,所选取的存储节点为所述存储节点集合中预设性能指标的排名大于或者等于预设排名的存储节点;After downloading the target file block, a storage node is selected from the storage node set, and the selected storage node is a storage node with a preset performance index ranking in the storage node set greater than or equal to a preset ranking;
    利用所述选取的存储节点更新所述存储节点列表中的存储节点。The storage nodes in the storage node list are updated using the selected storage nodes.
  15. 根据权利要求9-14中任一所述的请求节点,其特征在于,所述预设性能指标为传输时延、往返时延、可用带宽中的一种或者几种的组合。The requesting node according to any one of claims 9-14, wherein the preset performance indicator is one or a combination of transmission delay, round-trip delay, and available bandwidth.
  16. 一种P2P网络,其特征在于,包括至少一个请求节点和至少一个索引节点,其中,所述索引节点用于接收所述请求节点发送的下载请求,所述下载请求用于下载目标文件块;A P2P network, comprising at least one requesting node and at least one indexing node, wherein the indexing node is used to receive a download request sent by the requesting node, and the download request is used to download a target file block;
    根据所述下载请求获取子分布式散列表DHT中与所述目标文件块对应的全部存储节点,所述子DHT为所述P2P网络对应的DHT中存储于所述索引节点的部分DHT;Obtain all storage nodes corresponding to the target file block in the sub-distributed hash table DHT according to the download request, where the sub-DHT is a part of the DHT stored in the index node in the DHT corresponding to the P2P network;
    从所述全部存储节点中选取多个预选存储节点;selecting a plurality of preselected storage nodes from all the storage nodes;
    将所述多个预选存储节点发送至所述请求节点;sending the plurality of preselected storage nodes to the requesting node;
    所述请求节点用于执行如权利要求5-9中任一所述的方法。The requesting node is configured to perform the method according to any one of claims 5-9.
  17. 根据权利要求16所述的P2P网络,其特征在于,如果所述索引节点不存在与所述目标文件块对应的存储节点,则所述索引节点还用于将所述下载请求发送至相邻索引节点,并由所述相邻索引节点获取与所述目标文件块对应的全部存储节点,其中,所述相邻索引节点为所述P2P网络中与所述索引节点具有指定算法关系的索引节点。The P2P network according to claim 16, wherein if the index node does not have a storage node corresponding to the target file block, the index node is further configured to send the download request to an adjacent index node, and obtain all storage nodes corresponding to the target file block from the adjacent index nodes, wherein the adjacent index nodes are index nodes in the P2P network that have a specified algorithmic relationship with the index nodes.
  18. 根据权利要求16或17所述的P2P网络,其特征在于,所述索引节点还用于:The P2P network according to claim 16 or 17, wherein the index node is further used for:
    生成局部DHT,所述局部DHT包括所述多个预选存储节点;generating a local DHT, the local DHT including the plurality of preselected storage nodes;
    将所述局部DHT发送至所述请求节点。The local DHT is sent to the requesting node.
  19. 根据权利要求18所述的P2P网络,其特征在于,所述索引节点还用于:The P2P network according to claim 18, wherein the index node is further used for:
    在所述将所述局部存储节点列表发送至所述请求节点之后,清空所述局部DHT中的存储节点。After the sending the local storage node list to the requesting node, the storage nodes in the local DHT are emptied.
PCT/CN2020/106280 2020-07-31 2020-07-31 File block download method and apparatus WO2022021357A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202080024741.7A CN114375565B (en) 2020-07-31 2020-07-31 File block downloading method and device
PCT/CN2020/106280 WO2022021357A1 (en) 2020-07-31 2020-07-31 File block download method and apparatus

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2020/106280 WO2022021357A1 (en) 2020-07-31 2020-07-31 File block download method and apparatus

Publications (1)

Publication Number Publication Date
WO2022021357A1 true WO2022021357A1 (en) 2022-02-03

Family

ID=80036892

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/106280 WO2022021357A1 (en) 2020-07-31 2020-07-31 File block download method and apparatus

Country Status (2)

Country Link
CN (1) CN114375565B (en)
WO (1) WO2022021357A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114553885A (en) * 2022-03-02 2022-05-27 上海弘玑信息技术有限公司 DHT network-based storage method and device, electronic equipment and storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060212584A1 (en) * 2005-03-15 2006-09-21 Qian Xiang Shi Ji (Beijing) Technology Development Co. Ltd. Method and system for accelerating downloading of web page content by a peer-to-peer network
CN102195999A (en) * 2010-03-11 2011-09-21 中国移动通信集团公司 Peer-to-Peer network system, resource obtaining method and related device
US20120221647A1 (en) * 2009-11-03 2012-08-30 Telecom Italia S.P.A. Sharing of digital contents in p2p networks exploiting localization data
CN103248695A (en) * 2013-05-07 2013-08-14 北京奇虎科技有限公司 File downloading method and system and server node in CDN
CN109376122A (en) * 2018-09-25 2019-02-22 深圳市元征科技股份有限公司 A kind of file management method, system and block chain node device and storage medium
CN109981751A (en) * 2019-03-06 2019-07-05 珠海金山网络游戏科技有限公司 A kind of document transmission method and system, computer equipment and storage medium

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
GB0303192D0 (en) * 2003-02-12 2003-03-19 Saviso Group Ltd Methods and apparatus for traffic management in peer-to-peer networks
CN101719936A (en) * 2009-12-09 2010-06-02 成都市华为赛门铁克科技有限公司 Method, device and cache system for providing file downloading service
WO2011116502A1 (en) * 2010-03-26 2011-09-29 Nec(China) Co., Ltd. Indexing server and method therefor
US20120011200A1 (en) * 2010-07-06 2012-01-12 Roxbeam Media Network Corporation Method and apparatus for data storage in a peer-to-peer network
CN102833293A (en) * 2011-06-17 2012-12-19 腾讯科技(深圳)有限公司 Method for downloading resources in peer to server and peer (P2SP) network, and client
CN103269351A (en) * 2012-12-07 2013-08-28 北京奇虎科技有限公司 File download method and device
CN108462755B (en) * 2018-03-28 2020-06-05 网宿科技股份有限公司 Method and system for downloading data resources
CN109347893A (en) * 2018-08-09 2019-02-15 玄章技术有限公司 A kind of file memory method and device of block chain network

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060212584A1 (en) * 2005-03-15 2006-09-21 Qian Xiang Shi Ji (Beijing) Technology Development Co. Ltd. Method and system for accelerating downloading of web page content by a peer-to-peer network
US20120221647A1 (en) * 2009-11-03 2012-08-30 Telecom Italia S.P.A. Sharing of digital contents in p2p networks exploiting localization data
CN102195999A (en) * 2010-03-11 2011-09-21 中国移动通信集团公司 Peer-to-Peer network system, resource obtaining method and related device
CN103248695A (en) * 2013-05-07 2013-08-14 北京奇虎科技有限公司 File downloading method and system and server node in CDN
CN109376122A (en) * 2018-09-25 2019-02-22 深圳市元征科技股份有限公司 A kind of file management method, system and block chain node device and storage medium
CN109981751A (en) * 2019-03-06 2019-07-05 珠海金山网络游戏科技有限公司 A kind of document transmission method and system, computer equipment and storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114553885A (en) * 2022-03-02 2022-05-27 上海弘玑信息技术有限公司 DHT network-based storage method and device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN114375565A (en) 2022-04-19
CN114375565B (en) 2023-06-06

Similar Documents

Publication Publication Date Title
US10055262B1 (en) Distributed load balancing with imperfect workload information
US9992274B2 (en) Parallel I/O write processing for use in clustered file systems having cache storage
US10657108B2 (en) Parallel I/O read processing for use in clustered file systems having cache storage
US11392363B2 (en) Implementing application entrypoints with containers of a bundled application
CN108959399B (en) Distributed data deletion flow control method and device, electronic equipment and storage medium
WO2004063928A1 (en) Database load reducing system and load reducing program
US20150220438A1 (en) Dynamic hot volume caching
WO2022021357A1 (en) File block download method and apparatus
CN111694793A (en) Log storage method and device and log query method and device
CN109213774B (en) Data storage method and device, storage medium and terminal
US20190215281A1 (en) Fenced Clone Applications
US20150193343A1 (en) Cache system with multiple cache unit states
CN114338386B (en) Network configuration method and device, electronic equipment and storage medium
US10824640B1 (en) Framework for scheduling concurrent replication cycles
CN113037791B (en) Operation and maintenance method and system, and computer readable storage medium
CN111131078B (en) Message hashing method and device, FPGA module and processor module
KR102082484B1 (en) Apparatus for transmitting and receiving data
US11036439B2 (en) Automated management of bundled applications
CN113438274A (en) Data transmission method and device, computer equipment and readable storage medium
CN116737088B (en) Object migration method and device, electronic equipment and storage medium
WO2020049334A1 (en) A decentralized load-balancing method for resource/traffic distribution
KR102073682B1 (en) Apparatus for transmitting and receiving data for data distribution service
KR102073684B1 (en) Method for transmitting and receiving data for data distribution service
US10908848B2 (en) Automated management of bundled applications
KR102082486B1 (en) Method for transmitting and receiving data

Legal Events

Date Code Title Description
NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20946579

Country of ref document: EP

Kind code of ref document: A1