WO2024036889A1 - Mirror image distribution method, system, and device - Google Patents

Mirror image distribution method, system, and device Download PDF

Info

Publication number
WO2024036889A1
WO2024036889A1 PCT/CN2023/074444 CN2023074444W WO2024036889A1 WO 2024036889 A1 WO2024036889 A1 WO 2024036889A1 CN 2023074444 W CN2023074444 W CN 2023074444W WO 2024036889 A1 WO2024036889 A1 WO 2024036889A1
Authority
WO
WIPO (PCT)
Prior art keywords
peer
peer node
node
image
fragment
Prior art date
Application number
PCT/CN2023/074444
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 网易(杭州)网络有限公司
Publication of WO2024036889A1 publication Critical patent/WO2024036889A1/en

Links

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/1095Replication or mirroring of data, e.g. scheduling or transport for data synchronisation between network nodes
    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F13/00Video games, i.e. games using an electronically generated display having two or more dimensions
    • A63F13/30Interconnection arrangements between game servers and game devices; Interconnection arrangements between game devices; Interconnection arrangements between game servers
    • A63F13/34Interconnection arrangements between game servers and game devices; Interconnection arrangements between game devices; Interconnection arrangements between game servers using peer-to-peer connections
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/14Details of searching files based on file metadata
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/176Support for shared access to files; File sharing support
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/18File system types
    • G06F16/182Distributed file systems
    • G06F16/1824Distributed file systems implemented using Network-attached Storage [NAS] architecture
    • G06F16/183Provision of network file services by network file servers, e.g. by using NFS, CIFS
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/12Applying verification of the received information
    • H04L63/123Applying verification of the received information received data contents, e.g. message integrity
    • 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/34Network arrangements or protocols for supporting network services or applications involving the movement of software or configuration parameters 
    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F2300/00Features of games using an electronically generated display having two or more dimensions, e.g. on a television screen, showing representations related to the game
    • A63F2300/40Features of games using an electronically generated display having two or more dimensions, e.g. on a television screen, showing representations related to the game characterised by details of platform network
    • A63F2300/408Peer to peer connection

