CN113472832A - Node scheduling method, scheduling device, electronic equipment and storage medium in P2P network - Google Patents

Node scheduling method, scheduling device, electronic equipment and storage medium in P2P network Download PDF

Info

Publication number
CN113472832A
CN113472832A CN202010245071.3A CN202010245071A CN113472832A CN 113472832 A CN113472832 A CN 113472832A CN 202010245071 A CN202010245071 A CN 202010245071A CN 113472832 A CN113472832 A CN 113472832A
Authority
CN
China
Prior art keywords
target
node
target node
current
weight
Prior art date
Legal status (The legal status 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 status listed.)
Granted
Application number
CN202010245071.3A
Other languages
Chinese (zh)
Other versions
CN113472832B (en
Inventor
赵彦青
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Kingsoft Cloud Network Technology Co Ltd
Original Assignee
Beijing Kingsoft Cloud Network Technology Co Ltd
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 Beijing Kingsoft Cloud Network Technology Co Ltd filed Critical Beijing Kingsoft Cloud Network Technology Co Ltd
Priority to CN202010245071.3A priority Critical patent/CN113472832B/en
Publication of CN113472832A publication Critical patent/CN113472832A/en
Application granted granted Critical
Publication of CN113472832B publication Critical patent/CN113472832B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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/50Network services
    • H04L67/60Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/70Reducing energy consumption in communication networks in wireless communication networks

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)
  • Mobile Radio Communication Systems (AREA)

Abstract

The embodiment of the invention provides a node scheduling method, a node scheduling device, electronic equipment and a storage medium in a P2P network, wherein the method comprises the following steps: and aiming at a plurality of target nodes which are connected with the current node, determining the connection time between each target node, calculating the target weight corresponding to each target node based on the connection time and the information returned to the current node by each target node, and scheduling each target node based on the obtained target weight corresponding to each target node. The embodiment of the invention can avoid overlarge calculation pressure of the tracker server, thereby being more beneficial to improving the stability of the whole P2P network.

Description

