WO2021134928A1 - 基于p2p网络的数据传输方法、设备、系统、装置及介质 - Google Patents

基于p2p网络的数据传输方法、设备、系统、装置及介质 Download PDF

Info

Publication number
WO2021134928A1
WO2021134928A1 PCT/CN2020/080488 CN2020080488W WO2021134928A1 WO 2021134928 A1 WO2021134928 A1 WO 2021134928A1 CN 2020080488 W CN2020080488 W CN 2020080488W WO 2021134928 A1 WO2021134928 A1 WO 2021134928A1
Authority
WO
WIPO (PCT)
Prior art keywords
service node
network
service
client
data transmission
Prior art date
Application number
PCT/CN2020/080488
Other languages
English (en)
French (fr)
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 WO2021134928A1 publication Critical patent/WO2021134928A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/104Peer-to-peer [P2P] networks
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/06Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1001Protocols in which an application is distributed across nodes in the network for accessing one among a plurality of replicated servers
    • 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/1001Protocols in which an application is distributed across nodes in the network for accessing one among a plurality of replicated servers
    • H04L67/1004Server selection for load balancing
    • H04L67/1008Server selection for load balancing based on parameters of servers, e.g. available memory or workload
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/104Peer-to-peer [P2P] networks
    • H04L67/1074Peer-to-peer [P2P] networks for supporting data block transmission mechanisms
    • H04L67/1078Resource delivery mechanisms
    • H04L67/108Resource delivery mechanisms characterised by resources being split in blocks or fragments