Definitions

  • the present disclosure relates to the field of network technology, and in particular, to an image distribution method, system and device.
  • cloud gaming application scenarios it is necessary to provide users with a variety of games to play, and at the same time, it is necessary to meet the gaming needs of users in different regions.
  • cloud gaming systems need to be deployed everywhere, including cloud gaming storage devices. Therefore, it is necessary to maintain game storage in multiple local areas at the same time, and real-time update of game resources becomes a problem.
  • the Qcow2 image is mainly used to save game data.
  • the above method mounts the game data to the cloud game system, and the Qcow2 images in each region remain consistent.
  • the node that stores the game image file first transmits the complete game image file to the child nodes of the node. After the child node obtains the complete game image file, the child node then transmits the complete game image file to its child nodes. After all communicating nodes in the network obtain the complete game image file, the game image file sharing stops. process.
  • a first aspect of an embodiment of the present disclosure provides an image distribution method, applied to a peer-to-peer network including a first peer node and N second peer nodes, wherein the first peer node stores and applies The image file associated with the program, N is a positive integer greater than or equal to 2, includes: the first peer node receives N first query messages sent by the N second peer nodes, and the N first queries The message corresponds to the N second peer nodes one-to-one; the first peer node determines to send the N first peer nodes to the N second peer nodes based on the N first query messages.
  • the image file queried by the query message includes N different image fragments; the first peer node passes through N networks
  • the channel sends the N mirror fragments and N different hash values corresponding to the N mirror fragments to the N second peer nodes, so that the i-th second peer node is consistent with other Two peer nodes interact to obtain the image file, wherein the i-th network channel transmits the i-th image fragment and the i-th image fragment to the i-th second peer node.
  • the network channel of the hash value corresponding to the i-th mirror fragment, i 1,2,...,N.
  • the second aspect of the embodiment of the present disclosure provides an image distribution method, applied to a peer-to-peer network including a control node, a first peer node managed by the control node, and N second peer nodes, wherein the A peer node stores an image file associated with an application, and N is a positive integer greater than or equal to 2, including: the i-th second peer node determines to download the image based on the received download instruction sent by the control node.
  • the download order of the N image fragments included in the file, the download instruction is used to instruct to start downloading the image file, the N second peer nodes all receive the download instruction, and the N second peer nodes
  • the i-th second peer node is based on the i-th second peer node
  • the i-th download sequence corresponding to the node determines to send a first query message to the first peer node, and to send a second query message to other second peer nodes;
  • the first query message is used to query the image
  • the i-th image fragment included in the file, and the i-th image fragment is the first image fragment downloaded as indicated by the i-th download sequence;
  • the second query message is used to query the image
  • the file includes an image fragment other than the i-th image fragment, and the image fragment queried by the second query message is the j-th image fragment downloaded as indicated by the i-th download sequence.
  • the third aspect of the embodiment of the present disclosure provides an image distribution device, applied to a peer-to-peer network including a first peer node and N second peer nodes, wherein the first peer node stores information associated with an application mirror file, N is a positive integer greater than or equal to 2, including: a transceiver unit, used to receive N first query messages sent by the N second peer nodes, the N first query messages are the same as the There is a one-to-one correspondence between N second peer nodes; a processing unit configured to determine, based on the N first query messages, to send all the information queried by the N first query messages to the N second peer nodes.
  • the image file includes N different image fragments; the transceiver unit is also configured to send the N image fragments and the N images to the N second peer nodes through N network channels.
  • N different hash values corresponding to the fragments, so that the i-th second peer node interacts with other second peer nodes to obtain the image file, where the i-th network channel is the first pair
  • the network channel through which the peer node and the i-th second peer node transmit the i-th mirror fragment and the hash value corresponding to the i-th mirror fragment, i 1, 2,...,N.
  • the fourth aspect of the embodiment of the present disclosure provides an image distribution device, applied to a peer-to-peer network including a control node, a first peer node managed by the control node, and N second peer nodes, wherein the A peer node stores a
  • the image file associated with the application program includes: a processing unit, configured to determine the number of times to download N image fragments included in the image file according to the received download instruction sent by the control node.
  • the download instruction is used to instruct to start downloading the image file
  • the N second peer nodes all receive the download instruction
  • the processing unit is also used to determine the direction to the i-th second peer node according to the i-th downloading order corresponding to the i-th second peer node.
  • the first peer node sends a first query message, and sends a second query message to other second peer nodes; the first query message is used to query the i-th image fragment included in the image file, and The i-th image fragment is the first image fragment downloaded as indicated by the i-th download sequence; the second query message is used to query the image fragments included in the image file except the i-th image fragment.
  • a transceiver unit configured to send the first query message to the first peer node and the second query message to other second peer nodes to obtain the image file.
  • the fifth aspect of the embodiment of the present disclosure provides an image distribution device, which has the above-mentioned first aspect or any possible implementation manner of the first aspect, and the third aspect or any one of the third aspects.
  • Possible implementations describe the functions of the image distribution device. This function can be implemented based on hardware, or corresponding software implementation can be executed based on hardware.
  • the hardware or software includes one or more modules corresponding to the above functions.
  • the structure of the image distribution device includes a processor, and the processor is configured to support the image distribution device to perform corresponding functions in the above method.
  • the image distribution device may further include a memory, which is coupled to the processor and stores necessary program instructions and data for the image distribution device.
  • the image distribution device includes: a processor, a transmitter, a receiver, a random access memory, a read-only memory, and a bus.
  • the processor is respectively coupled to the transmitter, receiver, random access memory and read-only memory through the bus.
  • the sixth aspect of the embodiment of the present disclosure provides an image distribution device, which has the above second aspect or any possible implementation manner of the second aspect, and the fourth aspect or any one of the fourth aspect. Possible implementations describe the functions of the image distribution device. This function can be implemented based on hardware or executed based on hardware Corresponding software implementation. The hardware or software includes one or more modules corresponding to the above functions.
  • the structure of the image distribution device includes a processor, and the processor is configured to support the image distribution device to perform corresponding functions in the above method.
  • the image distribution device may further include a memory, which is coupled to the processor and stores necessary program instructions and data for the image distribution device.
  • the image distribution device includes: a processor, a transmitter, a receiver, a random access memory, a read-only memory, and a bus.
  • the processor is respectively coupled to the transmitter, receiver, random access memory and read-only memory through the bus.
  • the seventh aspect of the embodiment of the present disclosure also provides a computer-readable storage medium on which one or more computer instructions are stored, wherein the instructions are executed by a processor to implement the method described in any of the above technical solutions.
  • Figure 1 is a schematic diagram of an application scenario suitable for the image distribution method provided by an embodiment of the present disclosure.
  • Figure 2 is a schematic diagram of the transmission process of an image distribution method provided by traditional technology.
  • FIG. 3A is a schematic diagram of a network architecture suitable for embodiments of the present disclosure.
  • Figure 3B is a schematic diagram of another network architecture suitable for embodiments of the present disclosure.
  • FIG. 4 is a schematic structural diagram of a control node 100 provided by an embodiment of the present disclosure.
  • FIG. 5 is a schematic structural diagram of a peer node 200 provided by an embodiment of the present disclosure.
  • Figure 6 is a schematic diagram of an image distribution method provided by an embodiment of the present disclosure.
  • Figure 7 is a schematic diagram of the relationship between image files and image layers provided by an embodiment of the present disclosure.
  • Figure 8 is a schematic diagram of the relationship between the image layer and image sharding provided by an embodiment of the present disclosure.
  • Figure 9A is a schematic diagram of another image distribution method provided by an embodiment of the present disclosure.
  • Figure 9B is a schematic diagram of another image distribution method provided by an embodiment of the present disclosure.
  • Figure 10 is a schematic diagram of a network bandwidth adjustment method provided by an embodiment of the present disclosure.
  • Figure 11 is a schematic structural diagram of an image distribution device provided by an embodiment of the present disclosure.
  • Figure 12 is a schematic structural diagram of an image distribution system provided by an embodiment of the present disclosure.
  • Figure 13 is a schematic structural diagram of an image distribution device provided by an embodiment of the present disclosure.
  • Cloud technology refers to a hosting technology that unifies a series of resources such as hardware, software, and networks within a wide area network or local area network to realize data calculation, storage, processing, and sharing.
  • Cloud gaming is a gaming method based on cloud computing. In the operating mode of cloud gaming, all games are run on the server side, and the rendered game images are compressed and transmitted to users through the network.
  • P2P Peer-to-peer
  • Peer-to-peer network also known as peer-to-peer network or peer-to-peer computer network.
  • a peer-to-peer network is a distributed application architecture that distributes tasks and workloads among peer nodes. It is a networking or network form formed by the peer-to-peer computing model at the application layer.
  • network participants share a portion of the hardware resources they own (for example, computing resources, storage resources, network connection resources, printer resources, etc.), and these shared resources provide services and content through the network. Can be accessed directly by other peer nodes without going through intermediate entities.
  • participants in a peer-to-peer network are both providers (servers) of resources, services, and content, and at the same time, acquirers (clients) of resources, services, and content.
  • Mirror is also called an image file. Mirroring is a form of file storage, and a mirror can be thought of as a copy of the original file.
  • Mirrors are usually stored in a hierarchical structure, and the mirror structure corresponding to each layer is the mirror layer.
  • Mirror sharding is a logical sharding for the mirroring layer.
  • a mirror layer can be logically divided into multiple mirror shards. For example, if an image layer is 40 megabytes (MB), the image layer can be logically divided into 10 image shards, and the size of each image shard is 4MB.
  • MB megabytes
  • Tree network is a network topology shape. All nodes in the tree network are organized in a tree.
  • the tree network includes root nodes and leaf nodes.
  • data flows in one direction along the branches, that is, it can only flow from the root node to the leaf nodes, but cannot flow from the leaf nodes to the root node.
  • Mesh network is a network topology shape.
  • all nodes are interconnected irregularly and there is no absolute parent-child relationship. That is, node A can flow resources to node B, and node B can also flow resources to node A.
  • Qcow2 is the file format for disk image files used by QEMU.
  • Figure 1 is a schematic diagram of an application scenario suitable for the image distribution method provided by an embodiment of the present disclosure.
  • any two nodes among multiple nodes i can communicate through the network to realize data transmission, and the i-th node communicates with the i-th terminal to realize data transmission.
  • the application scenario may also include a larger number (for example, 10, etc.) of nodes that communicate through the network to realize data transmission.
  • any node i in this application scenario can also communicate with a larger (for example, 2 or 3, etc.) number of terminals to achieve data transmission.
  • the network shown in Figure 1 may be a wired network or a wireless network, which is not specifically limited in this disclosure.
  • the node i and the terminal i may be connected through a wired method or a wireless method (for example, Bluetooth or wireless communication technology (WIFI)), which is not specifically limited in this disclosure.
  • WIFI wireless communication technology
  • Node i may be a server with storage capabilities (for example, storing cloud game update image files) and computing capabilities.
  • an application for example, a game application
  • terminal i can run in node i. That is, node i can perform operations related to running the calculations and processing of the application. After node i runs the application, it will transmit the data generated by the application to terminal i, so that terminal i can obtain the data associated with the application.
  • This method can effectively reduce the calculation amount of terminal i.
  • the game application installed in terminal i can be run on node i. After running the game application, node i can also render and compress the obtained application data. After that, node i can undergo the above processing.
  • Node i can also send resources stored in node i (for example, image files generated by applications running in node i) to other nodes in Figure 1 through the network, or obtain other nodes from other nodes in Figure 1 through the network. stored resources.
  • node i may have a memory and a processor.
  • the processor of node i can be a central processing unit (CPU).
  • node i can also have one or more of a graphics processing unit (GPU), a neural network processing unit (NPU), and a field programmable gate array (FPGA).
  • GPU graphics processing unit
  • NPU neural network processing unit
  • FPGA field programmable gate array
  • the node The memory of i can be random access memory (RAM) or solid-state drive (SSD) or other devices or memory instances with storage capabilities.
  • a solid-state drive may also be called a solid-state drive (SSD).
  • the form of node i is not specifically limited.
  • Node i can be hardware or software. When node i is hardware, it can be implemented as a distributed server cluster composed of multiple servers or as a single server. When the node i is software, it can be implemented as multiple software or software modules (for example, software or software modules used to provide distributed services), or it can be implemented as a single software or software module. The embodiments of the present disclosure do not specifically limit this.
  • terminal i Applications can be installed and run on the terminal i, and the running results of the applications can be displayed.
  • terminal i The game application installed in can be run in node i. After running the game application, node i can render and compress the generated game data, and send the processed data to terminal i, and terminal i receives the data. The game data can then be displayed to the user through the display interface.
  • the form of terminal i is not specifically limited.
  • the terminal i may be, but is not limited to, a personal computer, a smartphone, a tablet, a desktop computer, or a wearable device (eg, a smart watch).
  • the above wireless network or wired network uses standard communication technologies and/or protocols.
  • the network is usually the Internet, but can be any network, including but not limited to local area network (LAN), metropolitan area network (MAN), wide area network (WAN), mobile, wired or wireless network, private network, or virtual private network).
  • data exchanged over the network is represented using technologies and/or formats including hypertext mark-up language (HTML), extensible markup language (XML), etc.
  • HTTP hypertext mark-up language
  • XML extensible markup language
  • customized and/or dedicated data communication technologies can also be used in place of or in addition to the data communication technologies described above.
  • the application scenarios shown in FIG. 1 are only illustrative and do not constitute any limitation to the application scenarios applicable to the image distribution method provided by the embodiments of the present disclosure.
  • the above application scenario may also include a larger number of nodes or terminals.
  • any node in the above application scenario can also communicate with a larger number of terminals to realize data transmission.
  • nodes in the cloud game application scenario can share a game update image file stored or generated by one node to achieve the purpose of game update image file sharing.
  • node 1 stores a game update image file generated by running a game application.
  • Node 1 communicates with node 2, node 3, and node 4 by transmitting the game update image file stored in node 1 to node 2 and node 1. 3 and node 4 to realize the sharing of game update image files.
  • node 1 that owns resources transmits the game update image file to a large number of nodes that do not own resources (for example, the game update image file includes 2 Qcow2 image files)
  • the game update image file includes 2 Qcow2 image files
  • the image file may be attacked or tampered with. In this way, node 2, node 3 and node 4 will receive The image file received is incomplete.
  • FIG. 2 shows a schematic diagram of the transmission process of the image distribution method provided by this traditional technology.
  • the network architecture shown in Figure 2 is a tree structure, and the seven nodes included in the tree structure can be nodes included in the application scenario shown in Figure 1.
  • Node 1 in Figure 2 can be a node that stores a cloud game update image file.
  • Node 1 When the image file needs to be shared with other nodes shown in Figure 2, Node 1 will first match the image file with the image file.
  • the hash value 1 is transmitted to node 2 and node 3 respectively.
  • node 2 or node 3 After node 2 or node 3 receives the image file and hash value 1, it first performs a hash operation on the image file to obtain a hash value 2. By comparing hash value 1 and hash value 2, it is determined that node 2 or node 3 is the same. Node 3 has successfully received the image file. After that, node 2 or node 3 will send the image file and hash value 2 to their respective child nodes, and so on until all nodes receive the image file, where the child nodes of node 2 are node 4 and node 5.
  • the child nodes of node 3 are node 6 and node 7.
  • the node needs to send a request to retransmit the image file to the upstream node to regain the image file.
  • the image file has a large amount of data (for example, an image file ranging from tens of gigabytes (Gigabyte, GB or G) to hundreds of GB).
  • the node performs processing on the received image file. Integrity verification takes a long time (for example, it usually takes tens of minutes), which causes a high delay in the transmission of the image file.
  • the above transmission image file is transmitted in a tree network, and as the number of nodes in the network increases The increase in purpose will inevitably lead to an increase in the total transmission time for transmitting the image file.
  • transmitting image files based on a tree network it is executed serially in layers. In other words, the node at this layer must wait for the node at the upper layer to finish transmitting the image file. After mirroring the file, the node in this layer can transmit the image file to its child nodes. In this way, the non-vertex nodes (nodes other than node 1) in the tree network have a higher transmission rate when receiving the image file. Delay.
  • a node for example, node 2 in the above-mentioned tree network fails during the transmission of the image file, it will also cause the failed child node to be unable to successfully receive the image file.
  • embodiments of the present disclosure provide an image distribution method, device and system to solve the above existing problems.
  • FIG. 3A is a schematic diagram of a network architecture suitable for embodiments of the present disclosure.
  • the network architecture includes a control node and multiple peer nodes.
  • the plurality of peer nodes are peer node 1, peer node 2 and peer node 3 respectively.
  • Any two nodes among all nodes included in the network architecture ie, control nodes and multiple peer nodes
  • This network architecture can be understood as a P2P network architecture. Any two nodes in this architecture can communicate based on the P2P network communication protocol. It is proposed to realize communication and data interaction.
  • the P2P network communication protocol may be a TCP/UDP-based P2P network communication protocol.
  • the network architecture may also include a larger number of peer nodes, which is not specifically limited in this disclosure.
  • the network architecture includes a larger number of peer nodes, any two nodes in the network architecture can communicate with each other to achieve data interaction.
  • FIG. 3B shows another network architecture suitable for the embodiment of the present disclosure.
  • the network architecture includes 5 peer nodes and 1 control node, and between any two nodes included in the network architecture Communication can be carried out to realize the transmission of data.
  • FIG. 4 shows a schematic structural diagram of a control node 100 provided by an embodiment of the present disclosure.
  • the control node 100 may be a control node in the network architecture shown in FIG. 3A , that is, the control node in FIG. 3A has the same or similar functions as the control node 100 in FIG. 4 .
  • the control node 100 includes the following functional modules: service registration and discovery 210, network topology center 220, network service (web server), and dynamic control center 240. Among them, service registration and discovery 210 is used to ensure the multi-activity of multiple peer nodes in the network architecture shown in Figure 3A.
  • the network topology center 220 is configured to construct a P2P network including the plurality of peer nodes according to the network status obtained from the plurality of peer nodes shown in FIG. 3A.
  • Network server 230 is used to provide network services.
  • the dynamic control center 240 is used to adjust the bandwidth of the network channel (for example, network channel 1 or network channel 2) in the network based on the network status information obtained from the peer node shown in Figure 3A to ensure that the P2P network includes Wait until the node is in normal working condition.
  • the peer node is configured to send network resources (for example, image file resources) stored by the peer node to other peer nodes in the network according to instructions sent by the control node.
  • Peer nodes can also receive network resources sent by other peer nodes in the network.
  • a peer node may also send the network status obtained by the peer node to the control node.
  • FIG. 5 shows a schematic structural diagram of a peer node 200 provided by an embodiment of the present disclosure. It can be understood that the peer node 200 can be any peer node in the network architecture shown in Figure 3A, that is, any peer node in Figure 3A has the same or similar information as the peer node 200 in Figure 5. Function. Referring to FIG.
  • the peer node 200 includes the following functional modules: an image fragment transmitter 210 , a network analysis model 220 , a dynamic control client 230 , and a file storage server 240 .
  • the image fragment transmitter 210 is used to transmit the image fragments stored in the file storage service 240 to other peer nodes in the network except the peer node 200.
  • the network analysis module 220 is used to perform inter-node speed measurement and maintain network conditions of the peer node 100 and other peer nodes communicating with the peer node 100 .
  • the network analysis module 220 can perform inter-node speed measurement based on raw-socket technology.
  • the dynamic control client 230 is responsible for analyzing the channel traffic status of data transmission by the peer node 200 and reporting the network conditions obtained by the network analysis module 220 to the dynamic control center 140 in the control node 100 .
  • control A node and multiple peer nodes can be servers.
  • Servers can be hardware or software.
  • the server can be implemented as a distributed server cluster composed of multiple servers, or it can be implemented as a single server.
  • the server is software, it can be implemented as multiple software or software modules (for example, software or software modules used to provide distributed services), or it can be implemented as a single software or software module.
  • the embodiments of the present disclosure do not specifically limit this.
  • control node shown in Figure 3A is a network node independent of peer node 1, peer node 2 and peer node 3.
  • the network architecture applicable to the embodiment of the present disclosure may include at least 4 nodes, namely the control node, peer node 1, peer node 2 and peer node 3.
  • the control node may also be any peer node among peer node 1, peer node 2, or peer node 3.
  • any peer node also has the configuration shown in Figure 3A The functions of the control nodes shown in .
  • the network architecture suitable for the embodiments of the present disclosure may include at least three nodes, namely peer node 1, peer node 2 and peer node 3, and these three peers
  • One of the peer nodes also has the function of a control node as shown in Figure 3A.
  • FIG. 3A may also include a greater number of peer nodes and a greater number of network channels.
  • Figure 6 is a schematic diagram of an image distribution method provided by an embodiment of the present disclosure.
  • the image distribution method provided by the embodiment of the present disclosure can be applied to a peer-to-peer network including a control node and a first peer node managed by the control node and N second peer nodes, where N is a positive integer greater than or equal to 2.
  • the control node shown in Figure 6 may be the control node shown in Figure 3
  • the first peer node and the N second peer nodes shown in Figure 6 may be the control node shown in Figure 6.
  • 3 shows multiple peer nodes.
  • the image distribution method provided by the embodiment of the present disclosure includes S601 to S606. Before introducing S601 to S606, the control node, the first peer node and the N second peer nodes involved in the implementation of the present disclosure are introduced in detail.
  • the control node in the peer-to-peer network is used to manage the first peer node and N second peer nodes.
  • the control node is used to manage the network bandwidth of the first peer node and the N second peer nodes, the network topology between the first peer node and the N second peer nodes, and so on.
  • the control node is any one of the following peer nodes: a first peer node, or N second peer nodes. It can be understood that when the control node is a first peer node or a second peer node among the N second peer nodes, the first peer node or the second peer node also has a control node function.
  • control node may also be a node independent of the first peer node and the N second peer nodes, in which case any of the first peer node or the N second peer nodes one A peer node may not have the function of a control node. It can be understood that any two nodes in the peer-to-peer network transmit data through different network channels, and any two nodes are any two nodes among the following nodes: a control node, a first peer node, and N second pairs. Wait for nodes.
  • the control node is the control node shown in Figure 3A
  • the first peer node is peer node 1
  • the plurality of second peer nodes are peer nodes 2 respectively.
  • control node and peer node 1 communicate with each other through network channel 5
  • control node and peer node 2 communicate with each other through network channel 4
  • control node and peer node 3 communicate with each other through network channel 5.
  • Channel 6 communicates with each other
  • peer node 1 and peer node 3 communicate with each other through network channel 3
  • peer node 1 and peer node 2 communicate with each other through network channel 1
  • peer node 2 and peer node 3 They communicate with each other through network channel 2.
  • any two network channels among the above-mentioned network channel 1 to network channel 6 are different.
  • the first peer node stores an image file associated with the application program. That is to say, the first peer node is the node that owns the image file in the peer-to-peer network.
  • the image file includes N different image slices, where N is a positive integer greater than or equal to 2. That is to say, the image file includes at least two different image slices.
  • N different image fragments that is, the N image fragments have different identifiers, but the information associated with the application carried by the N different image fragments may be the same or different. It can be understood that the identifier of a mirror fragment can be used to uniquely identify the mirror fragment.
  • the one image file when the image file is stored in an image layer structure, the one image file may include at least one image layer, and the at least one image layer may include the N different image slices.
  • Figure 7 shows a schematic diagram of the relationship between image files and image layers.
  • an image file can be divided into P image layers, where P is a positive integer greater than or equal to 1.
  • Figure 8 shows a schematic diagram of the relationship between the mirror layer and the mirror shards.
  • the mirror layer P can be divided into m mirror shards, where m is a positive integer greater than or equal to 2.
  • the type of application is not specifically limited.
  • the application is a cloud gaming application, and the image file associated with the application is an updated image file generated by the cloud gaming application.
  • the application program may also be a video application program, and the image file associated with the application program is an image file generated by the video application program.
  • the N second peer nodes are N peer nodes in the peer-to-peer network that do not store image files associated with the application. That is to say, before executing the image distribution method provided by the present disclosure, each second peer node included in the peer-to-peer network does not own at least one image shard included in the image file.
  • the control node sends a download instruction to N second peer nodes.
  • the download instruction is used to instruct to start downloading the image file, and N is a positive integer greater than or equal to 2.
  • the download command can carry the identifier of the image file.
  • the identifier of the image file is used to uniquely identify the image file. pieces.
  • the control node may also perform the following steps: receive a request sent by the user terminal, which request indicates that the N second peer nodes in the peer-to-peer network need to obtain the image file.
  • the N second peer nodes may provide network services (for example, data stored locally by the N second peer nodes) for the user terminal.
  • the type of user terminal is not specifically limited.
  • the user terminal may be, but is limited to, any of the following: a smartphone, a tablet computer, a desktop computer, or a wearable smart device (for example, a smart watch), etc.
  • the above S601 is executed, that is, the control node sends an instruction to start downloading the image file associated with the application program to the N second peer nodes.
  • each second peer node among the N second peer nodes i.e., the i-th second peer node
  • the download order of the mirror shards, the N second peer nodes correspond to the N download orders one-to-one, and the N download orders are different.
  • the N downloading orders are different, which can be understood as any two downloading orders among the N downloading orders are completely different.
  • the image file includes 2 image shards (ie, image shard 1 and image shard 2)
  • the N second peer nodes include 2 second peer nodes
  • one of the second peer nodes The download order determined by the second peer node may be to download image fragment 1 first, and then image fragment 2; the download order determined by the other second peer node may be to download image fragment 2 first, and then download image fragment 1.
  • the download sequences corresponding to the two second peer nodes are completely different.
  • the N downloading orders are different, which can be understood to mean that any two downloading orders among the N downloading orders are not exactly the same.
  • any two downloading orders are not exactly the same, which means that the image fragments of the first download indicated by any two downloading orders are different, and the image fragments indicated by any two downloading orders except the first downloaded
  • the download order of other image fragments after the image fragment is not specifically limited.
  • the N second peer nodes include 2 second peer nodes.
  • one of the second peer nodes determines the order of downloading the image fragments in order: image fragment 1, image fragment 2, and image fragment 3; the other second peer node determines the order of downloading the image fragments.
  • the order is: mirror shard 3, mirror shard 2 and mirror shard 1; or the order determined by another second peer node to download the mirror shards is: mirror shard 2, mirror shard 1 and mirror shard. 3.
  • the two second pairs The download order corresponding to other nodes is not exactly the same.
  • the i-th second peer node determines to send the first query message to the first peer node and sends the first query message to other second peer nodes according to the i-th download sequence corresponding to the i-th second peer node. 2. Query news.
  • the first query message is used to query the i-th image fragment included in the image file, and the i-th image fragment is the first image fragment downloaded as indicated by the i-th download sequence.
  • the above S603 is executed, that is, each second peer node
  • the query messages sent by the two peer nodes to the first peer node query different mirror shards.
  • the second query message is used to query an image fragment other than the i-th image fragment included in the image file, and the image fragment queried by the second query message is the j-th image fragment downloaded indicated by the i-th download sequence.
  • the N second peer nodes include 2 second peer nodes.
  • one of the second peer nodes determines the order of downloading the image fragments in order: image fragment 1, image fragment 2, and image fragment 3; the other second peer node determines the order of downloading the image fragments.
  • the order is: mirror shard 3, mirror shard 2 and mirror shard 1.
  • the first query message sent by the second peer node is used to query the mirror shard 1.
  • the first query message sent by the other second peer node is used to query the mirror shard 2.
  • the first second query message sent by the second peer node is used to query the mirror shard 2, and the second second query message sent by the second peer node is used to query the mirror shard 3.
  • the first second query message sent by the other second peer node is used to query the mirror shard 2, and the second second query message sent by the other second peer node is used to query the mirror shard 2.
  • Other second peer nodes refer to the N-1 second peer nodes other than the i-th second peer node among the N second peer nodes.
  • the i-th second peer node sends a first query message to the first peer node, and sends a second query message to other second peer nodes to obtain the image file.
  • the i-th second peer node sends a first query message to the first peer node, and sends a second query message to other second peer nodes to obtain the image file, including the following steps: The i second peer node sends a first query message to the first peer node; the i second peer node receives the i-th mirror fragment sent by the first peer node and the i-th mirror fragment corresponding to Hash value, and the hash value corresponding to each image fragment is different; when it is determined that the i-th image fragment received passes the integrity check, the i-th second peer node saves the i-th image shards, and sends a second query message to other second peer nodes; the i-th second peer node receives the mirror shard and the queried mirror queried by the second query message sent by other second peer nodes.
  • the hash value corresponding to the fragment, the number of mirror fragments sent by other second peer nodes does not exceed the preset threshold; when it is determined that the mirror fragment queried by the received second query message passes the integrity check , the i-th second peer node saves the mirror shard queried by the second query message.
  • the i-th second peer node can obtain all image fragments (ie, N image fragments) included in the image files sent by the first peer node and other second peer nodes. ).
  • N second peer nodes with N different image shards in the peer-to-peer network can interact with each other to share the image shards stored with each other, which can alleviate the problem of having a complete image file.
  • each second peer node does not need to wait to receive the complete image file before sending the image file to other second peer nodes that do not store the image file, which can improve the efficiency of image distribution. efficiency.
  • the i-th second peer node may also send a second query message to the first peer node.
  • the number of image fragments being uploaded by the first peer node exceeds the preset threshold.
  • the first peer node receives the second query message and the first peer node locally stores the second In the case of the mirror shard queried by the query message, the first peer node will not send the mirror shard queried by the second query message to the i-th second peer node.
  • the query result of the second query message sent to the i-th second peer node is failure, and the query result does not include the i-th second peer node. 2.
  • the mirror shard queried by the query message is
  • the i-th second peer node can continue to send a new query. information. In other words, when the i-th second peer node determines that a mirror fragment currently received does not pass the integrity check, the i-th second peer node will retransmit the message to request a retransmission.
  • the i-th second peer node sends the second query message to other second peer nodes, and may send the second query message to all the N-1 second peer nodes at the same time. Based on this, in some possible implementations, the i-th second peer node sends a second query message to other second peer nodes, including: the i-th second peer node sends a second query message to N second peer nodes All second peer nodes except the i-th second peer node send the first second query message, and the mirror fragment queried by the first second query message is downloaded as indicated by the i-th download sequence.
  • the second mirror fragment (j 2); when the i-th second peer node determines that it has successfully received the first second In the case of querying the mirror shard queried by the message, the i-th second peer node sends the second second peer node to all N second peer nodes except the i-th second peer node.
  • each second peer node that receives the mirror fragments can also perform an integrity check on the received mirror fragments to confirm that each second peer node has received Whether the image shards are complete or have been tampered with.
  • the image distribution method provided by the embodiment of the present disclosure may also include the following steps: the i-th second peer node performs integrity verification on the received image fragments, and the i-th second peer node receives The mirror fragment includes the i-th mirror fragment and the mirror fragment queried by the second query message; if it is determined that the i-th mirror fragment received does not pass the integrity check, the i-th second peer node sends a request to the i-th second peer node.
  • a peer node sends a first retransmission message, and the first retransmission message is used to instruct the first peer node to send the i-th mirror fragment; if it is determined that the mirror fragment queried by the received second query message has not passed the complete For verification, the i-th second peer node sends a second retransmission message to other second peer nodes. The second retransmission message is used to instruct other second peer nodes to send the mirror segment queried by the second query message. piece.
  • the i-th second peer node performs integrity verification on each image fragment based on each received image fragment and the hash value corresponding to each image fragment.
  • the verification includes: the i-th second peer node performs hash calculation on each received image fragment and obtains the hashed value; the i-th second peer node compares the hashed value The hash value corresponding to each mirror fragment determines whether each mirror fragment passes the integrity check; among them, if the calculated hash value is the same as the hash value corresponding to each mirror fragment, then it is determined Each mirror fragment passes the integrity check; if the calculated hash value is different from the hash value corresponding to each mirror fragment, it is determined that each mirror fragment fails the integrity check.
  • the type of hash algorithm used for hash calculation is not specifically limited.
  • the hash algorithm may be, but is not limited to, a hash algorithm or a message digest algorithm.
  • other second peer nodes in the above implementation do not locally store the mirror shards queried by the second query message. In this way, even if the other second peer nodes receive the second query message Afterwards, the mirror shards queried by the second query message and the corresponding hash values cannot be sent to the i-th second peer node.
  • other second peer nodes send requests to the i-th second peer node.
  • the query result of the second query message sent by the peer node is failure. Based on this, that is, if the i-th second peer node in the above implementation does not receive the mirror shard queried by the second query message sent by other second peer nodes and the hash corresponding to the queried mirror shard.
  • the image distribution method provided by the embodiment of the present disclosure may also include the following steps: the i-th second peer node sends a second query message to the first peer node; the i-th second peer node receives the first peer The mirror shard queried by the second query message sent by the node and the queried The hash value corresponding to the image shard.
  • the N second peer nodes include 2 second peer nodes.
  • one of the second peer nodes determines the order of downloading the image fragments in order: image fragment 1, image fragment 2, and image fragment 3; the other second peer node determines the order of downloading the image fragments.
  • the order is: mirror shard 3, mirror shard 2 and mirror shard 1.
  • the one second peer node and the other second peer node simultaneously download the second image fragment (ie, image fragment 2) indicated by the corresponding download sequence
  • the The other second peer node and the one second peer node send query messages to each other to query the mirror shard 2. Since neither of the above two second peer nodes locally stores the mirror shard 2, the above two second peer nodes do not store the mirror shard 2 locally.
  • the two peers cannot interact with each other to obtain mirror shard 2.
  • the one second peer node and the other second peer node may send a query message querying the mirror shard 2 to the first peer node.
  • the second peer node may send a query message for querying the mirror fragment 2 to the first peer node to save the obtained mirror fragment 2 locally; the other second peer node may then send a query message to the first peer node to save the obtained mirror fragment 2 locally; The one second peer node sends a message querying the mirror fragment 2 to obtain the mirror fragment 2.
  • the first peer node determines, based on the N first query messages, N different image fragments included in the image file queried by sending the N first query messages to the N second peer nodes.
  • the first peer node sends N mirror fragments and N different hash values corresponding to the N mirror fragments to the N second peer nodes through N network channels, so that the i-th second pair The peer node interacts with other second peer nodes to obtain the image file.
  • the first peer node sends the image fragments and the hash values corresponding to the image fragments.
  • the first peer node may encapsulate the image fragment and the hash value corresponding to the image fragment in the same data packet, and send the encapsulated data packet to the corresponding second peer node .
  • the second peer node can obtain the image fragment and the hash value corresponding to the image fragment after parsing the received data packet.
  • the first peer node can encapsulate the image fragment and the hash value corresponding to the image fragment in two different data packets, and send the two encapsulated data packets to the corresponding node at the same time. the second peer node.
  • the i-th second peer node interacts with other second peer nodes to obtain the image file, including: the i-th second peer node sends a first query message to the first peer node, and sending a second query message to other second peer nodes to obtain the image file.
  • the process of this implementation method is described in detail in S604 above. For content not described in detail here, please refer to the relevant description in S604 above.
  • the peer node After executing "the first peer node sends N mirror fragments and N different hash values corresponding to the N mirror fragments to N second peer nodes through N network channels" in the above S606, the peer node Each of the N second peer nodes included in the network that do not store the image file can successfully obtain one of the image files included in the network. Image shards, and each second peer node obtains different image shards. Based on this, N second peer nodes in the peer-to-peer network can interact with each other to obtain the image shards stored by each other, which can reduce the transmission burden of the first peer node that owns the complete image file 1 and improve the efficiency of node downloading. Speed and efficiency.
  • each second peer node when N second peer nodes share the image shards owned by each other, each second peer node is downloading the image shards stored by other second peer nodes and at the same time, it is also sending data to other second peer nodes. Peer nodes upload their own stored image shards, which can improve the transmission efficiency of image shards.
  • the i-th second peer node in the peer-to-peer network may receive the N image fragments included in the image file.
  • the integrity of all image fragments received by the i-th second peer node can be further verified to determine the i-th second peer node. Whether the peer node successfully received the image file.
  • the above integrity verification can be performed in the following manner: the i-th second peer node hashes all received image shards, obtains hash value #2, and converts the hash value #2 is sent to the control node; the first peer node hashes the image file to obtain hash value #3, and sends hash value #3 to the control node; the control node performs hash value #2 and Compare hash value #3 to obtain verification information.
  • the verification information is used to indicate whether the i-th second peer node successfully received the complete image file; among them, if hash value #2 and hash value #3 The same, the verification information is used to indicate that the i-th second peer node successfully received the complete image file; or, if the hash value #2 and the hash value #3 are not the same, the verification information is used to indicate that the i-th The second peer did not successfully receive the complete image file.
  • the above integrity verification can be performed in the following manner: the i-th second peer node hashes all received image fragments and obtains hash value #2; the first peer node The node hashes the image file to obtain hash value #3, and sends hash value #3 to the i-th second peer node; the i-th second peer node processes hash value #2 and hash Compare with value #3 to obtain verification information.
  • the verification information is used to indicate whether the i-th second peer node successfully received the complete image file; among them, if hash value #2 and hash value #3 are the same, The verification information is used to indicate that the i-th second peer node successfully received the complete image file; or, if hash value #2 and hash value #3 are not the same, the verification information is used to indicate that the i-th second peer node The peer node did not successfully receive the complete image file.
  • the i-th second peer node may also send a retransmission message to obtain at least one image fragment included in the unowned image file.
  • peer nodes in the P2P network can also communicate with other peer nodes to obtain the current network status of the other peer nodes.
  • the network status of a peer node may include the speed at which the peer node uploads data to other peer nodes, and the speed at which the peer node downloads data from other peer nodes.
  • any peer node In the P2P network, if any peer node discovers that the speed of data uploaded by any peer node to other peer nodes does not meet the preset upload speed, or that any peer node transfers data from other peer nodes to If the download speed of the peer node does not meet the preset download speed, any peer node can also send the obtained network status information to the control node, so that the control node reallocates the peer nodes in the P2P network based on the network status information. network bandwidth, thereby solving the problem that the upload speed or download speed of any peer node does not meet the preset speed, which is beneficial to ensuring that the network is in a stable working state.
  • the image distribution method provided by the embodiment of the present disclosure may also include the following steps: the i-th second peer node sends N detection messages to the first peer node and other second peer nodes to obtain N networks
  • N second peer nodes correspond to N detection messages one-to-one.
  • the network quality corresponding to the i-th network channel does not meet the preset requirements.
  • the i-th network channel is the i-th second peer.
  • the two peer nodes send the network quality corresponding to the N network channels to the control node, so that the control node evaluates the N network channels except the i-th network channel according to the network quality corresponding to the N network channels.
  • Figure 10 below is a network bandwidth adjustment method provided by an embodiment of the present disclosure. For content not described in detail here, please refer to the relevant description in Figure 10 below.
  • the first peer node in the peer-to-peer network that stores the image file sends the image fragments included in the image file to the second peer node in the peer-to-peer network that does not store the image file through different network channels, and The image shards received by each second peer are different.
  • the second peer node in the peer-to-peer network that does not store the image file can serve as a resource node in the peer-to-peer network and send data to other nodes in the peer-to-peer network that do not store the image fragments.
  • the second peer node provides upload functionality.
  • the second peer node that does not store the image file can distribute the image fragments included in the image file to the network without waiting to receive the complete image file.
  • the other second peer nodes in the network can improve network bandwidth utilization and reduce the total time spent on distributing image files on the network, thereby achieving the purpose of quickly distributing image files on the network.
  • the integrity of the image fragments associated with the image file received by the peer node is verified to determine whether the second peer node in the network that does not store the image file has successfully received the image file.
  • image fragmentation is used as the minimum transmission granularity, which can improve the flexibility of image distribution. In the scenario where image fragment transmission fails, only the abnormal image fragments need to be retransmitted, avoiding the problem of retransmitting the entire image file in related technologies, and helping to reduce the retransmission rate.
  • the network architecture shown in Figure 3A is referred to as a P2P network in the following.
  • the image distribution method described in FIG. 9A and FIG. 9B is a specific example of the image distribution method described in FIG. 6.
  • the method described in FIG. 9A and FIG. 9B is only for illustration and does not apply to the embodiments of the present disclosure.
  • the provided image distribution method constitutes no limitation.
  • the peer-to-peer network in the method described in Figure 6 includes a control node, peer node 1, peer node 2 and peer node 3.
  • the application scenario in Figure 6 is a cloud game.
  • the scenario is introduced as an example, as well as the game update image file 1 stored in peer node 1 to be shared.
  • peer node 1 can be understood as the first peer node shown in Figure 6 above
  • Figure 9A is a schematic diagram of another image distribution method provided by an embodiment of the present disclosure. It should be understood that the example in FIG. 9A is only to help those skilled in the art understand the embodiments of the present disclosure, but is not intended to limit the application embodiments to the specific numerical values or specific scenarios illustrated. Those skilled in the art can obviously make various equivalent modifications or changes based on the example of FIG. 9A given below, and such modifications and changes also fall within the scope of the embodiments of the present disclosure. As shown in Figure 9A, the method includes S901 to S911. Next, S901 to S911 are introduced in detail.
  • control node obtains request 1.
  • the control node is a node in the peer-to-peer network used to manage peer node 1, peer node 2 and peer node 3.
  • the control node may be a node independent of peer node 1, peer node 2, and peer node 3.
  • Request 1 is used to request image file 1 generated by running application 1.
  • Application 1 may be a cloud game application, and image file 1 may be a game update image file, and the specific type of application 1 is not limited.
  • Image file 1 may include an image layer, which includes image slice 1 and image slice 2, that is, image file 1 includes image slice 1 and image slice 2, and the identifier of image slice 1 It is different from the identifier of mirror shard 2.
  • the identity of image slice 1 is different from the identity of image slice 2, which means that image slice 1 and image slice 2 are two different image slices included in image file 1.
  • Figure 7 shows a schematic diagram of the relationship between image files and image layers.
  • an image file can be divided into P image layers, where P is a positive integer greater than or equal to 1.
  • Figure 8 shows a schematic diagram of the relationship between the mirror layer and the mirror shards.
  • the mirror layer P can be divided into m mirror shards.
  • m is a positive integer greater than or equal to 2.
  • Mirror shard 1 and mirror shard 2 are Image N consists of two different image shards.
  • the presentation form of the identifier of the image fragment in the image file There is no specific limitation on the presentation form of the identifier of the image fragment in the image file.
  • the identifier of the mirror fragment m is (T1, T2)
  • T1 identifies the mirror layer P where the mirror fragment m is located
  • T2 identifies the specific location in the mirror layer P where the mirror fragment m is located.
  • control node may actively obtain the request 1 from the user terminal, or the user terminal may actively send the request 1 to the control node. This disclosure does not specifically limit this.
  • image slices included in the image file 1 are stored in the following order: image slice 1, image slice 2.
  • S902 The control node sends instruction 1 to peer node 2 and peer node 3 respectively. Instruction 1 is used to instruct to download the image file requested by request 1. Correspondingly, peer node 2 and peer node 3 receive instruction 1 respectively.
  • Request 1 in the above S901 is used to request to obtain the image file 1. Based on this, the instruction 1 is specifically used to instruct to start downloading the image file 1 requested by the request 1.
  • peer node 2 determines that all image fragments included in the image file requested by request 1 need to be downloaded in the first download order.
  • the first download order is the order in which all image fragments included in image file 1 are downloaded. Among them, the first download sequence is to download image fragment 1 first, and then download image fragment 2.
  • the peer node 2 determines that it needs to download all the image fragments included in the image file requested by the request 1 in the first download order according to the instruction 1, including: the peer node 2 determines that it needs to download the image file 1 including the image according to the instruction 1. Slice 1 and image slice 2; Peer node 2 randomly sorts the order of the image slices included in image file 1 to obtain the first download order.
  • the peer node 3 determines that all the image fragments included in the image file requested by the request 1 need to be downloaded in the second download sequence.
  • the second download order is the order in which all image fragments included in the image file 1 are downloaded, and the second download order is different from the first download order. Among them, the second download sequence is to download image fragment 2 first, and then download image fragment 1.
  • the peer node 3 determines that it needs to download all the image fragments included in the image file requested by the request 1 in the second download order according to the instruction 1, including: the peer node 3 determines that it needs to download the image file 1 including the image according to the instruction 1. Slice 1 and image slice 2; peer node 3 randomly sorts the order of the image slices included in image file 1 to obtain the second download order.
  • Peer node 2 sends query message 1 to the node in the P2P network to query mirror shard 1.
  • Query message 1 is associated with the first download sequence.
  • Query message 1 is specifically used to query the first image fragment that needs to be downloaded in the sequence of downloading image fragments indicated by the first download sequence. That is, query message 1 is used to query the image.
  • Shard 1 is used to query the image.
  • the peer node 2 sends a query message 1 to the node in the network, including: the peer node 2 determines according to the instruction 1 that the peer node 2 does not store all the image fragments included in the image file 1 locally; the peer node 2 determines according to the instruction 1; A download sequence generates query message 1.
  • Peer node 3 sends query message 2 to the node in the network to query mirror shard 2.
  • Query message 2 is associated with the second download sequence.
  • Query message 2 is specifically used to query the second image fragment that needs to be downloaded in the sequence of downloading image fragments indicated by the first download sequence. That is, query message 2 is used to query the image.
  • Shard 2 is used to query the image.
  • the peer node 3 sends a query message 2 to the node in the network, including: the peer node 3 confirms according to the instruction 1 It is determined that the peer node 3 does not store all the image fragments included in the image file 1 locally; the peer node 3 generates the query message 2 according to the second download sequence.
  • Peer node 1 determines that mirror fragment 1 is stored locally according to query message 1; and determines that mirror fragment 2 is stored locally according to query message 2.
  • the peer node 1 determines that the mirror fragment 1 is stored locally according to the query message 1, including: the peer node 1 queries the locally stored mirror fragment 1 according to the identification of the mirror fragment 1 carried in the query message 1, and determines the local storage of the mirror fragment 1.
  • Mirror shard 1 is stored.
  • the peer node 1 determines that the mirror fragment 2 is stored locally according to the query message 2, including: the peer node 1 queries the locally stored mirror fragment 2 according to the identifier of the mirror fragment 2 carried in the query message 2, and determines the local storage of the mirror fragment 2.
  • Mirror shard 2 is stored.
  • peer node 1 in response to satisfying condition 1, sends mirror fragment 1 and hash value 1 to peer node 2 through network channel 1.
  • Satisfying condition 1 includes: satisfying that the number of mirror shards uploaded by peer node 1 does not exceed the preset upload number.
  • the preset upload amount can be determined based on the current network status of peer node 1. That is to say, when the current network status of peer node 1 is relatively good, the preset upload quantity can be larger; when the current network status of peer node 1 is not very good, the preset upload quantity can be smaller.
  • the preset upload number may be, but is not limited to, equal to 1 or 2, etc.
  • Network channel 1 is a network channel for data transmission between peer node 1 and peer node 2.
  • the peer node 1 can also perform hash calculation on the mirror fragment 1 to obtain the hash value 1, and the hash value 1 is used to implement the integrity check of the mirror fragment 1.
  • the type of hash algorithm is not specifically limited.
  • the hash algorithm may be, but is not limited to, a hash algorithm or a message digest algorithm.
  • peer node 1 sends the image fragment 1 and the hash value 1 to the peer node 2 through the network channel 1 is not limited.
  • peer node 1 can encapsulate image fragment 1 and hash value 1 in a data packet, and then send the encapsulated data packet to peer node 2.
  • peer node 1 can also encapsulate image fragment 1 and hash value 1 in two data packets respectively, and then send the two encapsulated data packets together to peer node 2.
  • peer node 1 in response to satisfying condition 1, sends mirror fragment 2 and hash value 2 to peer node 3 through network channel 3.
  • the satisfaction condition 1 in the above S909 is the same as the satisfaction condition 1 in the above S908.
  • satisfying condition 1 in the above S908 includes: satisfying that the number of mirror fragments uploaded by the peer node 1 does not exceed 1 mirror fragment, the peer node 1 can first execute the above S908 and then execute the above S909, or the peer node 1 You can first execute the above S909 Then execute the above S908.
  • Network channel 3 is a network channel for data transmission between peer node 1 and peer node 3, and network channel 3 and network channel 1 are not the same network channel. In other words, peer 1 transmits different image shards over different network channels.
  • peer node 1 can also perform hash calculation on mirror shard 2 to obtain hash value 2.
  • Peer node 2 performs an integrity check on the image fragment 1 based on the image fragment 1 and the hash value 1, and determines that the received image fragment 1 is complete.
  • the peer node 2 performs an integrity check on the image fragment 1 based on the image fragment 1 and the hash value 1 to determine that the received image fragment 1 is complete, including: the peer node 2 uses a hash algorithm to verify the integrity of the image fragment 1. Image fragment 1 is processed and hash value #1 is obtained; by comparing hash value 1 and hash value #1, it is determined that the received image fragment 1 is complete, that is, there is no Been attacked or tampered with. It can be understood that the hash algorithm used by peer node 1 to determine hash value 1 based on mirror shard 1 is the same as the hash algorithm used by peer node 2 to determine hash value #1 based on mirror shard 1.
  • peer node 1 when peer node 1 encapsulates image fragment 1 and hash value 1 in the same data packet, and sends the encapsulated data packet to peer node 2, peer node 2 is executing
  • the above-mentioned S910 can also perform the following operations: parse this data packet and obtain image fragment 1 and hash value 1.
  • Peer node 3 performs an integrity check on image fragment 2 based on image fragment 2 and hash value 2, and determines that the received image fragment 2 is complete.
  • the principle for peer node 3 to perform the above S911 is the same as the principle for peer node 2 to perform the above S910.
  • the first round of distribution of the image slices included in the image file 1 is completed.
  • peer nodes in the P2P network that do not own the image file i.e., peer node 2 and peer node 3
  • peer node 2 obtains mirror fragment 1 from peer node 1 through network channel 1
  • peer node 3 obtains mirror fragment 2 from peer node 1 through network channel 3.
  • Network channel 1 is different from network channel 3.
  • Mirror shard 1 is different from mirror shard 2.
  • peer node 2 and peer node 3 in the P2P network respectively have different image shards included in the image file 1. After that, peer node 2 and peer node 3 in the P2P network can obtain the mirror shards owned by each other through resource sharing.
  • the second round of distribution process will be introduced in detail with reference to S912 to S922 shown in FIG. 9B.
  • Peer node 2 generates query message 3 according to instruction 1 and the first download sequence.
  • the local storage of peer node 2 has the image slice 1 included in the image file 1. Based on this, the peer node 2 generates a query message 3 according to the instruction 1 and the first download sequence.
  • the query message 3 is specifically used to query the second image that needs to be downloaded in the sequence of downloading image fragments indicated by the first download sequence.
  • Sharding that is, query message 3 is used to query mirror shard 2.
  • the query message 3 can carry the identity of the mirror shard 2 and the identity of the peer node 2.
  • the identity of the mirror shard 2 is used to uniquely identify the mirror shard 2, and the identity of the peer node 2 is used to uniquely identify the peer. Node 2.
  • Peer node 3 generates query message 4 according to instruction 1 and the second download sequence.
  • the local storage of peer node 3 contains image slice 2 included in image file 1. Based on this, the peer node 3 generates a query message 4 according to the instruction 1 and the second download sequence.
  • the query message 4 is specifically used to query the second image that needs to be downloaded in the sequence of downloading image fragments indicated by the first download sequence.
  • Sharding that is, query message 4 is used to query mirror shard 1.
  • the query message 4 can carry the identifier of mirror fragment 1 and the identifier of peer node 3.
  • the identifier of mirror fragment 1 is used to uniquely identify mirror fragment 1, and the identifier of peer node 3 is used to uniquely identify the peer. Node 3.
  • Peer node 2 sends query message 3 to the node in the P2P network to query mirror shard 2.
  • the node in the P2P network receives query message 3.
  • the peer node 2 sends the query message 3 to the nodes in the P2P network, including: the peer node 2 sends the query message 3 to the peer node 1 through the network channel 1, and sends the query message 3 to the peer node 3 through the network channel 2. , and send query message 3 to the control node through network channel 4.
  • Peer node 3 sends query message 4 to the node in the P2P network to query mirror shard 1. Correspondingly, the node in the P2P network receives the query message 4.
  • the peer node 4 sends the query message 4 to the nodes in the P2P network, including: the peer node 4 sends the query message 4 to the peer node 1 through the network channel 3, and sends the query message 4 to the peer node 2 through the network channel 2. , and send query message 4 to the control node through network channel 6.
  • Peer node 3 determines that mirror fragment 2 is stored locally according to query message 3 and conditions 2 are met.
  • Satisfying condition 2 includes: satisfying that the peer node does not store all the image fragments included in the image file 1 locally, and the number of image fragments uploaded by the peer node does not exceed the preset upload number. That is to say, the peer node that meets condition 2 is not the peer node that owns the complete image file 1, and the number of image fragments uploaded by the peer node does not exceed the preset upload number.
  • the preset upload quantity can be set according to the network status of a peer node or user needs.
  • the preset upload number corresponding to each peer node in the P2P network can be the same or different.
  • the peer node 3 determines that the mirror shard 2 is stored locally according to the query message 3, including: the peer node 3 queries the locally stored data according to the identifier of the mirror shard 2 carried in the query message 3, and determines that the mirror is stored locally.
  • the identifier of shard 2 corresponds to the mirror shard 2.
  • Peer node 2 determines that mirror fragment 1 is stored locally according to query message 4 and conditions 2 are met.
  • the satisfying condition 2 described in the above S917 is the same as the satisfying condition 2 described in the above S916.
  • the peer node 2 determines that the mirror fragment 1 is stored locally according to the query message 4, including: the peer node 2 queries the locally stored data according to the identifier of the mirror fragment 1 carried in the query message 4, and determines that the mirror is stored locally.
  • the identifier of fragment 1 corresponds to the mirror fragment 1.
  • Peer node 1 determines that mirror fragment 2 is stored locally according to query message 3, and determines that mirror fragment 1 is stored locally according to query message 4, and conditions 3 are met.
  • Meeting condition 3 includes: the peer node locally stores all the image fragments included in the image file 1, and the number of image fragments uploaded by the peer node exceeds the preset upload number. It can be understood that when peer node 1 satisfies condition 3, even if peer node 1 locally stores mirror fragment 2 corresponding to query message 3, and mirror fragment 1 corresponding to query message 4, peer node 1 Nor will mirror shard 2 be sent to peer 2, nor will mirror shard 1 be sent to peer 3.
  • peer node 3 in response to satisfying condition 2, sends mirror fragment 2 and hash value 2 to peer node 2 through network channel 2.
  • peer node 2 in response to satisfying condition 2, sends mirror fragment 1 and hash value 1 to peer node 3 through network channel 2.
  • the above S919 and S920 can be executed at the same time.
  • the peer node 2 that owns part of the image fragments of the image file 1 ie, the image fragment 1 not only downloads the peer node 3 from the peer node 3 Node 3 owns part of the image shards of image file 1 (i.e., image shard 2).
  • peer node 2 also acts as a resource provider and uploads locally stored image shard 1 to peer node 3. This This method can improve the transmission efficiency of image fragmentation.
  • Peer node 2 performs an integrity check on image fragment 2 based on image fragment 2 and hash value 2, and determines that the received image fragment 2 is complete.
  • Peer node 3 performs an integrity check on image fragment 1 based on image fragment 1 and hash value 1, and determines that the received image fragment 1 is complete.
  • the peer node 1 can also send a message to the peer node 2.
  • Mirror fragment 2 and hash value 2 send mirror fragment 1 and hash value 1 to peer node 3.
  • peer node 2 and peer node 3 that do not store the complete image file 1 exchange the image shards owned by each other, which can reduce the transmission burden of peer node 1 that owns the complete image file 1 and improve Node download speed and efficiency.
  • the peer node for example, peer node 2 or peer node 3
  • the peer node that owns part of the image shards of image file 1 is also uploading the image shards to other peer nodes while downloading the image shards, which can improve The transmission efficiency of mirror sharding.
  • peer node 2 or peer node 3 can perform hash calculation on multiple received image fragments to obtain hash value A; peer node 2 or peer node 3 can also obtain hash value A from the peer node Obtain the hash value B corresponding to the image file 1 at 1; by comparing the hash value A and the hash value B, peer node 2 or peer node 3 can determine that peer node 2 or peer node 3 has successfully received the Complete image file 1.
  • peer node 2 or peer node 3 can perform hash calculation on multiple received mirror shards, obtain hash value A, and send message 1 to the control node, message 1 is used to indicate the
  • the hash values of multiple image fragments received by peer node 2 or peer node 3 are hash values A; the control node can also obtain the hash value B corresponding to image file 1 from peer node 1; the control node passes Comparing the hash value A and the hash value B are the same, it can be determined that peer node 2 or peer node 3 has successfully received the complete image file 1; the control node sends message 2 to peer node 2 or peer node 3, message 2 is used to indicate that peer node 2 or peer node 3 has successfully received the complete image file 1.
  • the methods shown in the above-mentioned FIG. 9A and the above-mentioned FIG. 9B are only illustrative and do not constitute any limitation on the image distribution method provided by the embodiment of the present disclosure.
  • the execution order of the steps shown in FIG. 9A and FIG. 9B is only illustrative and not limiting.
  • the above-mentioned image file 1 may also include a larger number of image slices.
  • the image file 1 includes image slice 1, image slice 2, and image slice 3.
  • the first download order is different from the second download order.
  • the first download order may be: mirror fragment 1, mirror fragment 3 and mirror fragment 2.
  • the second download order may be mirror fragment 3, mirror fragment 1 and mirror.
  • Shard 2 For example, when the peer node 2 performs the above S921 to determine that the received image fragment 2 is incomplete, the peer node 2 may also request the peer node 3 to retransmit the image fragment 2.
  • all multiple peer nodes in the P2P network that do not store the image file 1 (ie, peer node 2 and peer node 3) first download the complete image file 1 from the node that stores the complete image file 1 according to the download instructions sent by the control node.
  • Peer node 1 obtains one image fragment included in image file 1
  • the plurality of peer nodes obtain multiple different image fragments through multiple different network channels (ie, network channel 1 and network channel 3) (i.e. mirror shard 1 and mirror shard 2).
  • the peer nodes in the P2P network that have obtained some of the image shards included in the image file 1 can share the image shards owned by each other with each other. , which can reduce the transmission burden of peer node 1 with complete image file 1, and improve the speed and efficiency of node downloading.
  • the peer node for example, peer node 2 or peer node 3 that owns part of the image shards of image file 1 is in While downloading the image fragments, the image fragments are also uploaded to other peer nodes, which can improve the transmission efficiency of the image fragments.
  • the integrity of the image fragments associated with image file 1 received by the peer node is verified to determine whether the peer node that does not store image file 1 in the P2P network has successfully received image file 1. .
  • image fragmentation is used as the minimum transmission granularity, which can improve the flexibility of image distribution.
  • the integrity of the image fragments is verified. Since image distribution and integrity verification of image shards are performed at the same time, it does not affect the efficiency of distributing each image shard.
  • FIG. 9A and FIG. 9B illustrate an image distribution method provided by an embodiment of the present disclosure.
  • peer nodes in the P2P network can also communicate with other peer nodes to obtain the current network status of the other peer nodes.
  • the network status of a peer node may include the speed at which the peer node uploads data to other peer nodes, and the speed at which the peer node downloads data from other peer nodes.
  • any peer node finds that the speed of uploading data by any peer node to other peer nodes does not meet the preset upload speed, or the speed of downloading data by any peer node from other peer nodes If the preset download speed is not met, any peer node can also send the obtained network status information to the control node, so that the control node reallocates the network bandwidth of the peer nodes in the P2P network based on the network status information, thereby Solve the problem that the upload speed or download speed of any peer node does not meet the preset speed.
  • a schematic diagram of a multi-channel bandwidth adjustment method provided by an embodiment of the present disclosure will be introduced with reference to FIG. 10 .
  • Figure 10 is a schematic diagram of a network bandwidth adjustment method provided by an embodiment of the present disclosure. It should be understood that the example of Figure 10 only It is only to help those skilled in the art understand the embodiments of the present disclosure, but is not intended to limit the application embodiments to the specific numerical values or specific scenarios illustrated. Those skilled in the art can obviously make various equivalent modifications or changes based on the example of FIG. 10 given below, and such modifications and changes also fall within the scope of the embodiments of the present disclosure. As shown in Figure 10, the method includes S1001 to S1004. Below, S1001 to S1004 are introduced in detail.
  • the following description is given by taking the peer node included in the network architecture shown in Figure 3A as an example: Specifically, the speed at which the peer node 1 shown in Figure 3A uploads data to the peer node 3 meets the predetermined speed.
  • the upload speed i.e., the speed at which peer node 3 downloads data from peer node 1 meets the preset download speed
  • the speed at which peer node 3 uploads data to peer node 1 meets the preset upload speed i.e., the speed at which peer node 3 The speed at which node 1 downloads data from peer node 3 meets the preset download speed
  • the speed at which peer node 2 uploads data to peer node 3 is less than the preset upload speed (that is, the speed at which peer node 3 downloads data from peer node 2 The speed of downloading data is less than the preset download speed). That is to say.
  • the transmission quality of network channel 3 is higher than the transmission quality of network channel 2.
  • peer node 3 detects peer node 1 and peer node 2 respectively to obtain network status information 1.
  • the size of the preset period is not specifically limited and can be set according to actual needs.
  • the preset period can be 1 second, 5 seconds, or 20 seconds, etc.
  • Network status information 1 includes network bandwidth 1 and network bandwidth 2, and network bandwidth 1 meets the preset bandwidth requirement, and network bandwidth 2 does not meet the preset bandwidth requirement.
  • network bandwidth 1 represents the speed at which peer node 1 uploads data to peer node 3.
  • Network bandwidth 1 meets the preset bandwidth requirement, that is, the speed at which peer node 1 uploads data to peer node 3 meets the preset upload speed.
  • Network bandwidth 2 represents the speed at which peer 2 uploads data to peer 3.
  • Network bandwidth 2 does not meet the preset bandwidth requirement, that is, the speed at which peer node 2 uploads data to peer node 3 is less than the preset upload speed.
  • Executing the above S1001 includes: within a preset period, peer node 3 probes peer node 1 to obtain network bandwidth 1; and peer node 3 probes peer node 2 to obtain network bandwidth 2.
  • peer node 3 can use raw-socket technology to perform inter-node speed measurement on peer node 1 to obtain network bandwidth 1.
  • Peer node 3 sends network status information 1 to the control node.
  • the control node receives the network status information 1 sent by the peer node 3.
  • the triggering condition for the peer node 3 to send the network status information 1 to the control node is not specifically limited. For example, when the peer node 3 determines that the speed at which the peer node 2 uploads data to the peer node 3 is less than the preset upload speed, the peer node 3 sends message 1 to the control node. For another example, the peer node 3 may still discover that the peer node 3 still finds the peer node 3 after determining that the speed at which the peer node 2 uploads data to the peer node 3 is less than the preset upload speed and waiting for a short preset time (for example, 100 milliseconds). 2. When the speed of uploading data to peer node 3 is less than the preset upload speed, the peer node 3Send network status information 1 to the control node.
  • a short preset time for example, 100 milliseconds
  • the control node determines that the network bandwidth 3 needs to be increased based on the preset network bandwidth requirement and network status information 1 to obtain network bandwidth #3.
  • Network bandwidth 3 represents the speed at which peer 3 uploads data to peer 1.
  • the preset bandwidth requirement represents the preset upload speed for one peer to upload data to another peer.
  • the control node determines the need to increase the network bandwidth 3 based on the preset bandwidth requirement and network status information 1, including: the control node determines the preset upload speed minus the peer node 2 to the peer node based on the network bandwidth 2 and the preset bandwidth requirement. Wait until the upload speed of data uploaded by node 3 is equal to the first value; the control node determines that the network bandwidth 3 needs to be increased by the first value to obtain network bandwidth #3.
  • network bandwidth #3 meets the preset bandwidth requirements. That is to say, the speed of peer node 3 uploading data to peer node 1 indicated by network bandwidth #3 is greater than the speed of peer node 3 uploading data to peer node 1 indicated by network bandwidth #3. At the same time, the speed at which peer node 3 uploads data to peer node 1, indicated by network bandwidth #3, meets the preset upload speed requirement.
  • the speed at which peer node 2 uploads data to peer node 3 is less than the preset upload speed, that is, the network quality of network channel 2 is not very good.
  • the speed of peer node 3 uploading data to peer node 1 meets the preset upload speed (that is, the network quality of network channel 2 is better)
  • peer node 3 can upload data to peer node 1 by increasing the speed to cope with network fluctuations.
  • S1004 The control node updates the network bandwidth 3 of peer node 3 to network bandwidth #3 according to the bandwidth update message.
  • the control node can also set the upload speed to peer node 3.
  • the speed at which Node 3 uploads data to Peer 1 is re-updated to the upload speed indicated by Network Bandwidth 3.
  • the method shown in FIG. 10 can be used in combination with the methods shown in FIGS. 9A and 9B .
  • the execution position of the method shown in FIG. 10 in the method shown in FIGS. 9A and 9B is not limited.
  • network bandwidth adjustment method shown in FIG. 10 is only illustrative and does not constitute any limitation on the multi-channel bandwidth adjustment method provided by the present disclosure.
  • a balancing effect is achieved by increasing the load of non-faulty nodes, and the network bandwidth resources are preferentially allocated to network channels with good network quality to cope with network fluctuations.
  • This method can effectively solve the problem of network fluctuations. Abnormal fluctuation problem.
  • FIG 11 is a schematic structural diagram of an image distribution device provided by an embodiment of the present disclosure. As shown in Figure 11, the image distribution device includes a transceiver unit 1101 and a processing unit 1102.
  • the image distribution device is used to implement each step performed by the first peer node in the image distribution method shown in FIG. 6 .
  • the structure of the first peer node in the image distribution method shown in FIG. 6 is the structure of the peer node 200 shown in FIG. 5
  • the functions of the transceiver unit 1101 shown in FIG. 11 are the same as those shown in FIG. 5
  • the image distribution device is used to implement each step performed by the i-th second peer node in the image distribution method shown in Figure 6.
  • the structure of the i-th second peer node in the image distribution method shown in FIG. 6 is the structure of the peer node 200 shown in FIG. 5
  • the function of the transceiver unit 1101 shown in FIG. 11 is the same as that of the peer node 200 shown in FIG. 5.
  • the functions of the image fragment transmitter 210 shown in Figure 5 are the same; the functions of the processing unit 1101 shown in Figure 11 are the same as the network analysis module 220, dynamic control client 230 and file storage service 240 shown in Figure 5. The functions are the same.
  • the image distribution device is used to implement each step performed by the control node in the image distribution method shown in FIG. 6 .
  • the structure of the control node in the image distribution method shown in FIG. 6 is the structure of the control node 100 shown in FIG. 4
  • the function of the processing unit 1101 shown in FIG. 11 is the same as the service shown in FIG. 5
  • the registration and discovery 110, network topology center 120, network server 130, and dynamic control center 140 have the same functions.
  • Figure 12 is a schematic structural diagram of an image distribution system provided by an embodiment of the present disclosure. As shown in Figure 12, the system includes a control node 1201, a first peer node 1202, and N second peer nodes 1203, where N is a positive integer greater than or equal to 2.
  • control node 1201 is used to perform various steps performed by the control node in the image distribution method described above
  • first peer node 1202 is used to perform the first peer node execution in the image distribution method described above
  • the N second peer nodes 1203 are used to perform each step performed by the N second peer nodes in the image distribution method described above. For content not described in detail here, please refer to the above related describe.
  • Figure 13 is a schematic structural diagram of an image distribution device provided by an embodiment of the present disclosure. As shown in Figure 13, it includes a memory 1301, a processor 1302, a communication interface 1303 and a communication bus 1304. Among them, memory 1301, processing The controller 1302 and the communication interface 1303 realize the communication connection between each other through the communication bus 1304.
  • the memory 1301 may be a read only memory (ROM), a static storage device, a dynamic storage device or a random access memory (RAM).
  • the memory 1301 can store a program. When the program stored in the memory 1301 is executed by the processor 1302, the processor 1302 and the communication interface 1303 are used to execute various steps of the method implemented by the block cipher algorithm of the embodiment of the present disclosure.
  • the processor 1302 may be a general central processing unit (CPU), a microprocessor, an application specific integrated circuit (ASIC), a graphics processing unit (GPU), or one or more
  • the integrated circuit is used to execute relevant programs to implement the functions required to be performed by the units in the device for implementing the block cipher algorithm according to the embodiment of the present disclosure, or to perform various steps of the method for implementing the block cipher algorithm according to the embodiment of the present disclosure.
  • the processor 1302 may also be an integrated circuit chip with signal processing capabilities. During the implementation process, each step of the method for implementing the block cipher algorithm provided by the present disclosure can be completed by instructions in the form of hardware integrated logic circuits or software in the processor 1302 .
  • the above-mentioned processor 1302 can also be a general-purpose processor, a digital signal processor (digital signal processing, DSP), an application specific integrated circuit (ASIC), an off-the-shelf programmable gate array (field programmable gate array, FPGA) or other programmable logic devices. , discrete gate or transistor logic devices, discrete hardware components.
  • DSP digital signal processing
  • ASIC application specific integrated circuit
  • FPGA field programmable gate array
  • Each disclosed method, step and logical block diagram in the embodiment of the present disclosure can be implemented or executed.
  • a general-purpose processor may be a microprocessor or the processor may be any conventional processor, etc.
  • the steps of the method disclosed in conjunction with the embodiments of the present disclosure can be directly implemented by a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor.
  • the software module can be located in random access memory, flash memory, read-only memory, programmable read-only memory or electrically erasable programmable memory, registers and other mature storage media in this field.
  • the storage medium is located in the memory 1301, and the processor 1302 reads the information in the memory 1301, and in combination with its hardware, completes the functions required by the units included in the device for implementing the block cipher algorithm of the embodiment of the present disclosure, or performs the method embodiment of the present disclosure. Methods for implementing block cipher algorithms.
  • the communication interface 1303 uses a transceiver device such as but not limited to a transceiver to implement communication between the device shown in Figure 13 and other devices or communication networks. For example, ciphertext data and the like can be output through the communication interface 1303.
  • Communication bus 1304 may include a path for transferring information between various components of the device shown in Figure 13 (eg, memory 1301, processor 1302, communication interface 1303).
  • Embodiments of the present disclosure provide a computer-readable storage medium.
  • the computer-readable storage medium includes computer instructions. When executed by a processor, the computer instructions are used to implement the technical solution of any image distribution method in the embodiments of the disclosure.
  • the example embodiments described here can be implemented by software, or can be implemented by software combined with necessary hardware. Therefore, the technical solutions according to the embodiments of the present disclosure can be embodied in the form of a software product, which can be stored on a computer-readable medium and include a number of instructions to enable a computing device (which can be a personal computer, a server, a terminal device, or network device, etc.) to perform the method according to the disclosed embodiments of the present disclosure.
  • a computing device which can be a personal computer, a server, a terminal device, or network device, etc.
  • a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
  • processors CPUs
  • input/output interfaces network interfaces
  • memory volatile and non-volatile memory
  • Memory may include non-permanent storage in computer-readable media, random access memory (RAM) and/or non-volatile memory in the form of read-only memory (ROM) or flash memory (flash RAM). Memory is an example of computer-readable media.
  • RAM random access memory
  • ROM read-only memory
  • flash RAM flash random access memory
  • Computer-readable media includes permanent and non-permanent, removable and non-removable media that can be used to store information by any method or technology. Information may be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), and read-only memory. (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, Magnetic tape cassettes, tape magnetic disk storage or other magnetic storage media or any other non-transmission media can be used to store information that can be accessed by computing devices. As defined in this article, computer-readable media does not include non-transitory computer-readable media (transitory media), such as modulated data signals and carrier waves.
  • PRAM phase change memory
  • SRAM static random access memory
  • DRAM dynamic random access memory
  • embodiments of the present disclosure may be provided as methods, systems or computer program products. Accordingly, the present disclosure may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment that combines software and hardware aspects. Furthermore, the present disclosure may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.
  • computer-usable storage media including, but not limited to, disk storage, CD-ROM, optical storage, etc.

Abstract

The present application discloses a mirror image distribution method, system, and device. The method comprises: a first peer node receiving N first query messages sent by N second peer nodes; according to the N first query messages, the first peer node determining to send to the N second peer nodes N different mirror image fragments included in a mirror image file queried by the N first query messages; the first peer node using N network channels for sending to the N second peer nodes the N mirror image fragments and also N different hash values corresponding to the N mirror image fragments, so that an ith second peer node interacts with other second peer nodes to obtain a mirror image file, an ith network channel being a network channel for transmitting between the first peer node and an ith second peer node the ith mirror image fragment and the hash value corresponding to the ith mirror image fragment, N being a positive integer greater than or equal to 2, and i = 1, 2, ... , N. The method can improve mirror image distribution efficiency.

Description

一种镜像分发方法、系统和设备Image distribution method, system and device
相关申请的交叉引用Cross-references to related applications
本公开要求于2022年08月18日提交的申请号为202210994948.8、名称为“一种镜像分发方法、系统和设备”的中国专利申请的优先权,该中国专利申请的全部内容通过引用结合在本公开中。This disclosure claims priority to the Chinese patent application with application number 202210994948.8 and titled "An Image Distribution Method, System and Equipment" submitted on August 18, 2022. The entire content of this Chinese patent application is incorporated herein by reference. Public.
技术领域Technical field
本公开涉及网络技术领域,尤其涉及一种镜像分发方法、系统和设备。The present disclosure relates to the field of network technology, and in particular, to an image distribution method, system and device.
背景技术Background technique
随着云技术的发展,越来越多的应用场景中,基于云技术以实现网络内的资源共享。例如,云游戏应用场景下,需要给用户提供多种游戏进行游玩,同时需要满足不同地域的用户的游玩游戏的需求。为满足用户低延迟,高画质的需求,需要在各地部署云游戏系统,其中包括云游戏存储设备。因此需要同时维护多个地方区域的游戏存储,游戏资源的实时更新成为了难题。With the development of cloud technology, more and more application scenarios are based on cloud technology to realize resource sharing within the network. For example, in cloud gaming application scenarios, it is necessary to provide users with a variety of games to play, and at the same time, it is necessary to meet the gaming needs of users in different regions. In order to meet users' needs for low latency and high image quality, cloud gaming systems need to be deployed everywhere, including cloud gaming storage devices. Therefore, it is necessary to maintain game storage in multiple local areas at the same time, and real-time update of game resources becomes a problem.
传统方案中,主要是使用Qcow2镜像保存游戏数据,上述方法将游戏数据挂载到云游戏系统中,各个区域的Qcow2镜像保持一致。在进行游戏镜像文件共享时,存储有游戏镜像文件的节点将完整的游戏镜像文件先传输给该节点的子节点。在该子节点获得完整的游戏镜像文件后,该子节点再将完整的游戏镜像文件传输给其子节点,直到网络中的所有通信的节点获取到完整的游戏镜像文件后,停止游戏镜像文件共享的流程。上述技术中,存在镜像文件分发效率低的问题。In the traditional solution, the Qcow2 image is mainly used to save game data. The above method mounts the game data to the cloud game system, and the Qcow2 images in each region remain consistent. When sharing game image files, the node that stores the game image file first transmits the complete game image file to the child nodes of the node. After the child node obtains the complete game image file, the child node then transmits the complete game image file to its child nodes. After all communicating nodes in the network obtain the complete game image file, the game image file sharing stops. process. In the above technology, there is a problem of low image file distribution efficiency.
因此,亟需一种镜像分发方法,通过该方法可以提高镜像分发的效率。Therefore, an image distribution method is urgently needed, through which the efficiency of image distribution can be improved.
发明内容Contents of the invention
本公开本公开实施例第一方面提供了一种镜像分发方法,应用于包括第一对等节点和N个第二对等节点的对等网络,其中,所述第一对等节点存储与应用程序关联的镜像文件,N为大于等于2的正整数,包括:所述第一对等节点接收所述N个第二对等节点发送的N个第一查询消息,所述N个第一查询消息与所述N个第二对等节点一一对应;所述第一对等节点根据所述N个第一查询消息,确定向所述N个第二对等节点发送所述N个第一查询消息所查询的所述镜像文件包括的N个不同的镜像分片;所述第一对等节点通过N个网络 通道向所述N个第二对等节点发送所述N个镜像分片和所述N个镜像分片对应的N个不同的哈希值,以使第i个第二对等节点与其他第二对等节点进行交互获得所述镜像文件,其中,第i个网络通道为所述第一对等节点与所述第i个第二对等节点传输所述第i个镜像分片和所述第i个镜像分片对应的哈希值的网络通道,i=1,2,…,N。A first aspect of an embodiment of the present disclosure provides an image distribution method, applied to a peer-to-peer network including a first peer node and N second peer nodes, wherein the first peer node stores and applies The image file associated with the program, N is a positive integer greater than or equal to 2, includes: the first peer node receives N first query messages sent by the N second peer nodes, and the N first queries The message corresponds to the N second peer nodes one-to-one; the first peer node determines to send the N first peer nodes to the N second peer nodes based on the N first query messages. The image file queried by the query message includes N different image fragments; the first peer node passes through N networks The channel sends the N mirror fragments and N different hash values corresponding to the N mirror fragments to the N second peer nodes, so that the i-th second peer node is consistent with other Two peer nodes interact to obtain the image file, wherein the i-th network channel transmits the i-th image fragment and the i-th image fragment to the i-th second peer node. The network channel of the hash value corresponding to the i-th mirror fragment, i=1,2,…,N.
本公开实施例第二方面提供了一种镜像分发方法,应用于包括控制节点和所述控制节点管理的第一对等节点和N个第二对等节点的对等网络,其中,所述第一对等节点存储与应用程序关联的镜像文件,N为大于等于2的正整数,包括:第i个第二对等节点根据接收到的所述控制节点发送的下载指令,确定下载所述镜像文件包括的N个镜像分片的下载顺序,所述下载指令用于指示开始下载所述镜像文件,所述N个第二对等节点均接收到所述下载指令,所述N个第二对等节点与N个下载顺序一一对应,且所述N个下载顺序不同,i=1,2,…,N;所述第i个第二对等节点根据所述第i个第二对等节点对应的第i个下载顺序,确定向所述第一对等节点发送第一查询消息,以及向其他第二对等节点发送第二查询消息;所述第一查询消息用于查询所述镜像文件包括的第i个镜像分片,且所述第i个镜像分片为所述第i个下载顺序所指示下载的第一个镜像分片;所述第二查询消息用于查询所述镜像文件包括的除所述第i个镜像分片以外的一个镜像分片,且所述第二查询消息所查询的镜像分片为所述第i个下载顺序所指示下载的第j个镜像分片,j=2,3,…,N;所述第i个第二对等节点向所述第一对等节点发送所述第一查询消息,以及向其他第二对等节点发送所述第二查询消息,以获得所述镜像文件。The second aspect of the embodiment of the present disclosure provides an image distribution method, applied to a peer-to-peer network including a control node, a first peer node managed by the control node, and N second peer nodes, wherein the A peer node stores an image file associated with an application, and N is a positive integer greater than or equal to 2, including: the i-th second peer node determines to download the image based on the received download instruction sent by the control node. The download order of the N image fragments included in the file, the download instruction is used to instruct to start downloading the image file, the N second peer nodes all receive the download instruction, and the N second peer nodes There is a one-to-one correspondence between equal nodes and N download orders, and the N download orders are different, i=1,2,...,N; the i-th second peer node is based on the i-th second peer node The i-th download sequence corresponding to the node determines to send a first query message to the first peer node, and to send a second query message to other second peer nodes; the first query message is used to query the image The i-th image fragment included in the file, and the i-th image fragment is the first image fragment downloaded as indicated by the i-th download sequence; the second query message is used to query the image The file includes an image fragment other than the i-th image fragment, and the image fragment queried by the second query message is the j-th image fragment downloaded as indicated by the i-th download sequence. , j=2,3,...,N; the i-th second peer node sends the first query message to the first peer node, and sends the second query message to other second peer nodes. Query the message to obtain the image file.
本公开实施例第三方面提供了一种镜像分发装置,应用于包括第一对等节点和N个第二对等节点的对等网络,其中,所述第一对等节点存储与应用程序关联的镜像文件,N为大于等于2的正整数,包括:收发单元,用于接收所述N个第二对等节点发送的N个第一查询消息,所述N个第一查询消息与所述N个第二对等节点一一对应;处理单元,用于根据所述N个第一查询消息,确定向所述N个第二对等节点发送所述N个第一查询消息所查询的所述镜像文件包括的N个不同的镜像分片;所述收发单元,还用于通过N个网络通道向所述N个第二对等节点发送所述N个镜像分片和所述N个镜像分片对应的N个不同的哈希值,以使得第i个第二对等节点与其他第二对等节点进行交互获得所述镜像文件,其中,第i个网络通道为所述第一对等节点与所述第i个第二对等节点传输所述第i个镜像分片和所述第i个镜像分片对应的哈希值的网络通道,i=1,2,…,N。The third aspect of the embodiment of the present disclosure provides an image distribution device, applied to a peer-to-peer network including a first peer node and N second peer nodes, wherein the first peer node stores information associated with an application mirror file, N is a positive integer greater than or equal to 2, including: a transceiver unit, used to receive N first query messages sent by the N second peer nodes, the N first query messages are the same as the There is a one-to-one correspondence between N second peer nodes; a processing unit configured to determine, based on the N first query messages, to send all the information queried by the N first query messages to the N second peer nodes. The image file includes N different image fragments; the transceiver unit is also configured to send the N image fragments and the N images to the N second peer nodes through N network channels. N different hash values corresponding to the fragments, so that the i-th second peer node interacts with other second peer nodes to obtain the image file, where the i-th network channel is the first pair The network channel through which the peer node and the i-th second peer node transmit the i-th mirror fragment and the hash value corresponding to the i-th mirror fragment, i=1, 2,...,N.
本公开实施例第四方面提供了一种镜像分发装置,应用于包括控制节点和所述控制节点管理的第一对等节点和N个第二对等节点的对等网络,其中,所述第一对等节点存储与 应用程序关联的镜像文件,N为大于等于2的正整数,包括:处理单元,用于根据接收到的所述控制节点发送的下载指令,确定下载所述镜像文件包括的N个镜像分片的下载顺序,所述下载指令用于指示开始下载所述镜像文件,所述N个第二对等节点均接收到所述下载指令,所述N个第二对等节点与N个下载顺序一一对应,且所述N个下载顺序不同,i=1,2,…,N;所述处理单元,还用于根据所述第i个第二对等节点对应的第i个下载顺序,确定向所述第一对等节点发送第一查询消息,以及向其他第二对等节点发送第二查询消息;所述第一查询消息用于查询所述镜像文件包括的第i个镜像分片,且所述第i个镜像分片为所述第i个下载顺序所指示下载的第一个镜像分片;所述第二查询消息用于查询所述镜像文件包括的除所述第i个镜像分片以外的一个镜像分片,且所述第二查询消息所查询的镜像分片为所述第i个下载顺序所指示下载的第j个镜像分片,j=2,3,…,N;收发单元,用于向所述第一对等节点发送所述第一查询消息,以及向其他第二对等节点发送所述第二查询消息,以获得所述镜像文件。The fourth aspect of the embodiment of the present disclosure provides an image distribution device, applied to a peer-to-peer network including a control node, a first peer node managed by the control node, and N second peer nodes, wherein the A peer node stores a The image file associated with the application program, where N is a positive integer greater than or equal to 2, includes: a processing unit, configured to determine the number of times to download N image fragments included in the image file according to the received download instruction sent by the control node. Download sequence, the download instruction is used to instruct to start downloading the image file, the N second peer nodes all receive the download instruction, the N second peer nodes and the N download sequences are one by one corresponding, and the N downloading orders are different, i=1,2,...,N; the processing unit is also used to determine the direction to the i-th second peer node according to the i-th downloading order corresponding to the i-th second peer node. The first peer node sends a first query message, and sends a second query message to other second peer nodes; the first query message is used to query the i-th image fragment included in the image file, and The i-th image fragment is the first image fragment downloaded as indicated by the i-th download sequence; the second query message is used to query the image fragments included in the image file except the i-th image fragment. An image fragment other than the image fragment, and the image fragment queried by the second query message is the j-th image fragment downloaded indicated by the i-th download sequence, j=2,3,...,N; A transceiver unit configured to send the first query message to the first peer node and the second query message to other second peer nodes to obtain the image file.
本公开实施例第五方面提供了一种镜像分发设备,该镜像分发设备具有实现上述第一方面或第一方面的任意一种可能的实现方式,以及第三方面或第三方面中任意一种可能的实现方式所描述的镜像分发装置的功能。该功能可以基于硬件实现,也可以基于硬件执行相应的软件实现。该硬件或软件包括一个或多个与上述功能相对应的模块。The fifth aspect of the embodiment of the present disclosure provides an image distribution device, which has the above-mentioned first aspect or any possible implementation manner of the first aspect, and the third aspect or any one of the third aspects. Possible implementations describe the functions of the image distribution device. This function can be implemented based on hardware, or corresponding software implementation can be executed based on hardware. The hardware or software includes one or more modules corresponding to the above functions.
在一种可能的实现方式中,镜像分发设备的结构中包括处理器,该处理器被配置为支持镜像分发设备执行上述方法中相应的功能。In a possible implementation, the structure of the image distribution device includes a processor, and the processor is configured to support the image distribution device to perform corresponding functions in the above method.
该镜像分发设备还可以包括存储器,该存储器用于与处理器耦合,其保存镜像分发设备必要的程序指令和数据。The image distribution device may further include a memory, which is coupled to the processor and stores necessary program instructions and data for the image distribution device.
在另一种可能的实现方式中,该镜像分发设备包括:处理器、发送器、接收器、随机存取存储器、只读存储器以及总线。其中,处理器通过总线分别耦接发送器、接收器、随机存取存储器以及只读存储器。其中,当需要运行镜像分发装置时,通过固化在只读存储器中的基本输入/输出系统或者嵌入式系统中的bootloader引导系统进行启动,引导镜像分发设备进入正常运行状态。在镜像分发设备进入正常运行状态后,在随机存取存储器中运行应用程序和操作系统,使得该处理器执行第一方面或第一方面的任意可能的实现方式中的镜像分发方法。In another possible implementation, the image distribution device includes: a processor, a transmitter, a receiver, a random access memory, a read-only memory, and a bus. The processor is respectively coupled to the transmitter, receiver, random access memory and read-only memory through the bus. When it is necessary to run the image distribution device, it is started through the basic input/output system solidified in the read-only memory or the bootloader boot system in the embedded system, and the image distribution device is guided into a normal operating state. After the image distribution device enters the normal operating state, the application program and the operating system are run in the random access memory, so that the processor executes the image distribution method in the first aspect or any possible implementation of the first aspect.
本公开实施例第六方面提供了一种镜像分发设备,该镜像分发设备具有实现上述第二方面或第二方面的任意一种可能的实现方式,以及第四方面或第四方面中任意一种可能的实现方式所描述的镜像分发装置的功能。该功能可以基于硬件实现,也可以基于硬件执行 相应的软件实现。该硬件或软件包括一个或多个与上述功能相对应的模块。The sixth aspect of the embodiment of the present disclosure provides an image distribution device, which has the above second aspect or any possible implementation manner of the second aspect, and the fourth aspect or any one of the fourth aspect. Possible implementations describe the functions of the image distribution device. This function can be implemented based on hardware or executed based on hardware Corresponding software implementation. The hardware or software includes one or more modules corresponding to the above functions.
在一种可能的实现方式中,镜像分发设备的结构中包括处理器,该处理器被配置为支持镜像分发设备执行上述方法中相应的功能。In a possible implementation, the structure of the image distribution device includes a processor, and the processor is configured to support the image distribution device to perform corresponding functions in the above method.
该镜像分发设备还可以包括存储器,该存储器用于与处理器耦合,其保存镜像分发设备必要的程序指令和数据。The image distribution device may further include a memory, which is coupled to the processor and stores necessary program instructions and data for the image distribution device.
在另一种可能的实现方式中,该镜像分发设备包括:处理器、发送器、接收器、随机存取存储器、只读存储器以及总线。其中,处理器通过总线分别耦接发送器、接收器、随机存取存储器以及只读存储器。其中,当需要运行镜像分发装置时,通过固化在只读存储器中的基本输入/输出系统或者嵌入式系统中的bootloader引导系统进行启动,引导镜像分发设备进入正常运行状态。在镜像分发设备进入正常运行状态后,在随机存取存储器中运行应用程序和操作系统,使得该处理器执行第二方面或第二方面的任意可能的实现方式中的镜像分发方法。In another possible implementation, the image distribution device includes: a processor, a transmitter, a receiver, a random access memory, a read-only memory, and a bus. The processor is respectively coupled to the transmitter, receiver, random access memory and read-only memory through the bus. When it is necessary to run the image distribution device, it is started through the basic input/output system solidified in the read-only memory or the bootloader boot system in the embedded system, and the image distribution device is guided into a normal operating state. After the image distribution device enters the normal operating state, the application program and the operating system are run in the random access memory, so that the processor executes the image distribution method in the second aspect or any possible implementation of the second aspect.
本公开实施例第七方面还提供了一种计算机可读存储介质,其上存储有一条或多条计算机指令,其中,该指令被处理器执行以实现上述任意一种技术方案所述的方法。The seventh aspect of the embodiment of the present disclosure also provides a computer-readable storage medium on which one or more computer instructions are stored, wherein the instructions are executed by a processor to implement the method described in any of the above technical solutions.
应当理解,本部分所描述的内容并非旨在标识本公开公开的实施例的关键或重要特征,也不用于限制本公开公开的范围。本公开公开的其它特征将通过以下的说明书而变得容易理解。It should be understood that the content described in this section is not intended to identify key or important features of the embodiments of the disclosure, nor is it intended to limit the scope of the disclosure. Other features disclosed in the present disclosure will become readily understood from the following description.
附图说明Description of the drawings
为了更清楚地说明本公开实施例的技术方案,下面将对本公开实施例的描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本公开的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the drawings needed to be used in the description of the embodiments of the present disclosure will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present disclosure. , for those of ordinary skill in the art, other drawings can also be obtained based on these drawings without exerting creative labor.
图1是适用于本公开实施例提供的镜像分发方法的一种应用场景的示意图。Figure 1 is a schematic diagram of an application scenario suitable for the image distribution method provided by an embodiment of the present disclosure.
图2是传统技术提供的一种镜像分发方法的传输过程的示意图。Figure 2 is a schematic diagram of the transmission process of an image distribution method provided by traditional technology.
图3A是适用于本公开实施例的一种网络架构的示意图。FIG. 3A is a schematic diagram of a network architecture suitable for embodiments of the present disclosure.
图3B是适用于本公开实施例的另一种网络架构的示意图。Figure 3B is a schematic diagram of another network architecture suitable for embodiments of the present disclosure.
图4是本公开实施例提供的一种控制节点100的结构示意图。FIG. 4 is a schematic structural diagram of a control node 100 provided by an embodiment of the present disclosure.
图5是本公开实施例提供的一种对等节点200的结构示意图。FIG. 5 is a schematic structural diagram of a peer node 200 provided by an embodiment of the present disclosure.
图6是本公开实施例提供的一种镜像分发方法的示意图。Figure 6 is a schematic diagram of an image distribution method provided by an embodiment of the present disclosure.
图7是本公开实施例提供的镜像文件和镜像层的关系示意图。 Figure 7 is a schematic diagram of the relationship between image files and image layers provided by an embodiment of the present disclosure.
图8是本公开实施例提供的镜像层和镜像分片的关系示意图。Figure 8 is a schematic diagram of the relationship between the image layer and image sharding provided by an embodiment of the present disclosure.
图9A是本公开实施例提供的另一种镜像分发方法的示意图。Figure 9A is a schematic diagram of another image distribution method provided by an embodiment of the present disclosure.
图9B是本公开实施例提供的另一种镜像分发方法的示意图。Figure 9B is a schematic diagram of another image distribution method provided by an embodiment of the present disclosure.
图10是本公开实施例提供的一种网络带宽调整方法的示意图。Figure 10 is a schematic diagram of a network bandwidth adjustment method provided by an embodiment of the present disclosure.
图11是本公开实施例提供的一种镜像分发装置的结构示意图。Figure 11 is a schematic structural diagram of an image distribution device provided by an embodiment of the present disclosure.
图12是本公开实施例提供的一种镜像分发系统的结构示意图。Figure 12 is a schematic structural diagram of an image distribution system provided by an embodiment of the present disclosure.
图13是本公开实施例提供的一种镜像分发设备的结构示意图。Figure 13 is a schematic structural diagram of an image distribution device provided by an embodiment of the present disclosure.
具体实施方式Detailed ways
为了使本领域的技术人员能够更好的理解本公开的技术方案,下面结合本公开实施例中的附图,对本公开进行清楚、完整地描述。但本公开能够以很多不同于上述描述的其他方式进行实施,因此,基于本公开提供的实施例,本领域普通技术人员在不经过创造性劳动的情况下,所获得的所有其他实施例,都应属于本公开保护的范围。In order to enable those skilled in the art to better understand the technical solutions of the present disclosure, the present disclosure is clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present disclosure. However, the present disclosure can be implemented in many other ways different from the above description. Therefore, based on the embodiments provided by the present disclosure, all other embodiments obtained by those of ordinary skill in the art without creative work should be belong to the scope of protection of this disclosure.
需要说明的是,本公开的权利要求书、说明书及附图中的术语“第一”、“第二”、“第三”等是用于区别类似的对象,并不用于描述特定的顺序或先后次序。这样使用的数据在适当情况下是可以互换的,以便于本文所描述的本公开的实施例,能够以除了在本文图示或描述的内容以外的顺序实施。此外,术语“包括”、“具有”以及他们的变形形式,意图在于覆盖不排他的包含,例如,包含了一系列步骤或单元的过程、方法、系统、产品或设备不必限于清楚地列出的那些步骤或单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或单元。It should be noted that the terms “first”, “second”, “third”, etc. in the claims, description and drawings of this disclosure are used to distinguish similar objects and are not used to describe a specific sequence or sequence. Sequence. Data so used are interchangeable under appropriate circumstances so that the embodiments of the disclosure described herein can be practiced in sequences other than those illustrated or described herein. In addition, the terms "including", "having" and their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units and need not be limited to those explicitly listed. Those steps or elements may instead include other steps or elements not expressly listed or inherent to the process, method, product or apparatus.
为了便于理解,首先对本公开实施例中可能涉及的技术术语进行简单介绍。To facilitate understanding, technical terms that may be involved in the embodiments of the present disclosure are first briefly introduced.
1,云技术(cloud technology)1. Cloud technology
云技术,是指在广域网或局域网内将硬件、软件、网络等系列资源统一起来,实现数据的计算、储存、处理和共享的一种托管技术。Cloud technology refers to a hosting technology that unifies a series of resources such as hardware, software, and networks within a wide area network or local area network to realize data calculation, storage, processing, and sharing.
2,云游戏(cloud gaming)2. Cloud gaming
云游戏是以云计算为基础的游戏方式,在云游戏的运行模式下,所有游戏都在服务器端运行,并将渲染完毕后的游戏画面压缩后通过网络传送给用户。Cloud gaming is a gaming method based on cloud computing. In the operating mode of cloud gaming, all games are run on the server side, and the rendered game images are compressed and transmitted to users through the network.
3,云电脑(cloud computer)3. Cloud computer
与云游戏类似,是以云计算为基础的游戏方式。不同的是,该情境下提供给用户一个完全开放的环境,而不限制用户只进行游戏游玩。用户可以通过云电脑进行视频剪辑,机器学习等一系列操作。 Similar to cloud gaming, it is a gaming method based on cloud computing. The difference is that this scenario provides users with a completely open environment and does not restrict users to just playing games. Users can perform a series of operations such as video editing and machine learning through cloud computers.
4,对等(peer-to-peer,P2P)网络4. Peer-to-peer (P2P) network
对等网络,又称为点对点网络或对等计算机网络。对等网络是一种在对等(peer)节点之间分配任务和工作负载的分布式应用架构,是对等计算模型在应用层形成的一种组网或网络形式。具体来说,在对等网络中,网络的参与者共享他们所拥有的一部分硬件资源(例如,计算资源、存储资源、网络连接资源、打印机资源等),这些共享资源通过网络提供服务和内容,能被其它对等节点直接访问而无需经过中间实体。也就是说,对等网络中的参与者既是资源、服务和内容的提供者(server),同时,又是资源、服务和内容的获取者(client)。Peer-to-peer network, also known as peer-to-peer network or peer-to-peer computer network. A peer-to-peer network is a distributed application architecture that distributes tasks and workloads among peer nodes. It is a networking or network form formed by the peer-to-peer computing model at the application layer. Specifically, in a peer-to-peer network, network participants share a portion of the hardware resources they own (for example, computing resources, storage resources, network connection resources, printer resources, etc.), and these shared resources provide services and content through the network. Can be accessed directly by other peer nodes without going through intermediate entities. In other words, participants in a peer-to-peer network are both providers (servers) of resources, services, and content, and at the same time, acquirers (clients) of resources, services, and content.
5,镜像(mirror)5. Mirror
镜像又称为镜像文件。镜像是一种文件存储形式,镜像可以看作是原始文件的副本。Mirror is also called an image file. Mirroring is a form of file storage, and a mirror can be thought of as a copy of the original file.
6,镜像层(mirror layer)6. Mirror layer
镜像通常以分层的结构方式进行存储,每层对应的镜像结构即为镜像层。Mirrors are usually stored in a hierarchical structure, and the mirror structure corresponding to each layer is the mirror layer.
7,镜像分片7. Mirror sharding
镜像分片是对于镜像层而言的逻辑分片。也就是说,可以在逻辑上将一个镜像层划分为多个镜像分片。例如,一个镜像层为40兆字节(Mbyte,MB),可以在逻辑上将该一个镜像层划分为10个镜像分片,且每个镜像分片的大小为4MB。Mirror sharding is a logical sharding for the mirroring layer. In other words, a mirror layer can be logically divided into multiple mirror shards. For example, if an image layer is 40 megabytes (MB), the image layer can be logically divided into 10 image shards, and the size of each image shard is 4MB.
8,树形网络8. Tree network
树形网络为一种网络拓扑形状,树形网络中所有的节点都被组织在一棵树中,树形网络包括根节点和叶子节点。在树形网络中,数据会沿着树枝单向流动,即,只能从根节点流向叶子节点,而无法从叶子节点流向根节点。Tree network is a network topology shape. All nodes in the tree network are organized in a tree. The tree network includes root nodes and leaf nodes. In a tree network, data flows in one direction along the branches, that is, it can only flow from the root node to the leaf nodes, but cannot flow from the leaf nodes to the root node.
9,网状网络9. Mesh network
网状网络为一种网络拓扑形状,这种结构中,所有的节点无规则地互连,没有绝对的父子关系,即节点A可以将资源流向节点B,节点B也可以将资源流向节点A。Mesh network is a network topology shape. In this structure, all nodes are interconnected irregularly and there is no absolute parent-child relationship. That is, node A can flow resources to node B, and node B can also flow resources to node A.
10,Qcow2磁盘镜像文件的文件格式10. File format of Qcow2 disk image file
Qcow2是QEMU使用的磁盘镜像文件的文件格式。Qcow2 is the file format for disk image files used by QEMU.
下面,结合附图对适用于本公开实施例的镜像分发方法的应用场景、网络架构、镜像分发方法进行详细说明。可以理解的是,本公开提供的各实施例之间不冲突的情况下,下述的实施例及实施例中的特征可以相互组合。另外,下述各方法实施例中的步骤时序仅为一种举例,而非严格限定。Below, the application scenarios, network architecture, and image distribution method applicable to the image distribution method in the embodiments of the present disclosure will be described in detail with reference to the accompanying drawings. It can be understood that, as long as there is no conflict between the embodiments provided by the present disclosure, the following embodiments and features in the embodiments can be combined with each other. In addition, the sequence of steps in the following method embodiments is only an example and is not strictly limited.
首先,结合附图介绍适用于本公开实施例的镜像分发方法的应用场景。 First, the application scenarios of the image distribution method applicable to the embodiments of the present disclosure are introduced with reference to the accompanying drawings.
图1是适用于本公开实施例提供的镜像分发方法的一种应用场景的示意图。示例性的,如图1所示,该应用场景包括网络、多个节点i和多个终端i,i=1,2,3,4。其中,多个节点i中的任意两个节点之间可以通过网络进行通信以实现数据的传输,第i个节点与第i个终端进行通信以实现数据的传输。可选的,该应用场景还可以包括更多(例如,10个等)数目的节点,该更多数目的节点通过网络进行通信以实现数据的传输。可选的,该应用场景中的任意一个节点i还可以与更多(例如,2个或3个等)数目的终端进行通信以实现数据的传输。其中,图1示出的网络可以是有线网络或无线网络,本公开对此不作具体限定。节点i与终端i可以通过有线方式连接,也可以通过无线方式(例如,蓝牙(bluetooth)或无线通信技术(WIFI))连接,本公开对此不作具体限定。Figure 1 is a schematic diagram of an application scenario suitable for the image distribution method provided by an embodiment of the present disclosure. For example, as shown in Figure 1, the application scenario includes a network, multiple nodes i and multiple terminals i, i=1, 2, 3, 4. Among them, any two nodes among multiple nodes i can communicate through the network to realize data transmission, and the i-th node communicates with the i-th terminal to realize data transmission. Optionally, the application scenario may also include a larger number (for example, 10, etc.) of nodes that communicate through the network to realize data transmission. Optionally, any node i in this application scenario can also communicate with a larger (for example, 2 or 3, etc.) number of terminals to achieve data transmission. The network shown in Figure 1 may be a wired network or a wireless network, which is not specifically limited in this disclosure. The node i and the terminal i may be connected through a wired method or a wireless method (for example, Bluetooth or wireless communication technology (WIFI)), which is not specifically limited in this disclosure.
节点i可以是具有存储能力(例如,存储云游戏更新镜像文件)、计算能力的服务器。在图1示出的应用场景中,终端i中安装的应用程序(例如,游戏应用程序)可以运行在节点i中。也就是说,节点i可以执行运行该应用程序的相关计算和处理的操作。节点i运行该应用程序后会将该应用程序生成的数据传输给终端i,以使终端i获得该应用程序关联的数据,这种方式可以有效减少终端i的计算量。例如,在云游戏场景下,终端i中安装的游戏应用程序可以运行在节点i上,节点i运行游戏应用程序后还可以对获取的应用数据进行渲染和压缩,此后节点i可以将经过上述处理后的数据传输给终端i,以满足终端i的需求。节点i还可以通过网络向图1中的其他节点发送节点i中存储的资源(例如,节点i中运行的应用程序生成的镜像文件),或者通过网络从图1中的其他节点获取其他节点中存储的资源。可选的,节点i可以具有存储器和处理器。节点i的处理器可以为中央处理器(central processing unit,CPU)。可选的,节点i还可以有图形处理器(graphics processing unit,GPU)、神经网络处理器(neural network processing unit,NPU)、(field programmable gate array,FPGA)中的一种或多种,节点i的存储器可以为随机存取存储器(random access memory,RAM)或者固态驱动器(solid-state drive,SSD)等其它具有存储能力的设备或者内存实例。固态驱动器也可以称为固态硬盘(solid-state drive,SSD)。对节点i的形式不作具体限定。节点i可以是硬件,也可以是软件。当节点i为硬件时,可以实现成多个服务器组成的分布式服务器集群,也可以实现成单个服务器。当节点i为软件时,可以实现成多个软件或软件模块(例如用来提供分布式服务的软件或软件模块),也可以实现成单个软件或软件模块。本公开实施例对此不作具体限定。Node i may be a server with storage capabilities (for example, storing cloud game update image files) and computing capabilities. In the application scenario shown in Figure 1, an application (for example, a game application) installed in terminal i can run in node i. That is, node i can perform operations related to running the calculations and processing of the application. After node i runs the application, it will transmit the data generated by the application to terminal i, so that terminal i can obtain the data associated with the application. This method can effectively reduce the calculation amount of terminal i. For example, in a cloud gaming scenario, the game application installed in terminal i can be run on node i. After running the game application, node i can also render and compress the obtained application data. After that, node i can undergo the above processing. The final data is transmitted to terminal i to meet the needs of terminal i. Node i can also send resources stored in node i (for example, image files generated by applications running in node i) to other nodes in Figure 1 through the network, or obtain other nodes from other nodes in Figure 1 through the network. stored resources. Optionally, node i may have a memory and a processor. The processor of node i can be a central processing unit (CPU). Optionally, node i can also have one or more of a graphics processing unit (GPU), a neural network processing unit (NPU), and a field programmable gate array (FPGA). The node The memory of i can be random access memory (RAM) or solid-state drive (SSD) or other devices or memory instances with storage capabilities. A solid-state drive may also be called a solid-state drive (SSD). The form of node i is not specifically limited. Node i can be hardware or software. When node i is hardware, it can be implemented as a distributed server cluster composed of multiple servers or as a single server. When the node i is software, it can be implemented as multiple software or software modules (for example, software or software modules used to provide distributed services), or it can be implemented as a single software or software module. The embodiments of the present disclosure do not specifically limit this.
终端i上可以安装和运行应用程序,以及显示应用程序的运行结果。例如,终端i 中安装的游戏应用程序可以运行在节点i中,节点i运行该游戏应用程序后可以对生成的游戏数据进行渲染和压缩处理,并将处理后的数据发送给终端i,终端i接收到该数据后可以通过显示界面向用户展示该游戏数据。对终端i的形式不作具体限定。例如,终端i可以但不限于是个人电脑、智能手机、平板电脑、台式计算机、或者可穿戴设备(例如,智能手表)等。Applications can be installed and run on the terminal i, and the running results of the applications can be displayed. For example, terminal i The game application installed in can be run in node i. After running the game application, node i can render and compress the generated game data, and send the processed data to terminal i, and terminal i receives the data. The game data can then be displayed to the user through the display interface. The form of terminal i is not specifically limited. For example, the terminal i may be, but is not limited to, a personal computer, a smartphone, a tablet, a desktop computer, or a wearable device (eg, a smart watch).
可选的,上述无线网络或有线网络使用标准通信技术和/或协议。网络通常为因特网、但也能够是任何网络,包括但不限于局域网(local area network,LAN)、城域网(metropolitan area network,MAN)、广域网(wide area network,WAN)、移动、有线或者无线网络、专用网络或者虚拟专用网络的任何组合)。在一些实施例中,使用包括超文本标记语言(hyper text mark-up language,HTML)、可扩展标记语言(extensible markup language,XML)等的技术和/或格式来代表通过网络交换的数据。此外还能够使用诸如安全套接字层(secure socket layer,SSL)、传输层安全(transport layer security,TLS)、虚拟专用网络(virtual private network,VPN)、网际协议安全(internet protocol security,IPsec)等常规加密技术来加密所有或者一些链路。在另一些实施例中,还能够使用定制和/或专用数据通信技术取代或者补充上述数据通信技术。Optionally, the above wireless network or wired network uses standard communication technologies and/or protocols. The network is usually the Internet, but can be any network, including but not limited to local area network (LAN), metropolitan area network (MAN), wide area network (WAN), mobile, wired or wireless network, private network, or virtual private network). In some embodiments, data exchanged over the network is represented using technologies and/or formats including hypertext mark-up language (HTML), extensible markup language (XML), etc. In addition, you can also use services such as secure socket layer (SSL), transport layer security (TLS), virtual private network (VPN), and Internet protocol security (IPsec). Wait for conventional encryption techniques to encrypt all or some links. In other embodiments, customized and/or dedicated data communication technologies can also be used in place of or in addition to the data communication technologies described above.
应理解,上述图1示出的应用场景仅为示意,并不对适用于本公开实施例提供的镜像分发方法的应用场景构成任何限定。可选的,上述应用场景还可以包括更多数目的节点或终端。可选的,上述应用场景中的任意一个节点还可以与更多数目的终端进行通信以实现数据的传输。It should be understood that the application scenarios shown in FIG. 1 are only illustrative and do not constitute any limitation to the application scenarios applicable to the image distribution method provided by the embodiments of the present disclosure. Optionally, the above application scenario may also include a larger number of nodes or terminals. Optionally, any node in the above application scenario can also communicate with a larger number of terminals to realize data transmission.
当图1示出的应用场景为云游戏应用场景时,该云游戏应用场景中的多个节点可以共享一个节点存储或生成的游戏更新镜像文件,以实现游戏更新镜像文件共享的目的。示例性的,节点1中存储有运行游戏应用程序生成的游戏更新镜像文件,节点1与节点2、节点3和节点4通信,通过将节点1中存储的游戏更新镜像文件传输给节点2、节点3和节点4,以实现游戏更新镜像文件的共享。在实际应用中,当网络中未拥有资源的节点数目较多时,拥有资源的节点1向未拥有资源的大量节点传输该游戏更新镜像文件(例如,该游戏更新镜像文件包括2个Qcow2镜像文件),不仅会增加节点1上传文件的开销,而且还会使得节点1将本地存储的该游戏更新镜像文件分别传输至节点2、节点3和节点4时存在较高的传输延迟。在一些情况下,上述由节点1将镜像文件传输至节点2、节点3和节点4的过程中,可能存在该镜像文件被攻击或篡改的现象,这样,导致节点2、节点3和节点4接收到的镜像文件是不完整的。 When the application scenario shown in Figure 1 is a cloud game application scenario, multiple nodes in the cloud game application scenario can share a game update image file stored or generated by one node to achieve the purpose of game update image file sharing. For example, node 1 stores a game update image file generated by running a game application. Node 1 communicates with node 2, node 3, and node 4 by transmitting the game update image file stored in node 1 to node 2 and node 1. 3 and node 4 to realize the sharing of game update image files. In practical applications, when there are a large number of nodes in the network that do not own resources, node 1 that owns resources transmits the game update image file to a large number of nodes that do not own resources (for example, the game update image file includes 2 Qcow2 image files) , will not only increase the overhead of node 1 uploading files, but also cause high transmission delays when node 1 transmits the locally stored game update image files to node 2, node 3 and node 4 respectively. In some cases, during the above-mentioned process of transmitting the image file from node 1 to node 2, node 3 and node 4, the image file may be attacked or tampered with. In this way, node 2, node 3 and node 4 will receive The image file received is incomplete.
为了解决上述云游戏应用场景中存在的问题,传统技术提供了一种镜像分发方法。传统技术中主要使用Qcow2镜像保存游戏数据,该方法将游戏数据挂载到云游戏系统中,各个区域的节点中存储的Qcow2镜像保持一致,无法对每个区域的节点中存在的游戏镜像进行单独配置。图2示出了该传统技术提供的镜像分发方法的传输过程的示意图。参见图2,图2示出的网络架构为一种树形结构,该树形结构包括的7个节点可以是图1中示出的应用场景包括的节点。图2中的节点1可以是存储有云游戏更新镜像文件的节点,在需要将该镜像文件共享给图2示出的其他节点的情况下,节点1会先将该镜像文件和该镜像文件对应的哈希值1分别传输给节点2和节点3。节点2或节点3接收到该镜像文件和哈希值1后,先对该镜像文件进行哈希运算获得一个哈希值2,通过比较哈希值1和哈希值2相同,确定节点2或节点3已经成功接收到该镜像文件。此后,节点2或节点3会将该镜像文件和哈希值2发送给各自的子节点,以此类推,直到所有节点均接收到该镜像文件,其中,节点2的子节点为节点4和节点5,节点3的子节点为节点6和节点7。这种实现方式中,若一个节点发现未能接收到完整的镜像文件时,该一个节点需要向上游节点发送重传该镜像文件的请求,以重新获得该镜像文件。通常镜像文件的数据量很大(例如,几十吉字节(吉字节(Gigabyte,GB或G)到几百GB的镜像文件),上述实现方式中,节点对接收到的该镜像文件进行完整性校验时需要很长时间(例如,通常需要几十分钟),使得该镜像文件的传输存在较高的延迟。上述传输镜像文件是以树形网络进行传输的,随着网络中节点数目的增加必然会造成传输该一个镜像文件的总传输时长的增加。基于树形网络传输镜像文件时,是分层串行执行的。也就是说,本层节点必须等待上一层节点传输完该镜像文件后,本层节点才能将该镜像文件传输给其子节点。这样,使得树形网络中的非顶点(除节点1之外的节点)的节点接收到该镜像文件时存在较高的传输延迟。当上述树形网络中的一个节点(例如,节点2)在传输镜像文件的过程中发生故障时,还会导致发生故障的子节点不能成功接收到该镜像文件。In order to solve the problems existing in the above cloud game application scenarios, traditional technology provides an image distribution method. In traditional technology, Qcow2 images are mainly used to save game data. This method mounts the game data to the cloud game system. The Qcow2 images stored in the nodes in each region are consistent, and the game images existing in the nodes in each region cannot be separately processed. configuration. Figure 2 shows a schematic diagram of the transmission process of the image distribution method provided by this traditional technology. Referring to Figure 2, the network architecture shown in Figure 2 is a tree structure, and the seven nodes included in the tree structure can be nodes included in the application scenario shown in Figure 1. Node 1 in Figure 2 can be a node that stores a cloud game update image file. When the image file needs to be shared with other nodes shown in Figure 2, Node 1 will first match the image file with the image file. The hash value 1 is transmitted to node 2 and node 3 respectively. After node 2 or node 3 receives the image file and hash value 1, it first performs a hash operation on the image file to obtain a hash value 2. By comparing hash value 1 and hash value 2, it is determined that node 2 or node 3 is the same. Node 3 has successfully received the image file. After that, node 2 or node 3 will send the image file and hash value 2 to their respective child nodes, and so on until all nodes receive the image file, where the child nodes of node 2 are node 4 and node 5. The child nodes of node 3 are node 6 and node 7. In this implementation, if a node discovers that it has failed to receive a complete image file, the node needs to send a request to retransmit the image file to the upstream node to regain the image file. Usually the image file has a large amount of data (for example, an image file ranging from tens of gigabytes (Gigabyte, GB or G) to hundreds of GB). In the above implementation, the node performs processing on the received image file. Integrity verification takes a long time (for example, it usually takes tens of minutes), which causes a high delay in the transmission of the image file. The above transmission image file is transmitted in a tree network, and as the number of nodes in the network increases The increase in purpose will inevitably lead to an increase in the total transmission time for transmitting the image file. When transmitting image files based on a tree network, it is executed serially in layers. In other words, the node at this layer must wait for the node at the upper layer to finish transmitting the image file. After mirroring the file, the node in this layer can transmit the image file to its child nodes. In this way, the non-vertex nodes (nodes other than node 1) in the tree network have a higher transmission rate when receiving the image file. Delay. When a node (for example, node 2) in the above-mentioned tree network fails during the transmission of the image file, it will also cause the failed child node to be unable to successfully receive the image file.
因此,本公开实施例提供了一种镜像分发方法、装置和系统,以解决上述存在的问题。Therefore, embodiments of the present disclosure provide an image distribution method, device and system to solve the above existing problems.
接下来,结合图3A至图5介绍本公开实施例提供的镜像分发方法适用的网络架构。Next, the network architecture suitable for the image distribution method provided by the embodiment of the present disclosure is introduced with reference to FIGS. 3A to 5 .
图3A是适用于本公开实施例的一种网络架构的示意图。如图3A所示,该网络架构包括控制节点和多个对等节点。示例性的,图3A中以该多个对等节点分别为对等节点1、对等节点2和对等节点3为例示出。其中,该网络架构包括的所有节点(即,控制节点和多个对等节点)中的任意两个节点之间均可以相互通信,以实现数据的交互。该网络架构可以理解为是一个P2P网络架构,该架构中的任意两个节点之间可以基于P2P网络通信协 议实现通信和数据交互。例如,该P2P网络通信协议可以是基于TCP/UDP的P2P网络通信协议。可选的,该网络架构中还可以包括更多数目的对等节点,本公开对此不作具体限定。当该网络架构中包括更多数目的对等节点时,该网络架构中的任意两个节点之间均可以通信,以实现数据的交互。示例性的,图3B示出了适用于本公开实施例提供的另一种网络架构,该网络架构包括5个对等节点和1个控制节点,且网络架构中包括的任意两个节点之间可以进行通信,以实现数据的传输。FIG. 3A is a schematic diagram of a network architecture suitable for embodiments of the present disclosure. As shown in Figure 3A, the network architecture includes a control node and multiple peer nodes. For example, FIG. 3A shows that the plurality of peer nodes are peer node 1, peer node 2 and peer node 3 respectively. Any two nodes among all nodes included in the network architecture (ie, control nodes and multiple peer nodes) can communicate with each other to achieve data interaction. This network architecture can be understood as a P2P network architecture. Any two nodes in this architecture can communicate based on the P2P network communication protocol. It is proposed to realize communication and data interaction. For example, the P2P network communication protocol may be a TCP/UDP-based P2P network communication protocol. Optionally, the network architecture may also include a larger number of peer nodes, which is not specifically limited in this disclosure. When the network architecture includes a larger number of peer nodes, any two nodes in the network architecture can communicate with each other to achieve data interaction. Exemplarily, FIG. 3B shows another network architecture suitable for the embodiment of the present disclosure. The network architecture includes 5 peer nodes and 1 control node, and between any two nodes included in the network architecture Communication can be carried out to realize the transmission of data.
控制节点,用于管理该网络架构中的多个对等节点。示例性的,图4示出了本公开实施例提供的一种控制节点100的结构示意图。可以理解的是,控制节点100可以为图3A示出的网络架构中的控制节点,即图3A中的控制节点与图4中的控制节点100具有相同或相似的功能。参见图4,控制节点100包括以下功能模块:服务注册与发现210,网络拓扑中心220,网络服务(web server),以及动态调控中心240。其中,服务注册与发现210,用于保证图3A所示的网络架构中的多个对等节点多活。网络拓扑中心220,用于根据从图3A示出的多个对等节点处获取的网络状态,构建包括该多个对等节点的P2P网络。网络服务器230,用于提供网络服务。动态调控中心240,用于根据从图3A示出的对等节点处获取的网络状态信息,调整网络中的网络通道(例如,网络通道1或网络通道2)带宽,以保证P2P网络包括的对等节点处于正常工作状态。Control node, used to manage multiple peer nodes in the network architecture. For example, FIG. 4 shows a schematic structural diagram of a control node 100 provided by an embodiment of the present disclosure. It can be understood that the control node 100 may be a control node in the network architecture shown in FIG. 3A , that is, the control node in FIG. 3A has the same or similar functions as the control node 100 in FIG. 4 . Referring to Figure 4, the control node 100 includes the following functional modules: service registration and discovery 210, network topology center 220, network service (web server), and dynamic control center 240. Among them, service registration and discovery 210 is used to ensure the multi-activity of multiple peer nodes in the network architecture shown in Figure 3A. The network topology center 220 is configured to construct a P2P network including the plurality of peer nodes according to the network status obtained from the plurality of peer nodes shown in FIG. 3A. Network server 230 is used to provide network services. The dynamic control center 240 is used to adjust the bandwidth of the network channel (for example, network channel 1 or network channel 2) in the network based on the network status information obtained from the peer node shown in Figure 3A to ensure that the P2P network includes Wait until the node is in normal working condition.
对等节点,用于根据控制节点发送的指令向网络中的其他对等节点发送该对等节点存储的网络资源(例如,镜像文件资源)。对等节点还可以接收网络中其他对等节点发送的网络资源。对等节点还可以向控制节点发送该对等节点获取的网络状态。示例性的,图5示出了本公开实施例提供的一种对等节点200的结构示意图。可以理解的是,对等节点200可以为图3A示出的网络架构中的任意一个对等节点,即图3A中的任意一个对等节点与图5中的对等节点200具有相同或相似的功能。参见图5,对等节点200包括以下功能模块:镜像分片传输器210,网络分析模型220,动态调控客户端230,以及文件存储服务器240。其中,镜像分片传输器210用于将文件存储服务240中存储的镜像分片传输给网络中除该对等节点200意外的其他对等节点。网络分析模块220用于进行节点间测速,以及维护对等节点100与对等节点100通信的其他对等节点的网络情况。例如,网络分析模块220可以基于原始套接字(raw-socket)技术进行节点间测速。动态调控客户端230,用于负责分析对等节点200传输数据的通道流量状态,以及结合网络分析模块220获取的网络情况上报给控制节点100中的动态调控中心140。The peer node is configured to send network resources (for example, image file resources) stored by the peer node to other peer nodes in the network according to instructions sent by the control node. Peer nodes can also receive network resources sent by other peer nodes in the network. A peer node may also send the network status obtained by the peer node to the control node. For example, FIG. 5 shows a schematic structural diagram of a peer node 200 provided by an embodiment of the present disclosure. It can be understood that the peer node 200 can be any peer node in the network architecture shown in Figure 3A, that is, any peer node in Figure 3A has the same or similar information as the peer node 200 in Figure 5. Function. Referring to FIG. 5 , the peer node 200 includes the following functional modules: an image fragment transmitter 210 , a network analysis model 220 , a dynamic control client 230 , and a file storage server 240 . Among them, the image fragment transmitter 210 is used to transmit the image fragments stored in the file storage service 240 to other peer nodes in the network except the peer node 200. The network analysis module 220 is used to perform inter-node speed measurement and maintain network conditions of the peer node 100 and other peer nodes communicating with the peer node 100 . For example, the network analysis module 220 can perform inter-node speed measurement based on raw-socket technology. The dynamic control client 230 is responsible for analyzing the channel traffic status of data transmission by the peer node 200 and reporting the network conditions obtained by the network analysis module 220 to the dynamic control center 140 in the control node 100 .
本公开中对图3A示出的控制节点和多个对等节点的形态不作具体限定。例如,控制 节点和多个对等节点可以是服务器。服务器可以是硬件,也可以是软件。当该服务器为硬件时,可以实现成多个服务器组成的分布式服务器集群,也可以实现成单个服务器。当服务器为软件时,可以实现成多个软件或软件模块(例如用来提供分布式服务的软件或软件模块),也可以实现成单个软件或软件模块。本公开实施例对此不作具体限定。In this disclosure, there is no specific limitation on the form of the control node and the plurality of peer nodes shown in FIG. 3A. For example, control A node and multiple peer nodes can be servers. Servers can be hardware or software. When the server is hardware, it can be implemented as a distributed server cluster composed of multiple servers, or it can be implemented as a single server. When the server is software, it can be implemented as multiple software or software modules (for example, software or software modules used to provide distributed services), or it can be implemented as a single software or software module. The embodiments of the present disclosure do not specifically limit this.
需说明的是,图3A中示出的控制节点是独立于对等节点1、对等节点2和对等节点3的一个网络节点。可以理解的是,这种实现方式中,适用于本公开实施例的网络架构中最少可以包括4个节点,即控制节点,对等节点1,对等节点2和对等节点3。可选的,在另一些实现方式中,控制节点还可以是对等节点1、对等节点2或对等节点3中的任意一个对等节点,此时该任意一个对等节点还具有图3A中示出的控制节点的功能。可以理解的是,这种实现方式中,适用于本公开实施例的网络架构中最少可以包括3个节点,即对等节点1,对等节点2和对等节点3,且这3个对等节点中的一个对等节点还具有图3A示出的控制节点的功能。It should be noted that the control node shown in Figure 3A is a network node independent of peer node 1, peer node 2 and peer node 3. It can be understood that in this implementation, the network architecture applicable to the embodiment of the present disclosure may include at least 4 nodes, namely the control node, peer node 1, peer node 2 and peer node 3. Optionally, in other implementations, the control node may also be any peer node among peer node 1, peer node 2, or peer node 3. In this case, any peer node also has the configuration shown in Figure 3A The functions of the control nodes shown in . It can be understood that in this implementation, the network architecture suitable for the embodiments of the present disclosure may include at least three nodes, namely peer node 1, peer node 2 and peer node 3, and these three peers One of the peer nodes also has the function of a control node as shown in Figure 3A.
应理解,上述图3A至图5仅为示意,并不对本公开实施例提供的镜像分发方法适用的网络架构构成任何限定。例如,图3A示出的网络架构中还可以包括更多数目的对等节点和更多数目的网络通道。It should be understood that the above-mentioned Figures 3A to 5 are only illustrations and do not constitute any limitation on the network architecture applicable to the image distribution method provided by the embodiment of the present disclosure. For example, the network architecture shown in FIG. 3A may also include a greater number of peer nodes and a greater number of network channels.
以下,结合图6至图9介绍本公开实施例提供的镜像分发方法。Hereinafter, the image distribution method provided by the embodiment of the present disclosure will be introduced with reference to FIGS. 6 to 9 .
图6是本公开实施例提供的一种镜像分发方法的示意图。本公开实施例提供的镜像分发方法可以应用于包括控制节点和控制节点管理的第一对等节点和N个第二对等节点的对等网络,N为大于等于2的正整数。示例性的,图6示出的所述控制节点可以是上述图3示出的控制节点,图6示出的所述第一对等节点和所述N个第二对等节点可以为上述图3示出的多个对等节点。如图6所示,本公开实施例提供的镜像分发方法包括S601至S606。在介绍S601至S606之前,先对本公开实施中涉及的控制节点、第一对等节点和N个第二对等节点进行详细介绍。Figure 6 is a schematic diagram of an image distribution method provided by an embodiment of the present disclosure. The image distribution method provided by the embodiment of the present disclosure can be applied to a peer-to-peer network including a control node and a first peer node managed by the control node and N second peer nodes, where N is a positive integer greater than or equal to 2. For example, the control node shown in Figure 6 may be the control node shown in Figure 3, and the first peer node and the N second peer nodes shown in Figure 6 may be the control node shown in Figure 6. 3 shows multiple peer nodes. As shown in Figure 6, the image distribution method provided by the embodiment of the present disclosure includes S601 to S606. Before introducing S601 to S606, the control node, the first peer node and the N second peer nodes involved in the implementation of the present disclosure are introduced in detail.
本公开实施例中,对等网络中的控制节点用于管理的第一对等节点和N个第二对等节点。例如,控制节点用于管理第一对等节点和N个第二对等节点的网络带宽、第一对等节点和N个第二对等节点之间的网络拓扑等。在一些实施例中,控制节点为以下对等节点中的任意一个节点:第一对等节点、或N个第二对等节点。可以理解的是,当控制节点为第一对等节点或N个第二对等节点中的一个第二对等节点时,该第一对等节点或该一个第二对等节点还具有控制节点的功能。在另一些实施例中,控制节点还可以是独立于第一对等节点和N个第二对等节点之外的节点,此时第一对等节点或N个第二对等节点中的任意一 个对等节点可以不具备控制节点的功能。可以理解的是,对等网络中的任意两个节点通过不同网络通道进行数据传输,任意两个节点为以下节点中的任意两个节点:控制节点、第一对等节点和N个第二对等节点。示例性的,以图3A为例进行介绍,当所述控制节点为图3A示出的控制节点,第一对等节点为对等节点1,多个第二对等节点分别为对等节点2和对等节点3时,控制节点与对等节点1之间通过网络通道5相互通信,控制节点与对等节点2之间通过网络通道4相互通信,控制节点与对等节点3之间通过网络通道6相互通信,对等节点1与对等节点3之间通过网络通道3相互通信,对等节点1与对等节点2之间通过网络通道1相互通信,对等节点2与对等节点3之间通过网络通道2相互通信。且上述网络通道1至网络通道6中的任意两个网络通道不相同。In the embodiment of the present disclosure, the control node in the peer-to-peer network is used to manage the first peer node and N second peer nodes. For example, the control node is used to manage the network bandwidth of the first peer node and the N second peer nodes, the network topology between the first peer node and the N second peer nodes, and so on. In some embodiments, the control node is any one of the following peer nodes: a first peer node, or N second peer nodes. It can be understood that when the control node is a first peer node or a second peer node among the N second peer nodes, the first peer node or the second peer node also has a control node function. In other embodiments, the control node may also be a node independent of the first peer node and the N second peer nodes, in which case any of the first peer node or the N second peer nodes one A peer node may not have the function of a control node. It can be understood that any two nodes in the peer-to-peer network transmit data through different network channels, and any two nodes are any two nodes among the following nodes: a control node, a first peer node, and N second pairs. Wait for nodes. Illustratively, taking Figure 3A as an example for introduction, when the control node is the control node shown in Figure 3A, the first peer node is peer node 1, and the plurality of second peer nodes are peer nodes 2 respectively. When communicating with peer node 3, the control node and peer node 1 communicate with each other through network channel 5, the control node and peer node 2 communicate with each other through network channel 4, and the control node and peer node 3 communicate with each other through network channel 5. Channel 6 communicates with each other, peer node 1 and peer node 3 communicate with each other through network channel 3, peer node 1 and peer node 2 communicate with each other through network channel 1, peer node 2 and peer node 3 They communicate with each other through network channel 2. And any two network channels among the above-mentioned network channel 1 to network channel 6 are different.
本公开实施例中,第一对等节点存储与应用程序关联的镜像文件。也就是说,第一对等节点是所述对等网络中拥有镜像文件的节点。所述镜像文件包括N个不同的镜像分片,N为大于等于2的正整数。也就是说,所述镜像文件至少包括两个不同的镜像分片。N个不同的镜像分片,即该N个镜像分片的标识不同,但该N个不同的镜像分片携带与应用程序关联的信息可以相同或不同。可以理解的是,一个镜像分片的标识可以用于唯一标识该一个镜像分片。在一些实现方式中,当镜像文件是以镜像分层为结构存储时,该一个镜像文件可以包括至少一个镜像分层,该至少一个镜像分层可以包括所述N个不同的镜像分片。示例性的,图7示出了镜像文件和镜像层的关系的示意图,图7中一个镜像文件可以划分为P个镜像层,P为大于等于1的正整数。图8示出了镜像层与镜像分片的关系示意图,图8中镜像层P可以划分为m个镜像分片,m为大于等于2的正整数。对所述应用程序的类型不作具体限定。在一些实现方式中,所述应用程序为云游戏应用程序,所述与应用程序关联的镜像文件是所述云游戏应用程序生成的更新镜像文件。在另一些实现方式中,所述应用程序还可以为视频应用程序,所述与应用程序关联的镜像文件是所述视频应用程序生成的镜像文件。In the embodiment of the present disclosure, the first peer node stores an image file associated with the application program. That is to say, the first peer node is the node that owns the image file in the peer-to-peer network. The image file includes N different image slices, where N is a positive integer greater than or equal to 2. That is to say, the image file includes at least two different image slices. N different image fragments, that is, the N image fragments have different identifiers, but the information associated with the application carried by the N different image fragments may be the same or different. It can be understood that the identifier of a mirror fragment can be used to uniquely identify the mirror fragment. In some implementations, when the image file is stored in an image layer structure, the one image file may include at least one image layer, and the at least one image layer may include the N different image slices. For example, Figure 7 shows a schematic diagram of the relationship between image files and image layers. In Figure 7, an image file can be divided into P image layers, where P is a positive integer greater than or equal to 1. Figure 8 shows a schematic diagram of the relationship between the mirror layer and the mirror shards. In Figure 8, the mirror layer P can be divided into m mirror shards, where m is a positive integer greater than or equal to 2. The type of application is not specifically limited. In some implementations, the application is a cloud gaming application, and the image file associated with the application is an updated image file generated by the cloud gaming application. In other implementations, the application program may also be a video application program, and the image file associated with the application program is an image file generated by the video application program.
本公开实施例中,N个第二对等节点是对等网络中未存储与所述应用程序关联的镜像文件的N个对等节点。也就是说,在未执行本公开提供的镜像分发方法之前,对等网络中包括的每个第二对等节点都未拥有镜像文件包括的至少一个镜像分片。In this embodiment of the present disclosure, the N second peer nodes are N peer nodes in the peer-to-peer network that do not store image files associated with the application. That is to say, before executing the image distribution method provided by the present disclosure, each second peer node included in the peer-to-peer network does not own at least one image shard included in the image file.
下面,对S601至S606进行详细介绍。Next, S601 to S606 are introduced in detail.
S601,控制节点向N个第二对等节点发送下载指令,下载指令用于指示开始下载镜像文件,N为大于等于2的正整数。S601. The control node sends a download instruction to N second peer nodes. The download instruction is used to instruct to start downloading the image file, and N is a positive integer greater than or equal to 2.
可选的,下载指令可以携带镜像文件的标识,镜像文件的标识用于唯一标识该镜像文 件。控制节点执行上述S601后,N个第二对等节点均接收到下载指令。每个第二对等节点可以根据下载指令所包括的镜像文件的标识确定需要下载的镜像文件。Optionally, the download command can carry the identifier of the image file. The identifier of the image file is used to uniquely identify the image file. pieces. After the control node executes the above S601, all N second peer nodes receive the download instruction. Each second peer node may determine the image file that needs to be downloaded according to the identification of the image file included in the download instruction.
可选的,在一些实施例中,在上述S601之前,控制节点还可以执行以下步骤:接收用户终端发送的请求,该请求表示对等网络中的N个第二对等节点需要获取镜像文件。可选的,所述N个第二对等节点可以为所述用户终端提供网络服务(例如,所述N个第二对等节点本地存储的数据)。其中,对用户终端的类型不作具体限定。例如,用户终端可以但限于是以下任意一种:智能手机、平板电脑、台式电脑或可穿戴智能设备(例如,智能手表)等。Optionally, in some embodiments, before the above S601, the control node may also perform the following steps: receive a request sent by the user terminal, which request indicates that the N second peer nodes in the peer-to-peer network need to obtain the image file. Optionally, the N second peer nodes may provide network services (for example, data stored locally by the N second peer nodes) for the user terminal. Among them, the type of user terminal is not specifically limited. For example, the user terminal may be, but is limited to, any of the following: a smartphone, a tablet computer, a desktop computer, or a wearable smart device (for example, a smart watch), etc.
执行上述S601,即控制节点向N个第二对等节点发送开始下载与应用程序关联的镜像文件的指令。The above S601 is executed, that is, the control node sends an instruction to start downloading the image file associated with the application program to the N second peer nodes.
S602,第i个第二对等节点根据接收到的控制节点发送的下载指令,确定下载镜像文件包括的N个镜像分片的下载顺序,i=1,2,…,N。S602. The i-th second peer node determines the download order of N image fragments included in the download image file according to the received download instruction sent by the control node, i=1, 2,...,N.
执行上述S602,即N个第二对等节点中的每个第二对等节点(即,第i个第二对等节点)均会确定该每个第二对等节点下载镜像文件包括的N个镜像分片的下载顺序,N个第二对等节点与N个下载顺序一一对应,且N个下载顺序不同。The above S602 is executed, that is, each second peer node among the N second peer nodes (i.e., the i-th second peer node) will determine the N included in the downloaded image file of each second peer node. The download order of the mirror shards, the N second peer nodes correspond to the N download orders one-to-one, and the N download orders are different.
在一些实现方式中,N个下载顺序不同,可以理解为,N个下载顺序中的任意两个下载顺序完全不相同。示例性的,当所述镜像文件包括2个镜像分片(即,镜像分片1和镜像分片2)时,N个第二对等节点包括2个第二对等节点时,其中一个第二对等节点确定的下载顺序可以是先下载镜像分片1,再下载镜像分片2;另一个第二对等节点确定的下载顺序可以是先下载镜像分片2,再下载镜像分片1。这种实现方式中,这两个第二对等节点对应的下载顺序完全不相同。In some implementations, the N downloading orders are different, which can be understood as any two downloading orders among the N downloading orders are completely different. For example, when the image file includes 2 image shards (ie, image shard 1 and image shard 2), and the N second peer nodes include 2 second peer nodes, one of the second peer nodes The download order determined by the second peer node may be to download image fragment 1 first, and then image fragment 2; the download order determined by the other second peer node may be to download image fragment 2 first, and then download image fragment 1. . In this implementation, the download sequences corresponding to the two second peer nodes are completely different.
在另一些实现方式中,N个下载顺序不同,可以理解为,N个下载顺序中的任意两个下载顺序不完全相同。其中,任意两个下载顺序不完全相同,是指任意两个下载顺序所指示的第一个下载的镜像分片不同,且对所述任意两个下载顺序所指示的除所述第一个下载的镜像分片之后的其他镜像分片的下载顺序不作具体限定。示例性的,当所述镜像文件包括3个镜像分片(即,镜像分片1、镜像分片2和镜像分片3)时,N个第二对等节点包括2个第二对等节点时,其中一个第二对等节点确定的下载镜像分片的顺序依次为:镜像分片1、镜像分片2和镜像分片3;另一个第二对等节点确定的下载镜像分片的顺序依次为:镜像分片3、镜像分片2和镜像分片1;或另一个第二对等节点确定的下载镜像分片的顺序依次为:镜像分片2、镜像分片1和镜像分片3。这种实现方式中,这两个第二对 等节点对应的下载顺序不完全相同。In other implementations, the N downloading orders are different, which can be understood to mean that any two downloading orders among the N downloading orders are not exactly the same. Wherein, any two downloading orders are not exactly the same, which means that the image fragments of the first download indicated by any two downloading orders are different, and the image fragments indicated by any two downloading orders except the first downloaded The download order of other image fragments after the image fragment is not specifically limited. For example, when the image file includes 3 image shards (ie, image shard 1, image shard 2, and image shard 3), the N second peer nodes include 2 second peer nodes. When , one of the second peer nodes determines the order of downloading the image fragments in order: image fragment 1, image fragment 2, and image fragment 3; the other second peer node determines the order of downloading the image fragments. The order is: mirror shard 3, mirror shard 2 and mirror shard 1; or the order determined by another second peer node to download the mirror shards is: mirror shard 2, mirror shard 1 and mirror shard. 3. In this implementation, the two second pairs The download order corresponding to other nodes is not exactly the same.
S603,第i个第二对等节点根据第i个第二对等节点对应的第i个下载顺序,确定向第一对等节点发送第一查询消息,以及向其他第二对等节点发送第二查询消息。S603. The i-th second peer node determines to send the first query message to the first peer node and sends the first query message to other second peer nodes according to the i-th download sequence corresponding to the i-th second peer node. 2. Query news.
第一查询消息用于查询镜像文件包括的第i个镜像分片,且第i个镜像分片为第i个下载顺序所指示下载的第一个镜像分片。在一些实现方式中,当N个第二对等节点中的每个第二对等节点对应的下载顺序所指示下载的第一个镜像分片均不相同时,执行上述S603,即每个第二对等节点向第一对等节点发送的查询消息所查询的镜像分片均不相同。The first query message is used to query the i-th image fragment included in the image file, and the i-th image fragment is the first image fragment downloaded as indicated by the i-th download sequence. In some implementations, when the download order corresponding to each of the N second peer nodes indicates that the first image fragment to be downloaded is different, the above S603 is executed, that is, each second peer node The query messages sent by the two peer nodes to the first peer node query different mirror shards.
第二查询消息用于查询镜像文件包括的除所述第i个镜像分片以外的一个镜像分片,且第二查询消息所查询的镜像分片为第i个下载顺序所指示下载的第j个镜像分片,j=2,3,…,N。可以理解的是,当N具体为大于等于3的正整数时,若所述第二查询消息为第i个第二对等节点发送的第一个第二查询消息,则j=2;若所述第二查询消息为第i个第二对等节点发送的第二个第二查询消息时,则j=3;以此类推。示例性的,当所述镜像文件包括3个镜像分片(即,镜像分片1、镜像分片2和镜像分片3)时,N个第二对等节点包括2个第二对等节点时,其中一个第二对等节点确定的下载镜像分片的顺序依次为:镜像分片1、镜像分片2和镜像分片3;另一个第二对等节点确定的下载镜像分片的顺序依次为:镜像分片3、镜像分片2和镜像分片1。这种实现方式中,所述一个第二对等节点发送的第一查询消息用于查询镜像分片1。所述另一个第二对等节点发送的第一查询消息用于查询镜像分片2。所述一个第二对等节点发送的第一个第二查询消息用于查询镜像分片2,所述一个第二对等节点发送的第二个第二查询消息用于查询镜像分片3。所述另一个第二对等节点发送的第一个第二查询消息用于查询镜像分片2,所述另一个第二对等节点发送的第二个第二查询消息用于查询镜像分片1。The second query message is used to query an image fragment other than the i-th image fragment included in the image file, and the image fragment queried by the second query message is the j-th image fragment downloaded indicated by the i-th download sequence. mirror shards, j=2,3,…,N. It can be understood that when N is specifically a positive integer greater than or equal to 3, if the second query message is the first second query message sent by the i-th second peer node, then j=2; When the second query message is the second second query message sent by the i-th second peer node, then j=3; and so on. For example, when the image file includes 3 image shards (ie, image shard 1, image shard 2, and image shard 3), the N second peer nodes include 2 second peer nodes. When , one of the second peer nodes determines the order of downloading the image fragments in order: image fragment 1, image fragment 2, and image fragment 3; the other second peer node determines the order of downloading the image fragments. The order is: mirror shard 3, mirror shard 2 and mirror shard 1. In this implementation, the first query message sent by the second peer node is used to query the mirror shard 1. The first query message sent by the other second peer node is used to query the mirror shard 2. The first second query message sent by the second peer node is used to query the mirror shard 2, and the second second query message sent by the second peer node is used to query the mirror shard 3. The first second query message sent by the other second peer node is used to query the mirror shard 2, and the second second query message sent by the other second peer node is used to query the mirror shard 2. 1.
其他第二对等节点,是指N个第二对等节点中除第i个第二对等节点以外的N-1个第二对等节点。Other second peer nodes refer to the N-1 second peer nodes other than the i-th second peer node among the N second peer nodes.
S604,第i个第二对等节点向第一对等节点发送第一查询消息,以及向其他第二对等节点发送第二查询消息,以获得镜像文件。S604. The i-th second peer node sends a first query message to the first peer node, and sends a second query message to other second peer nodes to obtain the image file.
在一些实现方式中,第i个第二对等节点向第一对等节点发送第一查询消息,以及向其他第二对等节点发送第二查询消息,以获得镜像文件,包括以下步骤:第i个第二对等节点向第一对等节点发送第一查询消息;第i个第二对等节点接收第一对等节点发送的第i个镜像分片和第i个镜像分片对应的哈希值,且每个镜像分片对应的哈希值不同;在确定收到的第i个镜像分片通过完整性校验的情况下,第i个第二对等节点保存第i个镜像 分片,并向其他第二对等节点发送第二查询消息;第i个第二对等节点接收到其他第二对等节点发送的第二查询消息所查询的镜像分片和所查询的镜像分片对应的哈希值,其他第二对等节点发送的镜像分片的数目不超过预设阈值;在确定收到的第二查询消息所查询的镜像分片通过完整性校验的情况下,第i个第二对等节点保存第二查询消息所查询的镜像分片。可以理解的是,执行上述步骤后,第i个第二对等节点可以获得第一对等节点和其他第二对等节点发送的镜像文件包括的所有镜像分片(即,N个镜像分片)。这种实现方式中,对等网络中的拥有N个不同的镜像分片的N个第二对等节点之间可以相互交互,以共享彼此存储的镜像分片,可以减轻拥有完整镜像文件的第一对等节点的传输负担,提高了节点下载的速度与效率。这种实现方式中,每个第二对等节点无需等待接收到所述完整的镜像文件后再向其他未存储所述镜像文件的第二对等节点发送所述镜像文件,可以提高镜像分发的效率。In some implementations, the i-th second peer node sends a first query message to the first peer node, and sends a second query message to other second peer nodes to obtain the image file, including the following steps: The i second peer node sends a first query message to the first peer node; the i second peer node receives the i-th mirror fragment sent by the first peer node and the i-th mirror fragment corresponding to Hash value, and the hash value corresponding to each image fragment is different; when it is determined that the i-th image fragment received passes the integrity check, the i-th second peer node saves the i-th image shards, and sends a second query message to other second peer nodes; the i-th second peer node receives the mirror shard and the queried mirror queried by the second query message sent by other second peer nodes. The hash value corresponding to the fragment, the number of mirror fragments sent by other second peer nodes does not exceed the preset threshold; when it is determined that the mirror fragment queried by the received second query message passes the integrity check , the i-th second peer node saves the mirror shard queried by the second query message. It can be understood that after performing the above steps, the i-th second peer node can obtain all image fragments (ie, N image fragments) included in the image files sent by the first peer node and other second peer nodes. ). In this implementation, N second peer nodes with N different image shards in the peer-to-peer network can interact with each other to share the image shards stored with each other, which can alleviate the problem of having a complete image file. The transmission burden on a peer node improves the speed and efficiency of node downloads. In this implementation, each second peer node does not need to wait to receive the complete image file before sending the image file to other second peer nodes that do not store the image file, which can improve the efficiency of image distribution. efficiency.
可选的,在另一些实现方式中,第i个第二对等节点还可以向第一等节点发送第二查询消息。这种实现方式中,可能存在第一对等节点正在上传的镜像分片的数量超过预设阈值,基于第一对等节点即使接收到了第二查询消息且第一对等节点本地存储有第二查询消息所查询的镜像分片的情况下,第一对等节点也不会像第i个第二对等节点发送第二查询消息所查询的镜像分片。也就是说,这种实现方式中,第一对等节点接收到第二查询消息后,向第i个第二对等节点发送的第二查询消息的查询结果为失败,该查询结果不包括第二查询消息所查询的镜像分片。Optionally, in other implementations, the i-th second peer node may also send a second query message to the first peer node. In this implementation, it is possible that the number of image fragments being uploaded by the first peer node exceeds the preset threshold. Even if the first peer node receives the second query message and the first peer node locally stores the second In the case of the mirror shard queried by the query message, the first peer node will not send the mirror shard queried by the second query message to the i-th second peer node. That is to say, in this implementation, after the first peer node receives the second query message, the query result of the second query message sent to the i-th second peer node is failure, and the query result does not include the i-th second peer node. 2. The mirror shard queried by the query message.
上述实现方式中,第二查询消息所查询的镜像分片为第i个下载顺序所指示下载的第j个镜像分片,j=2,3,…,N。也就是说,第i个第二对等节点会发送N-1个第二查询消息,以获得N-1个第二查询消息所查询的N-1个不同的镜像分片。可选的,在一些实现方式中,第i个第二对等节点在确定当前接收到的一个镜像分片通过完整性校验后,该第i个第二对等节点可以继续发送新的查询消息。换句话说,当该第i个第二对等节点在确定当前接收到的一个镜像分片未通过完整性校验时,该第i个第二对等节点会发生重传消息,以请求重新获取该完整的一个镜像分片。第i个第二对等节点向其他第二对等节点发送第二查询消息,可以是同时向所述N-1个第二对等节点都发送第二查询消息。基于此,在一些可能的实现方式中,第i个第二对等节点向其他第二对等节点发送第二查询消息,包括:第i个第二对等节点向N个第二对等节点中除去第i个第二对等节点以外的所有第二对等节点发送第1个第二查询消息,第1个第二查询消息所查询的镜像分片为第i个下载顺序所指示下载的第2个镜像分片(j=2);在第i个第二对等节点在确定成功接收到第1个第二 查询消息所查询的镜像分片的情况下,第i个第二对等节点向N个第二对等节点中除去第i个第二对等节点以外的所有第二对等节点发送第2个第二查询消息,第2个第二查询消息所查询的镜像分片为第i个下载顺序所指示下载的第3个镜像分片(j=3),……,以此类推,直到第i个第二对等节点获得第N-1个查询消息所查询的镜像分片,第i个第二对等节点停止发送第二查询消息。In the above implementation, the image fragment queried by the second query message is the j-th image fragment downloaded as indicated by the i-th download sequence, j=2,3,...,N. That is to say, the i-th second peer node will send N-1 second query messages to obtain N-1 different mirror shards queried by the N-1 second query messages. Optionally, in some implementations, after the i-th second peer node determines that a currently received mirror fragment passes the integrity check, the i-th second peer node can continue to send a new query. information. In other words, when the i-th second peer node determines that a mirror fragment currently received does not pass the integrity check, the i-th second peer node will retransmit the message to request a retransmission. Get the complete image shard. The i-th second peer node sends the second query message to other second peer nodes, and may send the second query message to all the N-1 second peer nodes at the same time. Based on this, in some possible implementations, the i-th second peer node sends a second query message to other second peer nodes, including: the i-th second peer node sends a second query message to N second peer nodes All second peer nodes except the i-th second peer node send the first second query message, and the mirror fragment queried by the first second query message is downloaded as indicated by the i-th download sequence. The second mirror fragment (j=2); when the i-th second peer node determines that it has successfully received the first second In the case of querying the mirror shard queried by the message, the i-th second peer node sends the second second peer node to all N second peer nodes except the i-th second peer node. The second query message, the mirror fragment queried by the second second query message is the third mirror fragment (j=3) downloaded indicated by the i-th download sequence,..., and so on, until the i-th The second peer node obtains the mirror fragment queried by the N-1th query message, and the i-th second peer node stops sending the second query message.
可选的,上述实现方式中,接收到镜像分片的每个第二对等节点还可以对接收到的镜像分片进行完整性校验,以确认该每个第二对等节点接收到的镜像分片是否完整或是否被篡改。基于此,本公开实施例提供的镜像分发方法还可以包括以下步骤:第i个第二对等节点对接收到的镜像分片进行完整性校验,第i个第二对等节点接收到的镜像分片包括第i个镜像分片和第二查询消息所查询的镜像分片;若确定接收到的第i个镜像分片未通过完整性校验,第i个第二对等节点向第一对等节点发送第一重传消息,第一重传消息用于指示第一对等节点发送第i个镜像分片;若确定接收到的第二查询消息所查询的镜像分片未通过完整性校验,第i个第二对等节点向其他第二对等节点发送第二重传消息,第二重传消息用于指示其他第二对等节点发送第二查询消息所查询的镜像分片。Optionally, in the above implementation, each second peer node that receives the mirror fragments can also perform an integrity check on the received mirror fragments to confirm that each second peer node has received Whether the image shards are complete or have been tampered with. Based on this, the image distribution method provided by the embodiment of the present disclosure may also include the following steps: the i-th second peer node performs integrity verification on the received image fragments, and the i-th second peer node receives The mirror fragment includes the i-th mirror fragment and the mirror fragment queried by the second query message; if it is determined that the i-th mirror fragment received does not pass the integrity check, the i-th second peer node sends a request to the i-th second peer node. A peer node sends a first retransmission message, and the first retransmission message is used to instruct the first peer node to send the i-th mirror fragment; if it is determined that the mirror fragment queried by the received second query message has not passed the complete For verification, the i-th second peer node sends a second retransmission message to other second peer nodes. The second retransmission message is used to instruct other second peer nodes to send the mirror segment queried by the second query message. piece.
可选的,在一些实现方式中,第i个第二对等节点根据接收到的每个镜像分片和每个镜像分片对应的哈希值,对该每个镜像分片进行完整性校验,包括:第i个第二对等节点对接收到的每个镜像分片进行哈希计算,获得哈希计算后的值;第i个第二对等节点通过比较哈希计算后的值和每个镜像分片对应的哈希值,确定该每个镜像分片是否通过完整性校验;其中,若哈希计算后的值和每个镜像分片对应的哈希值相同,则确定该每个镜像分片通过完整性校验;若哈希计算后的值和每个镜像分片对应的哈希值不同,则确定该每个镜像分片未通过完整性校验。对哈希计算所采用的哈希算法的类型不作具体限定。例如,所述哈希算法可以但不限于是散列算法或者消息摘要算法。Optionally, in some implementations, the i-th second peer node performs integrity verification on each image fragment based on each received image fragment and the hash value corresponding to each image fragment. The verification includes: the i-th second peer node performs hash calculation on each received image fragment and obtains the hashed value; the i-th second peer node compares the hashed value The hash value corresponding to each mirror fragment determines whether each mirror fragment passes the integrity check; among them, if the calculated hash value is the same as the hash value corresponding to each mirror fragment, then it is determined Each mirror fragment passes the integrity check; if the calculated hash value is different from the hash value corresponding to each mirror fragment, it is determined that each mirror fragment fails the integrity check. The type of hash algorithm used for hash calculation is not specifically limited. For example, the hash algorithm may be, but is not limited to, a hash algorithm or a message digest algorithm.
可选的,在一些场景中,上述实现方式中的其他第二对等节点本地没有存储第二查询消息所查询的镜像分片,这样,即使该其他第二对等节点接收到第二查询消息后,也无法将第二查询消息所查询的镜像分片和对应的哈希值发送给第i个第二对等节点,这种实现方式中,其他第二对等节点向第i个第二对等节点发送的第二查询消息的查询结果为失败。基于此,即若上述实现方式中的第i个第二对等节点未接收到其他第二对等节点发送的第二查询消息所查询的镜像分片和所查询的镜像分片对应的哈希值,本公开实施例提供的镜像分发方法还可以包括以下步骤:第i个第二对等节点向第一对等节点发送第二查询消息;第i个第二对等节点接收第一对等节点发送的第二查询消息所查询的镜像分片和所查询 的镜像分片对应的哈希值。示例性的,当所述镜像文件包括3个镜像分片(即,镜像分片1、镜像分片2和镜像分片3)时,N个第二对等节点包括2个第二对等节点时,其中一个第二对等节点确定的下载镜像分片的顺序依次为:镜像分片1、镜像分片2和镜像分片3;另一个第二对等节点确定的下载镜像分片的顺序依次为:镜像分片3、镜像分片2和镜像分片1。这种场景中,若所述一个第二对等节点和所述另一个第二对等节点同时下载对应的下载顺序所指示的第二个镜像分片(即,镜像分片2)时,所述另一个第二对等节点与所述一个第二对等节点彼此发送查询镜像分片2的查询消息,由于上述两个第二对节点本地都没有存储镜像分片2,故上述两个第二对等节点无法通过彼此交互以获得镜像分片2。此后,所述一个第二对等节点和所述另一个第二对等节点可以向第一对等节点发送查询镜像分片2的查询消息。或者,所述一个第二对等节点可以向第一对等节点发送查询镜像分片2的查询消息,以将获得的镜像分片2保存至本地;所述另一个第二对等节点再向所述一个第二对等节点发送查询镜像分片2的消息,以获得所述镜像分片2。Optionally, in some scenarios, other second peer nodes in the above implementation do not locally store the mirror shards queried by the second query message. In this way, even if the other second peer nodes receive the second query message Afterwards, the mirror shards queried by the second query message and the corresponding hash values cannot be sent to the i-th second peer node. In this implementation, other second peer nodes send requests to the i-th second peer node. The query result of the second query message sent by the peer node is failure. Based on this, that is, if the i-th second peer node in the above implementation does not receive the mirror shard queried by the second query message sent by other second peer nodes and the hash corresponding to the queried mirror shard. value, the image distribution method provided by the embodiment of the present disclosure may also include the following steps: the i-th second peer node sends a second query message to the first peer node; the i-th second peer node receives the first peer The mirror shard queried by the second query message sent by the node and the queried The hash value corresponding to the image shard. For example, when the image file includes 3 image shards (ie, image shard 1, image shard 2, and image shard 3), the N second peer nodes include 2 second peer nodes. When , one of the second peer nodes determines the order of downloading the image fragments in order: image fragment 1, image fragment 2, and image fragment 3; the other second peer node determines the order of downloading the image fragments. The order is: mirror shard 3, mirror shard 2 and mirror shard 1. In this scenario, if the one second peer node and the other second peer node simultaneously download the second image fragment (ie, image fragment 2) indicated by the corresponding download sequence, the The other second peer node and the one second peer node send query messages to each other to query the mirror shard 2. Since neither of the above two second peer nodes locally stores the mirror shard 2, the above two second peer nodes do not store the mirror shard 2 locally. The two peers cannot interact with each other to obtain mirror shard 2. Thereafter, the one second peer node and the other second peer node may send a query message querying the mirror shard 2 to the first peer node. Alternatively, the second peer node may send a query message for querying the mirror fragment 2 to the first peer node to save the obtained mirror fragment 2 locally; the other second peer node may then send a query message to the first peer node to save the obtained mirror fragment 2 locally; The one second peer node sends a message querying the mirror fragment 2 to obtain the mirror fragment 2.
S605,第一对等节点根据N个第一查询消息,确定向N个第二对等节点发送N个第一查询消息所查询的镜像文件包括的N个不同的镜像分片。S605: The first peer node determines, based on the N first query messages, N different image fragments included in the image file queried by sending the N first query messages to the N second peer nodes.
S606,第一对等节点通过N个网络通道向N个第二对等节点发送N个镜像分片和N个镜像分片对应的N个不同的哈希值,以使第i个第二对等节点与其他第二对等节点进行交互获得镜像文件。S606: The first peer node sends N mirror fragments and N different hash values corresponding to the N mirror fragments to the N second peer nodes through N network channels, so that the i-th second pair The peer node interacts with other second peer nodes to obtain the image file.
对第一对等节点发送镜像分片和与镜像分片对应的哈希值的发送方式不作具体限定。例如,第一对等节点可以将该镜像分片和与该镜像分片对应的哈希值封装在同一个数据包中,并将封装后的该一个数据包发送给对应的第二对等节点。第二对等节点对接收到的该一个数据包进行解析后即可获得该镜像分片和与该镜像分片对应的哈希值。又如,第一对等节点可以将该镜像分片和与该镜像分片对应的哈希值分别封装在两个不同的数据包中,并将封装后的该两个数据包同时发送给对应的第二对等节点。There is no specific limitation on the method in which the first peer node sends the image fragments and the hash values corresponding to the image fragments. For example, the first peer node may encapsulate the image fragment and the hash value corresponding to the image fragment in the same data packet, and send the encapsulated data packet to the corresponding second peer node . The second peer node can obtain the image fragment and the hash value corresponding to the image fragment after parsing the received data packet. For another example, the first peer node can encapsulate the image fragment and the hash value corresponding to the image fragment in two different data packets, and send the two encapsulated data packets to the corresponding node at the same time. the second peer node.
在本公开实施例中,第i个第二对等节点与其他第二对等节点进行交互获得镜像文件,包括:第i个第二对等节点向第一对等节点发送第一查询消息,以及向其他第二对等节点发送第二查询消息,以获得镜像文件。上述S604中详细描述了这种实现方式的流程,此处未详细赘述的内容可以参见上文S604中的相关描述。In this embodiment of the disclosure, the i-th second peer node interacts with other second peer nodes to obtain the image file, including: the i-th second peer node sends a first query message to the first peer node, and sending a second query message to other second peer nodes to obtain the image file. The process of this implementation method is described in detail in S604 above. For content not described in detail here, please refer to the relevant description in S604 above.
执行上述S606中的“第一对等节点通过N个网络通道向N个第二对等节点发送N个镜像分片和N个镜像分片对应的N个不同的哈希值”之后,对等网络包括的未存储镜像文件的N个第二对等节点中的每个第二对等节点均可以成功获取所述镜像文件包括的一个 镜像分片,且每个第二对等节点获取的镜像分片不同。基于此,对等网络中的N个第二对等节点可以通过彼此交互以获得对方存储的镜像分片,可以减轻拥有完整镜像文件1的第一对等节点的传输负担,提高了节点下载的速度与效率。另外,N个第二对等节点之间彼此共享对方拥有的镜像分片时,每个第二对等节点在下载其他第二对等节点存储的镜像分片的同时,也在向其他第二对等节点上传自己存储的镜像分片,可以提高镜像分片的传输效率。After executing "the first peer node sends N mirror fragments and N different hash values corresponding to the N mirror fragments to N second peer nodes through N network channels" in the above S606, the peer node Each of the N second peer nodes included in the network that do not store the image file can successfully obtain one of the image files included in the network. Image shards, and each second peer node obtains different image shards. Based on this, N second peer nodes in the peer-to-peer network can interact with each other to obtain the image shards stored by each other, which can reduce the transmission burden of the first peer node that owns the complete image file 1 and improve the efficiency of node downloading. Speed and efficiency. In addition, when N second peer nodes share the image shards owned by each other, each second peer node is downloading the image shards stored by other second peer nodes and at the same time, it is also sending data to other second peer nodes. Peer nodes upload their own stored image shards, which can improve the transmission efficiency of image shards.
可选的,执行上述S601至S606之后,对等网络中的第i个第二对等节点可以接收到镜像文件包括的N个镜像分片。为验证第i个第二对等节点是否成功接收到完整的镜像文件,还可以进一步对第i个第二对等节点收到的所有镜像分片进行完整性验证,以确定第i个第二对等节点是否成功接收到该镜像文件。在一些实现方式中,可以通过以下方式实现执行上述完整性验证:第i个第二对等节点对收到的所有镜像分片进行哈希处理,获得哈希值#2,并将哈希值#2发送给控制节点;第一对等节点对镜像文件进行哈希处理获得哈希值#3,并将哈希值#3发送给控制节点;控制节点对收到的哈希值#2和哈希值#3进行比较,获得校验信息,校验信息用于指示第i个第二对等节点是否成功接收到完整的镜像文件;其中,若哈希值#2和哈希值#3相同,校验信息用于指示第i个第二对等节点成功接收到完整的镜像文件;或者,若哈希值#2和哈希值#3不相同,校验信息用于指示第i个第二对等节点没有成功接收到完整的镜像文件。在另一些实现方式中,可以通过以下方式实现执行上述完整性验证:第i个第二对等节点对收到的所有镜像分片进行哈希处理,获得哈希值#2;第一对等节点对镜像文件进行哈希处理获得哈希值#3,并将哈希值#3发送给第i个第二对等节点;第i个第二对等节点对哈希值#2和哈希值#3进行比较,获得校验信息,校验信息用于指示第i个第二对等节点是否成功接收到完整的镜像文件;其中,若哈希值#2和哈希值#3相同,校验信息用于指示第i个第二对等节点成功接收到完整的镜像文件;或者,若哈希值#2和哈希值#3不相同,校验信息用于指示第i个第二对等节点没有成功接收到完整的镜像文件。这种实现方式中,第i个第二对等节点还可以发送重传消息以获取未拥有的镜像文件包括的至少一个镜像分片。Optionally, after performing the above S601 to S606, the i-th second peer node in the peer-to-peer network may receive the N image fragments included in the image file. In order to verify whether the i-th second peer node successfully receives the complete image file, the integrity of all image fragments received by the i-th second peer node can be further verified to determine the i-th second peer node. Whether the peer node successfully received the image file. In some implementations, the above integrity verification can be performed in the following manner: the i-th second peer node hashes all received image shards, obtains hash value #2, and converts the hash value #2 is sent to the control node; the first peer node hashes the image file to obtain hash value #3, and sends hash value #3 to the control node; the control node performs hash value #2 and Compare hash value #3 to obtain verification information. The verification information is used to indicate whether the i-th second peer node successfully received the complete image file; among them, if hash value #2 and hash value #3 The same, the verification information is used to indicate that the i-th second peer node successfully received the complete image file; or, if the hash value #2 and the hash value #3 are not the same, the verification information is used to indicate that the i-th The second peer did not successfully receive the complete image file. In other implementations, the above integrity verification can be performed in the following manner: the i-th second peer node hashes all received image fragments and obtains hash value #2; the first peer node The node hashes the image file to obtain hash value #3, and sends hash value #3 to the i-th second peer node; the i-th second peer node processes hash value #2 and hash Compare with value #3 to obtain verification information. The verification information is used to indicate whether the i-th second peer node successfully received the complete image file; among them, if hash value #2 and hash value #3 are the same, The verification information is used to indicate that the i-th second peer node successfully received the complete image file; or, if hash value #2 and hash value #3 are not the same, the verification information is used to indicate that the i-th second peer node The peer node did not successfully receive the complete image file. In this implementation, the i-th second peer node may also send a retransmission message to obtain at least one image fragment included in the unowned image file.
可选的,在上述示出的镜像分发方法所描述的过程中,P2P网络中的对等节点还可以与其他对等节点通信,以获取该其他对等节点当前的网络状态。一个对等节点的网络状态可以包括该一个对等节点向其他对等节点上传数据的速度,以及该一个对等节点从其他对等节点下载数据的速度。在P2P网络中,若任意一个对等节点发现该任意一个对等节点向其他对等节点上传数据的速度不满足预设上传速度,或该任意一个对等节点从其他对等节 点下载数据的速度不满足预设下载速度,则该任意一个对等节点还可以将获取的网络状态信息发送给控制节点,以使控制节点根据该网络状态信息重新分配P2P网络中的对等节点的网络带宽,从而解决该任意一个对等节点存在的上传速度或下载速度不满足预设速度的问题,有利于保证网络处于稳定工作状态。基于此,本公开实施例提供的镜像分发方法还可以包括以下步骤:第i个第二对等节点向第一对等节点和其他第二对等节点发送N个探测消息,以获取N个网络通道对应的网络质量,N个第二对等节点与N个探测消息一一对应,第i个网络通道对应的网络质量不满足预设要求,第i个网络通道为第i个第二对等节点与第一对等节点进行数据传输的网络通道,或为第i个第二对等节点与其他第二对等节点中的一个第二对等节点进行数据传输的网络通道;第i个第二对等节点向控制节点发送N个网络通道对应的网络质量,以使所述控制节点根据所述N个网络通道对应的网络质量对所述N个网络通道中除所述第i个网络通道以外的网络通道对应的带宽值进行调整。示例性的,下文中的图10是本公开实施例提供的一种网络带宽调整方法,此处未详细赘述的内容可以参见下文中图10中的相关描述。Optionally, in the process described in the image distribution method shown above, peer nodes in the P2P network can also communicate with other peer nodes to obtain the current network status of the other peer nodes. The network status of a peer node may include the speed at which the peer node uploads data to other peer nodes, and the speed at which the peer node downloads data from other peer nodes. In the P2P network, if any peer node discovers that the speed of data uploaded by any peer node to other peer nodes does not meet the preset upload speed, or that any peer node transfers data from other peer nodes to If the download speed of the peer node does not meet the preset download speed, any peer node can also send the obtained network status information to the control node, so that the control node reallocates the peer nodes in the P2P network based on the network status information. network bandwidth, thereby solving the problem that the upload speed or download speed of any peer node does not meet the preset speed, which is beneficial to ensuring that the network is in a stable working state. Based on this, the image distribution method provided by the embodiment of the present disclosure may also include the following steps: the i-th second peer node sends N detection messages to the first peer node and other second peer nodes to obtain N networks The network quality corresponding to the channel. N second peer nodes correspond to N detection messages one-to-one. The network quality corresponding to the i-th network channel does not meet the preset requirements. The i-th network channel is the i-th second peer. A network channel for data transmission between the node and the first peer node, or a network channel for data transmission between the i-th second peer node and one of the other second peer nodes; the i-th second peer node The two peer nodes send the network quality corresponding to the N network channels to the control node, so that the control node evaluates the N network channels except the i-th network channel according to the network quality corresponding to the N network channels. Adjust the bandwidth value corresponding to other network channels. For example, Figure 10 below is a network bandwidth adjustment method provided by an embodiment of the present disclosure. For content not described in detail here, please refer to the relevant description in Figure 10 below.
应理解,上述图6示出的镜像分发方法仅为示意,并不对本公开实施例提供的镜像分发方法构成任何限定。It should be understood that the image distribution method shown in FIG. 6 is only for illustration and does not constitute any limitation on the image distribution method provided by the embodiment of the present disclosure.
本公开实施例中,对等网络中存储镜像文件的第一对等节点通过不同网络通道向对等网络中没有存储该镜像文件的第二对等节点发送该镜像文件包括的镜像分片,且每个第二对等节点接收到的镜像分片是不同的。对等网络中没有存储镜像文件的第二对等节点在接收到镜像文件包括的镜像分片后,即可作为对等网络中的资源节点,向对等网络中未存储该镜像分片的其他第二对等节点提供上传功能。上述实现过程中,该未存储镜像文件的第二对等节点在接受到镜像文件包括的镜像分片后,无需等待接受到完整的镜像文件就能将该镜像文件包括的镜像分片分发给网络中的其他第二对等节点,可以提网络带宽利用率,以及降低在网络中分发镜像文件的总耗时,可以实现在网络中快速分发镜像文件的目的。上述镜像分发过程中,通过对对等节点接收到的与镜像文件关联的镜像分片进行完整性校验,以确定网络中未存储镜像文件的第二对等节点是否成功接收到镜像文件。在网络中实现镜像文件的分发时,是以镜像分片为最小传输粒度的,可以提高镜像分发的灵活度。在镜像分片传输失败的场景下,只需要重传异常的镜像分片,避免相关技术中需要重传整个镜像文件的问题,有利于降低重传率。In the embodiment of the present disclosure, the first peer node in the peer-to-peer network that stores the image file sends the image fragments included in the image file to the second peer node in the peer-to-peer network that does not store the image file through different network channels, and The image shards received by each second peer are different. After receiving the image fragments included in the image file, the second peer node in the peer-to-peer network that does not store the image file can serve as a resource node in the peer-to-peer network and send data to other nodes in the peer-to-peer network that do not store the image fragments. The second peer node provides upload functionality. In the above implementation process, after receiving the image fragments included in the image file, the second peer node that does not store the image file can distribute the image fragments included in the image file to the network without waiting to receive the complete image file. The other second peer nodes in the network can improve network bandwidth utilization and reduce the total time spent on distributing image files on the network, thereby achieving the purpose of quickly distributing image files on the network. During the above image distribution process, the integrity of the image fragments associated with the image file received by the peer node is verified to determine whether the second peer node in the network that does not store the image file has successfully received the image file. When distributing image files on the network, image fragmentation is used as the minimum transmission granularity, which can improve the flexibility of image distribution. In the scenario where image fragment transmission fails, only the abnormal image fragments need to be retransmitted, avoiding the problem of retransmitting the entire image file in related technologies, and helping to reduce the retransmission rate.
下面,以上文中图3A示出的网络架构为例,结合图9A和图9B介绍本公开提供的另一种镜像分发方法。为便于描述,下文中将图3A示出的网络架构称为P2P网络。可以理 解的是,图9A和图9B所述描述的镜像分发方法为上述图6所描述的镜像分发方法的一个具体示例,图9A和图9B所描述的方法仅为示意,并不对本公开实施例提供的镜像分发方法构成任何限定。具体的,图9A和图9B以上述图6所述的方法中的对等网络包括控制节点、对等节点1、对等节点2和对等节点3,以图6中的应用场景为云游戏场景,以及对等节点1中存储有待共享的游戏更新镜像文件1为例进行介绍。其中,对等节点1可以理解为是上述图6示出的第一对等节点,对等节点2和对等节点3可以理解为是上述图6示出的N个第二对等节点,N=2。Next, taking the network architecture shown in Figure 3A above as an example, another image distribution method provided by the present disclosure will be introduced in conjunction with Figures 9A and 9B. For ease of description, the network architecture shown in Figure 3A is referred to as a P2P network in the following. Reasonable It should be understood that the image distribution method described in FIG. 9A and FIG. 9B is a specific example of the image distribution method described in FIG. 6. The method described in FIG. 9A and FIG. 9B is only for illustration and does not apply to the embodiments of the present disclosure. The provided image distribution method constitutes no limitation. Specifically, in Figures 9A and 9B, the peer-to-peer network in the method described in Figure 6 includes a control node, peer node 1, peer node 2 and peer node 3. The application scenario in Figure 6 is a cloud game. The scenario is introduced as an example, as well as the game update image file 1 stored in peer node 1 to be shared. Among them, peer node 1 can be understood as the first peer node shown in Figure 6 above, peer node 2 and peer node 3 can be understood as the N second peer nodes shown in Figure 6 above, N =2.
图9A是本公开实施例提供的另一种镜像分发方法的示意图。应理解,图9A的例子仅仅是为了帮助本领域技术人员理解本公开实施例,而非要将申请实施例限制于所示例的具体数值或具体场景。本领域技术人员根据下面所给出的图9A的例子,显然可以进行各种等价的修改或变化,这样的修改和变化也落入本公开实施例的范围内。如图9A所示,该方法包括S901至S911。下面,详细介绍S901至S911。Figure 9A is a schematic diagram of another image distribution method provided by an embodiment of the present disclosure. It should be understood that the example in FIG. 9A is only to help those skilled in the art understand the embodiments of the present disclosure, but is not intended to limit the application embodiments to the specific numerical values or specific scenarios illustrated. Those skilled in the art can obviously make various equivalent modifications or changes based on the example of FIG. 9A given below, and such modifications and changes also fall within the scope of the embodiments of the present disclosure. As shown in Figure 9A, the method includes S901 to S911. Next, S901 to S911 are introduced in detail.
S901,控制节点获取请求1。S901, the control node obtains request 1.
控制节点是对等网络中用于管理对等节点1、对等节点2和对等节点3的节点。本公开实施例中,控制节点可以是独立于对等节点1、对等节点2和对等节点3之外的节点。The control node is a node in the peer-to-peer network used to manage peer node 1, peer node 2 and peer node 3. In the embodiment of the present disclosure, the control node may be a node independent of peer node 1, peer node 2, and peer node 3.
请求1用于请求获取运行应用程序1生成的镜像文件1。应用程序1可以是云游戏应用程序,镜像文件1可以是游戏更新镜像文件,对应用程序1的具体类型也不限定。镜像文件1可以包括1个镜像分层,该1个镜像分层包括镜像分片1和镜像分片2,即镜像文件1包括镜像分片1和镜像分片2,且镜像分片1的标识和镜像分片2的标识不同。镜像分片1的标识和镜像分片2的标识不同,是指镜像分片1和镜像分片2是镜像文件1包括的两个不同的镜像分片。示例性的,图7示出了镜像文件和镜像层的关系的示意图,图7中一个镜像文件可以划分为P个镜像层,P为大于等于1的正整数。图8示出了镜像层与镜像分片的关系的示意图,图8中镜像层P可以划分为m个镜像分片,m为大于等于2的正整数,镜像分片1和镜像分片2是镜像N包括的两个不同的镜像分片。对镜像文件中镜像分片的标识的呈现形式不作具体限定。例如,镜像分片m的标识为(T1,T2),T1标识该镜像分片m所在的镜像层P,T2标识镜像分片m位于镜像层P中的具体的位置。Request 1 is used to request image file 1 generated by running application 1. Application 1 may be a cloud game application, and image file 1 may be a game update image file, and the specific type of application 1 is not limited. Image file 1 may include an image layer, which includes image slice 1 and image slice 2, that is, image file 1 includes image slice 1 and image slice 2, and the identifier of image slice 1 It is different from the identifier of mirror shard 2. The identity of image slice 1 is different from the identity of image slice 2, which means that image slice 1 and image slice 2 are two different image slices included in image file 1. For example, Figure 7 shows a schematic diagram of the relationship between image files and image layers. In Figure 7, an image file can be divided into P image layers, where P is a positive integer greater than or equal to 1. Figure 8 shows a schematic diagram of the relationship between the mirror layer and the mirror shards. In Figure 8, the mirror layer P can be divided into m mirror shards. m is a positive integer greater than or equal to 2. Mirror shard 1 and mirror shard 2 are Image N consists of two different image shards. There is no specific limitation on the presentation form of the identifier of the image fragment in the image file. For example, the identifier of the mirror fragment m is (T1, T2), T1 identifies the mirror layer P where the mirror fragment m is located, and T2 identifies the specific location in the mirror layer P where the mirror fragment m is located.
实际应用中,可以是控制节点主动从用户终端获取请求1,也可以是用户终端主动向控制节点发送请求1,本公开对此不作具体限定。In practical applications, the control node may actively obtain the request 1 from the user terminal, or the user terminal may actively send the request 1 to the control node. This disclosure does not specifically limit this.
可以理解的是,本公开实施例中镜像文件1包括的所有镜像分片是按照以下顺序存储的:镜像分片1、镜像分片2。 It can be understood that in the embodiment of the present disclosure, all image slices included in the image file 1 are stored in the following order: image slice 1, image slice 2.
S902,控制节点分别向对等节点2和对等节点3发送指令1,指令1用于指示下载请求1所请求的镜像文件。相应的,对等节点2和对等节点3分别接收到指令1。S902: The control node sends instruction 1 to peer node 2 and peer node 3 respectively. Instruction 1 is used to instruct to download the image file requested by request 1. Correspondingly, peer node 2 and peer node 3 receive instruction 1 respectively.
上述S901中请求1用于请求获取镜像文件1,基于此,指令1具体用于指示开始下载请求1所请求的镜像文件1。Request 1 in the above S901 is used to request to obtain the image file 1. Based on this, the instruction 1 is specifically used to instruct to start downloading the image file 1 requested by the request 1.
S903,对等节点2根据指令1,确定需要以第一下载顺序下载请求1所请求的镜像文件包括的所有镜像分片。S903: According to instruction 1, peer node 2 determines that all image fragments included in the image file requested by request 1 need to be downloaded in the first download order.
第一下载顺序,即下载镜像文件1包括的所有镜像分片的顺序。其中,第一下载顺序是先下载镜像分片1,再下载镜像分片2。The first download order is the order in which all image fragments included in image file 1 are downloaded. Among them, the first download sequence is to download image fragment 1 first, and then download image fragment 2.
其中,对等节点2根据指令1,确定需要以第一下载顺序下载请求1所请求的镜像文件包括的所有镜像分片,包括:对等节点2根据指令1,确定需要下载镜像文件1包括镜像分片1和镜像分片2;对等节点2对镜像文件1包括的镜像分片的顺序进行随机排序,获得第一下载顺序。Among them, the peer node 2 determines that it needs to download all the image fragments included in the image file requested by the request 1 in the first download order according to the instruction 1, including: the peer node 2 determines that it needs to download the image file 1 including the image according to the instruction 1. Slice 1 and image slice 2; Peer node 2 randomly sorts the order of the image slices included in image file 1 to obtain the first download order.
S904,对等节点3根据指令1,确定需要以第二下载顺序下载请求1所请求的镜像文件包括的所有镜像分片。S904: According to the instruction 1, the peer node 3 determines that all the image fragments included in the image file requested by the request 1 need to be downloaded in the second download sequence.
第二下载顺序,即下载镜像文件1包括的所有镜像分片的顺序了,且第二下载顺序与第一下载顺序不同。其中,第二下载顺序是先下载镜像分片2,再下载镜像分片1。The second download order is the order in which all image fragments included in the image file 1 are downloaded, and the second download order is different from the first download order. Among them, the second download sequence is to download image fragment 2 first, and then download image fragment 1.
其中,对等节点3根据指令1,确定需要以第二下载顺序下载请求1所请求的镜像文件包括的所有镜像分片,包括:对等节点3根据指令1,确定需要下载镜像文件1包括镜像分片1和镜像分片2;对等节点3对镜像文件1包括的镜像分片的顺序进行随机排序,获得第二下载顺序。Among them, the peer node 3 determines that it needs to download all the image fragments included in the image file requested by the request 1 in the second download order according to the instruction 1, including: the peer node 3 determines that it needs to download the image file 1 including the image according to the instruction 1. Slice 1 and image slice 2; peer node 3 randomly sorts the order of the image slices included in image file 1 to obtain the second download order.
S905,对等节点2向P2P网络中的节点发送查询消息1,查询镜像分片1。S905: Peer node 2 sends query message 1 to the node in the P2P network to query mirror shard 1.
查询消息1与第一下载顺序关联,查询消息1具体是用于查询第一下载顺序所指示的下载镜像分片的顺序中需要下载的第一个镜像分片,即查询消息1用于查询镜像分片1。Query message 1 is associated with the first download sequence. Query message 1 is specifically used to query the first image fragment that needs to be downloaded in the sequence of downloading image fragments indicated by the first download sequence. That is, query message 1 is used to query the image. Shard 1.
其中,对等节点2向网络中的节点发送查询消息1,包括:对等节点2根据指令1确定对等节点2的本地没有存储镜像文件1包括的所有镜像分片;对等节点2根据第一下载顺序,生成查询消息1。Among them, the peer node 2 sends a query message 1 to the node in the network, including: the peer node 2 determines according to the instruction 1 that the peer node 2 does not store all the image fragments included in the image file 1 locally; the peer node 2 determines according to the instruction 1; A download sequence generates query message 1.
S906,对等节点3向网络中的节点发送查询消息2,查询镜像分片2。S906: Peer node 3 sends query message 2 to the node in the network to query mirror shard 2.
查询消息2与第二下载顺序关联,查询消息2具体是用于查询第一下载顺序所指示的下载镜像分片的顺序中需要下载的第二个镜像分片,即查询消息2用于查询镜像分片2。Query message 2 is associated with the second download sequence. Query message 2 is specifically used to query the second image fragment that needs to be downloaded in the sequence of downloading image fragments indicated by the first download sequence. That is, query message 2 is used to query the image. Shard 2.
其中,对等节点3向网络中的节点发送查询消息2,包括:对等节点3根据指令1确 定对等节点3的本地没有存储镜像文件1包括的所有镜像分片;对等节点3根据第二下载顺序,生成查询消息2。Among them, the peer node 3 sends a query message 2 to the node in the network, including: the peer node 3 confirms according to the instruction 1 It is determined that the peer node 3 does not store all the image fragments included in the image file 1 locally; the peer node 3 generates the query message 2 according to the second download sequence.
S907,对等节点1根据查询消息1确定本地存储有镜像分片1;根据查询消息2确定本地存储有镜像分片2。S907: Peer node 1 determines that mirror fragment 1 is stored locally according to query message 1; and determines that mirror fragment 2 is stored locally according to query message 2.
其中,对等节点1根据查询消息1确定本地存储有镜像分片1,包括:对等节点1根据查询消息1携带的镜像分片1的标识,对本地存储的镜像分片进行查询,确定本地存储有镜像分片1。Among them, the peer node 1 determines that the mirror fragment 1 is stored locally according to the query message 1, including: the peer node 1 queries the locally stored mirror fragment 1 according to the identification of the mirror fragment 1 carried in the query message 1, and determines the local storage of the mirror fragment 1. Mirror shard 1 is stored.
其中,对等节点1根据查询消息2确定本地存储有镜像分片2,包括:对等节点1根据查询消息2携带的镜像分片2的标识,对本地存储的镜像分片进行查询,确定本地存储有镜像分片2。Among them, the peer node 1 determines that the mirror fragment 2 is stored locally according to the query message 2, including: the peer node 1 queries the locally stored mirror fragment 2 according to the identifier of the mirror fragment 2 carried in the query message 2, and determines the local storage of the mirror fragment 2. Mirror shard 2 is stored.
S908,响应于满足条件1,对等节点1通过网络通道1向对等节点2发送镜像分片1和哈希值1。S908, in response to satisfying condition 1, peer node 1 sends mirror fragment 1 and hash value 1 to peer node 2 through network channel 1.
满足条件1包括:满足对等节点1上传镜像分片的数量不超过预设上传数量。对预设上传数据量不作具体限定,预设上传数量可以根据对等节点1当前的网络状态进行确定。也就是说,当对等节点1当前的网络状态比较好时,该预设上传数量可以较大;当对等节点1当前的网络状态不太好时,该预设上传数量可以较小。例如,预设上传数量可以但不限于等于1或2等。Satisfying condition 1 includes: satisfying that the number of mirror shards uploaded by peer node 1 does not exceed the preset upload number. There is no specific limit on the preset upload data amount, and the preset upload amount can be determined based on the current network status of peer node 1. That is to say, when the current network status of peer node 1 is relatively good, the preset upload quantity can be larger; when the current network status of peer node 1 is not very good, the preset upload quantity can be smaller. For example, the preset upload number may be, but is not limited to, equal to 1 or 2, etc.
网络通道1为对等节点1与对等节点2之间进行数据传输的网络通道。Network channel 1 is a network channel for data transmission between peer node 1 and peer node 2.
可选的,在上述S908之前,对等节点1还可以对镜像分片1进行哈希计算,获得哈希值1,哈希值1用于实现镜像分片1的完整性校验。对哈希算法的类型不作具体限定。例如,所述哈希算法可以但不限于是散列算法或者消息摘要算法。Optionally, before the above-mentioned S908, the peer node 1 can also perform hash calculation on the mirror fragment 1 to obtain the hash value 1, and the hash value 1 is used to implement the integrity check of the mirror fragment 1. The type of hash algorithm is not specifically limited. For example, the hash algorithm may be, but is not limited to, a hash algorithm or a message digest algorithm.
对对等节点1通过网络通道1向对等节点2发送镜像分片1和哈希值1的形式不作限定。例如,对等节点1可以将镜像分片1和哈希值1封装在一个数据包中,然后将封装后的该一个数据包发送给对等节点2。又如,对等节点1还可以将镜像分片1和哈希值1分别封装在两个数据包中,然后将封装后的两个数据包一同发送给对等节点2。The form in which the peer node 1 sends the image fragment 1 and the hash value 1 to the peer node 2 through the network channel 1 is not limited. For example, peer node 1 can encapsulate image fragment 1 and hash value 1 in a data packet, and then send the encapsulated data packet to peer node 2. For another example, peer node 1 can also encapsulate image fragment 1 and hash value 1 in two data packets respectively, and then send the two encapsulated data packets together to peer node 2.
S909,响应于满足条件1,对等节点1通过网络通道3向对等节点3发送镜像分片2和哈希值2。S909, in response to satisfying condition 1, peer node 1 sends mirror fragment 2 and hash value 2 to peer node 3 through network channel 3.
上述S909中的满足条件1,与上述S908中的满足条件1相同。当上述S908中的满足条件1包括:满足对等节点1上传镜像分片的数量不超过1个镜像分片时,对等节点1可以先执行完上述S908之后再执行上述S909,或对等节点1可以先执行上述S909之后 再执行上述S908。The satisfaction condition 1 in the above S909 is the same as the satisfaction condition 1 in the above S908. When satisfying condition 1 in the above S908 includes: satisfying that the number of mirror fragments uploaded by the peer node 1 does not exceed 1 mirror fragment, the peer node 1 can first execute the above S908 and then execute the above S909, or the peer node 1 You can first execute the above S909 Then execute the above S908.
网络通道3为对等节点1与对等节点3之间进行数据传输的网络通道,且网络通道3与网络通道1不是同一个网络通道。换句话说,对等节点1通过不同的网络通道传输不同的镜像分片。Network channel 3 is a network channel for data transmission between peer node 1 and peer node 3, and network channel 3 and network channel 1 are not the same network channel. In other words, peer 1 transmits different image shards over different network channels.
可选的,在上述S909之前,对等节点1还可以对镜像分片2进行哈希计算,获得哈希值2。Optionally, before the above S909, peer node 1 can also perform hash calculation on mirror shard 2 to obtain hash value 2.
S910,对等节点2根据镜像分片1和哈希值1对镜像分片1进行完整性校验,确定接收到的镜像分片1是完整的。S910: Peer node 2 performs an integrity check on the image fragment 1 based on the image fragment 1 and the hash value 1, and determines that the received image fragment 1 is complete.
其中,对等节点2根据镜像分片1和哈希值1对镜像分片1进行完整性校验,确定接收到的镜像分片1是完整的,包括:对等节点2利用哈希算法对镜像分片1进行处理,获得哈希值#1;通过比较哈希值1和哈希值#1相同,确定接收到的镜像分片1是完整的,即镜像分片1在传输过程中没有被攻击或篡改。可以理解的是,对等节点1根据镜像分片1确定哈希值1的哈希算法,与对等节点2根据镜像分片1确定哈希值#1的哈希算法是相同的。Among them, the peer node 2 performs an integrity check on the image fragment 1 based on the image fragment 1 and the hash value 1 to determine that the received image fragment 1 is complete, including: the peer node 2 uses a hash algorithm to verify the integrity of the image fragment 1. Image fragment 1 is processed and hash value #1 is obtained; by comparing hash value 1 and hash value #1, it is determined that the received image fragment 1 is complete, that is, there is no Been attacked or tampered with. It can be understood that the hash algorithm used by peer node 1 to determine hash value 1 based on mirror shard 1 is the same as the hash algorithm used by peer node 2 to determine hash value #1 based on mirror shard 1.
示例性的,当对等节点1将镜像分片1和哈希值1封装在同一个数据包中,并将封装后的该一个数据包发送给对等节点2时,对等节点2在执行上述S910之前还可以执行以下操作:对该一个数据包进行解析,获取镜像分片1和哈希值1。For example, when peer node 1 encapsulates image fragment 1 and hash value 1 in the same data packet, and sends the encapsulated data packet to peer node 2, peer node 2 is executing The above-mentioned S910 can also perform the following operations: parse this data packet and obtain image fragment 1 and hash value 1.
S911,对等节点3根据镜像分片2和哈希值2对镜像分片2进行完整性校验,确定接收到的镜像分片2是完整的。S911. Peer node 3 performs an integrity check on image fragment 2 based on image fragment 2 and hash value 2, and determines that the received image fragment 2 is complete.
对等节点3执行上述S911的原理,与对等节点2执行上述S910的原理相同,此处未详细赘述的内容可以参见上述对S910的相关描述。The principle for peer node 3 to perform the above S911 is the same as the principle for peer node 2 to perform the above S910. For content not described in detail here, please refer to the above related description of S910.
可以理解的是,执行完上述S901至上述S911后,即完成对镜像文件1包括的镜像分片的第一轮分发。在第一轮分发过程中,P2P网络中未拥有镜像文件的对等节点(即,对等节点2和对等节点3),可以从拥有镜像文件的对等节点1处获取镜像文件包括的一个镜像分片。具体的,对等节点2通过网络通道1从对等节点1获取镜像分片1,对等节点3通过网络通道3从对等节点1获取镜像分片2,网络通道1与网络通道3不同,镜像分片1与镜像分片2不同。也就是说,执行完第一轮镜像分片的分发后,P2P网络中的对等节点2和对等节点3分别拥有镜像文件1包括的不同的镜像分片。在此之后,P2P网络中的对等节点2和对等节点3可以通过资源共享的方式,获取彼此拥有的镜像分片。下面,结合图9B示出的S912至S922详细介绍第二轮分发过程。 It can be understood that after the above-mentioned S901 to the above-mentioned S911 are executed, the first round of distribution of the image slices included in the image file 1 is completed. During the first round of distribution, peer nodes in the P2P network that do not own the image file (i.e., peer node 2 and peer node 3) can obtain an image file included in the image file from peer node 1 that owns the image file. Mirror sharding. Specifically, peer node 2 obtains mirror fragment 1 from peer node 1 through network channel 1, and peer node 3 obtains mirror fragment 2 from peer node 1 through network channel 3. Network channel 1 is different from network channel 3. Mirror shard 1 is different from mirror shard 2. That is to say, after the first round of image shard distribution is completed, peer node 2 and peer node 3 in the P2P network respectively have different image shards included in the image file 1. After that, peer node 2 and peer node 3 in the P2P network can obtain the mirror shards owned by each other through resource sharing. Next, the second round of distribution process will be introduced in detail with reference to S912 to S922 shown in FIG. 9B.
S912,对等节点2根据指令1和第一下载顺序,生成查询消息3。S912: Peer node 2 generates query message 3 according to instruction 1 and the first download sequence.
在执行完第一轮分发后,对等节点2的本地存储有镜像文件1包括的镜像分片1。基于此,对等节点2根据指令1和第一下载顺序,生成查询消息3,查询消息3具体是用于查询第一下载顺序所指示的下载镜像分片的顺序中需要下载的第二个镜像分片,即查询消息3用于查询镜像分片2。可选的,查询消息3可携带镜像分片2的标识和对等节点2的标识,镜像分片2的标识用于唯一标识镜像分片2,对等节点2的标识用于唯一标识对等节点2。After the first round of distribution is performed, the local storage of peer node 2 has the image slice 1 included in the image file 1. Based on this, the peer node 2 generates a query message 3 according to the instruction 1 and the first download sequence. The query message 3 is specifically used to query the second image that needs to be downloaded in the sequence of downloading image fragments indicated by the first download sequence. Sharding, that is, query message 3 is used to query mirror shard 2. Optionally, the query message 3 can carry the identity of the mirror shard 2 and the identity of the peer node 2. The identity of the mirror shard 2 is used to uniquely identify the mirror shard 2, and the identity of the peer node 2 is used to uniquely identify the peer. Node 2.
S913,对等节点3根据指令1和第二下载顺序,生成查询消息4。S913: Peer node 3 generates query message 4 according to instruction 1 and the second download sequence.
在执行完第一轮分发后,对等节点3的本地存储有镜像文件1包括的镜像分片2。基于此,对等节点3根据指令1和第二下载顺序,生成查询消息4,查询消息4具体是用于查询第一下载顺序所指示的下载镜像分片的顺序中需要下载的第二个镜像分片,即查询消息4用于查询镜像分片1。可选的,查询消息4可携带镜像分片1的标识和对等节点3的标识,镜像分片1的标识用于唯一标识镜像分片1,对等节点3的标识用于唯一标识对等节点3。After the first round of distribution is performed, the local storage of peer node 3 contains image slice 2 included in image file 1. Based on this, the peer node 3 generates a query message 4 according to the instruction 1 and the second download sequence. The query message 4 is specifically used to query the second image that needs to be downloaded in the sequence of downloading image fragments indicated by the first download sequence. Sharding, that is, query message 4 is used to query mirror shard 1. Optionally, the query message 4 can carry the identifier of mirror fragment 1 and the identifier of peer node 3. The identifier of mirror fragment 1 is used to uniquely identify mirror fragment 1, and the identifier of peer node 3 is used to uniquely identify the peer. Node 3.
S914,对等节点2向P2P网络中的节点发送查询消息3,查询镜像分片2。相应的,P2P网络中的节点接收到查询消息3。S914. Peer node 2 sends query message 3 to the node in the P2P network to query mirror shard 2. Correspondingly, the node in the P2P network receives query message 3.
其中,对等节点2向P2P网络中的节点发送查询消息3,包括:对等节点2通过网络通道1向对等节点1发送查询消息3、通过网络通道2向对等节点3发送查询消息3、以及通过网络通道4向控制节点发送查询消息3。Among them, the peer node 2 sends the query message 3 to the nodes in the P2P network, including: the peer node 2 sends the query message 3 to the peer node 1 through the network channel 1, and sends the query message 3 to the peer node 3 through the network channel 2. , and send query message 3 to the control node through network channel 4.
S915,对等节点3向P2P网络中的节点发送查询消息4,查询镜像分片1。相应的,P2P网络中的节点接收到查询消息4。S915. Peer node 3 sends query message 4 to the node in the P2P network to query mirror shard 1. Correspondingly, the node in the P2P network receives the query message 4.
其中,对等节点4向P2P网络中的节点发送查询消息4,包括:对等节点4通过网络通道3向对等节点1发送查询消息4、通过网络通道2向对等节点2发送查询消息4、以及通过网络通道6向控制节点发送查询消息4。Among them, the peer node 4 sends the query message 4 to the nodes in the P2P network, including: the peer node 4 sends the query message 4 to the peer node 1 through the network channel 3, and sends the query message 4 to the peer node 2 through the network channel 2. , and send query message 4 to the control node through network channel 6.
S916,对等节点3根据查询消息3确定本地存储有镜像分片2,且满足条件2。S916: Peer node 3 determines that mirror fragment 2 is stored locally according to query message 3 and conditions 2 are met.
满足条件2包括:满足对等节点本地未存储镜像文件1包括的所有镜像分片,且对等节点上传镜像分片的数目不超过预设上传数量。也就是说,满足条件2的对等节点不是拥有完整镜像文件1的对等节点,且该对等节点上传的镜像分片的数目不超过预设上传数量。Satisfying condition 2 includes: satisfying that the peer node does not store all the image fragments included in the image file 1 locally, and the number of image fragments uploaded by the peer node does not exceed the preset upload number. That is to say, the peer node that meets condition 2 is not the peer node that owns the complete image file 1, and the number of image fragments uploaded by the peer node does not exceed the preset upload number.
对预设上传数量不作具体限定,可以根据一个对等节点的网络状态或用户需求进行设置。P2P网络中每个对等节点对应的预设上传数量可以相同或不同。 There is no specific limit on the preset upload quantity, and it can be set according to the network status of a peer node or user needs. The preset upload number corresponding to each peer node in the P2P network can be the same or different.
其中,对等节点3根据查询消息3确定本地存储有镜像分片2,包括:对等节点3根据查询消息3携带的镜像分片2的标识对本地存储的数据进行查询,确定本地存储有镜像分片2的标识对应的镜像分片2。Among them, the peer node 3 determines that the mirror shard 2 is stored locally according to the query message 3, including: the peer node 3 queries the locally stored data according to the identifier of the mirror shard 2 carried in the query message 3, and determines that the mirror is stored locally. The identifier of shard 2 corresponds to the mirror shard 2.
S917,对等节点2根据查询消息4确定本地存储有镜像分片1,且满足条件2。S917: Peer node 2 determines that mirror fragment 1 is stored locally according to query message 4 and conditions 2 are met.
上述S917中所描述的满足条件2,与上述S916中所描述的满足条件2相同,此处未详细赘述的内容可以参见上述S916中的相关描述。The satisfying condition 2 described in the above S917 is the same as the satisfying condition 2 described in the above S916. For content not described in detail here, please refer to the relevant description in the above S916.
其中,对等节点2根据查询消息4确定本地存储有镜像分片1,包括:对等节点2根据查询消息4携带的镜像分片1的标识对本地存储的数据进行查询,确定本地存储有镜像分片1的标识对应的镜像分片1。Among them, the peer node 2 determines that the mirror fragment 1 is stored locally according to the query message 4, including: the peer node 2 queries the locally stored data according to the identifier of the mirror fragment 1 carried in the query message 4, and determines that the mirror is stored locally. The identifier of fragment 1 corresponds to the mirror fragment 1.
S918,对等节点1根据查询消息3确定本地存储有镜像分片2,以及根据查询消息4确定本地存储有镜像分片1,且满足条件3。S918: Peer node 1 determines that mirror fragment 2 is stored locally according to query message 3, and determines that mirror fragment 1 is stored locally according to query message 4, and conditions 3 are met.
满足条件3包括:对等节点本地存储镜像文件1包括的所有镜像分片,且对等节点上传镜像分片的数目超过预设上传数量。可以理解的是,在对等节点1满足条件3的情况下,即使对等节点1本地存储有查询消息3对应的镜像分片2,以及查询消息4对应的镜像分片1,对等节点1也不会向对等节点2发送镜像分片2,也不会向对等节点3发送镜像分片1。Meeting condition 3 includes: the peer node locally stores all the image fragments included in the image file 1, and the number of image fragments uploaded by the peer node exceeds the preset upload number. It can be understood that when peer node 1 satisfies condition 3, even if peer node 1 locally stores mirror fragment 2 corresponding to query message 3, and mirror fragment 1 corresponding to query message 4, peer node 1 Nor will mirror shard 2 be sent to peer 2, nor will mirror shard 1 be sent to peer 3.
S919,响应于满足条件2,对等节点3通过网络通道2向对等节点2发送镜像分片2和哈希值2。S919, in response to satisfying condition 2, peer node 3 sends mirror fragment 2 and hash value 2 to peer node 2 through network channel 2.
S920,响应于满足条件2,对等节点2通过网络通道2向对等节点3发送镜像分片1和哈希值1。S920, in response to satisfying condition 2, peer node 2 sends mirror fragment 1 and hash value 1 to peer node 3 through network channel 2.
可以理解的是,上述S919和S920可以是同时执行的,此时,拥有镜像文件1的部分镜像分片(即,镜像分片1)的对等节点2不仅从对等节点3处下载对等节点3拥有的镜像文件1的部分镜像分片(即,镜像分片2),同时对等节点2也作为资源的提供者,将本地存储的镜像分片1上传给对等节点3,这种方式,可以提高镜像分片的传输效率。It can be understood that the above S919 and S920 can be executed at the same time. At this time, the peer node 2 that owns part of the image fragments of the image file 1 (ie, the image fragment 1) not only downloads the peer node 3 from the peer node 3 Node 3 owns part of the image shards of image file 1 (i.e., image shard 2). At the same time, peer node 2 also acts as a resource provider and uploads locally stored image shard 1 to peer node 3. This This method can improve the transmission efficiency of image fragmentation.
S921,对等节点2根据镜像分片2和哈希值2对镜像分片2进行完整性校验,确定接收到的镜像分片2是完整的。S921. Peer node 2 performs an integrity check on image fragment 2 based on image fragment 2 and hash value 2, and determines that the received image fragment 2 is complete.
上述S921中对等节点2进行完整性校验的原理,与上述S910中对等节点2进行完整性校验的原理类似,此处未详细赘述的内容可以参见上述S910中的相关描述。The principle of the integrity check performed by the peer node 2 in the above S921 is similar to the principle of the integrity check performed by the peer node 2 in the above S910. For content not described in detail here, please refer to the relevant description in the above S910.
S922,对等节点3根据镜像分片1和哈希值1对镜像分片1进行完整性校验,确定接收到的镜像分片1是完整的。 S922: Peer node 3 performs an integrity check on image fragment 1 based on image fragment 1 and hash value 1, and determines that the received image fragment 1 is complete.
上述S922中对等节点3进行完整性校验的原理,与上述S910中对等节点2进行完整性校验的原理类似,此处未详细赘述的内容可以参见上述S910中的相关描述。The principle of the integrity check performed by the peer node 3 in the above S922 is similar to the principle of the integrity check performed by the peer node 2 in the above S910. For content not described in detail here, please refer to the relevant description in the above S910.
需说明的是,当上述S919中对等节点3不满足条件2,上述S917中对等节点2不满足条件2时,在执行上述S917之后,还可以由对等节点1向对等节点2发送镜像分片2和哈希值2,向对等节点3发送镜像分片1和哈希值1。It should be noted that when the peer node 3 does not satisfy condition 2 in the above S919 and the peer node 2 does not satisfy the condition 2 in the above S917, after executing the above S917, the peer node 1 can also send a message to the peer node 2. Mirror fragment 2 and hash value 2, send mirror fragment 1 and hash value 1 to peer node 3.
可以理解的是,执行完上述S912至S922之后,即执行完成第二轮分发过程。在第二轮分发过程中,未存储完整镜像文件1的对等节点2和对等节点3交换彼此拥有的镜像分片,可以减轻拥有完整镜像文件1的对等节点1的传输负担,提高了节点下载的速度与效率。具体的,拥有镜像文件1的部分镜像分片的对等节点(例如,对等节点2或对等节点3)在下载镜像分片的同时也在向其他对等节点上传镜像分片,可以提高镜像分片的传输效率。It can be understood that after the above S912 to S922 are executed, the second round of distribution process is completed. During the second round of distribution, peer node 2 and peer node 3 that do not store the complete image file 1 exchange the image shards owned by each other, which can reduce the transmission burden of peer node 1 that owns the complete image file 1 and improve Node download speed and efficiency. Specifically, the peer node (for example, peer node 2 or peer node 3) that owns part of the image shards of image file 1 is also uploading the image shards to other peer nodes while downloading the image shards, which can improve The transmission efficiency of mirror sharding.
在执行上述S922之后,还可以根据对等节点2和/或对等节点3接收到的镜像分片,确定对等节点2和/或对等节点3是否成功接收到了完整的镜像文件1。After executing the above S922, it may also be determined based on the image fragments received by the peer node 2 and/or the peer node 3 whether the peer node 2 and/or the peer node 3 successfully received the complete image file 1.
在一个示例中,对等节点2或对等节点3可以对接收到的多个镜像分片进行哈希计算,获取哈希值A;对等节点2或对等节点3还可以从对等节点1处获取镜像文件1对应的哈希值B;对等节点2或对等节点3通过比较哈希值A与哈希值B相同,可以确定对等节点2或对等节点3已成功接收到完整的镜像文件1。In one example, peer node 2 or peer node 3 can perform hash calculation on multiple received image fragments to obtain hash value A; peer node 2 or peer node 3 can also obtain hash value A from the peer node Obtain the hash value B corresponding to the image file 1 at 1; by comparing the hash value A and the hash value B, peer node 2 or peer node 3 can determine that peer node 2 or peer node 3 has successfully received the Complete image file 1.
在另一个示例中,对等节点2或对等节点3可以对接收到的多个镜像分片进行哈希计算,获取哈希值A,并向控制节点发送消息1,消息1用于指示对等节点2或对等节点3接收到的多个镜像分片的哈希值为哈希值A;控制节点还可以从对等节点1处获取镜像文件1对应的哈希值B;控制节点通过比较哈希值A与哈希值B相同,可以确定对等节点2或对等节点3已成功接收到完整的镜像文件1;控制节点向对等节点2或对等节点3发送消息2,消息2用于指示对等节点2或对等节点3已经成功接收到完整的镜像文件1。In another example, peer node 2 or peer node 3 can perform hash calculation on multiple received mirror shards, obtain hash value A, and send message 1 to the control node, message 1 is used to indicate the The hash values of multiple image fragments received by peer node 2 or peer node 3 are hash values A; the control node can also obtain the hash value B corresponding to image file 1 from peer node 1; the control node passes Comparing the hash value A and the hash value B are the same, it can be determined that peer node 2 or peer node 3 has successfully received the complete image file 1; the control node sends message 2 to peer node 2 or peer node 3, message 2 is used to indicate that peer node 2 or peer node 3 has successfully received the complete image file 1.
执行上述第一轮分发和第二轮分发过程,以及镜像文件完整性校验后,P2P网络中原来未拥有镜像文件1的对等节点2和对等节点3已经拥有了完整的镜像文件1,至此结束整个镜像分发过程。After executing the above-mentioned first-round distribution and second-round distribution processes and verifying the integrity of the image file, peer node 2 and peer node 3 that did not originally own image file 1 in the P2P network already own the complete image file 1. This ends the entire image distribution process.
应理解的是,上述图9A和上述图9B示出的方法仅为示意,并不对本公开实施例提供的镜像分发方法构成任何限定。例如,上述图9A和上述图9B示出的步骤的执行顺序仅为示意并非限定。例如,在另一些可能的实现方式中,上述镜像文件1还可以包括更多数目的镜像分片,如镜像文件1包括镜像分片1、镜像分片2和镜像分片3。这种实现方式中, 第一下载顺序与第二下载顺序不同,第一下载顺序可以是:镜像分片1、镜像分片3和镜像分片2,第二下载顺序可以是镜像分片3、镜像分片1和镜像分片2。例如,当对等节点2执行上述S921确定接收到的镜像分片2是不完整时,对等节点2还可以请求对等节点3重传镜像分片2。It should be understood that the methods shown in the above-mentioned FIG. 9A and the above-mentioned FIG. 9B are only illustrative and do not constitute any limitation on the image distribution method provided by the embodiment of the present disclosure. For example, the execution order of the steps shown in FIG. 9A and FIG. 9B is only illustrative and not limiting. For example, in other possible implementations, the above-mentioned image file 1 may also include a larger number of image slices. For example, the image file 1 includes image slice 1, image slice 2, and image slice 3. In this implementation, The first download order is different from the second download order. The first download order may be: mirror fragment 1, mirror fragment 3 and mirror fragment 2. The second download order may be mirror fragment 3, mirror fragment 1 and mirror. Shard 2. For example, when the peer node 2 performs the above S921 to determine that the received image fragment 2 is incomplete, the peer node 2 may also request the peer node 3 to retransmit the image fragment 2.
本公开实施例中,P2P网络中所有未存储镜像文件1的多个对等节点(即,对等节点2和对等节点3)根据控制节点发送的下载指令,先从存储完整镜像文件1的对等节点1处获取镜像文件1包括的一个镜像分片,且所述多个对等节点通过多个不同的网络通道(即,网络通道1和网络通道3)获取多个不同的镜像分片(即,镜像分片1和镜像分片2)。后续镜像分片分发过程中,P2P网络中获取到镜像文件1包括的部分镜像分片的对等节点(即,对等节点2和对等节点3)之间可以彼此共享对方拥有的镜像分片,可以减轻拥有完整镜像文件1的对等节点1的传输负担,提高了节点下载的速度与效率。另外,对等节点2和对等节点3之间彼此共享对方拥有的镜像分片时,拥有镜像文件1的部分镜像分片的对等节点(例如,对等节点2或对等节点3)在下载镜像分片的同时也在向其他对等节点上传镜像分片,可以提高镜像分片的传输效率。上述镜像分发过程中,通过对对等节点接收到的与镜像文件1关联的镜像分片进行完整性校验,以确定P2P网络中未存储镜像文件1的对等节点是否成功接收到镜像文件1。在P2P网络中实现镜像文件1的分发时,是以镜像分片为最小传输粒度的,可以提高镜像分发的灵活度。在镜像分发的同时实现了对镜像分片的完整性校验。由于镜像分发和镜像分片的完整性校验时同时进行的,并不会影响分发每个镜像分片的效率。In this disclosed embodiment, all multiple peer nodes in the P2P network that do not store the image file 1 (ie, peer node 2 and peer node 3) first download the complete image file 1 from the node that stores the complete image file 1 according to the download instructions sent by the control node. Peer node 1 obtains one image fragment included in image file 1, and the plurality of peer nodes obtain multiple different image fragments through multiple different network channels (ie, network channel 1 and network channel 3) (i.e. mirror shard 1 and mirror shard 2). During the subsequent image shard distribution process, the peer nodes in the P2P network that have obtained some of the image shards included in the image file 1 (i.e., peer node 2 and peer node 3) can share the image shards owned by each other with each other. , which can reduce the transmission burden of peer node 1 with complete image file 1, and improve the speed and efficiency of node downloading. In addition, when peer node 2 and peer node 3 share the image shards owned by each other, the peer node (for example, peer node 2 or peer node 3) that owns part of the image shards of image file 1 is in While downloading the image fragments, the image fragments are also uploaded to other peer nodes, which can improve the transmission efficiency of the image fragments. During the above image distribution process, the integrity of the image fragments associated with image file 1 received by the peer node is verified to determine whether the peer node that does not store image file 1 in the P2P network has successfully received image file 1. . When distributing image file 1 in a P2P network, image fragmentation is used as the minimum transmission granularity, which can improve the flexibility of image distribution. While the image is being distributed, the integrity of the image fragments is verified. Since image distribution and integrity verification of image shards are performed at the same time, it does not affect the efficiency of distributing each image shard.
上述图9A和图9B示出了本公开实施例提供的镜像分发的一种镜像分发方法。可选的,在上述示出的镜像分发方法所描述的过程中,P2P网络中的对等节点还可以与其他对等节点通信,以获取该其他对等节点当前的网络状态。一个对等节点的网络状态可以包括该一个对等节点向其他对等节点上传数据的速度,以及该一个对等节点从其他对等节点下载数据的速度。在P2P网络中,若任意一个对等节点发现该任意一个对等节点向其他对等节点上传数据的速度不满足预设上传速度,或该任意一个对等节点从其他对等节点下载数据的速度不满足预设下载速度,则该任意一个对等节点还可以将获取的网络状态信息发送给控制节点,以使控制节点根据该网络状态信息重新分配P2P网络中的对等节点的网络带宽,从而解决该任意一个对等节点存在的上传速度或下载速度不满足预设速度的问题。下面,将结合图10介绍本公开实施例提供的一种多通道带宽调整方法的示意图。The above-mentioned FIG. 9A and FIG. 9B illustrate an image distribution method provided by an embodiment of the present disclosure. Optionally, in the process described in the image distribution method shown above, peer nodes in the P2P network can also communicate with other peer nodes to obtain the current network status of the other peer nodes. The network status of a peer node may include the speed at which the peer node uploads data to other peer nodes, and the speed at which the peer node downloads data from other peer nodes. In the P2P network, if any peer node finds that the speed of uploading data by any peer node to other peer nodes does not meet the preset upload speed, or the speed of downloading data by any peer node from other peer nodes If the preset download speed is not met, any peer node can also send the obtained network status information to the control node, so that the control node reallocates the network bandwidth of the peer nodes in the P2P network based on the network status information, thereby Solve the problem that the upload speed or download speed of any peer node does not meet the preset speed. Next, a schematic diagram of a multi-channel bandwidth adjustment method provided by an embodiment of the present disclosure will be introduced with reference to FIG. 10 .
图10是本公开实施例提供的一种网络带宽调整方法的示意图。应理解,图10的例子仅 仅是为了帮助本领域技术人员理解本公开实施例,而非要将申请实施例限制于所示例的具体数值或具体场景。本领域技术人员根据下面所给出的图10的例子,显然可以进行各种等价的修改或变化,这样的修改和变化也落入本公开实施例的范围内。如图10所示,该方法包括S1001至S1004。下面,详细介绍S1001至S1004。Figure 10 is a schematic diagram of a network bandwidth adjustment method provided by an embodiment of the present disclosure. It should be understood that the example of Figure 10 only It is only to help those skilled in the art understand the embodiments of the present disclosure, but is not intended to limit the application embodiments to the specific numerical values or specific scenarios illustrated. Those skilled in the art can obviously make various equivalent modifications or changes based on the example of FIG. 10 given below, and such modifications and changes also fall within the scope of the embodiments of the present disclosure. As shown in Figure 10, the method includes S1001 to S1004. Below, S1001 to S1004 are introduced in detail.
本公开实施例中,以图3A示出的网络架构包括的对等节点为以下状态为例进行描述:具体的,图3A示出的对等节点1向对等节点3上传数据的速度满足预设上传速度(即,对等节点3从对等节点1处下载数据的速度满足预设下载速度),对等节点3向对等节点1上传速度的速度满足预设上传速度(即,对等节点1从对等节点3处下载数据的速度满足预设下载速度),对等节点2向对等节点3上传数据的速度小于预设上传速度(即,对等节点3从对等节点2处下载数据的速度小于预设下载速度)。也就是说。网络通道3的传输质量高于网络通道2的传输质量。In this embodiment of the present disclosure, the following description is given by taking the peer node included in the network architecture shown in Figure 3A as an example: Specifically, the speed at which the peer node 1 shown in Figure 3A uploads data to the peer node 3 meets the predetermined speed. Assume that the upload speed (i.e., the speed at which peer node 3 downloads data from peer node 1 meets the preset download speed), and the speed at which peer node 3 uploads data to peer node 1 meets the preset upload speed (i.e., the speed at which peer node 3 The speed at which node 1 downloads data from peer node 3 meets the preset download speed), and the speed at which peer node 2 uploads data to peer node 3 is less than the preset upload speed (that is, the speed at which peer node 3 downloads data from peer node 2 The speed of downloading data is less than the preset download speed). That is to say. The transmission quality of network channel 3 is higher than the transmission quality of network channel 2.
S1001,在预设周期内,对等节点3分别对等节点1和对等节点2进行探测,以获取网络状态信息1。S1001. Within a preset period, peer node 3 detects peer node 1 and peer node 2 respectively to obtain network status information 1.
对预设周期的大小不作具体限定,可以根据实际需求进行设置。例如,预设周期可以是1秒、5秒或20秒等。The size of the preset period is not specifically limited and can be set according to actual needs. For example, the preset period can be 1 second, 5 seconds, or 20 seconds, etc.
网络状态信息1包括网络带宽1和网络带宽2,且网络带宽1满足预设带宽要求,网络带宽2不满足预设带宽要求。其中,网络带宽1表示对等节点1向对等节点3上传数据的速度。网络带宽1满足预设带宽要求,即对等节点1向对等节点3上传数据的速度满足预设上传速度。网络带宽2表示对等节点2向对等节点3上传数据的速度。网络带宽2不满足预设带宽要求,即对等节点2向对等节点3上传数据的速度小于预设上传速度。Network status information 1 includes network bandwidth 1 and network bandwidth 2, and network bandwidth 1 meets the preset bandwidth requirement, and network bandwidth 2 does not meet the preset bandwidth requirement. Among them, network bandwidth 1 represents the speed at which peer node 1 uploads data to peer node 3. Network bandwidth 1 meets the preset bandwidth requirement, that is, the speed at which peer node 1 uploads data to peer node 3 meets the preset upload speed. Network bandwidth 2 represents the speed at which peer 2 uploads data to peer 3. Network bandwidth 2 does not meet the preset bandwidth requirement, that is, the speed at which peer node 2 uploads data to peer node 3 is less than the preset upload speed.
执行上述S1001,包括:在预设周期内,对等节点3对对等节点1进行探测,获取网络带宽1;以及对等节点3对对等节点2进行探测,获取网络带宽2。例如,对等节点3可以利用raw-socket技术对对等节点1进行节点间测速以获得网络带宽1。Executing the above S1001 includes: within a preset period, peer node 3 probes peer node 1 to obtain network bandwidth 1; and peer node 3 probes peer node 2 to obtain network bandwidth 2. For example, peer node 3 can use raw-socket technology to perform inter-node speed measurement on peer node 1 to obtain network bandwidth 1.
S1002,对等节点3向控制节点发送网络状态信息1。相应的,控制节点接收到对等节点3发送的网络状态信息1。S1002. Peer node 3 sends network status information 1 to the control node. Correspondingly, the control node receives the network status information 1 sent by the peer node 3.
对对等节点3向控制节点发送网络状态信息1的触发条件不作具体限定。例如,可以是对等节点3在确定对等节点2向对等节点3上传数据的速度小于预设上传速度的情况下,对等节点3向控制节点发送消息1。又如,可以是对等节点3在确定对等节点2向对等节点3上传数据的速度小于预设上传速度,且等待一小段预设时间(例如,100毫秒)后,仍然发现对等节点2向对等节点3上传数据的速度小于预设上传速度的情况下,对等节点 3向控制节点发送网络状态信息1。The triggering condition for the peer node 3 to send the network status information 1 to the control node is not specifically limited. For example, when the peer node 3 determines that the speed at which the peer node 2 uploads data to the peer node 3 is less than the preset upload speed, the peer node 3 sends message 1 to the control node. For another example, the peer node 3 may still discover that the peer node 3 still finds the peer node 3 after determining that the speed at which the peer node 2 uploads data to the peer node 3 is less than the preset upload speed and waiting for a short preset time (for example, 100 milliseconds). 2. When the speed of uploading data to peer node 3 is less than the preset upload speed, the peer node 3Send network status information 1 to the control node.
S1003,控制节点根据预设网络带宽要求和网络状态信息1,确定需要增大网络带宽3,以获得网络带宽#3。S1003. The control node determines that the network bandwidth 3 needs to be increased based on the preset network bandwidth requirement and network status information 1 to obtain network bandwidth #3.
网络带宽3表示对等节点3向对等节点1上传数据的速度。预设带宽要求表示一个对等节点向另一个对等节点上传数据的预设上传速度。Network bandwidth 3 represents the speed at which peer 3 uploads data to peer 1. The preset bandwidth requirement represents the preset upload speed for one peer to upload data to another peer.
其中,控制节点根据预设带宽要求和网络状态信息1,确定需要增大网络带宽3,包括:控制节点根据网络带宽2和预设带宽要求,确定预设上传速度减去对等节点2向对等节点3上传数据的上传速度等于第一值;控制节点确定需要将对网络带宽3增大第一值,以获得网络带宽#3。其中,网络带宽#3满足预设带宽要求。也就是说,网络带宽#3所指示的对等节点3向对等节点1上传数据的速度,大于网络带宽3所指示的对等节点3向对等节点1上传数据的速度。同时,网络带宽#3所指示的对等节点3向对等节点1上传数据的速度满足预设上传速度的要求。Among them, the control node determines the need to increase the network bandwidth 3 based on the preset bandwidth requirement and network status information 1, including: the control node determines the preset upload speed minus the peer node 2 to the peer node based on the network bandwidth 2 and the preset bandwidth requirement. Wait until the upload speed of data uploaded by node 3 is equal to the first value; the control node determines that the network bandwidth 3 needs to be increased by the first value to obtain network bandwidth #3. Among them, network bandwidth #3 meets the preset bandwidth requirements. That is to say, the speed of peer node 3 uploading data to peer node 1 indicated by network bandwidth #3 is greater than the speed of peer node 3 uploading data to peer node 1 indicated by network bandwidth #3. At the same time, the speed at which peer node 3 uploads data to peer node 1, indicated by network bandwidth #3, meets the preset upload speed requirement.
上述实现方式中,对等节点2向对等节点3上传数据的速度小于预设上传速度,即网络通道2的网络质量不太好。在对等节点3向对等节点1上传数据的速度满足预设上传速度的情况下(即,网络通道2的网络质量较好),可以通过增大对等节点3向对等节点1上传数据的速度,以应对网络波动的情况。In the above implementation, the speed at which peer node 2 uploads data to peer node 3 is less than the preset upload speed, that is, the network quality of network channel 2 is not very good. When the speed of peer node 3 uploading data to peer node 1 meets the preset upload speed (that is, the network quality of network channel 2 is better), peer node 3 can upload data to peer node 1 by increasing the speed to cope with network fluctuations.
S1004,控制节点根据带宽更新消息,将对等节点3的网络带宽3更新为网络带宽#3。S1004: The control node updates the network bandwidth 3 of peer node 3 to network bandwidth #3 according to the bandwidth update message.
可选的,为了保证P2P网络处于正常状态,在执行上述S1001至S1004之后,若对等节点2向对等节点3上传速度的速度满足预设上传速度的情况下,控制节点还可以将对等节点3向对等节点1上传数据的速度重新更新为网络带宽3所指示的上传速度。Optionally, in order to ensure that the P2P network is in a normal state, after executing the above S1001 to S1004, if the upload speed of peer node 2 to peer node 3 meets the preset upload speed, the control node can also set the upload speed to peer node 3. The speed at which Node 3 uploads data to Peer 1 is re-updated to the upload speed indicated by Network Bandwidth 3.
需说明的是,上述图10所示的方法可以与上述图9A和图9B所示的方法结合使用。当上述图10所示的方法与上述图9A和图9B所示的方法结合使用时,不限制上述图10所示的方法在述图9A和图9B所示的方法中的执行位置。It should be noted that the method shown in FIG. 10 can be used in combination with the methods shown in FIGS. 9A and 9B . When the method shown in FIG. 10 is used in combination with the method shown in FIGS. 9A and 9B , the execution position of the method shown in FIG. 10 in the method shown in FIGS. 9A and 9B is not limited.
应理解的是,上述图10所示的网络带宽调整方法仅为示意,并不对本公开提供的多通道带宽调整方法构成任何限定。It should be understood that the network bandwidth adjustment method shown in FIG. 10 is only illustrative and does not constitute any limitation on the multi-channel bandwidth adjustment method provided by the present disclosure.
在本公开实施例中,通过增大非故障节点的负载,来达到均衡的效果,实现将网络带宽资源优先分配给网络质量好的网络通道,以应对网络波动的情况,该方法可以有效解决网络异常波动问题。In the embodiment of the present disclosure, a balancing effect is achieved by increasing the load of non-faulty nodes, and the network bandwidth resources are preferentially allocated to network channels with good network quality to cope with network fluctuations. This method can effectively solve the problem of network fluctuations. Abnormal fluctuation problem.
上文,结合图1至图10详细介绍了本公开提供的镜像分发方法适用的应用场景、网络架构、镜像分发方法、以及网络带宽调整方法。下面,结合图11至图13介绍本公开提 供的镜像分发装置、镜像分发系统和镜像分发设备。应理解,上文中镜像分发方法与下文中的镜像分发装置、镜像分发系统和设备相对应。下文中未详细描述的内容可以参见上述方法实施例中的相关描述。Above, the applicable application scenarios, network architecture, image distribution method, and network bandwidth adjustment method of the image distribution method provided by the present disclosure are introduced in detail with reference to Figures 1 to 10. Next, the disclosure proposed by the present disclosure will be introduced with reference to Figures 11 to 13. Provided image distribution device, image distribution system and image distribution equipment. It should be understood that the above image distribution method corresponds to the image distribution device, image distribution system and equipment below. For content not described in detail below, please refer to the relevant descriptions in the above method embodiments.
图11是本公开实施例提供的一种镜像分发装置的结构示意图。如图11所示,镜像分发装置包括收发单元1101和处理单元1102。Figure 11 is a schematic structural diagram of an image distribution device provided by an embodiment of the present disclosure. As shown in Figure 11, the image distribution device includes a transceiver unit 1101 and a processing unit 1102.
在一些实现方式中,所示镜像分发装置用于实现上述图6示出的镜像分发方法中的第一对等节点所执行的各个步骤。当上述图6示出的镜像分发方法中的第一对等节点的结构为上述图5示出的对等节点200的结构时,所述图11示出的收发单元1101的功能与上述图5示出的镜像分片传输器210的功能相同;所述图11示出的处理单元1101的功能与上述图5示出的网络分析模块220、动态调控客户端230和文件存储服务240的功能相同。In some implementations, the image distribution device is used to implement each step performed by the first peer node in the image distribution method shown in FIG. 6 . When the structure of the first peer node in the image distribution method shown in FIG. 6 is the structure of the peer node 200 shown in FIG. 5 , the functions of the transceiver unit 1101 shown in FIG. 11 are the same as those shown in FIG. 5 The functions of the image fragment transmitter 210 shown are the same; the functions of the processing unit 1101 shown in Figure 11 are the same as the functions of the network analysis module 220, dynamic control client 230 and file storage service 240 shown in Figure 5. .
在另一些实现方式中,所示镜像分发装置用于实现上述图6示出的镜像分发方法中的第i个第二对等节点所执行的各个步骤。当上述图6示出的镜像分发方法中的第i个第二对等节点的结构为上述图5示出的对等节点200的结构时,所述图11示出的收发单元1101的功能与上述图5示出的镜像分片传输器210的功能相同;所述图11示出的处理单元1101的功能与上述图5示出的网络分析模块220、动态调控客户端230和文件存储服务240的功能相同。In other implementations, the image distribution device is used to implement each step performed by the i-th second peer node in the image distribution method shown in Figure 6. When the structure of the i-th second peer node in the image distribution method shown in FIG. 6 is the structure of the peer node 200 shown in FIG. 5, the function of the transceiver unit 1101 shown in FIG. 11 is the same as that of the peer node 200 shown in FIG. 5. The functions of the image fragment transmitter 210 shown in Figure 5 are the same; the functions of the processing unit 1101 shown in Figure 11 are the same as the network analysis module 220, dynamic control client 230 and file storage service 240 shown in Figure 5. The functions are the same.
在又一些实现方式中,所示镜像分发装置用于实现上述图6示出的镜像分发方法中的控制节点所执行的各个步骤。当上述图6示出的镜像分发方法中的控制节点的结构为上述图4示出的控制节点100的结构时,所述图11示出的处理单元1101的功能与上述图5示出的服务注册与发现110、网络拓扑中心120、网络服务器130、动态调控中心140的功能相同。In some implementations, the image distribution device is used to implement each step performed by the control node in the image distribution method shown in FIG. 6 . When the structure of the control node in the image distribution method shown in FIG. 6 is the structure of the control node 100 shown in FIG. 4 , the function of the processing unit 1101 shown in FIG. 11 is the same as the service shown in FIG. 5 The registration and discovery 110, network topology center 120, network server 130, and dynamic control center 140 have the same functions.
图12是本公开实施例提供的一种镜像分发系统的结构示意图。如图12所示,该系统包括控制节点1201、第一对等节点1202、N个第二对等节点1203,N为大于等于2的正整数。Figure 12 is a schematic structural diagram of an image distribution system provided by an embodiment of the present disclosure. As shown in Figure 12, the system includes a control node 1201, a first peer node 1202, and N second peer nodes 1203, where N is a positive integer greater than or equal to 2.
其中,控制节点1201用于执行上文所述的镜像分发方法中的控制节点执行的各个步骤,第一对等节点1202用于执行上文所述的镜像分发方法中的第一对等节点执行的各个步骤,N个第二对等节点1203用于执行上文所述的镜像分发方法中的N个第二对等节点执行的各个步骤,此处未详细赘述的内容可以参见上文中的相关描述。Among them, the control node 1201 is used to perform various steps performed by the control node in the image distribution method described above, and the first peer node 1202 is used to perform the first peer node execution in the image distribution method described above. The N second peer nodes 1203 are used to perform each step performed by the N second peer nodes in the image distribution method described above. For content not described in detail here, please refer to the above related describe.
图13是本公开实施例提供的一种镜像分发设备的结构示意图。如图13所示,包括存储器1301、处理器1302、通信接口1303以及通信总线1304。其中,存储器1301、处理 器1302、通信接口1303通过通信总线1304实现彼此之间的通信连接。Figure 13 is a schematic structural diagram of an image distribution device provided by an embodiment of the present disclosure. As shown in Figure 13, it includes a memory 1301, a processor 1302, a communication interface 1303 and a communication bus 1304. Among them, memory 1301, processing The controller 1302 and the communication interface 1303 realize the communication connection between each other through the communication bus 1304.
存储器1301可以是只读存储器(read only memory,ROM),静态存储设备,动态存储设备或者随机存取存储器(random access memory,RAM)。存储器1301可以存储程序,当存储器1301中存储的程序被处理器1302执行时,处理器1302和通信接口1303用于执行本公开实施例的分组密码算法实现的方法的各个步骤。The memory 1301 may be a read only memory (ROM), a static storage device, a dynamic storage device or a random access memory (RAM). The memory 1301 can store a program. When the program stored in the memory 1301 is executed by the processor 1302, the processor 1302 and the communication interface 1303 are used to execute various steps of the method implemented by the block cipher algorithm of the embodiment of the present disclosure.
处理器1302可以采用通用的中央处理器(central processing unit,CPU),微处理器,应用专用集成电路(application specific integrated circuit,ASIC),图形处理器(graphics processing unit,GPU)或者一个或多个集成电路,用于执行相关程序,以实现本公开实施例的分组密码算法实现的装置中的单元所需执行的功能,或者执行本公开实施例的分组密码算法实现的方法的各个步骤。The processor 1302 may be a general central processing unit (CPU), a microprocessor, an application specific integrated circuit (ASIC), a graphics processing unit (GPU), or one or more The integrated circuit is used to execute relevant programs to implement the functions required to be performed by the units in the device for implementing the block cipher algorithm according to the embodiment of the present disclosure, or to perform various steps of the method for implementing the block cipher algorithm according to the embodiment of the present disclosure.
处理器1302还可以是一种集成电路芯片,具有信号的处理能力。在实现过程中,本公开提供的分组密码算法实现的方法的各个步骤可以通过处理器1302中的硬件的集成逻辑电路或者软件形式的指令完成。上述的处理器1302还可以是通用处理器、数字信号处理器(digital signal processing,DSP)、专用集成电路(ASIC)、现成可编程门阵列(field programmable gate array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。可以实现或者执行本公开实施例中的公开的各方法、步骤及逻辑框图。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。结合本公开实施例所公开的方法的步骤可以直接体现为硬件译码处理器执行完成,或者用译码处理器中的硬件及软件模块组合执行完成。软件模块可以位于随机存储器,闪存、只读存储器,可编程只读存储器或者电可擦写可编程存储器、寄存器等本领域成熟的存储介质中。该存储介质位于存储器1301,处理器1302读取存储器1301中的信息,结合其硬件完成本公开实施例的分组密码算法实现的装置中包括的单元所需执行的功能,或者执行本公开方法实施例的分组密码算法实现的方法。The processor 1302 may also be an integrated circuit chip with signal processing capabilities. During the implementation process, each step of the method for implementing the block cipher algorithm provided by the present disclosure can be completed by instructions in the form of hardware integrated logic circuits or software in the processor 1302 . The above-mentioned processor 1302 can also be a general-purpose processor, a digital signal processor (digital signal processing, DSP), an application specific integrated circuit (ASIC), an off-the-shelf programmable gate array (field programmable gate array, FPGA) or other programmable logic devices. , discrete gate or transistor logic devices, discrete hardware components. Each disclosed method, step and logical block diagram in the embodiment of the present disclosure can be implemented or executed. A general-purpose processor may be a microprocessor or the processor may be any conventional processor, etc. The steps of the method disclosed in conjunction with the embodiments of the present disclosure can be directly implemented by a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor. The software module can be located in random access memory, flash memory, read-only memory, programmable read-only memory or electrically erasable programmable memory, registers and other mature storage media in this field. The storage medium is located in the memory 1301, and the processor 1302 reads the information in the memory 1301, and in combination with its hardware, completes the functions required by the units included in the device for implementing the block cipher algorithm of the embodiment of the present disclosure, or performs the method embodiment of the present disclosure. Methods for implementing block cipher algorithms.
通信接口1303使用例如但不限于收发器一类的收发装置,来实现图13所示的设备与其他设备或通信网络之间的通信。例如,可以通过通信接口1303输出密文数据等。The communication interface 1303 uses a transceiver device such as but not limited to a transceiver to implement communication between the device shown in Figure 13 and other devices or communication networks. For example, ciphertext data and the like can be output through the communication interface 1303.
通信总线1304可包括在图13所示的设备各个部件(例如,存储器1301、处理器1302、通信接口1303)之间传送信息的通路。Communication bus 1304 may include a path for transferring information between various components of the device shown in Figure 13 (eg, memory 1301, processor 1302, communication interface 1303).
本公开实施例提供了一种计算机可读存储介质,计算机可读存储介质包括计算机指令,计算机指令在被处理器执行时用于实现本公开实施例中任意一种镜像分发方法的技术方案。 Embodiments of the present disclosure provide a computer-readable storage medium. The computer-readable storage medium includes computer instructions. When executed by a processor, the computer instructions are used to implement the technical solution of any image distribution method in the embodiments of the disclosure.
通过以上的实施方式的描述,本领域的技术人员易于理解,这里描述的示例实施方式可以通过软件实现,也可以通过软件结合必要的硬件的方式来实现。因此,根据本公开实施方式的技术方案可以以软件产品的形式体现出来,该软件产品可以存储在一个计算机可读介质上,包括若干指令以使得一台计算设备(可以是个人计算机、服务器、终端装置、或者网络设备等)执行根据本公开公开实施方式的方法。Through the above description of the embodiments, those skilled in the art can easily understand that the example embodiments described here can be implemented by software, or can be implemented by software combined with necessary hardware. Therefore, the technical solutions according to the embodiments of the present disclosure can be embodied in the form of a software product, which can be stored on a computer-readable medium and include a number of instructions to enable a computing device (which can be a personal computer, a server, a terminal device, or network device, etc.) to perform the method according to the disclosed embodiments of the present disclosure.
在一个典型的配置中,计算设备包括一个或多个处理器(CPU)、输入/输出接口、网络接口和内存。In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
内存可能包括计算机可读介质中的非永久性存储器,随机存取存储器(RAM)和/或非易失性内存等形式,如只读存储器(ROM)或闪存(flash RAM)。内存是计算机可读介质的示例。Memory may include non-permanent storage in computer-readable media, random access memory (RAM) and/or non-volatile memory in the form of read-only memory (ROM) or flash memory (flash RAM). Memory is an example of computer-readable media.
1、计算机可读介质包括永久性和非永久性、可移动和非可移动媒体可以由任何方法或技术来实现信息存储。信息可以是计算机可读指令、数据结构、程序的模块或其他数据。计算机的存储介质的例子包括,但不限于相变内存(PRAM)、静态随机存取存储器(SRAM)、动态随机存取存储器(DRAM)、其他类型的随机存取存储器(RAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、快闪记忆体或其他内存技术、只读光盘只读存储器(CD-ROM)、数字多功能光盘(DVD)或其他光学存储、磁盒式磁带,磁带磁磁盘存储或其他磁性存储介质或任何其他非传输介质,可用于存储可以被计算设备访问的信息。按照本文中的界定,计算机可读介质不包括非暂存电脑可读媒体(transitory media),如调制的数据信号和载波。1. Computer-readable media includes permanent and non-permanent, removable and non-removable media that can be used to store information by any method or technology. Information may be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), and read-only memory. (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, Magnetic tape cassettes, tape magnetic disk storage or other magnetic storage media or any other non-transmission media can be used to store information that can be accessed by computing devices. As defined in this article, computer-readable media does not include non-transitory computer-readable media (transitory media), such as modulated data signals and carrier waves.
2、本领域技术人员应明白,本公开的实施例可提供为方法、系统或计算机程序产品。因此,本公开可采用完全硬件实施例、完全软件实施例或结合软件和硬件方面的实施例的形式。而且,本公开可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。2. Those skilled in the art should understand that embodiments of the present disclosure may be provided as methods, systems or computer program products. Accordingly, the present disclosure may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment that combines software and hardware aspects. Furthermore, the present disclosure may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.
本公开虽然以较佳实施例公开如上,但其并不是用来限定本公开,任何本领域技术人员在不脱离本公开的精神和范围内,都可以做出可能的变动和修改,因此本公开的保护范围应当以本公开权利要求所界定的范围为准。 Although the present disclosure is disclosed above in terms of preferred embodiments, this is not intended to limit the present disclosure. Any person skilled in the art can make possible changes and modifications without departing from the spirit and scope of the present disclosure. Therefore, the present disclosure The scope of protection shall be subject to the scope defined by the claims of this disclosure.

Claims (17)

  1. 一种镜像分发方法,其中,应用于包括第一对等节点和N个第二对等节点的对等网络,其中,所述第一对等节点存储与应用程序关联的镜像文件,N为大于等于2的正整数,包括:An image distribution method, which is applied to a peer-to-peer network including a first peer node and N second peer nodes, wherein the first peer node stores an image file associated with an application, and N is greater than Positive integers equal to 2, including:
    所述第一对等节点接收所述N个第二对等节点发送的N个第一查询消息,所述N个第一查询消息与所述N个第二对等节点一一对应;The first peer node receives N first query messages sent by the N second peer nodes, and the N first query messages correspond to the N second peer nodes on a one-to-one basis;
    所述第一对等节点根据所述N个第一查询消息,确定向所述N个第二对等节点发送所述N个第一查询消息所查询的所述镜像文件包括的N个不同的镜像分片;The first peer node determines, according to the N first query messages, to the N second peer nodes that the N different image files included in the image files queried by the N first query messages are sent to the N second peer nodes. Mirror sharding;
    所述第一对等节点通过N个网络通道向所述N个第二对等节点发送所述N个镜像分片和所述N个镜像分片对应的N个不同的哈希值,以使第i个第二对等节点与其他第二对等节点进行交互获得所述镜像文件,其中,第i个网络通道为所述第一对等节点与所述第i个第二对等节点传输所述第i个镜像分片和所述第i个镜像分片对应的哈希值的网络通道,i=1,2,…,N。The first peer node sends the N mirror fragments and N different hash values corresponding to the N mirror fragments to the N second peer nodes through N network channels, so that The i-th second peer node interacts with other second peer nodes to obtain the image file, wherein the i-th network channel is used for transmission between the first peer node and the i-th second peer node. The i-th image fragment and the network channel of the hash value corresponding to the i-th image fragment, i=1, 2,...,N.
  2. 如权利要求1所述的镜像分发方法,其中,所述方法还包括:The image distribution method according to claim 1, wherein the method further includes:
    所述第一对等节点接收所述第i个第二对等节点发送的第一重传消息;The first peer node receives the first retransmission message sent by the i-th second peer node;
    所述第一对等节点根据所述第一重传消息,确定向所述第i个第二对等节点发送所述第i个镜像分片;The first peer node determines to send the i-th mirror fragment to the i-th second peer node according to the first retransmission message;
    所述第一对等节点通过所述第i个网络通道向所述第i个第二对等节点发送所述第i个镜像分片和所述第i个镜像分片对应的哈希值。The first peer node sends the i-th mirror fragment and the hash value corresponding to the i-th mirror fragment to the i-th second peer node through the i-th network channel.
  3. 如权利要求1或2所述的镜像分发方法,其中,所述应用程序为云游戏应用程序,所述与应用程序关联的镜像文件是所述云游戏应用程序生成的更新镜像文件。The image distribution method according to claim 1 or 2, wherein the application program is a cloud game application program, and the image file associated with the application program is an updated image file generated by the cloud game application program.
  4. 如权利要求1至3任一项所述的镜像分发方法,其中,所述控制节点为以下对等节点中的任意一个节点:The image distribution method according to any one of claims 1 to 3, wherein the control node is any one of the following peer nodes:
    所述第一对等节点、或所述N个第二对等节点。The first peer node, or the N second peer nodes.
  5. 一种镜像分发方法,其中,应用于包括控制节点和所述控制节点管理的第一对等节点和N个第二对等节点的对等网络,其中,所述第一对等节点存储与应用程序关联的镜像文件,N为大于等于2的正整数,包括:An image distribution method, which is applied to a peer-to-peer network including a control node and a first peer node managed by the control node and N second peer nodes, wherein the first peer node stores and applies The image file associated with the program, N is a positive integer greater than or equal to 2, including:
    第i个第二对等节点根据接收到的所述控制节点发送的下载指令,确定下载所述镜像文件包括的N个镜像分片的下载顺序,所述下载指令用于指示开始下载所述镜像文件,所述N个第二对等节点均接收到所述下载指令,所述N个第二对等节点与N个下载顺序一一 对应,且所述N个下载顺序不同,i=1,2,…,N;The i-th second peer node determines the download order for downloading the N image fragments included in the image file according to the received download instruction sent by the control node, where the download instruction is used to indicate starting to download the image. file, the N second peer nodes all receive the download instruction, and the N second peer nodes and N download sequences are one by one. Corresponding, and the N download orders are different, i=1,2,...,N;
    所述第i个第二对等节点根据所述第i个第二对等节点对应的第i个下载顺序,确定向所述第一对等节点发送第一查询消息,以及向其他第二对等节点发送第二查询消息;所述第一查询消息用于查询所述镜像文件包括的第i个镜像分片,且所述第i个镜像分片为所述第i个下载顺序所指示下载的第一个镜像分片;所述第二查询消息用于查询所述镜像文件包括的除所述第i个镜像分片以外的一个镜像分片,且所述第二查询消息所查询的镜像分片为所述第i个下载顺序所指示下载的第j个镜像分片,j=2,3,…,N;The i-th second peer node determines to send a first query message to the first peer node according to the i-th download sequence corresponding to the i-th second peer node, and to send a first query message to other second peer nodes. The other nodes send a second query message; the first query message is used to query the i-th image fragment included in the image file, and the i-th image fragment is downloaded as indicated by the i-th download sequence. the first mirror fragment; the second query message is used to query a mirror fragment other than the i-th mirror fragment included in the image file, and the image queried by the second query message The fragment is the j-th image fragment downloaded as indicated by the i-th download sequence, j=2,3,...,N;
    所述第i个第二对等节点向所述第一对等节点发送所述第一查询消息,以及向其他第二对等节点发送所述第二查询消息,以获得所述镜像文件。The i-th second peer node sends the first query message to the first peer node, and sends the second query message to other second peer nodes to obtain the image file.
  6. 如权利要求5所述的镜像分发方法,其中,所述第i个第二对等节点向所述第一对等节点发送所述第一查询消息,以及向其他第二对等节点发送所述第二查询消息,以获得所述镜像文件,包括:The image distribution method according to claim 5, wherein the i-th second peer node sends the first query message to the first peer node, and sends the first query message to other second peer nodes. The second query message to obtain the image file includes:
    所述第i个第二对等节点向所述第一对等节点发送所述第一查询消息;The i-th second peer node sends the first query message to the first peer node;
    所述第i个第二对等节点接收所述第一对等节点发送的所述第i个镜像分片和所述第i个镜像分片对应的哈希值,且每个镜像分片对应的哈希值不同;The i-th second peer node receives the i-th mirror fragment sent by the first peer node and the hash value corresponding to the i-th mirror fragment, and each mirror fragment corresponds to The hash values are different;
    在确定收到的第i个镜像分片通过完整性校验的情况下,所述第i个第二对等节点保存所述第i个镜像分片,并向其他第二对等节点发送所述第二查询消息;When it is determined that the i-th mirror fragment received passes the integrity check, the i-th second peer node saves the i-th mirror fragment and sends the received i-th mirror fragment to other second peer nodes. The second query message;
    所述第i个第二对等节点接收到所述其他第二对等节点发送的所述第二查询消息所查询的镜像分片和所述所查询的镜像分片对应的哈希值,所述其他第二对等节点发送的镜像分片的数目不超过预设阈值;The i-th second peer node receives the mirror fragment queried by the second query message sent by the other second peer node and the hash value corresponding to the queried mirror fragment, so The number of mirror fragments sent by the other second peer nodes does not exceed the preset threshold;
    在确定收到的所述第二查询消息所查询的镜像分片通过完整性校验的情况下,所述第i个第二对等节点保存所述第二查询消息所查询的镜像分片。When it is determined that the mirror fragment queried by the received second query message passes the integrity check, the i-th second peer node saves the mirror fragment queried by the second query message.
  7. 如权利要求6所述的镜像分发方法,其中,所述方法还包括:The image distribution method according to claim 6, wherein the method further includes:
    所述第i个第二对等节点对接收到的镜像分片进行完整性校验,所述第i个第二对等节点接收到的镜像分片包括所述第i个镜像分片和所述第二查询消息所查询的镜像分片;The i-th second peer node performs integrity verification on the received image fragments, and the i-th second peer node receives the image fragments including the i-th image fragment and all The mirror shard queried by the second query message;
    若确定接收到的所述第i个镜像分片未通过所述完整性校验,所述第i个第二对等节点向所述第一对等节点发送第一重传消息,所述第一重传消息用于指示所述第一对等节点发送所述第i个镜像分片;If it is determined that the received i-th mirror fragment fails the integrity check, the i-th second peer node sends a first retransmission message to the first peer node, and the i-th second peer node sends a first retransmission message to the first peer node. A retransmission message is used to instruct the first peer node to send the i-th mirror fragment;
    若确定接收到的所述第二查询消息所查询的镜像分片未通过所述完整性校验,所述第i个第二对等节点向所述其他第二对等节点发送第二重传消息,所述第二重传消息用于指 示所述其他第二对等节点发送所述第二查询消息所查询的镜像分片。If it is determined that the mirror fragment queried by the received second query message does not pass the integrity check, the i-th second peer node sends a second retransmission to the other second peer nodes. message, the second retransmission message is used to refer to Instruct the other second peer nodes to send the mirror fragment queried by the second query message.
  8. 如权利要求6或7所述的镜像分发方法,其中,所述方法还包括:The image distribution method according to claim 6 or 7, wherein the method further includes:
    若所述第i个第二对等节点未接收到所述其他第二对等节点发送的所述第二查询消息所查询的镜像分片和所述所查询的镜像分片对应的哈希值,所述第i个第二对等节点向所述第一对等节点发送所述第二查询消息;If the i-th second peer node does not receive the mirror fragment queried by the second query message sent by the other second peer node and the hash value corresponding to the queried mirror fragment. , the i-th second peer node sends the second query message to the first peer node;
    所述第i个第二对等节点接收所述第一对等节点发送的所述第二查询消息所查询的镜像分片和所述所查询的镜像分片对应的哈希值。The i-th second peer node receives the mirror fragment queried by the second query message sent by the first peer node and the hash value corresponding to the queried mirror fragment.
  9. 如权利要求5至8任一项所述的镜像分发方法,其中,所述方法还包括:The image distribution method according to any one of claims 5 to 8, wherein the method further includes:
    所述第i个第二对等节点向所述第一对等节点和所述其他第二对等节点发送N个探测消息,以获取所述N个网络通道对应的网络质量,所述N个第二对等节点与所述N个探测消息一一对应,所述第i个网络通道对应的网络质量不满足预设要求,所述第i个网络通道为所述第i个第二对等节点与所述第一对等节点进行数据传输的网络通道,或为所述第i个第二对等节点与所述其他第二对等节点中的一个第二对等节点进行数据传输的网络通道;The i-th second peer node sends N detection messages to the first peer node and the other second peer nodes to obtain the network quality corresponding to the N network channels, and the N The second peer node has a one-to-one correspondence with the N detection messages. The network quality corresponding to the i-th network channel does not meet the preset requirements. The i-th network channel is the i-th second peer. A network channel for data transmission between a node and the first peer node, or a network for data transmission between the i-th second peer node and one of the other second peer nodes. aisle;
    所述第i个第二对等节点向所述控制节点发送所述N个网络通道对应的网络质量,以使所述控制节点根据所述N个网络通道对应的网络质量对所述N个网络通道中除所述第i个网络通道以外的网络通道对应的带宽值进行调整。The i-th second peer node sends the network quality corresponding to the N network channels to the control node, so that the control node evaluates the N networks based on the network quality corresponding to the N network channels. The bandwidth values corresponding to network channels other than the i-th network channel in the channel are adjusted.
  10. 如权利要求5至9任一项所述的镜像分发方法,其中,所述应用程序为云游戏应用程序,所述与应用程序关联的镜像文件是所述云游戏应用程序生成的更新镜像文件。The image distribution method according to any one of claims 5 to 9, wherein the application program is a cloud game application program, and the image file associated with the application program is an updated image file generated by the cloud game application program.
  11. 如权利要求5至10任一项所述的镜像分发方法,其中,所述控制节点为以下对等节点中的任意一个节点:The image distribution method according to any one of claims 5 to 10, wherein the control node is any one of the following peer nodes:
    所述第一对等节点、或所述N个第二对等节点。The first peer node, or the N second peer nodes.
  12. 一种镜像分发装置,其中,应用于包括第一对等节点和N个第二对等节点的对等网络,其中,所述第一对等节点存储与应用程序关联的镜像文件,N为大于等于2的正整数,包括:An image distribution device, which is applied to a peer-to-peer network including a first peer node and N second peer nodes, wherein the first peer node stores an image file associated with an application, and N is greater than Positive integers equal to 2, including:
    收发单元,用于接收所述N个第二对等节点发送的N个第一查询消息,所述N个第一查询消息与所述N个第二对等节点一一对应;A transceiver unit configured to receive N first query messages sent by the N second peer nodes, where the N first query messages correspond to the N second peer nodes in one-to-one correspondence;
    处理单元,用于根据所述N个第一查询消息,确定向所述N个第二对等节点发送所述N个第一查询消息所查询的所述镜像文件包括的N个不同的镜像分片;A processing unit configured to determine, according to the N first query messages, N different image components included in the image file queried by sending the N first query messages to the N second peer nodes. piece;
    所述收发单元,还用于通过N个网络通道向所述N个第二对等节点发送所述N个镜像 分片和所述N个镜像分片对应的N个不同的哈希值,以使得第i个第二对等节点与其他第二对等节点进行交互获得所述镜像文件,其中,第i个网络通道为所述第一对等节点与所述第i个第二对等节点传输所述第i个镜像分片和所述第i个镜像分片对应的哈希值的网络通道,i=1,2,…,N。The transceiver unit is also configured to send the N mirror images to the N second peer nodes through N network channels. N different hash values corresponding to the fragments and the N mirror fragments, so that the i-th second peer node interacts with other second peer nodes to obtain the image file, where the i-th second peer node The network channel is the network channel through which the first peer node and the i-th second peer node transmit the i-th mirror fragment and the hash value corresponding to the i-th mirror fragment, i= 1,2,…,N.
  13. 一种镜像分发装置,其中,应用于包括控制节点和所述控制节点管理的第一对等节点和N个第二对等节点的对等网络,其中,所述第一对等节点存储与应用程序关联的镜像文件,N为大于等于2的正整数,包括:An image distribution device, which is applied to a peer-to-peer network including a control node and a first peer node managed by the control node and N second peer nodes, wherein the first peer node stores and applies The image file associated with the program, N is a positive integer greater than or equal to 2, including:
    处理单元,用于根据接收到的所述控制节点发送的下载指令,确定下载所述镜像文件包括的N个镜像分片的下载顺序,所述下载指令用于指示开始下载所述镜像文件,所述N个第二对等节点均接收到所述下载指令,所述N个第二对等节点与N个下载顺序一一对应,且所述N个下载顺序不同,i=1,2,…,N;The processing unit is configured to determine the download order for downloading the N image fragments included in the image file according to the received download instruction sent by the control node, where the download instruction is used to instruct to start downloading the image file, so The N second peer nodes all receive the download instruction, the N second peer nodes correspond to N download sequences one-to-one, and the N download sequences are different, i=1,2,... ,N;
    所述处理单元,还用于根据所述第i个第二对等节点对应的第i个下载顺序,确定向所述第一对等节点发送第一查询消息,以及向其他第二对等节点发送第二查询消息;所述第一查询消息用于查询所述镜像文件包括的第i个镜像分片,且所述第i个镜像分片为所述第i个下载顺序所指示下载的第一个镜像分片;所述第二查询消息用于查询所述镜像文件包括的除所述第i个镜像分片以外的一个镜像分片,且所述第二查询消息所查询的镜像分片为所述第i个下载顺序所指示下载的第j个镜像分片,j=2,3,…,N;The processing unit is also configured to determine, according to the i-th download sequence corresponding to the i-th second peer node, to send a first query message to the first peer node, and to send a first query message to other second peer nodes. Send a second query message; the first query message is used to query the i-th image fragment included in the image file, and the i-th image fragment is the i-th image fragment downloaded indicated by the i-th download sequence. One mirror fragment; the second query message is used to query a mirror fragment other than the i-th mirror fragment included in the image file, and the mirror fragment queried by the second query message It is the j-th image fragment downloaded as indicated by the i-th download sequence, j=2,3,...,N;
    收发单元,用于向所述第一对等节点发送所述第一查询消息,以及向其他第二对等节点发送所述第二查询消息,以获得所述镜像文件。A transceiver unit configured to send the first query message to the first peer node and the second query message to other second peer nodes to obtain the image file.
  14. 一种镜像分发设备,其中,包括:存储器和处理器、所述存储器和所述处理器耦合;An image distribution device, which includes: a memory and a processor, and the memory and the processor are coupled;
    所述存储器用于存储一条或多条计算机指令;The memory is used to store one or more computer instructions;
    所述处理器用于执行所述一条或多条计算机指令,以实现如权利要求1至6任意一项所述的方法。The processor is configured to execute the one or more computer instructions to implement the method according to any one of claims 1 to 6.
  15. 一种镜像分发设备,其中,包括:存储器和处理器、所述存储器和所述处理器耦合;An image distribution device, which includes: a memory and a processor, and the memory and the processor are coupled;
    所述存储器用于存储一条或多条计算机指令;The memory is used to store one or more computer instructions;
    所述处理器用于执行所述一条或多条计算机指令,以实现如权利要求7至11任意一项所述的方法。The processor is configured to execute the one or more computer instructions to implement the method according to any one of claims 7 to 11.
  16. 一种镜像分发系统,其中,所述系统包括控制节点,所述控制节点管理的第一对 等节点和N个第二对等节点的对等网络,其中,所述第一对等节点存储与应用程序关联的镜像文件,N为大于等于2的正整数,包括:An image distribution system, wherein the system includes a control node, and the control node manages a first pair of A peer-to-peer network of peer nodes and N second peer nodes, wherein the first peer node stores an image file associated with an application, and N is a positive integer greater than or equal to 2, including:
    所述控制节点向所述N个第二对等节点发送下载指令,所述下载指令用于指示开始下载所述镜像文件;The control node sends a download instruction to the N second peer nodes, where the download instruction is used to instruct to start downloading the image file;
    其中,所述第一对等节点用于执行如权利要求1至4中任意一项所述的方法,所述N个第二对等节点中的第i个第二对等节点用于执行如权利要求5至11中任意一项所述的方法,i=1,2,…,N。Wherein, the first peer node is used to perform the method as described in any one of claims 1 to 4, and the i-th second peer node among the N second peer nodes is used to perform the method as described in any one of claims 1 to 4. The method according to any one of claims 5 to 11, i=1,2,...,N.
  17. 一种计算机可读存储介质,其上存储有一条或多条计算机指令,其中,该指令被处理器执行以实现如权利要求1至11任意一项所述的方法。 A computer-readable storage medium on which one or more computer instructions are stored, wherein the instructions are executed by a processor to implement the method according to any one of claims 1 to 11.
PCT/CN2023/074444 2022-08-18 2023-02-03 Mirror image distribution method, system, and device WO2024036889A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202210994948.8 2022-08-18
CN202210994948.8A CN115567547A (en) 2022-08-18 2022-08-18 Mirror image distribution method, system and equipment

Publications (1)

Publication Number Publication Date
WO2024036889A1 true WO2024036889A1 (en) 2024-02-22

Family

ID=84738608

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2023/074444 WO2024036889A1 (en) 2022-08-18 2023-02-03 Mirror image distribution method, system, and device

Country Status (2)

Country Link
CN (1) CN115567547A (en)
WO (1) WO2024036889A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115567547A (en) * 2022-08-18 2023-01-03 网易(杭州)网络有限公司 Mirror image distribution method, system and equipment

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1925403A (en) * 2005-09-02 2007-03-07 腾讯科技(深圳)有限公司 Network communication system and method realizing file downloading
US20180188966A1 (en) * 2016-12-29 2018-07-05 Intel Corporation Systems and method for dynamic address based mirroring
CN108958742A (en) * 2017-05-26 2018-12-07 华为技术有限公司 A kind of method of batch installing operating system, relevant device and system
CN111064785A (en) * 2019-12-16 2020-04-24 腾讯科技(深圳)有限公司 Resource package downloading method, device and system
CN115567547A (en) * 2022-08-18 2023-01-03 网易(杭州)网络有限公司 Mirror image distribution method, system and equipment

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7509372B2 (en) * 2001-09-13 2009-03-24 International Business Machines Corporation Method and system for redirecting data requests in peer-to-peer data networks
CN101471919B (en) * 2007-12-29 2012-01-11 突触计算机系统(上海)有限公司 Method and device for downloading slicing of equipment based on point-to-point transmission protocol
CN110912955B (en) * 2018-09-17 2022-04-05 阿里巴巴集团控股有限公司 Container mirror image downloading and uploading method and device
CN109491758A (en) * 2018-10-11 2019-03-19 深圳市网心科技有限公司 Docker mirror image distribution method, system, data gateway and computer readable storage medium
CN109788032B (en) * 2018-12-17 2021-12-14 深圳壹账通智能科技有限公司 Method and device for acquiring mirror image file, computer equipment and storage medium
US11550490B2 (en) * 2020-02-12 2023-01-10 Red Hat, Inc. Scalable storage cluster mirroring
CN112883006A (en) * 2021-03-12 2021-06-01 云知声智能科技股份有限公司 Enterprise-level container mirror image acceleration method and device, electronic equipment and storage medium
CN113064696A (en) * 2021-03-25 2021-07-02 网易(杭州)网络有限公司 Cluster system capacity expansion method, device and medium
CN114003556A (en) * 2021-10-29 2022-02-01 北京航空航天大学 Container deployment acceleration method based on delayed loading and P2P distribution

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1925403A (en) * 2005-09-02 2007-03-07 腾讯科技(深圳)有限公司 Network communication system and method realizing file downloading
US20180188966A1 (en) * 2016-12-29 2018-07-05 Intel Corporation Systems and method for dynamic address based mirroring
CN108958742A (en) * 2017-05-26 2018-12-07 华为技术有限公司 A kind of method of batch installing operating system, relevant device and system
CN111064785A (en) * 2019-12-16 2020-04-24 腾讯科技(深圳)有限公司 Resource package downloading method, device and system
CN115567547A (en) * 2022-08-18 2023-01-03 网易(杭州)网络有限公司 Mirror image distribution method, system and equipment

Also Published As

Publication number Publication date
CN115567547A (en) 2023-01-03

Similar Documents

Publication Publication Date Title
US11240213B2 (en) Resource obtaining, distribution, and download method and apparatus, device, and storage medium
US20200304508A1 (en) Method and device for providing authentication in network-based media processing (nbmp) system
US10834206B2 (en) Broker-based bus protocol and multi-client architecture
WO2021228102A1 (en) Method, device, and storage medium
US9350802B2 (en) System and method for secure, high-speed transfer of very large files
US9350682B1 (en) Compute instance migrations across availability zones of a provider network
US11843527B2 (en) Real-time scalable virtual session and network analytics
US11917018B2 (en) Broker-based bus protocol and multi-client architecture
JP2015534769A (en) Load balancing in data networks
WO2024036889A1 (en) Mirror image distribution method, system, and device
JP2013257798A (en) Data collection system and data collection method
WO2017097210A1 (en) Method, apparatus and system for upgrading software
CN113163162A (en) Service providing method based on video cloud and video cloud system
US20230134683A1 (en) Memory interleaving coordinated by networked processing units
CN112804289A (en) Resource synchronization method, device, equipment and storage medium
CN109150829B (en) Software-defined cloud network trusted data distribution method, readable storage medium and terminal
CN114338682A (en) Flow identity mark transmission method and device, electronic equipment and storage medium
US20130054691A1 (en) Flexible rule based multi-protocol peer-to-peer caching
CN115695049B (en) CDN metadata distribution method and device
US11558812B2 (en) System and methods for multi-links SD-WAN using cellular device connections
CN116781764A (en) Long-connection task execution method and device and related equipment
US11533308B2 (en) Systems and methods for supporting unauthenticated post requests through a reverse proxy enabled for authentication
CN115242646B (en) Block chain-based network slice application method and related device
US20230336360A1 (en) Server to synchronize a digital avatar with a device based on items of information wrapped together
WO2023160076A1 (en) Information interaction method and apparatus, computer device, storage medium and program product

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 23853808

Country of ref document: EP

Kind code of ref document: A1