Node scheduling method, scheduling device, electronic equipment and storage medium in P2P network
Technical Field
The present invention relates to the field of network communication technologies, and in particular, to a node scheduling method, a node scheduling apparatus, an electronic device, and a storage medium in a P2P network.
Background
P2P (peer-to-peer) is a network technology that does not have a central server and relies on user group nodes to exchange information, that is, each node in the P2P network is both a client and a server, and can serve as a server to provide services to other nodes.
In the existing P2P network, in order for a current node to obtain target data from the P2P network, an initial target node needs to be determined first, and a connection is established with each initial target node. Generally, the process for the current node to establish a connection with a target node in the P2P network is as follows: the current node is firstly connected with a selection (selector) server, a tracking (tracker) server list is obtained from the selector server, then the current node is connected with the tracker server based on the tracker server list, a target node list is obtained from the tracker server, and then the current node is connected with a plurality of initial target nodes in the target node list. The initial target node is a node storing data to be acquired by a current node, the selector server is a server for providing a tracker server address, and the tracker server is a server for providing a target node address.
The current node then obtains target data from the target node. Generally, after establishing connection with each initial target node, the current node determines the initial target node with better network quality as a final target node according to the connection establishment condition, sends a piece (piece) data request to each final target node to obtain each data piece of target data, and finally combines the received data pieces to obtain complete target data.
Therefore, in the prior art, the current node performs uniform scheduling on the target node according to the network quality only before sending the piece data request for the first time. However, the network condition is constantly changing, and in the process that the current node acquires each piece of data from each final destination node, the network quality of each final destination node is likely to change, so that the final destination node connected to the current node is prone to have problems of response timeout, poor data transmission quality and the like, and therefore the efficiency of the current node acquiring data through the P2P network is reduced.
Disclosure of Invention
An embodiment of the present invention provides a node scheduling method, a node scheduling apparatus, an electronic device, and a storage medium in a P2P network, so as to improve data transmission efficiency of the P2P network. The specific technical scheme is as follows:
in a first aspect, an embodiment of the present invention provides a node scheduling method in a P2P network, which is applied to a current node, where the current node is any node in the P2P network, and the method includes:
determining connection time consumption between each target node and a plurality of target nodes which are connected with the current node, wherein the connection time consumption is the time consumption of the current node and each target node in the connection establishing process; the target nodes are nodes containing target data;
calculating target weight corresponding to each target node based on the connection time and information returned to the current node by each target node, wherein the information is information related to the transmission state of each target node;
and scheduling each target node based on the obtained target weight corresponding to each target node.
Optionally, the step of determining, for a plurality of target nodes that have established connections with the current node, a time consumed for establishing connections with each target node includes:
aiming at each target node in the target nodes, sending a connection establishment request to the target node, and recording a first current time corresponding to the sending of the connection establishment request;
receiving a response message of the target node aiming at the connection establishment request, and recording a second current time corresponding to the receiving of the response message;
and determining the difference value between the second current time and the first current time as the consumed time of the current node and the target node in the process of establishing connection.
Optionally, the step of calculating a target weight corresponding to each target node based on the connection time and information returned by each target node to the current node includes:
if the connection time is greater than a preset connection time threshold, reducing the preset weight of the target node by half to obtain a first current weight, and determining the first current weight as the target weight;
if the data volume of the data returned by the target node is smaller than the requested data volume of the current node, subtracting a first preset value from the first current weight to obtain a second current weight, and determining the second current weight as the target weight;
if the load capacity of the target node is greater than a preset load capacity threshold value, halving the second current weight to obtain a third current weight, and determining the third current weight as the target weight;
if the target node is overtime and is overtime once, subtracting a second preset value from the third current weight to obtain a fourth current weight, and determining the fourth current weight as the target weight.
Optionally, before subtracting a first preset value from the first current weight to obtain a second current weight, the method further includes:
sending a data acquisition request to each target node in the plurality of target nodes, wherein the data acquisition request carries the requested data volume;
receiving data returned by the target node aiming at the data acquisition request, and calculating the data volume of the returned data;
and judging the size between the data volume of the returned data and the requested data volume.
Optionally, after sending the data obtaining request to the target node, the method preferably includes:
and under the condition that the data returned by the target node is not received within the preset time length, sending a data acquisition request to the target node again, and accumulating the overtime times for the target node.
Optionally, the step of scheduling each target node based on the obtained target weight corresponding to each target node includes:
and scheduling each target node according to the descending order of the target weight corresponding to each target node.
Optionally, when there are target nodes with the same target weight, the method further includes:
calculating respective response speeds of the target nodes with the same weight, wherein the response speeds represent the time delay of the target nodes when returning data;
the step of scheduling each target node according to the descending order of the target weight corresponding to each target node includes:
and scheduling each target node according to the sequence of the target weight corresponding to each target node from large to small and the sequence of the response speed of each target node with the same target weight from high to low.
Optionally, when there is a target node with a target weight of zero in the plurality of nodes, the method further includes:
deleting target nodes with the weight of zero from the plurality of target nodes to obtain residual target nodes;
the step of scheduling each target node based on the obtained target weight corresponding to each target node includes:
and scheduling each residual target node according to the descending order of the target weight corresponding to each residual target node.
In a second aspect, an embodiment of the present invention provides an apparatus for scheduling nodes in a P2P network, where the apparatus is applied to a current node, and the current node is any node in the P2P network, and the apparatus includes:
the determining module is used for determining the connection time between each target node and a plurality of target nodes which are connected with the current node, wherein the connection time is the time consumed by the current node and each target node in the connection establishing process; the target nodes are nodes containing target data;
a first calculating module, configured to calculate a target weight corresponding to each target node based on the connection establishment time and information returned by each target node to the current node, where the information is information related to a transmission state of each target node;
and the scheduling module is used for scheduling each target node based on the obtained target weight corresponding to each target node.
Optionally, the determining module includes:
the sending submodule is used for sending a connection establishment request to each target node in the plurality of target nodes and recording a first current time corresponding to the sending of the connection establishment request;
the recording submodule is used for receiving a response message of the target node aiming at the connection establishment request and recording a second current time corresponding to the received response message;
and the determining submodule is used for determining the difference value between the second current time and the first current time as the consumed time of the current node and the target node in the process of establishing connection.
Optionally, the first computing module includes:
the first calculation submodule is used for halving the preset weight of the target node to obtain a first current weight and determining the first current weight as the target weight if the connection time is greater than a preset connection time threshold;
the second calculation submodule is used for subtracting a first preset value from the first current weight to obtain a second current weight and determining the second current weight as the target weight if the data volume of the data returned by the target node is smaller than the requested data volume of the current node;
the third calculation submodule is used for halving the second current weight to obtain a third current weight if the load of the target node is greater than a preset load threshold value, and determining the third current weight as the target weight;
and the fourth calculation submodule is used for subtracting a second preset value from the third current weight to obtain a fourth current weight if the target node is overtime and is overtime once, and determining the fourth current weight as the target weight.
Optionally, the apparatus further comprises:
a sending module, configured to send a data acquisition request to each target node in the multiple target nodes, where the data acquisition request carries the requested data volume;
the second calculation module is used for receiving the data returned by the target node aiming at the data acquisition request and calculating the data volume of the returned data;
and the judging module is used for judging the size between the data volume of the returned data and the data volume of the request.
Optionally, the sending module is further configured to:
and under the condition that the data returned by the target node is not received within the preset time length, sending a data acquisition request to the target node again, and accumulating the overtime times for the target node.
Optionally, the scheduling module is specifically configured to:
and scheduling each target node according to the descending order of the target weight corresponding to each target node.
Optionally, the apparatus further comprises:
the third calculation module is used for calculating the respective response speeds of the target nodes with the same weight, wherein the response speeds represent the time delay when the target nodes return data;
the scheduling module is specifically configured to:
and scheduling each target node according to the sequence of the target weight corresponding to each target node from large to small and the sequence of the response speed of each target node with the same target weight from high to low.
Optionally, the apparatus further comprises:
a deleting module, configured to delete a target node with a weight of zero from the plurality of target nodes, to obtain a remaining target node;
the scheduling module is specifically configured to:
and scheduling each residual target node according to the descending order of the target weight corresponding to each residual target node.
In a third aspect, an embodiment of the present invention provides an electronic device, which includes a processor and a machine-readable storage medium, where the machine-readable storage medium stores machine-executable instructions executable by the processor, and the processor executes the machine-executable instructions to implement the method steps of the node scheduling method in the P2P network provided in the first aspect.
In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, where a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, the method steps of the node scheduling method in the P2P network provided in the first aspect are implemented.
In a fifth aspect, an embodiment of the present invention further provides a computer program product containing instructions, which when run on a computer, causes the computer to perform the method steps of the node scheduling method in the P2P network provided in the first aspect.
In a sixth aspect, an embodiment of the present invention further provides a computer program, which when run on a computer, causes the computer to perform the method steps of the node scheduling method in the P2P network provided in the first aspect.
According to the node scheduling method, the node scheduling device, the electronic device and the storage medium in the P2P network, a current node in the P2P network can determine connection time consumption between the current node and each target node according to a plurality of target nodes connected with the current node, and then target weights corresponding to the target nodes are calculated based on the connection time consumption and information carried by the target nodes when the target nodes return data to the current node, so that the target nodes are scheduled based on the obtained target weights corresponding to the target nodes. Compared with the prior art, the method has the advantages that the tracker server is not required to process the information reported by each target node in a centralized manner, so that the excessive calculation pressure of the tracker server can be avoided, and the stability of the whole P2P network can be improved. Of course, it is not necessary for any product or method of practicing the invention to achieve all of the above-described advantages at the same time.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a schematic flowchart of a node scheduling method in a P2P network according to an embodiment of the present invention;
fig. 2 is a schematic flowchart of step S101 in the node scheduling method in the P2P network according to the embodiment of the present invention;
fig. 3 is a schematic flowchart of step S102 in the method for scheduling nodes in a P2P network according to an embodiment of the present invention;
fig. 4 is another schematic flowchart of a node scheduling method in a P2P network according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of a node scheduling apparatus in a P2P network according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of a determination module in a node scheduling apparatus in a P2P network according to an embodiment of the present invention;
fig. 7 is a schematic structural diagram of a first computing module in a node scheduling apparatus in a P2P network according to an embodiment of the present invention;
fig. 8 is a schematic structural diagram of a node scheduling apparatus in a P2P network according to an embodiment of the present invention;
fig. 9 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In the existing P2P network, when a current node acquires data from a target node, a tracker server acquires state information such as network quality of the target node, and therefore the target node needs to report its own state information to the tracker server, and therefore in the prior art, each target node needs to detect its own network quality, which increases the complexity of operation of each target node.
Referring to this, as shown in fig. 1, an embodiment of the present invention provides a node scheduling method in a P2P network, where the method may include the following steps:
s101, determining the connection time between each target node and a plurality of target nodes which are connected with the current node.
The execution subject of the embodiment of the present invention may be a current node in the P2P network, where the current node may refer to a node to be used to obtain data from other nodes in the P2P network, and the node may refer to a server, an electronic computer or a mobile terminal, and may be regarded as a node as long as one electronic device is connected to the P2P network. Based on the characteristics of the P2P network, any one node in the P2P network can be the current node.
The current node may be connected to a plurality of nodes including target data, and these nodes may all be referred to as target nodes, and it can be understood that the current node needs to consume time in the process of establishing connection with each target node, and therefore the consumed time may be referred to as connection consumption.
And S102, calculating target weights corresponding to the target nodes based on the connection time and information returned to the current node by the target nodes.
In the data acquisition process, the current node can establish connection with a plurality of target nodes, some target nodes may have poor network conditions, which results in slow data return, some target nodes may have network jitter conditions, which results in connection overtime or even connection interruption, and some target nodes may have overload conditions, which cannot normally provide service.
The process of determining the time consumption for establishing the connection with each target node may be performed when the current node establishes the connection with the target node, for example, the target node list may be obtained from the tracker server, and then the connection with the target node in the target node list may be established, so as to determine the time consumption for establishing the connection with each target node.
After the connection is established, the current node may send a data acquisition request to the target node to acquire fragment data in the target node, for example, the current node desires to download a video through a P2P network, where the video may be the target data, the fragment data may be one segment of data of the video, and each target node may store the fragment data of the video, which is a feature of P2P network downloading, and details of the embodiment of the present invention are not repeated. Of course, when the target node returns the target data to the current node, the target node may carry information related to the transmission state of each target node, for example: the data volume of the data returned by the target node, the node load capacity of the target node, and the like, and of course, the current node may also record information related to the transmission state of each target node, for example, information such as the speed of returning data by the target node, the total number of times of response timeout of the target node, and the like.
The data volume of the returned data may be the data volume of the returned data of each target node after the current node sends the data acquisition request to each target node, and is recorded as data _ size 2. For example, the current node requests a piece of 100KB of data from a target node that returns 50KB of data, or 100KB of data.
The node load may refer to load information of the target node, for example, information of a current CPU usage rate, a memory usage rate, a network bandwidth usage rate, and the like of the target node.
The total response timeout times may be times that the current node sends a data acquisition request to a certain target node after the current node sends the data acquisition request to the target node and exceeds a preset response time, and the current node sends the data acquisition request to the target node again after the preset response time is exceeded in the above process.
Referring to fig. 1, S103 schedules each target node based on the obtained target weight corresponding to each target node.
It can be understood that, after the current node obtains the target weight corresponding to each target node, the current node may schedule each target node by using the target weight corresponding to each target node, where the scheduling may refer to a process in which the current node selects a plurality of target nodes from a plurality of target nodes to obtain target data, or may refer to a process in which different numbers of pieces of data are obtained from different target nodes.
In one implementation mode, the target nodes can be sorted according to the weight, so that the required piece of data is acquired from the target nodes in the front of the sorting, and the data can be prevented from being acquired from the target nodes with poor network conditions or the target nodes with high load as much as possible, so that the data acquisition efficiency is improved.
In an implementation manner, for example, the target nodes may be further sorted according to the weight, more pieces of data are obtained from the target node that is sorted in the front, and less pieces of data are obtained or no data are obtained from the target node that is sorted in the back, so that the data obtaining efficiency can also be improved.
As an optional implementation manner of the embodiment of the present invention, as shown in fig. 2, the step S101 may specifically include the following steps:
s1011, for each target node of the plurality of target nodes, sending a connection establishment request to the target node, and recording a first current time corresponding to the sending of the connection establishment request.
The current node of the embodiment of the invention can send a connection establishment request to each target node, and record a first current time corresponding to the sending of the connection establishment request, which is recorded as time _ start, wherein the first current time represents the starting time of the connection establishment process.
S1012, receiving a response message of the target node to the connection establishment request, and recording a second current time corresponding to the received response message.
After receiving a response message returned by the target node for the connection establishment request, the current node may record a second current time corresponding to the reception of the response message, where the second current time represents an end time of the connection establishment process and is recorded as time _ end.
And S1013, determining the difference value between the second current time and the first current time as the consumed time of the current node and the target node in the process of establishing the connection.
The current node may subtract the second current time from the first current time, and record the subtraction as time _ used, where time _ used is time _ end-time _ start, and the obtained difference is time consumed by the target node in the connection establishment process.
As an optional implementation manner of the embodiment of the present invention, as shown in fig. 3, the step S102 may specifically include the following steps:
and S1021, if the connection time is greater than the preset connection time threshold, reducing the preset weight of the target node by half to obtain a first current weight, and determining the first current weight as the target weight.
Illustratively, the preset weight is 100, that is, the initial value of the weight is 100, the preset connection time threshold is 2 seconds, and if the connection time is greater than 2 seconds, the preset weight is halved to obtain the first current weight 50. Of course, the administrator can reasonably set the weight and the connection-consuming time threshold according to actual service requirements, and the embodiment of the present invention does not limit specific values.
And S1022, if the data volume of the data returned by the target node is smaller than the requested data volume of the current node, subtracting a first preset numerical value from the first current weight to obtain a second current weight, and determining the second current weight as the target weight.
And if the data volume of the data returned by the target node is smaller than the requested data volume of the current node, subtracting a first preset value on the basis of the first current weight to obtain a second current weight, and determining the second current weight as the target weight.
Illustratively, if the amount of data requested by the current node is 100KB and the amount of data returned by the target node is 50KB, then the first predetermined value of 2 is subtracted from the first current weight 50 to obtain 48. Of course, the administrator may reasonably set the first preset value according to actual business requirements, and the embodiment of the present invention does not limit specific values.
And S1023, if the load of the target node is greater than a preset load threshold, halving the second current weight to obtain a third current weight, and determining the third current weight as the target weight.
And if the load capacity of the target node is greater than a preset load capacity threshold value, halving on the basis of the second current weight to obtain a third current weight, and determining the third current weight as the target weight.
Illustratively, the preset load amount threshold of the target node is 50%, and if the load amount of the target node is 60%, the second current weight 48 is halved to obtain the third current weight 24. Of course, the administrator can reasonably set the load threshold according to the actual service requirement, and the embodiment of the present invention does not limit the specific numerical value. The load amount threshold may be, for example: CPU (Central Processing Unit) utilization, memory utilization, network bandwidth utilization, and the like.
And S1024, if the target node is overtime and is overtime once, subtracting a second preset value from the third current weight to obtain a fourth current weight, and determining the fourth current weight as the target weight.
If the target node is overtime, on the basis of the third current weight, subtracting a second preset numerical value every time the target node is overtime, so as to obtain a fourth current weight, and determining the fourth current weight as the target weight.
Illustratively, the second preset value is 2, and if the target node times out 3 times, the third current weight 24 is subtracted by 6 (i.e., 2 x 3), resulting in 18.
As an optional implementation manner in the embodiment of the present invention, as shown in fig. 4, the node scheduling method in the embodiment of the present invention may further include:
s401, for each target node in a plurality of target nodes, sending a data acquisition request to the target node.
This step may be located before step S1022, where the current node may send, for each target node in the plurality of target nodes, a data obtaining request to request data, where the data obtaining request may carry a requested data amount, which is denoted as data _ size1, for example, data of 100KB is requested, and a time when the data obtaining request is sent is denoted as time 1.
S402, receiving the data returned by the target node aiming at the data acquisition request, and calculating the data volume of the returned data.
After receiving the data acquisition request, the target node may return data to the current node, so that the current node may calculate the data volume of the returned data, and the time when the returned data is received is denoted as time 2.
S403, judging the size between the data volume of the return data and the request data volume.
The current node may perform subsequent operations, such as calculating the weight of the target node, by taking the size between the amount of data returned and the amount of data requested.
As an optional implementation manner of the embodiment of the present invention, after the current node sends the data acquisition request to the target node, in a case that data returned by the target node is not received within a preset time period, the data acquisition request may be sent to the target node again, and the number of times of timeout is accumulated for the target node, so as to calculate the weight of the target node subsequently. The preset time period may be, for example, 2 seconds, and of course, the embodiment of the present invention may set a time threshold for the total number of times of sending the data acquisition request, for example, set to 3 times, 5 times, or 10 times.
As an optional implementation manner of the embodiment of the present invention, after the target weights corresponding to the target nodes are obtained, the target nodes may be scheduled according to the descending order of the target weights corresponding to the target nodes, so that data may be obtained from the target nodes with good network conditions or the target nodes with low load as much as possible, and data is prevented from being obtained from the target nodes with poor network conditions or the target nodes with high load, thereby improving data obtaining efficiency.
As an optional implementation manner of the embodiment of the present invention, when target nodes with the same weight exist in a plurality of target nodes, respective response speeds of the target nodes with the same weight may be calculated, and then the target nodes with the same weight are sorted according to a sequence from a high response speed to a low response speed, so that the target nodes may be scheduled according to a sequence from a large target weight to a small target weight corresponding to each target node and a sequence from a high response speed to a low response speed of each target node with the same weight, thereby avoiding a situation that the target nodes with the same weight cannot be scheduled, and further enabling a scheduling process to be more intelligent.
For example, when there are 3 target nodes with the same weight in a plurality of target nodes, for example, there are target node a, target node B, and target node C, the response speeds corresponding to target node a, target node B, and target node C may be respectively calculated, and the response speed a, the response speed B, and the response speed C are respectively obtained, where the response speed B > the response speed a > the response speed C, and then the three target nodes are sorted as target node B-target node a-target node C. The response speed represents the time delay when the target node returns data.
Alternatively, the response speed may be calculated by the following expression:
speed=data_size2/(time2-time1)
where speed denotes the response speed of the target node, data _ size2 denotes the data amount of the returned data, time1 denotes the time at which the data acquisition request is transmitted, and the time at which the returned data is received is denoted as time 2.
As an optional implementation manner of the embodiment of the present invention, if target nodes with the same response speed still exist, the target nodes may be scheduled according to a randomly selected manner, so that the scheduling process is further intelligent.
As an optional implementation manner of the embodiment of the present invention, after obtaining the respective weights of the multiple target nodes, when there is a target node whose target weight is zero, since the target node whose weight is zero indicates that the current state of the target node is very poor, the target node whose weight is zero may be deleted from the multiple target nodes to obtain remaining target nodes, that is, the target nodes whose weight is zero are not scheduled, in other words, the remaining target nodes may be scheduled according to a descending order of the respective target weights corresponding to the remaining target nodes, so as to avoid scheduling the target node whose target weight is zero in the scheduling process.
According to the node scheduling method in the P2P network provided by the embodiment of the invention, the current node in the P2P network can determine the connection time between the current node and each target node aiming at a plurality of target nodes which are connected with the current node, and then the target weight corresponding to each target node is calculated based on the connection time and information carried by each target node when returning data to the current node, so that each target node is scheduled based on the obtained target weight corresponding to each target node. Compared with the prior art, the method has the advantages that the tracker server is not required to process the information reported by each target node in a centralized manner, so that the excessive calculation pressure of the tracker server can be avoided, and the stability of the whole P2P network can be improved.
Corresponding to the above method embodiment, the embodiment of the present invention also provides a corresponding device embodiment.
As shown in fig. 5, an embodiment of the present invention provides an apparatus for scheduling nodes in a P2P network, including:
a determining module 501, configured to determine, for multiple target nodes that have established connections with a current node, connection time consumed between each target node and the current node, where the connection time consumed is time consumed in a connection establishment process between the current node and each target node; the plurality of target nodes are nodes containing target data.
The first calculating module 502 is configured to calculate a target weight corresponding to each target node based on the connection establishment time and information returned by each target node to the current node.
And a scheduling module 503, configured to schedule each target node based on the obtained target weight corresponding to each target node.
As shown in fig. 6, the determining module 501 includes:
the sending submodule 5011 is configured to send, to each of the multiple target nodes, a connection establishment request to the target node, and record a first current time corresponding to the sending of the connection establishment request.
The recording submodule 5012 is configured to receive a response message of the target node to the connection establishment request, and record a second current time corresponding to the received response message.
The determining submodule 5013 is configured to determine a difference between the second current time and the first current time as a time consumed by the current node and the target node in the process of establishing the connection.
As shown in fig. 7, the first calculating module 502 includes:
the first calculating submodule 5021 is configured to, if the connection establishment time is greater than a preset connection establishment time threshold, halve the preset weight of the target node to obtain a first current weight, and determine the first current weight as the target weight.
The second calculating submodule 5022 subtracts the first preset value from the first current weight to obtain a second current weight if the data volume of the data returned by the target node is smaller than the requested data volume of the current node, and determines the second current weight as the target weight.
And the third calculation submodule 5023 is used for halving the second current weight to obtain a third current weight if the load of the target node is greater than the preset load threshold, and determining the third current weight as the target weight.
And if the target node is overtime and is overtime once, the fourth calculation submodule 5024 subtracts a second preset value from the third current weight to obtain a fourth current weight, and determines the fourth current weight as the target weight.
On the basis of the apparatus structure shown in fig. 5, as shown in fig. 8, the apparatus for scheduling nodes in a P2P network according to the embodiment of the present invention may further include:
a sending module 801, configured to send a data obtaining request to each target node in the multiple target nodes, where the data obtaining request carries a request data volume.
A second calculating module 802, configured to receive data returned by the target node for the data obtaining request, and calculate a data amount of the returned data;
a judging module 803, configured to judge a size between a data amount of the returned data and a requested data amount.
Wherein, the sending module may be further configured to:
and under the condition that the data returned by the target node is not received within the preset time length, sending a data acquisition request to the target node again, and accumulating the overtime times for the target node.
The scheduling module may be specifically configured to:
and scheduling each target node according to the descending order of the target weight corresponding to each target node.
Wherein, above-mentioned device can also include:
and the third calculation module is used for calculating the respective response speeds of the target nodes with the same weight, wherein the response speeds represent the time delay when the target nodes return data.
The scheduling module is specifically configured to:
and scheduling each target node according to the sequence of the target weight corresponding to each target node from large to small and the sequence of the response speed of each target node with the same target weight from high to low.
Wherein, above-mentioned device can also include:
and the deleting module is used for deleting the target nodes with the weight of zero from the plurality of target nodes to obtain the residual target nodes.
The scheduling module is specifically configured to:
and scheduling each residual target node according to the descending order of the target weight corresponding to each residual target node.
According to the node scheduling device in the P2P network provided by the embodiment of the invention, the current node in the P2P network can determine the connection time between each target node and each target node aiming at a plurality of target nodes which are connected with the current node, and then the target weight corresponding to each target node is calculated based on the connection time and information carried by each target node when returning data to the current node, so that each target node is scheduled based on the obtained target weight corresponding to each target node. Compared with the prior art, the method has the advantages that the tracker server is not required to process the information reported by each target node in a centralized manner, so that the excessive calculation pressure of the tracker server can be avoided, and the stability of the whole P2P network can be improved.
An embodiment of the present invention further provides an electronic device, which may specifically be a server, as shown in fig. 9, where the device 900 includes a processor 901 and a machine-readable storage medium 902, where the machine-readable storage medium stores machine-executable instructions that can be executed by the processor, and the processor executes the machine-executable instructions to implement the following steps:
determining the connection time between each target node and a plurality of target nodes which are connected with the current node, wherein the connection time is the time consumed by the current node and each target node in the connection establishing process; the target nodes are nodes containing target data;
calculating target weight corresponding to each target node based on the time consumed for establishing connection and information returned to the current node by each target node, wherein the information is information related to the transmission state of each target node;
and scheduling each target node based on the obtained target weight corresponding to each target node.
The machine-readable storage medium may include a Random Access Memory (RAM) or a non-volatile Memory (non-volatile Memory), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, and includes a Central Processing Unit (CPU), a Network Processor (NP), and the like; the Integrated Circuit may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, a discrete Gate or transistor logic device, or a discrete hardware component.
In the electronic device provided by the embodiment of the present invention, a current node in a P2P network can determine a connection time between each target node and each target node for a plurality of target nodes to which the current node is connected, and then calculate a target weight corresponding to each target node based on the connection time and information carried by each target node when returning data to the current node, so that each target node is scheduled based on the obtained target weight corresponding to each target node. Compared with the prior art, the method has the advantages that the tracker server is not required to process the information reported by each target node in a centralized manner, so that the excessive calculation pressure of the tracker server can be avoided, and the stability of the whole P2P network can be improved.
An embodiment of the present invention further provides a computer-readable storage medium, in which a computer program is stored, and when the computer program is executed by a processor, the computer program is configured to perform the following steps:
determining the connection time between each target node and a plurality of target nodes which are connected with the current node, wherein the connection time is the time consumed by the current node and each target node in the connection establishing process; the target nodes are nodes containing target data;
calculating target weight corresponding to each target node based on the time consumed for establishing connection and information returned to the current node by each target node, wherein the information is information related to the transmission state of each target node;
and scheduling each target node based on the obtained target weight corresponding to each target node.
In the computer-readable storage medium provided in the embodiment of the present invention, a current node in a P2P network can determine, for a plurality of target nodes that have established connections with the current node, connection time consumption between each target node, and then calculate a target weight corresponding to each target node based on the connection time consumption and information carried by each target node when returning data to the current node, so as to schedule each target node based on the obtained target weight corresponding to each target node. Compared with the prior art, the method has the advantages that the tracker server is not required to process the information reported by each target node in a centralized manner, so that the excessive calculation pressure of the tracker server can be avoided, and the stability of the whole P2P network can be improved.
Embodiments of the present invention also provide a computer program product comprising instructions which, when run on a computer, cause the computer to perform the steps of:
determining the connection time between each target node and a plurality of target nodes which are connected with the current node, wherein the connection time is the time consumed by the current node and each target node in the connection establishing process; the target nodes are nodes containing target data;
calculating target weight corresponding to each target node based on the time consumed for establishing connection and information returned to the current node by each target node, wherein the information is information related to the transmission state of each target node;
and scheduling each target node based on the obtained target weight corresponding to each target node.
In the computer program product including the instruction provided in the embodiment of the present invention, the current node may determine, for a plurality of target nodes that have established connections with the current node, connection time consumption between each target node and each target node, and then calculate a target weight corresponding to each target node based on the connection time consumption and information carried by each target node when returning data to the current node, so that each target node is scheduled based on the obtained target weight corresponding to each target node.
Embodiments of the present invention further provide a computer program, which when running on a computer, causes the computer to execute the following steps:
determining the connection time between each target node and a plurality of target nodes which are connected with the current node, wherein the connection time is the time consumed by the current node and each target node in the connection establishing process; the target nodes are nodes containing target data;
calculating target weight corresponding to each target node based on the time consumed for establishing connection and information returned to the current node by each target node, wherein the information is information related to the transmission state of each target node;
and scheduling each target node based on the obtained target weight corresponding to each target node.
With the computer program including the instructions provided in the embodiment of the present invention, a current node in a P2P network can determine, for a plurality of target nodes that have established connections with the current node, connection time consumption between each target node, and then calculate a target weight corresponding to each target node based on the connection time consumption and information carried by each target node when returning data to the current node, so as to schedule each target node based on the obtained target weight corresponding to each target node. Compared with the prior art, the method has the advantages that the tracker server is not required to process the information reported by each target node in a centralized manner, so that the excessive calculation pressure of the tracker server can be avoided, and the stability of the whole P2P network can be improved.
For the apparatus/electronic device/storage medium embodiment, since it is substantially similar to the method embodiment, the description is relatively simple, and for the relevant points, reference may be made to part of the description of the method embodiment.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The above description is only for the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.