Definitions

  • the present invention relates to the field of Internet technology, in particular to data transmission methods, equipment, systems, devices and media based on P2P networks.
  • the server cluster (server)
  • the load continues to increase, and multiple clients grab bandwidth from each other, which will eventually cause the client to fail to download or play files normally.
  • the server cluster is also at risk of crashing due to too high load.
  • the main purpose of the present invention is to provide data transmission methods, equipment, systems, devices and media based on P2P networks, which can dynamically adjust multiple service nodes serving the client to achieve load balancing of server clusters in the P2P network and ensure that the servers The cluster will not collapse due to excessive load, thereby ensuring the quality of service of the server cluster.
  • the present invention provides a data transmission method based on a P2P network, which is applied to a service node, the service node is connected to a client, and each service node is used to provide data transmission services to multiple clients.
  • the methods include:
  • the method further includes:
  • the load and network performance information of the service node itself are detected.
  • the determining the service abnormality of the service node includes:
  • the network bandwidth is determined from the network performance information of the service node, and when the network bandwidth is less than the configured bandwidth, the network performance of the service node is determined.
  • the delay or the packet loss rate is determined in the information, and when the delay exceeds the configured delay or the packet loss rate exceeds the configured packet loss rate, it is determined that the service of the service node is abnormal.
  • the method further includes:
  • the requested file slice is sent to the client.
  • the service node stores a plurality of different file slices, and the service node receives request instructions from different clients for the same file slice or different file slices.
  • the present invention further provides a data transmission method based on a P2P network, which is applied to a client, the client is connected to a service node, and each client is used to request data transmission services from multiple service nodes,
  • the method includes:
  • the method further includes:
  • the file slices are processed to stitch to obtain a file.
  • the client sends a request instruction to a service node storing corresponding file slices in the order of file slices.
  • the present invention further provides an electronic device, the electronic device including:
  • Memory storing at least one instruction
  • the processor executes the instructions stored in the memory to implement the data transmission method based on the P2P network.
  • the electronic device is a node constituting a content distribution network or a blockchain network.
  • the present invention further provides a data transmission system based on a P2P network, which runs on a service node, the service node is connected to a client, and each service node is used to provide data transmission services to multiple clients,
  • the system includes:
  • An obtaining unit configured to obtain load and network performance information of the service node itself in response to a file slice request instruction of the client;
  • a determining unit configured to determine that the service of the service node is abnormal when the load and/or the network performance information is abnormal
  • the disconnection unit is used to disconnect the connection between the service node and the client.
  • the system further includes:
  • the detecting unit is configured to detect the load and network performance information of the service node itself at a preset time interval.
  • the determining unit is specifically configured to:
  • the network bandwidth is determined from the network performance information of the service node, and when the network bandwidth is less than the configured bandwidth, the network performance of the service node is determined.
  • the delay or the packet loss rate is determined in the information, and when the delay exceeds the configured delay or the packet loss rate exceeds the configured packet loss rate, it is determined that the service of the service node is abnormal.
  • the system further includes:
  • the sending unit is configured to send the requested file slice to the client when it is determined that the service of the service node is not abnormal.
  • the service node stores a plurality of different file slices, and the service node receives request instructions from different clients for the same file slice or different file slices.
  • the present invention further provides a data transmission device based on a P2P network, which runs on a client, the client is connected to a service node, and each client is used to request data transmission services from multiple service nodes,
  • the device includes:
  • the sending module is used to send request instructions to the service nodes storing the file slices respectively;
  • a determining module configured to determine the file slice requested from the disconnected service node as the target file slice when it is detected that the service node is disconnected from the client;
  • the sending module is also used to resend the request instruction to other service nodes having the target file slice.
  • the device further includes:
  • the splicing module is used for processing the file slices to obtain a file by splicing when a plurality of file slices are received.
  • the client sends a request instruction to a service node storing corresponding file slices in the order of file slices.
  • the present invention further provides a computer-readable storage medium on which a data transmission program based on a P2P network is stored, and the data transmission program based on a P2P network can be used by one or more The processor executes to implement the data transmission method based on the P2P network.
  • the present invention can obtain the load and network performance information of the service node itself in response to the file slicing request instruction of the client, so as to simultaneously use multiple service nodes to download files in fragments.
  • the load and/or the network performance information is abnormal, it is determined that the service of the service node is abnormal, and then the service of the service node can be monitored through the load and network performance information, and the service abnormality is found in time, and the service node is further disconnected
  • the connection with the client is then dynamically adjusted to multiple service nodes serving the client, realizing the load balancing of the server cluster in the P2P network, and further ensuring that the server cluster will not collapse due to excessive load, and ensuring that the server The quality of service of the cluster.
  • FIG. 1 is a schematic diagram of a P2P network according to an embodiment of the present invention
  • FIG. 2 is a schematic flowchart of an embodiment of the present invention
  • FIG. 3 is a schematic flowchart of another embodiment of the present invention.
  • FIG. 4 is a schematic diagram of the internal structure of an electronic device disclosed in an embodiment of the present invention.
  • Fig. 5 is a schematic diagram of functional modules of a data transmission system based on a P2P network according to the present invention
  • Fig. 6 is a schematic diagram of functional modules of a data transmission device based on a P2P network according to the present invention.
  • first, second, third, “fourth”, etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish similar objects and are only used Describe the purpose, but cannot be understood as indicating or implying its relative importance or implicitly indicating the number of technical features indicated. Therefore, the feature defined with “first” and “second” may explicitly or implicitly include at least one of the features, and does not have to be used to describe a specific sequence or sequence. It should be understood that the data used in this way can be interchanged under appropriate circumstances so that the embodiments described herein can be implemented in a sequence other than the content illustrated or described herein.
  • the terms “including” and “having” and any variations of them are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or device that includes a series of steps or units is not necessarily limited to those clearly listed. Those steps or units may include other steps or units that are not clearly listed or are inherent to these processes, methods, products, or equipment.
  • the invention provides a data transmission method based on a P2P network.
  • FIG. 1 it is a schematic diagram of a P2P network according to an embodiment of the present invention.
  • This embodiment is applied to a P2P network (Peer to Peer, peer-to-peer network), and the P2P network is a peer-to-peer service network.
  • P2P network Peer to Peer, peer-to-peer network
  • P2P network is a peer-to-peer service network.
  • the P2P network includes multiple clients and server clusters, and the server cluster may include multiple service nodes.
  • the server cluster may include multiple service nodes.
  • the requested service node sends the requested corresponding data to the requesting client.
  • the P2P network-based data transmission method is applied to one or more electronic devices, and the electronic device is a device that can automatically perform numerical calculation and/or information processing in accordance with pre-set or stored instructions.
  • the hardware equipment of electronic equipment includes, but is not limited to, microprocessors, application specific integrated circuits (ASICs), programmable gate arrays (Field-Programmable Gate Arrays, FPGAs), digital processors (Digital Signal Processors, DSPs), Embedded devices, etc.
  • the electronic device may be any electronic product that can interact with a user with a human machine, for example, a personal computer, a tablet computer, a smart phone, a personal digital assistant (PDA), a game console, an interactive network television ( Internet Protocol Television, IPTV), smart wearable devices, etc.
  • a personal computer for example, a personal computer, a tablet computer, a smart phone, a personal digital assistant (PDA), a game console, an interactive network television ( Internet Protocol Television, IPTV), smart wearable devices, etc.
  • PDA personal digital assistant
  • IPTV Internet Protocol Television
  • smart wearable devices etc.
  • the electronic device may also include a network device and/or user equipment.
  • the network device includes, but is not limited to, a single network server, a server group composed of multiple network servers, or a cloud composed of a large number of hosts or network servers based on cloud computing.
  • the network where the electronic device is located includes, but is not limited to, the Internet, a wide area network, a metropolitan area network, a local area network, a virtual private network (Virtual Private Network, VPN), etc.
  • the electronic device includes a service node and a client.
  • a data transmission method based on a P2P network is applied to a service node, the service node is connected to a client, and each service node is used to provide data transmission services to multiple clients.
  • the method includes :
  • the service node stores a plurality of different file slices, and the service node receives request instructions from different clients for the same file slice or different file slices.
  • the request instruction may be a download request instruction for the file, or another transmission request instruction for the file, such as a request for video playback data.
  • the file may be any form of file to be downloaded, or a video file requested to be played.
  • the file when the client requests the file from the server cluster, the file may be divided into multiple file slices, and corresponding to each file slice, the client sends one file The service node sends a request. Therefore, multiple service nodes will provide the client with a service for sending the file at the same time, which speeds up data transmission and further improves the performance of data transmission in the P2P network.
  • the client since the client does not store the relevant data of each service node of the server cluster in advance, when requesting the service node for each file slice of the file, the client uses a random request method.
  • the selection can also be made according to predetermined rules, for example, according to the service quality of the service node in a predetermined time period in the past, the node whose service quality meets the preset condition is selected first as the service node.
  • the file can be equally divided into multiple file slices, or can be divided according to other strategies.
  • the present invention is not limited.
  • the file slices can also be processed in a redundant coding manner to ensure that the client Even if all the file slices are not received, the content of the file can be better restored.
  • the load indicates the hardware performance of the service node. Therefore, the higher the occupied load of the service node, the greater the hardware pressure of the service node, and it can be determined The worse the current performance of the hardware of the service node, on the contrary, the lower the occupied load of the service node, the lower the hardware pressure of the service node, and the higher the current performance of the hardware of the service node can be determined. it is good.
  • the network performance information may include, but is not limited to: network bandwidth, delay, packet loss rate, etc.
  • the network bandwidth includes, but is not limited to: bandwidth, number of connections, and so on.
  • the greater the number of connections, the less available bandwidth indirectly, and the poor network performance can be determined.
  • the less the number of connections, the more available bandwidth indirectly, and the better the network performance can be determined.
  • the bandwidth and the number of connections may each correspond to a weight, and the weight of the bandwidth is higher than the number of connections. In this way, the weighted sum of the bandwidth and the number of connections is calculated, and the weighted Compare with the configured network bandwidth to further determine the network performance of the service node.
  • the delay refers to the time required for a message or packet to be transmitted from one end of a network to another end, which can characterize whether each service node can respond in a timely manner. Therefore, when the When the delay is high, it can be determined that the network performance is poor, and vice versa, it can be determined that the network performance is better.
  • the packet loss rate refers to the ratio of the number of lost data packets to the transmitted data group.
  • the packet loss rate of the network should be controlled within a certain range. If the packet loss rate is too high , It can be determined that the network performance is poor. On the contrary, if the packet loss rate is low, it can be determined that the network performance is better.
  • the method further includes:
  • the service node detects its own load and network performance information.
  • each service node of the server cluster can be periodically monitored.
  • the service node stores the load and network performance information of each service node, so that it can be called in time when needed, so as to avoid the delay of the normal service of the P2P network caused by temporary detection when needed.
  • the priority of the load is higher than that of the network performance information, and in the network performance information, the priority of the network bandwidth is higher than that of the network performance information. State the delay or packet loss rate.
  • the determining by the service node that the service of the service node is abnormal includes:
  • the service node determines that the service of the service node is abnormal.
  • the configuration load can be customized configuration.
  • the load Since the load has the highest priority, as long as it is determined that the load is greater than or equal to the configured load, it can be directly determined that the service of the service node is abnormal, and there is no need to judge the network performance information.
  • the configuration bandwidth can be customized.
  • the load When the load is less than the configured load, it indicates that the load of the service node is normal. At this time, according to the priority, it is necessary to continue to determine whether the network bandwidth in the network performance information of the service node is abnormal. If the network bandwidth is greater than or equal to the configured network, it can be directly determined that the service of the service node is abnormal, and there is no need to judge the delay or packet loss rate in the network performance information.
  • the network bandwidth is determined from the network performance information of the service node, and when the network bandwidth is less than the configured bandwidth, the network bandwidth is determined from the service node.
  • the delay or the packet loss rate is determined in the network performance information of the network, and when the delay exceeds the configured delay or the packet loss rate exceeds the configured packet loss rate, it is determined that the service of the service node is abnormal.
  • the configuration delay and the configuration packet loss rate can be customized.
  • the load When the load is less than the configured load, it indicates that the load of the service node is normal. At this time, according to the priority, it is necessary to continue to determine whether the network bandwidth in the network performance information of the service node is abnormal. When the bandwidth is less than the configured bandwidth, it indicates that the network bandwidth of the service node is normal. Then, according to the priority, it is necessary to further determine whether the delay or packet loss rate in the network performance information of the service node is abnormal. If there is an abnormality in the delay or the packet loss rate, it can be directly determined that the service of the service node is abnormal.
  • each service node's own attributes are different, it means that each service node's own performance is also different. Therefore, in order to enable each service node to perform services within the tolerable range of its own performance, it can be based on The performance of each service node configures different parameter thresholds for each service node, such as the configuration load, the configuration bandwidth, the configuration packet loss rate, and the configuration delay.
  • the service of the service node can be monitored through load and network performance information, and service abnormalities can be discovered in time.
  • S12 Disconnect the connection between the service node and the client.
  • the client may also perform meaningless waits for the P2P network.
  • the service has an impact, which reduces the speed of data transmission and at the same time affects the use of users.
  • the method further includes:
  • the service node When it is determined that the service of the service node is not abnormal, the service node sends the requested file slice to the client.
  • the method further includes:
  • the newly added service node has file slices required by the client.
  • new service nodes can be added to the server cluster in time when the server cluster is overloaded, so as to realize the horizontal expansion of the server cluster and ensure that the server cluster will not be caused by excessive load.
  • the crash guarantees the quality of service of the server cluster.
  • the present invention can obtain the load and network performance information of the service node itself in response to the file slicing request instruction of the client, so as to simultaneously use multiple service nodes to download files in fragments.
  • the load and/or the network performance information is abnormal, it is determined that the service of the service node is abnormal, and then the service of the service node can be monitored through the load and network performance information, and the service abnormality can be found in time, and the service node is further disconnected
  • the connection with the client is then dynamically adjusted to multiple service nodes serving the client, realizing the load balancing of the server cluster in the P2P network, and further ensuring that the server cluster will not collapse due to excessive load, and ensuring that the server The quality of service of the cluster.
  • FIG. 3 it is a schematic flowchart of another embodiment of the present invention. According to different needs, the sequence of the steps in the flow diagram can be changed, and some steps can be omitted.
  • a data transmission method based on a P2P network is applied to a client, the client is connected to a service node, and each client is used to request data transmission services from multiple service nodes, the method include:
  • S20 Send request instructions to service nodes storing file slices respectively.
  • the client sends the request instruction to the service node storing the corresponding file slices in the order of the file slices.
  • the file may be any form of file to be downloaded, or may be a video file requested to be played.
  • the size of each file slice can be customized.
  • the client sends a request to a service node. Therefore, multiple service nodes will provide the client with a service for sending the file at the same time, which speeds up data transmission and further The performance of data transmission in the P2P network is improved.
  • the method further includes:
  • the client processes the file slices to stitch together to obtain a file.
  • the request instruction can be resent to other service nodes without affecting the file request, and other service nodes can replace the abnormal service node to continue the service.
  • the service node may be a server corresponding to a peer node in a P2P network (Peer to Peer, peer-to-peer network).
  • the peer node is usually deployed in the user's home, and there is no need to establish an additional computer room, and the data Transmission relies on the upstream bandwidth of the peer node, and the upstream bandwidth is generally idle and does not incur additional costs, so the cost is lower.
  • the service node can also be a server that performs data transmission based on the http protocol, which can provide stable and reliable resources, thereby providing stable and reliable data transmission services.
  • the type is not limited.
  • the present invention can divide a file into multiple file slices, and send request instructions to the service nodes storing the file slices respectively, so as to use multiple service nodes to download the file in slices at the same time.
  • the service node determines the file slice requested from the disconnected service node as the target file slice, and resends the request instruction to other service nodes with the target file slice, which can be timely Discover service abnormalities and dynamically adjust multiple service nodes serving the client to achieve load balancing of the server cluster in the P2P network, and further ensure that the server cluster will not collapse due to excessive load, and ensure the service of the server cluster quality.
  • the electronic device 1 may be a node constituting a content distribution network or a blockchain network.
  • the electronic device 1 may include a memory 12, a processor 13, and a bus, and may also include a computer program stored in the memory 12 and running on the processor 13, such as a data transmission program based on a P2P network.
  • the electronic device 1 may have a bus structure or a star structure.
  • the device 1 may also include more or less other hardware or software than shown in the figure, or a different component arrangement.
  • the electronic device 1 may also include an input/output device, a network access device, and the like.
  • the electronic device 1 is only an example. If other existing or future electronic products can be adapted to the present invention, they should also be included in the protection scope of the present invention and included here by reference. .
  • the memory 12 includes at least one type of readable storage medium, the readable storage medium includes flash memory, mobile hard disk, multimedia card, card-type memory (for example: SD or DX memory, etc.), magnetic memory, magnetic disk, optical disk, etc. .
  • the memory 12 may be an internal storage unit of the electronic device 1 in some embodiments, for example, a mobile hard disk of the electronic device 1.
  • the memory 12 may also be an external storage device of the electronic device 1, such as a plug-in mobile hard disk, a smart media card (SMC), and a secure digital (Secure Digital, SD) equipped on the electronic device 1. ) Card, Flash Card, etc.
  • the memory 12 may also include both an internal storage unit of the electronic device 1 and an external storage device.
  • the memory 12 can be used not only to store application software and various data installed in the electronic device 1, such as codes of a data transmission program based on a P2P network, etc., but also to temporarily store data that has been output or will be output.
  • the processor 13 may be composed of integrated circuits in some embodiments, for example, may be composed of a single packaged integrated circuit, or may be composed of multiple integrated circuits with the same function or different functions, including one or more central processing units. Combinations of central processing unit (CPU), microprocessor, digital processing chip, graphics processor, and various control chips.
  • the processor 13 is the control unit of the electronic device 1, which uses various interfaces and lines to connect the various components of the entire electronic device 1, and runs or executes programs or modules stored in the memory 12 (such as executing Data transmission programs based on the P2P network, etc.), and call data stored in the memory 12 to execute various functions of the electronic device 1 and process data.
  • the processor 13 executes the operating system of the electronic device 1 and various installed applications.
  • the processor 13 executes the application program to implement the steps in the above-mentioned P2P network-based data transmission method embodiments, such as steps S10, S11, S12 shown in FIG. 2 and/or step S20 shown in FIG. 3 , S21, S22.
  • the processor 13 implements the functions of the modules/units in the foregoing device embodiments when executing the computer program, for example:
  • processor 13 when the processor 13 executes the computer program, it also implements the functions of the modules/units in the foregoing device embodiments, for example:
  • the computer program may be divided into one or more modules/units, and the one or more modules/units are stored in the memory 12 and executed by the processor 13 to complete the present invention.
  • the one or more modules/units may be a series of computer program instruction segments capable of completing specific functions, and the instruction segments are used to describe the execution process of the computer program in the electronic device 1.
  • the computer program may be divided into an acquiring unit 111, a determining unit 112, a disconnecting unit 113, a detecting unit 114, a sending unit 115 and/or a sending module 223, a determining module 224, and a splicing module 225.
  • the above-mentioned integrated unit implemented in the form of a software function module may be stored in a computer readable storage medium.
  • the above-mentioned software function module is stored in a storage medium and includes several instructions to make a computer device (which may be a personal computer, a computer device, or a network device, etc.) or a processor execute the method described in each embodiment of the present invention part.
  • the integrated module/unit of the electronic device 1 is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer readable storage medium.
  • the present invention implements all or part of the processes in the above-mentioned embodiments and methods, and can also be completed by instructing related hardware devices through a computer program.
  • the computer program can be stored in a computer-readable storage medium. When the computer program is executed by the processor, it can implement the steps of the foregoing method embodiments.
  • the computer program includes computer program code
  • the computer program code may be in the form of source code, object code, executable file, or some intermediate forms.
  • the computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory) .
  • the bus may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus.
  • PCI peripheral component interconnect
  • EISA extended industry standard architecture
  • the bus can be divided into address bus, data bus, control bus and so on. For ease of presentation, only one arrow is used to indicate in FIG. 4, but it does not mean that there is only one bus or one type of bus.
  • the bus is configured to implement connection and communication between the memory 12 and at least one processor 13 and the like.
  • the electronic device 1 may also include a power source (such as a battery) for supplying power to various components.
  • the power source may be logically connected to the at least one processor 13 through a power management device, so as to be realized by the power management device. Functions such as charge management, discharge management, and power consumption management.
  • the power supply may also include any components such as one or more DC or AC power supplies, recharging devices, power failure detection circuits, power converters or inverters, and power status indicators.
  • the electronic device 1 may also include various sensors, Bluetooth modules, Wi-Fi modules, etc., which will not be repeated here.
  • the electronic device 1 may also include a network interface.
  • the network interface may include a wired interface and/or a wireless interface (such as a WI-FI interface, a Bluetooth interface, etc.), which is usually used in the electronic device 1 Establish a communication connection with other electronic devices.
  • the electronic device 1 may also include a user interface.
  • the user interface may be a display (Display) and an input unit (such as a keyboard (Keyboard)).
  • the user interface may also be a standard wired interface or a wireless interface.
  • the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode, organic light-emitting diode) touch device, etc.
  • the display can also be appropriately called a display screen or a display unit, which is used to display the information processed in the electronic device 1 and to display a visualized user interface.
  • FIG. 4 only shows the electronic device 1 with components 12-13. Those skilled in the art can understand that the structure shown in FIG. 4 does not constitute a limitation on the electronic device 1, and may include less Or more parts, or a combination of some parts, or a different arrangement of parts.
  • the memory 12 in the electronic device 1 stores multiple instructions to implement a P2P network-based data transmission method, and the processor 13 can execute the multiple instructions to achieve:
  • the memory 12 in the electronic device 1 stores multiple instructions to implement a P2P network-based data transmission method, and the processor 13 may also execute the multiple instructions to achieve:
  • the P2P network-based data transmission system 11 includes an acquiring unit 111, a determining unit 112, a disconnecting unit 113, a detecting unit 114, and a sending unit 115.
  • the module/unit referred to in the present invention refers to a series of computer program segments that can be executed by the processor 13 and can complete fixed functions, and are stored in the memory 12. In this embodiment, the functions of each module/unit will be described in detail in subsequent embodiments.
  • the obtaining unit 111 obtains the load and network performance information of the service node itself.
  • the service node stores a plurality of different file slices, and the service node receives request instructions from different clients for the same file slice or different file slices.
  • the request instruction may be a download request instruction for the file, or another transmission request instruction for the file, such as a request for video playback data.
  • the file may be any form of file to be downloaded, or a video file requested to be played.
  • the file when the client requests the file from the server cluster, the file may be divided into multiple file slices, and corresponding to each file slice, the client sends one file The service node sends a request. Therefore, multiple service nodes will provide the client with a service for sending the file at the same time, which speeds up data transmission and further improves the performance of data transmission in the P2P network.
  • the client since the client does not store the relevant data of each service node of the server cluster in advance, when requesting the service node for each file slice of the file, the client uses a random request method.
  • the selection can also be made according to predetermined rules, for example, according to the service quality of the service node in a predetermined time period in the past, the node whose service quality meets the preset condition is selected first as the service node.
  • the file can be equally divided into multiple file slices, or can be divided according to other strategies.
  • the present invention is not limited.
  • the file slices can also be processed in a redundant coding manner to ensure that the client Even if all the file slices are not received, the content of the file can be better restored.
  • the load indicates the hardware performance of the service node. Therefore, the higher the occupied load of the service node, the greater the hardware pressure of the service node, and it can be determined The worse the current performance of the hardware of the service node, on the contrary, the lower the occupied load of the service node, the lower the hardware pressure of the service node, and the higher the current performance of the hardware of the service node can be determined. it is good.
  • the network performance information may include, but is not limited to: network bandwidth, delay, packet loss rate, etc.
  • the network bandwidth includes, but is not limited to: bandwidth, number of connections, and so on.
  • the more the number of connections, the less available bandwidth indirectly, and the poor network performance can be determined. Conversely, the less the number of connections, the more available bandwidth indirectly, and the better the network performance can be determined.
  • the bandwidth and the number of connections may each correspond to a weight, and the weight of the bandwidth is higher than the number of connections. In this way, the weighted sum of the bandwidth and the number of connections is calculated, and the weighted Compare with the configured network bandwidth to further determine the network performance of the service node.
  • the delay refers to the time required for a message or packet to be transmitted from one end of a network to another end, which can characterize whether each service node can respond in a timely manner. Therefore, when the When the delay is high, it can be determined that the network performance is poor, and vice versa, it can be determined that the network performance is better.
  • the packet loss rate refers to the ratio of the number of lost data packets to the transmitted data group.
  • the packet loss rate of the network should be controlled within a certain range. If the packet loss rate is too high , It can be determined that the network performance is poor. On the contrary, if the packet loss rate is low, it can be determined that the network performance is better.
  • the detection unit 114 detects the load and network performance information of the service node itself every preset time interval.
  • each service node of the server cluster can be periodically monitored.
  • the detection unit 114 stores the load and network performance information of each service node, so that it can be called in time when needed, so as to avoid the delay of the normal service of the P2P network caused by the temporary detection when needed.
  • the determining unit 112 determines that the service of the service node is abnormal.
  • the priority of the load is higher than that of the network performance information, and in the network performance information, the priority of the network bandwidth is higher than that of the network performance information. State the delay or packet loss rate.
  • the determining unit 112 determining that the service of the service node is abnormal includes:
  • the determining unit 112 determines that the service of the service node is abnormal.
  • the configuration load can be customized configuration.
  • the load Since the load has the highest priority, as long as it is determined that the load is greater than or equal to the configured load, it can be directly determined that the service of the service node is abnormal, and there is no need to judge the network performance information.
  • the determining unit 112 determines the network bandwidth from the network performance information of the serving node, and when the network bandwidth is greater than or equal to the configured bandwidth, The determining unit 112 determines that the service of the service node is abnormal.
  • the configuration bandwidth can be customized.
  • the load When the load is less than the configured load, it indicates that the load of the service node is normal. At this time, according to the priority, it is necessary to continue to determine whether the network bandwidth in the network performance information of the service node is abnormal. If the network bandwidth is greater than or equal to the configured network, it can be directly determined that the service of the service node is abnormal, and there is no need to judge the delay or packet loss rate in the network performance information.
  • the determining unit 112 determines the network bandwidth from the network performance information of the service node, and when the network bandwidth is less than the configured bandwidth, The determining unit 112 determines the delay or the packet loss rate from the network performance information of the service node, and when the delay exceeds the configured delay or the packet loss rate exceeds the configured packet loss rate, the determining unit 112 It is determined that the service of the service node is abnormal.
  • the configuration delay and the configuration packet loss rate can be customized.
  • the load When the load is less than the configured load, it indicates that the load of the service node is normal. At this time, according to the priority, it is necessary to continue to determine whether the network bandwidth in the network performance information of the service node is abnormal. When the bandwidth is less than the configured bandwidth, it indicates that the network bandwidth of the service node is normal. Then, according to the priority, it is necessary to further determine whether the delay or packet loss rate in the network performance information of the service node is abnormal. If there is an abnormality in the delay or the packet loss rate, it can be directly determined that the service of the service node is abnormal.
  • each service node's own attributes are different, it means that each service node's own performance is also different. Therefore, in order to enable each service node to perform services within the tolerable range of its own performance, it can be based on The performance of each service node configures different parameter thresholds for each service node, such as the configuration load, the configuration bandwidth, the configuration packet loss rate, and the configuration delay.
  • the service of the service node can be monitored through load and network performance information, and service abnormalities can be discovered in time.
  • the disconnecting unit 113 disconnects the connection between the service node and the client.
  • the client may also perform meaningless waits for the P2P network.
  • the service has an impact, which reduces the speed of data transmission and at the same time affects the use of users.
  • the sending unit 115 when it is determined that the service of the service node is not abnormal, sends the requested file slice to the client.
  • a new service node is added to the server cluster.
  • the newly added service node has file slices required by the client.
  • new service nodes can be added to the server cluster in time when the server cluster is overloaded, so as to realize the horizontal expansion of the server cluster and ensure that the server cluster will not be caused by excessive load.
  • the crash guarantees the quality of service of the server cluster.
  • the present invention can obtain the load and network performance information of the service node itself in response to the file slicing request instruction of the client, so as to simultaneously use multiple service nodes to download files in fragments.
  • the load and/or the network performance information is abnormal, it is determined that the service of the service node is abnormal, and then the service of the service node can be monitored through the load and network performance information, and the service abnormality is found in time, and the service node is further disconnected
  • the connection with the client is then dynamically adjusted to multiple service nodes serving the client, realizing the load balancing of the server cluster in the P2P network, and further ensuring that the server cluster will not collapse due to excessive load, and ensuring that the server The quality of service of the cluster.
  • the data transmission device 22 based on the P2P network includes a sending module 223, a determining module 224, and a splicing module 225.
  • the module/unit referred to in the present invention refers to a series of computer program segments that can be executed by a processor and can complete fixed functions, and are stored in a memory. In this embodiment, the functions of each module/unit will be described in detail in subsequent embodiments.
  • the sending module 223 respectively sends request instructions to the service nodes storing the file slices.
  • the client sends the request instruction to the service node storing the corresponding file slices in the order of the file slices.
  • the file may be any form of file to be downloaded, or may be a video file requested to be played.
  • the size of each file slice can be customized.
  • the client sends a request to a service node. Therefore, multiple service nodes will provide the client with a service for sending the file at the same time, which speeds up data transmission and further The performance of data transmission in the P2P network is improved.
  • the determining module 224 determines the file slice requested from the disconnected service node as the target file slice.
  • the splicing module 225 processes the file slices to splice the files.
  • the sending module 223 resends the request instruction to other service nodes having the target file slice.
  • the request instruction can be re-sent to other service nodes without affecting the file request, and other service nodes can replace the abnormal service node to continue the service.
  • the service node may be a server corresponding to a peer node in a P2P network (Peer to Peer, peer-to-peer network).
  • the peer node is usually deployed in the user's home, and there is no need to build an additional computer room. Transmission relies on the upstream bandwidth of the peer node, and the upstream bandwidth is generally idle and does not incur additional costs, so the cost is lower.
  • the service node can also be a server that performs data transmission based on the http protocol, which can provide stable and reliable resources, thereby providing stable and reliable data transmission services.
  • the type is not limited.
  • the present invention can divide a file into multiple file slices, and send request instructions to the service nodes storing the file slices respectively, so as to use multiple service nodes to download the file in slices at the same time.
  • the service node determines the file slice requested from the disconnected service node as the target file slice, and resends the request instruction to other service nodes with the target file slice, which can be timely Discover service abnormalities and dynamically adjust multiple service nodes serving the client to achieve load balancing of the server cluster in the P2P network, and further ensure that the server cluster will not collapse due to excessive load, and ensure the service of the server cluster quality.
  • the computer program product includes one or more computer instructions.
  • the computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices.
  • the computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium.
  • the computer instructions may be transmitted from a website, computer, server, or data center. Transmission to another website, computer, server or data center via wired (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, microwave, etc.).
  • wired such as coaxial cable, optical fiber, digital subscriber line (DSL)
  • wireless such as infrared, wireless, microwave, etc.
  • the computer-readable storage medium may be any available medium that can be stored by a computer or a data storage device such as a server or a data center integrated with one or more available media.
  • the usable medium may be a magnetic medium (for example, a floppy disk, a mobile hard disk, and a magnetic tape), an optical medium (for example, a DVD), or a semiconductor medium (for example, a solid state mobile hard disk (SSD)).
  • the disclosed system, device, and method can be implemented in other ways.
  • the device embodiments described above are merely illustrative.
  • the division of the units is only a logical function division, and there may be other divisions in actual implementation, for example, multiple units or components may be combined It can be integrated into another system, or some features can be ignored or not implemented.
  • the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may be in electrical, mechanical or other forms.
  • the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the solutions of the embodiments.
  • the functional units in the various embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit.
  • the above-mentioned integrated unit can be implemented in the form of a hardware device, or can be implemented in the form of a software functional unit.
  • the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer readable storage medium.
  • the technical solution of this application essentially or the part that contributes to the existing technology or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium.
  • a computer device which may be a personal computer, a server, or a network device, etc.
  • the aforementioned storage media include: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), magnetic disk or optical disk and other media that can store program codes.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Hardware Design (AREA)
  • General Engineering & Computer Science (AREA)
  • Information Transfer Between Computers (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

本申请提供了一种基于P2P网络的数据传输方法、设备、系统、装置及介质,所述方法包括:响应于客户端的文件切片的请求指令,获取服务节点自身的负载及网络性能信息;当所述负载及/或所述网络性能信息异常时,确定所述服务节点的服务异常;断开所述服务节点与所述客户端的连接。本申请能够通过动态地调整为客户端服务的多个服务节点,实现P2P网络中服务器集群的负载均衡,确保服务器集群不会由于负载过高而崩溃,进而保证了服务器集群的服务质量。

Description

基于P2P网络的数据传输方法、设备、系统、装置及介质
本申请要求于2019年12月31日提交中国专利局,申请号为201911416651.8、发明名称为“基于P2P网络的数据传输方法、设备、系统、装置及介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本发明涉及互联网技术领域,尤其涉及基于P2P网络的数据传输方法、设备、系统、装置及介质。
背景技术
现有技术方案中,对于P2P网络(Peer to Peer,对等网络),随着客户端(client)连接数的不断增多,服务带宽将变得越来越大,因此,服务器集群(server)的负载也随之不断地增加,多个客户端之间相互抢占带宽,最终会导致客户端无法正常下载或播放文件,相应地,服务器集群也有由于负载太高导致崩溃的风险。
发明内容
本发明的主要目的在于提供基于P2P网络的数据传输方法、设备、系统、装置及介质,能够通过动态地调整为客户端服务的多个服务节点,实现P2P网络中服务器集群的负载均衡,确保服务器集群不会由于负载过高而崩溃,进而保证了服务器集群的服务质量。
为实现上述目的,本发明提供一种基于P2P网络的数据传输方法,应用于服务节点,所述服务节点与客户端相连接,每个服务节点用于向多个客户端提供数据传输服务,所述方法包括:
响应于所述客户端的文件切片的请求指令,获取所述服务节点自身的负载及网络性能信息;
当所述负载及/或所述网络性能信息异常时,确定所述服务节点的服务异常;
断开所述服务节点与所述客户端的连接。
根据本发明优选实施例,所述方法还包括:
每隔预设时间间隔,检测所述服务节点自身的负载及网络性能信息。
根据本发明优选实施例,所述确定所述服务节点的服务异常包括:
当所述服务节点的负载大于或者等于配置负载时,确定所述服务节点的服务异常;或者
当所述服务节点的负载小于所述配置负载时,从所述服务节点的网络性能信息中确定网络带宽,当所述网络带宽大于或者等于配置带宽时,确定所述服务节点的服务异常;或者
当所述服务节点的负载小于所述配置负载时,从所述服务节点的网络性能信息中确定所述网络带宽,当所述网络带宽小于所述配置带宽时,从所述服务节点的网络性能信息中确定延时或丢包率,当所述延时超过配置延时或者所述丢包率超过配置丢包率时,确定所述服务节点的服务异常。
根据本发明优选实施例,所述方法还包括:
当确定所述服务节点的服务没有异常时,向所述客户端发送请求的文件切片。
根据本发明优选实施例,所述服务节点存储有多个不同的文件切片,所述服务节点接收不同客户端对于相同文件切片或者不同文件切片的请求指令。
为实现上述目的,本发明进一步提供一种基于P2P网络的数据传输方法,应用于客户端,所述客户端与服务节点相连接,每个客户端用于向多个服务节点请求数据传输服务,所述方法包括:
向存储有文件切片的服务节点分别发送请求指令;
当检测到有服务节点断开与所述客户端的连接时,将向断开连接的服务节点所请求的文件切片确定为目标文件切片;
向具有所述目标文件切片的其他服务节点重新发送请求指令。
根据本发明优选实施例,所述方法还包括:
当接收到多个文件切片时对所述文件切片进行处理以拼接得到文件。
根据本发明优选实施例,所述客户端按照文件切片的顺序向存储有对应文件切片的服务节点发送请求指令。
为实现上述目的,本发明进一步提供一种电子设备,所述电子设备包括:
存储器,存储至少一个指令;及
处理器,执行所述存储器中存储的指令以实现所述基于P2P网络的数据传输方法。
优选地,所述电子设备为组成内容分发网络或者区块链网络的节点。
为实现上述目的,本发明进一步提供一种基于P2P网络的数据传输系统,运行于服务 节点,所述服务节点与客户端相连接,每个服务节点用于向多个客户端提供数据传输服务,所述系统包括:
获取单元,用于响应于所述客户端的文件切片的请求指令,获取所述服务节点自身的负载及网络性能信息;
确定单元,用于当所述负载及/或所述网络性能信息异常时,确定所述服务节点的服务异常;
断开单元,用于断开所述服务节点与所述客户端的连接。
根据本发明优选实施例,所述系统还包括:
检测单元,用于每隔预设时间间隔,检测所述服务节点自身的负载及网络性能信息。
根据本发明优选实施例,所述确定单元具体用于:
当所述服务节点的负载大于或者等于配置负载时,确定所述服务节点的服务异常;或者
当所述服务节点的负载小于所述配置负载时,从所述服务节点的网络性能信息中确定网络带宽,当所述网络带宽大于或者等于配置带宽时,确定所述服务节点的服务异常;或者
当所述服务节点的负载小于所述配置负载时,从所述服务节点的网络性能信息中确定所述网络带宽,当所述网络带宽小于所述配置带宽时,从所述服务节点的网络性能信息中确定延时或丢包率,当所述延时超过配置延时或者所述丢包率超过配置丢包率时,确定所述服务节点的服务异常。
根据本发明优选实施例,所述系统还包括:
发送单元,用于当确定所述服务节点的服务没有异常时,向所述客户端发送请求的文件切片。
根据本发明优选实施例,所述服务节点存储有多个不同的文件切片,所述服务节点接收不同客户端对于相同文件切片或者不同文件切片的请求指令。
为实现上述目的,本发明进一步提供一种基于P2P网络的数据传输装置,运行于客户端,所述客户端与服务节点相连接,每个客户端用于向多个服务节点请求数据传输服务,所述装置包括:
发送模块,用于向存储有文件切片的服务节点分别发送请求指令;
确定模块,用于当检测到有服务节点断开与所述客户端的连接时,将向断开连接的服务节点所请求的文件切片确定为目标文件切片;
所述发送模块,还用于向具有所述目标文件切片的其他服务节点重新发送请求指令。
根据本发明优选实施例,所述装置还包括:
拼接模块,用于当接收到多个文件切片时对所述文件切片进行处理以拼接得到文件。
根据本发明优选实施例,所述客户端按照文件切片的顺序向存储有对应文件切片的服务节点发送请求指令。
为实现上述目的,本发明进一步提供一种计算机可读存储介质,所述计算机可读存储介质上存储有基于P2P网络的数据传输程序,所述基于P2P网络的数据传输程序可被一个或者多个处理器执行,以实现所述基于P2P网络的数据传输方法。
综上所述,本发明能够响应于所述客户端的文件切片的请求指令,获取所述服务节点自身的负载及网络性能信息,以便同时利用多个服务节点对文件进行分片下载,当所述负载及/或所述网络性能信息异常时,确定所述服务节点的服务异常,进而能够通过负载和网络性能信息对服务节点的服务进行监控,并及时发现服务异常,进一步断开所述服务节点与所述客户端的连接,进而动态地调整为客户端服务的多个服务节点,实现P2P网络中服务器集群的负载均衡,并进一步确保了服务器集群不会由于负载过高而崩溃,且保证了服务器集群的服务质量。
附图说明
图1为本发明一实施例的P2P网络的示意图;
图2为本发明一实施例的流程示意图;
图3为本发明另一实施例的流程示意图;
图4为本发明一实施例揭露的电子设备的内部结构示意图;
图5为本发明基于P2P网络的数据传输系统的功能模块示意图;
图6为本发明基于P2P网络的数据传输装置的功能模块示意图。
具体实施方式
为了使本发明的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本发明进行进一步详细说明。应当理解,此处所描述的具体实施例仅用以解释本发明,并不用于限定本发明。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。
本申请的说明书和权利要求书及上述附图中的术语“第一”、“第二”、“第三”、“第四”等(如果存在)是用于区别类似的对象,仅用于描述目的,而不能理解为指示或暗示其相 对重要性或者隐含指明所指示的技术特征的数量。由此,限定有“第一”、“第二”的特征可以明示或者隐含地包括至少一个该特征,而不必用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便这里描述的实施例能够以除了在这里图示或描述的内容以外的顺序实施。此外,术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或单元的过程、方法、系统、产品或设备不必限于清楚地列出的那些步骤或单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或单元。
另外,各个实施例之间的技术方案可以相互结合,但是必须是以本领域普通技术人员能够实现为基础,当技术方案的结合出现相互矛盾或无法实现时应当认为这种技术方案的结合不存在,也不在本发明要求的保护范围之内。
本发明提供一种基于P2P网络的数据传输方法。
参照图1,为本发明一实施例的P2P网络的示意图。
本实施例应用于P2P网络(Peer to Peer,对等网络)中,所述P2P网络是一个点对点服务的网络。
具体地,所述P2P网络中包括多个客户端及服务器集群(server),所述服务器集群可以包括多个服务节点。当在所述P2P网络中存在任意客户端向任意服务节点发出数据请求时,由被请求的服务节点向发出请求的客户端发送请求的相应数据。
所述基于P2P网络的数据传输方法应用于一个或者多个电子设备中,所述电子设备是一种能够按照事先设定或存储的指令,自动进行数值计算和/或信息处理的设备,所述电子设备的硬件设备包括但不限于微处理器、专用集成电路(Application Specific Integrated Circuit,ASIC)、可编程门阵列(Field-Programmable Gate Array,FPGA)、数字处理器(Digital Signal Processor,DSP)、嵌入式设备等。
所述电子设备可以是任何一种可与用户进行人机交互的电子产品,例如,个人计算机、平板电脑、智能手机、个人数字助理(Personal Digital Assistant,PDA)、游戏机、交互式网络电视(Internet Protocol Television,IPTV)、智能式穿戴式设备等。
所述电子设备还可以包括网络设备和/或用户设备。其中,所述网络设备包括,但不限于单个网络服务器、多个网络服务器组成的服务器组或基于云计算(Cloud Computing)的由大量主机或网络服务器构成的云。
所述电子设备所处的网络包括但不限于互联网、广域网、城域网、局域网、虚拟专用 网络(Virtual Private Network,VPN)等。
在本实施例中,所述电子设备包括服务节点及客户端。
参照图2,为本发明一实施例的流程示意图。根据不同的需求,该流程示意图中步骤的顺序可以改变,某些步骤可以省略。
在一实施例中,一种基于P2P网络的数据传输方法,应用于服务节点,所述服务节点与客户端相连接,每个服务节点用于向多个客户端提供数据传输服务,该方法包括:
S10,响应于所述客户端的文件切片的请求指令,获取所述服务节点自身的负载及网络性能信息。
其中,所述服务节点存储有多个不同的文件切片,所述服务节点接收不同客户端对于相同文件切片或者不同文件切片的请求指令。
在本发明的至少一个实施例中,所述请求指令可以是对于所述文件的下载请求指令,还可以是对所述文件的其他传输请求指令,例如:视频播放数据的请求等。
相应地,所述文件可以是待下载的任意形式的文件,也可以是请求播放的视频文件等。
进一步地,在本实施例中,当所述客户端向服务器集群请求所述文件时,所述文件可以被切分为多个文件切片,对应于每个文件切片,所述客户端分别向一个服务节点发出请求,因此,将由多个服务节点为所述客户端同时提供对所述文件的发送服务,加快了数据传输的速度,也进一步提升了所述P2P网络中数据传输的性能。
具体地,由于所述客户端预先并没有存储所述服务器集群的各个服务节点的相关数据,因此,所述客户端在为所述文件的每个文件切片请求服务节点时,采取随机请求的方式,也可以按照预定的规则进行选择,例如,按照服务节点在过去预定时间段内的服务质量,选择服务质量满足预设条件的节点优先作为服务节点。
进一步地,所述文件可以被均分为多个文件切片,也可以根据其他策略进行切分,本发明不限制,例如,还可以采用冗余编码的方式对文件切片进行处理,以保证客户端即使没有接收到全部的文件切片,也可以较好的还原出文件的内容。
在本发明的至少一个实施例中,所述负载标志着所述服务节点的硬件性能,因此,所述服务节点被占用的负载越高,说明所述服务节点的硬件压力越大,则可以确定所述服务节点的硬件的当前性能越不好,反之,所述服务节点被占用的负载越低,说明所述服务节点的硬件压力越小,则可以确定所述服务节点的硬件的当前性能越好。
进一步地,所述网络性能信息可以包括,但不限于:网络带宽、延时、丢包率等。
其中,所述网络带宽包括,但不限于:带宽、连接数等。
可以理解的是,所述带宽被占用的越多,说明可用带宽越少,则可以确定网络性能不佳,反之,所述带宽被占用的越少,说明可用带宽越多,则可以确定网络性能较佳。
同样地,所述连接数越多,间接说明可用带宽越少,则可以确定网络性能不佳,反之,所述连接数越少,间接说明可用带宽越多,则可以确定网络性能较佳。
进一步地,所述带宽及所述连接数可以分别对应一个权重,所述带宽的权重高于所述连接数,这样,通过计算所述带宽及所述连接数的加权和,并将得到的加权和与配置网络带宽进行比较,以便进一步确定所述服务节点的网络性能。
在本实施例中,所述延时是指一个报文或分组从一个网络的一端传送到另一个端所需要的时间,能够表征每个服务节点是否能够进行及时的响应,因此,当所述延时较高时,则可以确定网络性能不佳,反之,则可以确定网络性能较佳。
在本实施例中,所述丢包率是指所丢失数据包的数量占所发送数据组的比率,正常传输时网络的丢包率应该控制在一定范围内,如果所述丢包率过高,则可以确定网络性能不佳,反之,如果所述丢包率较低,则可以确定网络性能较佳。
在本发明的至少一个实施例中,所述方法还包括:
每隔预设时间间隔,所述服务节点检测所述服务节点自身的负载及网络性能信息。
通过上述实施方式,能够对所述服务器集群的每个服务节点进行周期性的监控。
另外,所述服务节点存储每个服务节点的负载及网络性能信息,以便后续需要时及时调用,避免在需要时临时进行检测对所述P2P网络的正常服务造成延时。
S11,当所述负载及/或所述网络性能信息异常时,确定所述服务节点的服务异常。
需要说明的是,在确定所述服务节点的服务是否异常时,所述负载的优先级高于所述网络性能信息,而在所述网络性能信息中,所述网络带宽的优先级高于所述延时或丢包率。
在本发明的至少一个实施例中,所述服务节点确定所述服务节点的服务异常包括:
(1)当所述服务节点的负载大于或者等于配置负载时,所述服务节点确定所述服务节点的服务异常。
其中,所述配置负载可以进行自定义配置。
由于所述负载的优先级最高,因此,只要确定所述负载大于或者等于所述配置负载,则可以直接确定所述服务节点的服务异常,无需再进行网络性能信息的判断。
(2)当所述服务节点的负载小于所述配置负载时,从所述服务节点的网络性能信息中确定网络带宽,当所述网络带宽大于或者等于配置带宽时,确定所述服务节点的服务异 常。
其中,所述配置带宽可以进行自定义配置。
当所述负载小于所述配置负载时,说明所述服务节点的负载正常,此时,根据优先级,则需要继续判断所述服务节点的网络性能信息中的网络带宽是否异常,只要确定所述网络带宽大于或者等于所述配置网络,则可以直接确定所述服务节点的服务异常,无需再进行所述网络性能信息中延时或丢包率的判断。
(3)当所述服务节点的负载小于所述配置负载时,从所述服务节点的网络性能信息中确定所述网络带宽,当所述网络带宽小于所述配置带宽时,从所述服务节点的网络性能信息中确定延时或丢包率,当所述延时超过配置延时或者所述丢包率超过配置丢包率时,确定所述服务节点的服务异常。
其中,所述配置延时及所述配置丢包率可以进行自定义配置。
当所述负载小于所述配置负载时,说明所述服务节点的负载正常,此时,根据优先级,则需要继续判断所述服务节点的网络性能信息中的网络带宽是否异常,当所述网络带宽小于所述配置带宽时,说明所述服务节点的网络带宽正常,那么根据优先级,则需要进一步判断所述服务节点的网络性能信息中的延时或丢包率是否异常,只要确定所述延时或所述丢包率中有一项异常,则可以直接确定所述服务节点的服务异常。
需要说明的是,由于每个服务节点的自身属性不同,则说明每个服务节点的自身性能也不同,因此,为了使每个服务节点都能够在自身性能的可承受范围内进行服务,可以根据每个服务节点的自身性能为每个服务节点配置不同的参数阈值,如:所述配置负载、所述配置带宽、所述配置丢包率及所述配置延时等。
通过上述实施方式,能够通过负载及网络性能信息对服务节点的服务进行监控,并及时发现服务异常。
S12,断开所述服务节点与所述客户端的连接。
可以理解的是,通过断开所述服务节点与所述客户端的连接,能够避免在所述服务节点无法提供正常数据传输时,所述客户端还进行无意义的等待,给所述P2P网络的服务造成影响,降低了数据传输的速度,同时影响了用户的使用。
在本发明的至少一个实施例中,所述方法还包括:
当确定所述服务节点的服务没有异常时,所述服务节点向所述客户端发送请求的文件切片。
通过上述实施方式,能够在确定所述服务节点没有异常时,及时响应所述客户端的数 据请求。
在本发明的至少一个实施例中,所述方法还包括:
当每个服务节点的服务都异常时,添加新的服务节点至服务器集群。
需要说明的是,新增的服务节点具备所述客户端所需要的文件切片。
通过上述实施方式,能够在所述服务器集群超负荷运行时,及时添加新的服务节点至所述服务器集群,实现对所述服务器集群的横向扩展,确保所述服务器集群不会由于负载过高而崩溃,保证了服务器集群的服务质量。
综上所述,本发明能够响应于所述客户端的文件切片的请求指令,获取所述服务节点自身的负载及网络性能信息,以便同时利用多个服务节点对文件进行分片下载,当所述负载及/或所述网络性能信息异常时,确定所述服务节点的服务异常,进而能够通过负载和网络性能信息对服务节点的服务进行监控,并及时发现服务异常,进一步断开所述服务节点与所述客户端的连接,进而动态地调整为客户端服务的多个服务节点,实现P2P网络中服务器集群的负载均衡,并进一步确保了服务器集群不会由于负载过高而崩溃,且保证了服务器集群的服务质量。
参照图3,为本发明另一实施例的流程示意图。根据不同的需求,该流程示意图中步骤的顺序可以改变,某些步骤可以省略。
在一实施例中,一种基于P2P网络的数据传输方法,应用于客户端,所述客户端与服务节点相连接,每个客户端用于向多个服务节点请求数据传输服务,所述方法包括:
S20,向存储有文件切片的服务节点分别发送请求指令。
具体地,所述客户端按照文件切片的顺序向存储有对应文件切片的服务节点发送请求指令。
其中,所述文件可以是待下载的任意形式的文件,也可以是请求播放的视频文件等。
其中,每个文件切片的大小可以进行自定义配置。
对应于每个文件切片,所述客户端分别向一个服务节点发出请求,因此,将由多个服务节点为所述客户端同时提供对所述文件的发送服务,加快了数据传输的速度,也进一步提升了所述P2P网络中数据传输的性能。
S21,当检测到有服务节点断开与所述客户端的连接时,将向断开连接的服务节点所请求的文件切片确定为目标文件切片。
在本发明的至少一个实施例中,所述方法还包括:
当接收到多个文件切片时,所述客户端对所述文件切片进行处理以拼接得到文件。
S22,向具有所述目标文件切片的其他服务节点重新发送请求指令。
通过上述实施方式,能够在一个服务节点异常时,向其他服务节点重新发送请求指令,不会对文件的请求造成影响,其他服务节点可以代替异常的服务节点继续服务。
需要说明的是,所述服务节点可以是P2P网络(Peer to Peer,对等网络)中对等节点对应的服务器,所述对等节点通常部署在用户家中,不需要额外建立机房,且数据的传输依靠对等节点的上行带宽,而上行带宽一般是闲置的,不会产生另外的成本,因此成本较低。
而当所述P2P网络不稳定时,所述服务节点还可以是基于http协议进行数据传输的服务器,能够提供稳定可靠的资源,进而提供稳定可靠的数据传输服务,本发明对所述服务节点的类型不限制。
综上所述,本发明能够将文件切分为多个文件切片,并向存储有文件切片的服务节点分别发送请求指令,以便同时利用多个服务节点对文件进行分片下载,当检测到有服务节点断开与所述客户端的连接时,将向断开连接的服务节点所请求的文件切片确定为目标文件切片,并向具有所述目标文件切片的其他服务节点重新发送请求指令,能够及时发现服务异常,并动态地调整为客户端服务的多个服务节点,实现P2P网络中服务器集群的负载均衡,并进一步确保了服务器集群不会由于负载过高而崩溃,且保证了服务器集群的服务质量。
参见图4,在本实施例中,所述电子设备1可以是组成内容分发网络或者区块链网络的节点。
所述电子设备1可以包括存储器12、处理器13和总线,还可以包括存储在所述存储器12中并可在所述处理器13上运行的计算机程序,例如基于P2P网络的数据传输程序。
本领域技术人员可以理解,所述示意图仅仅是电子设备1的示例,并不构成对电子设备1的限定,所述电子设备1既可以是总线型结构,也可以是星形结构,所述电子设备1还可以包括比图示更多或更少的其他硬件或者软件,或者不同的部件布置,例如所述电子设备1还可以包括输入输出设备、网络接入设备等。
需要说明的是,所述电子设备1仅为举例,其他现有的或今后可能出现的电子产品如可适应于本发明,也应包含在本发明的保护范围以内,并以引用方式包含于此。
其中,存储器12至少包括一种类型的可读存储介质,所述可读存储介质包括闪存、 移动硬盘、多媒体卡、卡型存储器(例如:SD或DX存储器等)、磁性存储器、磁盘、光盘等。存储器12在一些实施例中可以是电子设备1的内部存储单元,例如该电子设备1的移动硬盘。存储器12在另一些实施例中也可以是电子设备1的外部存储设备,例如电子设备1上配备的插接式移动硬盘、智能存储卡(Smart Media Card,SMC)、安全数字(Secure Digital,SD)卡、闪存卡(Flash Card)等。进一步地,存储器12还可以既包括电子设备1的内部存储单元也包括外部存储设备。存储器12不仅可以用于存储安装于电子设备1的应用软件及各类数据,例如基于P2P网络的数据传输程序的代码等,还可以用于暂时地存储已经输出或者将要输出的数据。
处理器13在一些实施例中可以由集成电路组成,例如可以由单个封装的集成电路所组成,也可以是由多个相同功能或不同功能封装的集成电路所组成,包括一个或者多个中央处理器(Central Processing unit,CPU)、微处理器、数字处理芯片、图形处理器及各种控制芯片的组合等。处理器13是所述电子设备1的控制核心(Control Unit),利用各种接口和线路连接整个电子设备1的各个部件,通过运行或执行存储在所述存储器12内的程序或者模块(例如执行基于P2P网络的数据传输程序等),以及调用存储在所述存储器12内的数据,以执行电子设备1的各种功能和处理数据。
所述处理器13执行所述电子设备1的操作系统以及安装的各类应用程序。所述处理器13执行所述应用程序以实现上述各个基于P2P网络的数据传输方法实施例中的步骤,例如图2所示的步骤S10、S11、S12及/或如图3所示的步骤S20、S21、S22。
或者,所述处理器13执行所述计算机程序时实现上述各装置实施例中各模块/单元的功能,例如:
响应于所述客户端的文件切片的请求指令,获取所述服务节点自身的负载及网络性能信息;
当所述负载及/或所述网络性能信息异常时,确定所述服务节点的服务异常;
断开所述服务节点与所述客户端的连接。
或者,所述处理器13执行所述计算机程序时还实现上述各装置实施例中各模块/单元的功能,例如:
向存储有文件切片的服务节点分别发送请求指令;
当检测到有服务节点断开与所述客户端的连接时,将向断开连接的服务节点所请求的文件切片确定为目标文件切片;
向具有所述目标文件切片的其他服务节点重新发送请求指令。
示例性的,所述计算机程序可以被分割成一个或多个模块/单元,所述一个或者多个模块/单元被存储在所述存储器12中,并由所述处理器13执行,以完成本发明。所述一个或多个模块/单元可以是能够完成特定功能的一系列计算机程序指令段,该指令段用于描述所述计算机程序在所述电子设备1中的执行过程。例如,所述计算机程序可以被分割成获取单元111、确定单元112、断开单元113、检测单元114、发送单元115及/或发送模块223、确定模块224、拼接模块225。
上述以软件功能模块的形式实现的集成的单元,可以存储在一个计算机可读取存储介质中。上述软件功能模块存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机、计算机设备,或者网络设备等)或处理器(processor)执行本发明各个实施例所述方法的部分。
所述电子设备1集成的模块/单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明实现上述实施例方法中的全部或部分流程,也可以通过计算机程序来指示相关的硬件设备来完成,所述的计算机程序可存储于一计算机可读存储介质中,该计算机程序在被处理器执行时,可实现上述各个方法实施例的步骤。
其中,所述计算机程序包括计算机程序代码,所述计算机程序代码可以为源代码形式、对象代码形式、可执行文件或某些中间形式等。所述计算机可读介质可以包括:能够携带所述计算机程序代码的任何实体或装置、记录介质、U盘、移动硬盘、磁碟、光盘、计算机存储器、只读存储器(ROM,Read-Only Memory)。
总线可以是外设部件互连标准(peripheral component interconnect,简称PCI)总线或扩展工业标准结构(extended industry standard architecture,简称EISA)总线等。该总线可以分为地址总线、数据总线、控制总线等。为便于表示,在图4中仅用一根箭头表示,但并不表示仅有一根总线或一种类型的总线。所述总线被设置为实现所述存储器12以及至少一个处理器13等之间的连接通信。
尽管未示出,所述电子设备1还可以包括给各个部件供电的电源(比如电池),优选地,电源可以通过电源管理装置与所述至少一个处理器13逻辑相连,从而通过电源管理装置实现充电管理、放电管理、以及功耗管理等功能。电源还可以包括一个或一个以上的直流或交流电源、再充电装置、电源故障检测电路、电源转换器或者逆变器、电源状态指示器等任意组件。所述电子设备1还可以包括多种传感器、蓝牙模块、Wi-Fi模块等,在此不再赘述。
进一步地,所述电子设备1还可以包括网络接口,可选地,所述网络接口可以包括有线接口和/或无线接口(如WI-FI接口、蓝牙接口等),通常用于在该电子设备1与其他电子设备之间建立通信连接。
可选地,该电子设备1还可以包括用户接口,用户接口可以是显示器(Display)、输入单元(比如键盘(Keyboard)),可选地,用户接口还可以是标准的有线接口、无线接口。可选地,在一些实施例中,显示器可以是LED显示器、液晶显示器、触控式液晶显示器以及OLED(Organic Light-Emitting Diode,有机发光二极管)触摸器等。其中,显示器也可以适当的称为显示屏或显示单元,用于显示在电子设备1中处理的信息以及用于显示可视化的用户界面。
应该了解,所述实施例仅为说明之用,在专利申请范围上并不受此结构的限制。
图4仅示出了具有组件12-13的电子设备1,本领域技术人员可以理解的是,图4示出的结构并不构成对所述电子设备1的限定,可以包括比图示更少或者更多的部件,或者组合某些部件,或者不同的部件布置。
结合图2,所述电子设备1中的所述存储器12存储多个指令以实现一种基于P2P网络的数据传输方法,所述处理器13可执行所述多个指令从而实现:
响应于所述客户端的文件切片的请求指令,获取所述服务节点自身的负载及网络性能信息;
当所述负载及/或所述网络性能信息异常时,确定所述服务节点的服务异常;
断开所述服务节点与所述客户端的连接。
结合图3,所述电子设备1中的所述存储器12存储多个指令以实现一种基于P2P网络的数据传输方法,所述处理器13还可执行所述多个指令从而实现:
向存储有文件切片的服务节点分别发送请求指令;
当检测到有服务节点断开与所述客户端的连接时,将向断开连接的服务节点所请求的文件切片确定为目标文件切片;
向具有所述目标文件切片的其他服务节点重新发送请求指令。
具体地,所述处理器13对上述指令的具体实现方法可参考图2及/或图3对应实施例中相关步骤的描述,在此不赘述。
参照图5,为本发明基于P2P网络的数据传输系统的功能模块示意图。所述基于P2P网络的数据传输系统11包括获取单元111、确定单元112、断开单元113、检测单元114、 发送单元115。本发明所称的模块/单元是指一种能够被处理器13所执行,并且能够完成固定功能的一系列计算机程序段,其存储在存储器12中。在本实施例中,关于各模块/单元的功能将在后续的实施例中详述。
应于所述客户端的文件切片的请求指令,获取单元111获取服务节点自身的负载及网络性能信息。
其中,服务节点存储有多个不同的文件切片,所述服务节点接收不同客户端对于相同文件切片或者不同文件切片的请求指令。
在本发明的至少一个实施例中,所述请求指令可以是对于所述文件的下载请求指令,还可以是对所述文件的其他传输请求指令,例如:视频播放数据的请求等。
相应地,所述文件可以是待下载的任意形式的文件,也可以是请求播放的视频文件等。
进一步地,在本实施例中,当所述客户端向服务器集群请求所述文件时,所述文件可以被切分为多个文件切片,对应于每个文件切片,所述客户端分别向一个服务节点发出请求,因此,将由多个服务节点为所述客户端同时提供对所述文件的发送服务,加快了数据传输的速度,也进一步提升了所述P2P网络中数据传输的性能。
具体地,由于所述客户端预先并没有存储所述服务器集群的各个服务节点的相关数据,因此,所述客户端在为所述文件的每个文件切片请求服务节点时,采取随机请求的方式,也可以按照预定的规则进行选择,例如,按照服务节点在过去预定时间段内的服务质量,选择服务质量满足预设条件的节点优先作为服务节点。
进一步地,所述文件可以被均分为多个文件切片,也可以根据其他策略进行切分,本发明不限制,例如,还可以采用冗余编码的方式对文件切片进行处理,以保证客户端即使没有接收到全部的文件切片,也可以较好的还原出文件的内容。
在本发明的至少一个实施例中,所述负载标志着所述服务节点的硬件性能,因此,所述服务节点被占用的负载越高,说明所述服务节点的硬件压力越大,则可以确定所述服务节点的硬件的当前性能越不好,反之,所述服务节点被占用的负载越低,说明所述服务节点的硬件压力越小,则可以确定所述服务节点的硬件的当前性能越好。
进一步地,所述网络性能信息可以包括,但不限于:网络带宽、延时、丢包率等。
其中,所述网络带宽包括,但不限于:带宽、连接数等。
可以理解的是,所述带宽被占用的越多,说明可用带宽越少,则可以确定网络性能不佳,反之,所述带宽被占用的越少,说明可用带宽越多,则可以确定网络性能较佳。
同样地,所述连接数越多,间接说明可用带宽越少,则可以确定网络性能不佳,反之, 所述连接数越少,间接说明可用带宽越多,则可以确定网络性能较佳。
进一步地,所述带宽及所述连接数可以分别对应一个权重,所述带宽的权重高于所述连接数,这样,通过计算所述带宽及所述连接数的加权和,并将得到的加权和与配置网络带宽进行比较,以便进一步确定所述服务节点的网络性能。
在本实施例中,所述延时是指一个报文或分组从一个网络的一端传送到另一个端所需要的时间,能够表征每个服务节点是否能够进行及时的响应,因此,当所述延时较高时,则可以确定网络性能不佳,反之,则可以确定网络性能较佳。
在本实施例中,所述丢包率是指所丢失数据包的数量占所发送数据组的比率,正常传输时网络的丢包率应该控制在一定范围内,如果所述丢包率过高,则可以确定网络性能不佳,反之,如果所述丢包率较低,则可以确定网络性能较佳。
在本发明的至少一个实施例中,每隔预设时间间隔,检测单元114检测所述服务节点自身的负载及网络性能信息。
通过上述实施方式,能够对所述服务器集群的每个服务节点进行周期性的监控。
另外,所述检测单元114存储每个服务节点的负载及网络性能信息,以便后续需要时及时调用,避免在需要时临时进行检测对所述P2P网络的正常服务造成延时。
当所述负载及/或所述网络性能信息异常时,确定单元112确定所述服务节点的服务异常。
需要说明的是,在确定所述服务节点的服务是否异常时,所述负载的优先级高于所述网络性能信息,而在所述网络性能信息中,所述网络带宽的优先级高于所述延时或丢包率。
在本发明的至少一个实施例中,所述确定单元112确定所述服务节点的服务异常包括:
(1)当所述服务节点的负载大于或者等于配置负载时,所述确定单元112确定所述服务节点的服务异常。
其中,所述配置负载可以进行自定义配置。
由于所述负载的优先级最高,因此,只要确定所述负载大于或者等于所述配置负载,则可以直接确定所述服务节点的服务异常,无需再进行网络性能信息的判断。
(2)当所述服务节点的负载小于所述配置负载时,所述确定单元112从所述服务节点的网络性能信息中确定网络带宽,当所述网络带宽大于或者等于配置带宽时,所述确定单元112确定所述服务节点的服务异常。
其中,所述配置带宽可以进行自定义配置。
当所述负载小于所述配置负载时,说明所述服务节点的负载正常,此时,根据优先级,则需要继续判断所述服务节点的网络性能信息中的网络带宽是否异常,只要确定所述网络带宽大于或者等于所述配置网络,则可以直接确定所述服务节点的服务异常,无需再进行所述网络性能信息中延时或丢包率的判断。
(3)当所述服务节点的负载小于所述配置负载时,所述确定单元112从所述服务节点的网络性能信息中确定所述网络带宽,当所述网络带宽小于所述配置带宽时,所述确定单元112从所述服务节点的网络性能信息中确定延时或丢包率,当所述延时超过配置延时或者所述丢包率超过配置丢包率时,所述确定单元112确定所述服务节点的服务异常。
其中,所述配置延时及所述配置丢包率可以进行自定义配置。
当所述负载小于所述配置负载时,说明所述服务节点的负载正常,此时,根据优先级,则需要继续判断所述服务节点的网络性能信息中的网络带宽是否异常,当所述网络带宽小于所述配置带宽时,说明所述服务节点的网络带宽正常,那么根据优先级,则需要进一步判断所述服务节点的网络性能信息中的延时或丢包率是否异常,只要确定所述延时或所述丢包率中有一项异常,则可以直接确定所述服务节点的服务异常。
需要说明的是,由于每个服务节点的自身属性不同,则说明每个服务节点的自身性能也不同,因此,为了使每个服务节点都能够在自身性能的可承受范围内进行服务,可以根据每个服务节点的自身性能为每个服务节点配置不同的参数阈值,如:所述配置负载、所述配置带宽、所述配置丢包率及所述配置延时等。
通过上述实施方式,能够通过负载及网络性能信息对服务节点的服务进行监控,并及时发现服务异常。
断开单元113断开所述服务节点与所述客户端的连接。
可以理解的是,通过断开所述服务节点与所述客户端的连接,能够避免在所述服务节点无法提供正常数据传输时,所述客户端还进行无意义的等待,给所述P2P网络的服务造成影响,降低了数据传输的速度,同时影响了用户的使用。
在本发明的至少一个实施例中,当确定所述服务节点的服务没有异常时,发送单元115向所述客户端发送请求的文件切片。
通过上述实施方式,能够在确定所述服务节点没有异常时,及时响应所述客户端的数据请求。
在本发明的至少一个实施例中,当每个服务节点的服务都异常时,添加新的服务节点至所述服务器集群。
需要说明的是,新增的服务节点具备所述客户端所需要的文件切片。
通过上述实施方式,能够在所述服务器集群超负荷运行时,及时添加新的服务节点至所述服务器集群,实现对所述服务器集群的横向扩展,确保所述服务器集群不会由于负载过高而崩溃,保证了服务器集群的服务质量。
综上所述,本发明能够响应于所述客户端的文件切片的请求指令,获取所述服务节点自身的负载及网络性能信息,以便同时利用多个服务节点对文件进行分片下载,当所述负载及/或所述网络性能信息异常时,确定所述服务节点的服务异常,进而能够通过负载和网络性能信息对服务节点的服务进行监控,并及时发现服务异常,进一步断开所述服务节点与所述客户端的连接,进而动态地调整为客户端服务的多个服务节点,实现P2P网络中服务器集群的负载均衡,并进一步确保了服务器集群不会由于负载过高而崩溃,且保证了服务器集群的服务质量。
参照图6,为本发明基于P2P网络的数据传输装置的功能模块示意图。所述基于P2P网络的数据传输装置22包括发送模块223、确定模块224、拼接模块225。本发明所称的模块/单元是指一种能够被处理器所执行,并且能够完成固定功能的一系列计算机程序段,其存储在存储器中。在本实施例中,关于各模块/单元的功能将在后续的实施例中详述。
发送模块223向存储有文件切片的服务节点分别发送请求指令。
具体地,客户端按照文件切片的顺序向存储有对应文件切片的服务节点发送请求指令。
其中,所述文件可以是待下载的任意形式的文件,也可以是请求播放的视频文件等。
其中,每个文件切片的大小可以进行自定义配置。
对应于每个文件切片,所述客户端分别向一个服务节点发出请求,因此,将由多个服务节点为所述客户端同时提供对所述文件的发送服务,加快了数据传输的速度,也进一步提升了所述P2P网络中数据传输的性能。
当检测到有服务节点断开与所述客户端的连接时,确定模块224将向断开连接的服务节点所请求的文件切片确定为目标文件切片。
在本发明的至少一个实施例中,当接收到多个文件切片时,拼接模块225对所述文件切片进行处理以拼接得到文件。
所述发送模块223向具有所述目标文件切片的其他服务节点重新发送请求指令。
通过上述实施方式,能够在一个服务节点异常时,向其他服务节点重新发送请求指令, 不会对文件的请求造成影响,其他服务节点可以代替异常的服务节点继续服务。
需要说明的是,所述服务节点可以是P2P网络(Peer to Peer,对等网络)中对等节点对应的服务器,所述对等节点通常部署在用户家中,不需要额外建立机房,且数据的传输依靠对等节点的上行带宽,而上行带宽一般是闲置的,不会产生另外的成本,因此成本较低。
而当所述P2P网络不稳定时,所述服务节点还可以是基于http协议进行数据传输的服务器,能够提供稳定可靠的资源,进而提供稳定可靠的数据传输服务,本发明对所述服务节点的类型不限制。
综上所述,本发明能够将文件切分为多个文件切片,并向存储有文件切片的服务节点分别发送请求指令,以便同时利用多个服务节点对文件进行分片下载,当检测到有服务节点断开与所述客户端的连接时,将向断开连接的服务节点所请求的文件切片确定为目标文件切片,并向具有所述目标文件切片的其他服务节点重新发送请求指令,能够及时发现服务异常,并动态地调整为客户端服务的多个服务节点,实现P2P网络中服务器集群的负载均衡,并进一步确保了服务器集群不会由于负载过高而崩溃,且保证了服务器集群的服务质量。
在上述实施例中,可以全部或部分地通过软件、硬件设备、固件或者其任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。
所述计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行所述计算机程序指令时,全部或部分地产生按照本发明实施例所述的流程或功能。所述计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。所述计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一计算机可读存储介质传输,例如,所述计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如同轴电缆、光纤、数字用户线(DSL))或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。所述计算机可读存储介质可以是计算机能够存储的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。所述可用介质可以是磁性介质,(例如,软盘、移动硬盘、磁带)、光介质(例如,DVD)、或者半导体介质(例如固态移动硬盘Solid State Disk(SSD))等。
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统,装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。
在本申请所提供的几个实施例中,应该理解到,所揭露的系统,装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件设备的形式实现,也可以采用软件功能单元的形式实现。
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动移动硬盘、只读存储器(ROM,Read-Only Memory)、磁碟或者光盘等各种可以存储程序代码的介质。
需要说明的是,上述本发明实施例序号仅仅为了描述,不代表实施例的优劣。并且本文中的术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、装置、物品或者方法不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、装置、物品或者方法所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、装置、物品或者方法中还存在另外的相同要素。
以上仅为本发明的优选实施例,并非因此限制本发明的专利范围,凡是利用本发明说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本发明的专利保护范围内。

Claims (12)

  1. 一种基于P2P网络的数据传输方法,应用于服务节点,所述服务节点与客户端相连接,每个服务节点用于向多个客户端提供数据传输服务,其特征在于,所述方法包括:
    响应于所述客户端的文件切片的请求指令,获取所述服务节点自身的负载及网络性能信息;
    当所述负载及/或所述网络性能信息异常时,确定所述服务节点的服务异常;
    断开所述服务节点与所述客户端的连接。
  2. 如权利要求1所述的基于P2P网络的数据传输方法,其特征在于,所述方法还包括:
    每隔预设时间间隔,检测所述服务节点自身的负载及网络性能信息。
  3. 如权利要求1所述的基于P2P网络的数据传输方法,其特征在于,所述确定所述服务节点的服务异常包括:
    当所述服务节点的负载大于或者等于配置负载时,确定所述服务节点的服务异常;或者
    当所述服务节点的负载小于所述配置负载时,从所述服务节点的网络性能信息中确定网络带宽,当所述网络带宽大于或者等于配置带宽时,确定所述服务节点的服务异常;或者
    当所述服务节点的负载小于所述配置负载时,从所述服务节点的网络性能信息中确定所述网络带宽,当所述网络带宽小于所述配置带宽时,从所述服务节点的网络性能信息中确定延时或丢包率,当所述延时超过配置延时或者所述丢包率超过配置丢包率时,确定所述服务节点的服务异常。
  4. 如权利要求1所述的基于P2P网络的数据传输方法,其特征在于,所述方法还包括:
    当确定所述服务节点的服务没有异常时,向所述客户端发送请求的文件切片。
  5. 如权利要求1所述的基于P2P网络的数据传输方法,其特征在于,所述服务节点存储有多个不同的文件切片,所述服务节点接收不同客户端对于相同文件切片或者不同文件切片的请求指令。
  6. 一种基于P2P网络的数据传输方法,应用于客户端,所述客户端与服务节点相连接,每个客户端用于向多个服务节点请求数据传输服务,其特征在于,所述方法包括:
    向存储有文件切片的服务节点分别发送请求指令;
    当检测到有服务节点断开与所述客户端的连接时,将向断开连接的服务节点所请求的文件切片确定为目标文件切片;
    向具有所述目标文件切片的其他服务节点重新发送请求指令。
  7. 如权利要求6所述的基于P2P网络的数据传输方法,其特征在于,所述方法还包括:
    当接收到多个文件切片时,对所述文件切片进行处理以拼接得到文件。
  8. 如权利要求6所述的基于P2P网络的数据传输方法,其特征在于,所述客户端按照文件切片的顺序向存储有对应文件切片的服务节点发送请求指令。
  9. 一种电子设备,其特征在于,所述电子设备包括:
    存储器,存储至少一个指令;及
    处理器,执行所述存储器中存储的指令以实现如权利要求1-5中任意一项所述的基于P2P网络的数据传输方法及/或如权利要求6-8中任意一项所述的基于P2P网络的数据传输方法。
  10. 一种基于P2P网络的数据传输系统,运行于服务节点,所述服务节点与客户端相连接,每个服务节点用于向多个客户端提供数据传输服务,其特征在于,所述系统包括:
    获取单元,用于响应于所述客户端的文件切片的请求指令,获取所述服务节点自身的负载及网络性能信息;
    确定单元,用于当所述负载及/或所述网络性能信息异常时,确定所述服务节点的服务异常;
    断开单元,用于断开所述服务节点与所述客户端的连接。
  11. 一种基于P2P网络的数据传输装置,运行于客户端,所述客户端与服务节点相连接,每个客户端用于向多个服务节点请求数据传输服务,其特征在于,所述装置包括:
    发送模块,用于向存储有文件切片的服务节点分别发送请求指令;
    确定模块,用于当检测到有服务节点断开与所述客户端的连接时,将向断开连接的服务节点所请求的文件切片确定为目标文件切片;
    所述发送模块,还用于向具有所述目标文件切片的其他服务节点重新发送请求指令。
  12. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质上存储有基于P2P网络的数据传输程序,所述基于P2P网络的数据传输程序可被一个或者多个处理器执行,以实现如权利要求1-5中任意一项所述的基于P2P网络的数据传输方法及/或如权利要求6-8中任意一项所述的基于P2P网络的数据传输方法。