Claims (18)

1. A node scheduling method in a peer-to-peer P2P network is applied to a current node, wherein the current node is any node in a P2P network, and the method comprises the following steps:
determining connection time consumption between each target node and a plurality of target nodes which are connected with the current node, wherein the connection time consumption is the time consumption of the current node and each target node in the connection establishing process; the target nodes are nodes containing target data;
calculating target weight corresponding to each target node based on the connection time and information returned to the current node by each target node, wherein the information is information related to the transmission state of each target node;
and scheduling each target node based on the obtained target weight corresponding to each target node.
2. The method according to claim 1, wherein the step of determining, for a plurality of target nodes with which connections have been established with the current node, the time consumed for establishing connections with the respective target nodes comprises:
aiming at each target node in the target nodes, sending a connection establishment request to the target node, and recording a first current time corresponding to the sending of the connection establishment request;
receiving a response message of the target node aiming at the connection establishment request, and recording a second current time corresponding to the receiving of the response message;
and determining the difference value between the second current time and the first current time as the consumed time of the current node and the target node in the process of establishing connection.
3. The method according to claim 1, wherein the step of calculating the target weight corresponding to each target node based on the connection time and the information returned by each target node to the current node comprises:
if the connection time is greater than a preset connection time threshold, reducing the preset weight of the target node by half to obtain a first current weight, and determining the first current weight as the target weight;
if the data volume of the data returned by the target node is smaller than the requested data volume of the current node, subtracting a first preset value from the first current weight to obtain a second current weight, and determining the second current weight as the target weight;
if the load capacity of the target node is greater than a preset load capacity threshold value, halving the second current weight to obtain a third current weight, and determining the third current weight as the target weight;
if the target node is overtime and is overtime once, subtracting a second preset value from the third current weight to obtain a fourth current weight, and determining the fourth current weight as the target weight.
4. The method of claim 3, wherein before subtracting the first current weight by the first predetermined value to obtain the second current weight, the method further comprises:
sending a data acquisition request to each target node in the plurality of target nodes, wherein the data acquisition request carries the requested data volume;
receiving data returned by the target node aiming at the data acquisition request, and calculating the data volume of the returned data;
and judging the size between the data volume of the returned data and the requested data volume.
5. The method of claim 4, wherein after sending the data acquisition request to the target node, the method further comprises:
and under the condition that the data returned by the target node is not received within the preset time length, sending a data acquisition request to the target node again, and accumulating the overtime times for the target node.
6. The method of claim 1, wherein the step of scheduling each target node based on the obtained target weight corresponding to each target node comprises:
and scheduling each target node according to the descending order of the target weight corresponding to each target node.
7. The method of claim 6, wherein when there are target nodes with the same target weight, the method further comprises:
calculating respective response speeds of the target nodes with the same weight, wherein the response speeds represent the time delay of the target nodes when returning data;
the step of scheduling each target node according to the descending order of the target weight corresponding to each target node includes:
and scheduling each target node according to the sequence of the target weight corresponding to each target node from large to small and the sequence of the response speed of each target node with the same target weight from high to low.
8. The method of claim 1, wherein when there is a target node with a target weight of zero in the plurality of nodes, the method further comprises:
deleting target nodes with the weight of zero from the plurality of target nodes to obtain residual target nodes;
the step of scheduling each target node based on the obtained target weight corresponding to each target node includes:
and scheduling each residual target node according to the descending order of the target weight corresponding to each residual target node.
9. An apparatus for scheduling nodes in a peer-to-peer P2P network, applied to a current node, the current node being any node in a P2P network, the apparatus comprising:
the determining module is used for determining the connection time between each target node and a plurality of target nodes which are connected with the current node, wherein the connection time is the time consumed by the current node and each target node in the connection establishing process; the target nodes are nodes containing target data;
a first calculating module, configured to calculate a target weight corresponding to each target node based on the connection establishment time and information returned by each target node to the current node, where the information is information related to a transmission state of each target node;
and the scheduling module is used for scheduling each target node based on the obtained target weight corresponding to each target node.
10. The apparatus of claim 9, wherein the determining module comprises:
the sending submodule is used for sending a connection establishment request to each target node in the plurality of target nodes and recording a first current time corresponding to the sending of the connection establishment request;
the recording submodule is used for receiving a response message of the target node aiming at the connection establishment request and recording a second current time corresponding to the received response message;
and the determining submodule is used for determining the difference value between the second current time and the first current time as the consumed time of the current node and the target node in the process of establishing connection.
11. The apparatus of claim 9, wherein the first computing module comprises:
the first calculation submodule is used for halving the preset weight of the target node to obtain a first current weight and determining the first current weight as the target weight if the connection time is greater than a preset connection time threshold;
the second calculation submodule is used for subtracting a first preset value from the first current weight to obtain a second current weight and determining the second current weight as the target weight if the data volume of the data returned by the target node is smaller than the requested data volume of the current node;
the third calculation submodule is used for halving the second current weight to obtain a third current weight if the load of the target node is greater than a preset load threshold value, and determining the third current weight as the target weight;
and the fourth calculation submodule is used for subtracting a second preset value from the third current weight to obtain a fourth current weight if the target node is overtime and is overtime once, and determining the fourth current weight as the target weight.
12. The apparatus of claim 11, further comprising:
a sending module, configured to send a data acquisition request to each target node in the multiple target nodes, where the data acquisition request carries the requested data volume;
the second calculation module is used for receiving the data returned by the target node aiming at the data acquisition request and calculating the data volume of the returned data;
and the judging module is used for judging the size between the data volume of the returned data and the data volume of the request.
13. The apparatus of claim 12, wherein the sending module is further configured to:
and under the condition that the data returned by the target node is not received within the preset time length, sending a data acquisition request to the target node again, and accumulating the overtime times for the target node.
14. The apparatus of claim 9, wherein the scheduling module is specifically configured to:
and scheduling each target node according to the descending order of the target weight corresponding to each target node.
15. The apparatus of claim 14, further comprising:
the third calculation module is used for calculating the respective response speeds of the target nodes with the same weight, wherein the response speeds represent the time delay when the target nodes return data;
the scheduling module is specifically configured to:
and scheduling each target node according to the sequence of the target weight corresponding to each target node from large to small and the sequence of the response speed of each target node with the same target weight from high to low.
16. The apparatus of claim 9, further comprising:
a deleting module, configured to delete a target node with a weight of zero from the plurality of target nodes, to obtain a remaining target node;
the scheduling module is specifically configured to:
and scheduling each residual target node according to the descending order of the target weight corresponding to each residual target node.
17. An electronic device comprising a processor and a machine-readable storage medium storing machine-executable instructions executable by the processor to perform method steps of the method of node scheduling in a P2P network of any one of claims 1-8.
18. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the method steps of the method for scheduling nodes in a P2P network according to any one of claims 1 to 8.
CN202010245071.3A 2020-03-31 2020-03-31 Node scheduling method, scheduling device, electronic equipment and storage medium in P2P network Active CN113472832B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010245071.3A CN113472832B (en) 2020-03-31 2020-03-31 Node scheduling method, scheduling device, electronic equipment and storage medium in P2P network

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010245071.3A CN113472832B (en) 2020-03-31 2020-03-31 Node scheduling method, scheduling device, electronic equipment and storage medium in P2P network