PCT/CN2020/080488 2019-12-31 2020-03-20 基于p2p网络的数据传输方法、设备、系统、装置及介质 WO2021134928A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201911416651.8A CN111131505A (zh) 2019-12-31 2019-12-31 基于p2p网络的数据传输方法、设备、系统、装置及介质
CN201911416651.8 2019-12-31

Publications (1)

Publication Number Publication Date
WO2021134928A1 true WO2021134928A1 (zh) 2021-07-08

Family

ID=70506889

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/080488 WO2021134928A1 (zh) 2019-12-31 2020-03-20 基于p2p网络的数据传输方法、设备、系统、装置及介质

Country Status (2)

Country Link
CN (1) CN111131505A (zh)
WO (1) WO2021134928A1 (zh)

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114374683A (zh) * 2021-12-20 2022-04-19 上海金仕达软件科技有限公司 一种档案文件的管理方法、系统及计算机可读存储介质
CN114465932A (zh) * 2021-07-30 2022-05-10 荣耀终端有限公司 Tcp通信质量评估方法、装置及电子设备
CN114567638A (zh) * 2022-02-14 2022-05-31 珠海迈科智能科技股份有限公司 一种根据节点实际网络动态调整分享策略的方法
CN114885373A (zh) * 2022-05-26 2022-08-09 杭州矩视科技有限公司 一种节点数据上传方法、装置、设备及存储介质
CN114978964A (zh) * 2022-05-10 2022-08-30 未鲲(上海)科技服务有限公司 基于网络自检的通信公告配置方法、装置、设备及介质
CN115022657A (zh) * 2022-05-30 2022-09-06 上海哔哩哔哩科技有限公司 直播服务器的调度方法及装置
CN115348255A (zh) * 2022-07-27 2022-11-15 广州市金其利信息科技有限公司 一种操作系统的镜像安装方法、装置及存储介质
CN116566973A (zh) * 2023-06-20 2023-08-08 北京中宏立达科技发展有限公司 一种基于对等网络的文件传输系统

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7451209B1 (en) * 2003-10-22 2008-11-11 Cisco Technology, Inc. Improving reliability and availability of a load balanced server
CN102123179A (zh) * 2011-03-28 2011-07-13 中国人民解放军国防科学技术大学 应用于分布式应用系统的负载均衡方法和系统
CN105450760A (zh) * 2015-12-04 2016-03-30 中铁工程装备集团有限公司 一种基于p2p的自适应资源下载方法
CN105959369A (zh) * 2016-05-03 2016-09-21 叶江鹏 对等网络的资源下载方法
CN110213351A (zh) * 2019-05-17 2019-09-06 北京航空航天大学 一种面向广域高性能计算环境的动态自适应io负载均衡方法

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7451209B1 (en) * 2003-10-22 2008-11-11 Cisco Technology, Inc. Improving reliability and availability of a load balanced server
CN102123179A (zh) * 2011-03-28 2011-07-13 中国人民解放军国防科学技术大学 应用于分布式应用系统的负载均衡方法和系统
CN105450760A (zh) * 2015-12-04 2016-03-30 中铁工程装备集团有限公司 一种基于p2p的自适应资源下载方法
CN105959369A (zh) * 2016-05-03 2016-09-21 叶江鹏 对等网络的资源下载方法
CN110213351A (zh) * 2019-05-17 2019-09-06 北京航空航天大学 一种面向广域高性能计算环境的动态自适应io负载均衡方法

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114465932A (zh) * 2021-07-30 2022-05-10 荣耀终端有限公司 Tcp通信质量评估方法、装置及电子设备
CN114374683A (zh) * 2021-12-20 2022-04-19 上海金仕达软件科技有限公司 一种档案文件的管理方法、系统及计算机可读存储介质
CN114567638A (zh) * 2022-02-14 2022-05-31 珠海迈科智能科技股份有限公司 一种根据节点实际网络动态调整分享策略的方法
CN114567638B (zh) * 2022-02-14 2023-09-01 珠海迈科智能科技股份有限公司 一种根据节点实际网络动态调整分享策略的方法
CN114978964A (zh) * 2022-05-10 2022-08-30 未鲲(上海)科技服务有限公司 基于网络自检的通信公告配置方法、装置、设备及介质
CN114885373A (zh) * 2022-05-26 2022-08-09 杭州矩视科技有限公司 一种节点数据上传方法、装置、设备及存储介质
CN115022657A (zh) * 2022-05-30 2022-09-06 上海哔哩哔哩科技有限公司 直播服务器的调度方法及装置
CN115022657B (zh) * 2022-05-30 2023-12-26 上海哔哩哔哩科技有限公司 直播服务器的调度方法及装置
CN115348255A (zh) * 2022-07-27 2022-11-15 广州市金其利信息科技有限公司 一种操作系统的镜像安装方法、装置及存储介质
CN116566973A (zh) * 2023-06-20 2023-08-08 北京中宏立达科技发展有限公司 一种基于对等网络的文件传输系统
CN116566973B (zh) * 2023-06-20 2023-11-07 北京中宏立达科技发展有限公司 一种基于对等网络的文件传输系统

Also Published As

Publication number Publication date
CN111131505A (zh) 2020-05-08

Similar Documents

Publication Publication Date Title
WO2021134928A1 (zh) 基于p2p网络的数据传输方法、设备、系统、装置及介质
JP5863942B2 (ja) ウィットネスサービスの提供
US10594606B2 (en) Wired data-connection aggregation
WO2021237433A1 (zh) 消息推送方法、装置、电子设备及计算机可读介质
JP2008083939A (ja) 計算機システム及び動的ポート割当方法
CN107211046B (zh) 促进第一屏幕设备与客户端设备间互操作性的方法、设备和计算机可读存储介质
CN107645517B (zh) 数据推送方法及装置
US10581697B2 (en) SDN controlled PoE management system
US20230069240A1 (en) Dynamic cloning of application infrastructures
US20140365756A1 (en) Managing host computing devices with a host control component
CN112398689A (zh) 网络恢复方法、装置、存储介质及电子设备
CN115280288A (zh) 服务器系统和管理服务器系统的方法
EP2916502A1 (en) Method and apparatus for periodical protocol packet transmission by network device
US9544371B1 (en) Method to discover multiple paths to disk devices cluster wide
CN113364678A (zh) 数据传输系统、方法、装置、电子设备和计算机可读介质
CN115103005B (zh) 请求响应方法、装置、电子设备及存储介质
WO2023197666A1 (zh) 服务调度方法、系统、vtep、存储介质及计算机程序产品
CN109347743B (zh) 一种专线通信方法、计算机可读存储介质和终端设备
CN113132758B (zh) 内容分发网络的控制方法、装置及计算机程序产品
CN115378962A (zh) 一种基于iSCSI协议的存储集群的高可用性连通方法和系统
JPH1027146A (ja) 通信処理装置及び通信処理方法
KR101869925B1 (ko) 웹서버와 was의 연동 방법 및 이를 사용한 was 관리자 서버
TWI755005B (zh) 基於改進的rest協議的測試方法、用戶端、伺服器及介質
EP3188531A1 (en) Cluster system self-organizing method, device, and cluster system
WO2022001947A1 (zh) 以太网供电的功率协商方法、供电设备、系统及存储介质

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: 20910981

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 28.10.2022)

122 Ep: pct application non-entry in european phase

Ref document number: 20910981

Country of ref document: EP

Kind code of ref document: A1