Publications (2)

Publication Number Publication Date
CN113472832A true CN113472832A (en) 2021-10-01
CN113472832B CN113472832B (en) 2023-06-02

Family

ID=77865455

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010245071.3A Active CN113472832B (en) 2020-03-31 2020-03-31 Node scheduling method, scheduling device, electronic equipment and storage medium in P2P network

Country Status (1)

Country Link
CN (1) CN113472832B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101296152A (en) * 2008-06-26 2008-10-29 腾讯科技(深圳)有限公司 Data scheduling method and system of equity linked network
US20100146136A1 (en) * 2008-12-04 2010-06-10 Microsoft Corporation Peer-to-Peer Packet Scheduling Algorithm
CN107682415A (en) * 2017-09-20 2018-02-09 郑州云海信息技术有限公司 A kind of method and system of peer-to-peer network transmission neighbor node selection
CN109933420A (en) * 2019-04-02 2019-06-25 深圳市网心科技有限公司 Node tasks dispatching method, electronic equipment and system

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101296152A (en) * 2008-06-26 2008-10-29 腾讯科技(深圳)有限公司 Data scheduling method and system of equity linked network
US20100146136A1 (en) * 2008-12-04 2010-06-10 Microsoft Corporation Peer-to-Peer Packet Scheduling Algorithm
CN107682415A (en) * 2017-09-20 2018-02-09 郑州云海信息技术有限公司 A kind of method and system of peer-to-peer network transmission neighbor node selection
CN109933420A (en) * 2019-04-02 2019-06-25 深圳市网心科技有限公司 Node tasks dispatching method, electronic equipment and system

Also Published As

Publication number Publication date
CN113472832B (en) 2023-06-02

Similar Documents

Publication Publication Date Title
CN110049130B (en) Service deployment and task scheduling method and device based on edge computing
CN108306971B (en) Method and system for sending acquisition request of data resource
US10225203B2 (en) Scheduled transmission of data
CN110519183B (en) Node speed limiting method and device, electronic equipment and storage medium
CN111200657B (en) Method for managing resource state information and resource downloading system
US11178220B2 (en) Method and system for transmitting a data resource acquisition request
CN109348264B (en) Video resource sharing method and device, storage medium and electronic equipment
CN109309698B (en) Data processing system, method and device
CN108156257B (en) Information pushing method and device
US11593176B2 (en) Computer-readable recording medium storing transfer program, transfer method, and transferring device
CN111865674A (en) Log processing method, device and medium
CN101854287B (en) Method and device for optimizing P2P traffic
CN109951540B (en) Data acquisition method and device based on content timeliness and electronic equipment
CN113676514B (en) File source returning method and device
CN111897659B (en) Method, system and device for controlling service processing frequency and electronic equipment
CN113472832A (en) Node scheduling method, scheduling device, electronic equipment and storage medium in P2P network
US10812390B2 (en) Intelligent load shedding of traffic based on current load state of target capacity
CN113835905B (en) Message queue load balancing method and device, electronic equipment and medium
CN113810461B (en) Bandwidth control method, device and equipment and readable storage medium
CN109257449A (en) A method of the Web in Nginx based on URI loads distribution
CN115037696B (en) Data transmission method, device, electronic equipment and storage medium
CN114500663B (en) Scheduling method, device, equipment and storage medium of content distribution network equipment
CN110300035B (en) Method, system, device and server for judging load state of storage system
CN114615333A (en) Resource access request processing method, device, equipment and medium
CN113608870A (en) Load balancing method and device of message queue, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant