CN109962947B - Task allocation method and device in peer-to-peer network - Google Patents

Task allocation method and device in peer-to-peer network Download PDF

Info

Publication number
CN109962947B
CN109962947B CN201711406747.7A CN201711406747A CN109962947B CN 109962947 B CN109962947 B CN 109962947B CN 201711406747 A CN201711406747 A CN 201711406747A CN 109962947 B CN109962947 B CN 109962947B
Authority
CN
China
Prior art keywords
node
task
uploading
nodes
upload
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.)
Active
Application number
CN201711406747.7A
Other languages
Chinese (zh)
Other versions
CN109962947A (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.)
Alibaba Group Holding Ltd
Original Assignee
Alibaba Group Holding 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 Alibaba Group Holding Ltd filed Critical Alibaba Group Holding Ltd
Priority to CN201711406747.7A priority Critical patent/CN109962947B/en
Publication of CN109962947A publication Critical patent/CN109962947A/en
Application granted granted Critical
Publication of CN109962947B publication Critical patent/CN109962947B/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/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/104Peer-to-peer [P2P] networks
    • H04L67/1074Peer-to-peer [P2P] networks for supporting data block transmission mechanisms
    • H04L67/1078Resource delivery mechanisms
    • 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
    • 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
    • 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
    • H04L67/61Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources taking into account QoS or priority requirements

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The application provides a task allocation method and a device in a peer-to-peer network, wherein the task allocation method in the peer-to-peer network comprises the following steps: determining the service capacity of each node according to the condition that each node corresponding to the resource to be shared processes the uploading task; the resource to be shared is divided into a plurality of uploading tasks to be uploaded; and allocating uploading tasks to the nodes according to the service capacity of each node. According to at least one embodiment of the application, the distribution of the uploading tasks in the peer-to-peer network can be optimized, and the resource uploading efficiency of the peer-to-peer network is improved.

Description

Task allocation method and device in peer-to-peer network
Technical Field
The present invention relates to the field of networks, and in particular, to a method and an apparatus for task allocation in a peer-to-peer network.
Background
Peer-to-Peer (P2P) is a distributed application architecture that distributes tasks and workloads among peers (peers), and is a networking or networking form of Peer-to-Peer computing model formed at the application layer. Each terminal in the P2P network system may be referred to as a P2P node. In a P2P network system, nodes share resources, and may share resources with each other, such as uploading and downloading resources with each other; in one resource sharing, the P2P node downloading the resource may be referred to as a downloading node, and the P2P node uploading the resource may be referred to as an uploading node.
In a P2P network system serving video on demand, there is a very high demand for P2P technology to ensure the fluency of video playing by users.
In the P2P network system, in each link of resource downloading, the screening of P2P nodes and the scheduling and allocation of tasks are very important rings.
At present, a specific process of a P2P task allocation method includes the following steps 101 to 106:
101. the accelerator in the P2P node to be downloaded starts the downloading task, and requests the server of the P2P network for the node list corresponding to the resource.
The accelerator may refer to a P2P program running on the P2P node, may be a dynamic library integrated in an application (App), or a static library, or may be an independent executable program.
102. The accelerator decomposes the download task into P2P tasks (hereinafter also referred to as upload tasks) of small blocks with fixed size, for example, small blocks of about 20KB, and puts the small blocks into a task pool uniformly and sorts the small blocks from small to large according to the starting point of the tasks.
103. And the accelerator sequentially takes out the nodes from the node list returned by the server to establish connection.
104. For the nodes with established connection, the accelerator takes the foremost task from the task pool to be distributed to the node (the node is an uploading node for the task), and the accelerator sends the distributed task to the corresponding uploading node through network connection.
105. And the accelerator receives the data sent by the uploading node, and adds 1 to the task completion number of the uploading node if the data of the current downloading task is completely received. And then the next uploading task is taken from the current task pool and distributed to the uploading node.
106. The accelerator periodically checks the current task list, finds out the overdue or unfinished tasks, recycles the rest tasks, puts the tasks into the task pool, and reorders the tasks.
The above solution has the following drawbacks:
(1) for nodes with good service capacity, the network overhead of the protocol interaction part of each uploading task can be increased if the task block is too small, and the downloading efficiency is low; for nodes with poor service capability, the task blocks are too large, so that the completion rate is reduced, and the task blocks are easily eliminated.
(2) For an uploading node, discrete task blocks which are small blocks are received, the efficiency is very low when data are read from a disk, and when the number of tasks is large, the disk Input and Output (IO) can become a bottleneck restricting network uploading.
Disclosure of Invention
The application provides a task allocation method and device in a peer-to-peer network, which can optimize allocation of uploading tasks in a P2P network and improve resource uploading efficiency of the P2P network.
The technical scheme is as follows.
A method of task allocation in a peer-to-peer network, comprising:
determining the service capacity of each node according to the condition that each node corresponding to the resource to be shared processes the uploading task; the resource to be shared is divided into a plurality of uploading tasks to be uploaded;
and allocating uploading tasks for the nodes according to the service capacity of each node.
Wherein the service capability of the node may include one or more of the following parameters:
the speed of the node completing the uploading task;
the time length from sending the uploading task to the node to receiving the first resource corresponding to the uploading task;
the average speed of the node's transmission resources;
the real-time speed of the node transmission resource;
the cost of use of the node.
Wherein, determining the service capability of each node according to the condition that each node corresponding to the resource to be shared processes the upload task may include:
respectively calculating initial scores of all nodes according to attribute data of all nodes corresponding to resources to be shared, and taking the initial scores of the nodes as scores representing the service capacity of the nodes;
after the node finishes at least one uploading task, updating a score representing the service capability of the node according to the condition that the node processes the uploading task;
the allocating the upload task to the node according to the service capability of each node may include:
when the uploading tasks need to be distributed, the uploading tasks are distributed to the nodes in sequence according to the sequence that the scores representing the service capabilities of the nodes are from large to small.
Wherein the attribute data of the node may include one or more of:
terminal type, area information, operator information, network type.
The initial score of a node may be equal to the result of weighted summation of scores of attribute data of the node.
Wherein, according to the situation that the node processes the uploading task, the calculating the score representing the service capability of the node may include:
and mapping the completion speed of the node to the uploading task in a preset value interval through an arc tangent function to obtain a score representing the service capability of the node.
Wherein, the allocating the upload task to the node according to the service capability of each node may include:
respectively calculating the size of an uploading task which can be completed by each node in a task period according to the service capacity of each node;
and allocating the uploading tasks to the nodes according to the size of the uploading tasks which can be completed by each node in the task period.
Wherein, the allocating the upload task to the node according to the size of the upload task that each node can complete in the task period may include:
for each node, respectively distributing N uploading tasks with unit size; for a node, N is the largest integer that enables the product of N and the unit size to be no greater than the size of the upload task that the node can complete in the task period.
Wherein, the allocating the upload task to the node according to the size of the upload task that each node can complete in the task period may include:
the following operations can be performed for each node:
when the size A of the uploading task to be distributed is not larger than the size B of the uploading task which can be distributed by the node, distributing the uploading task to be distributed to the node; the size of the uploading task which can be distributed by the node is not larger than the size of the uploading task which can be completed by the node in the task period;
and when the size A of the uploading task to be distributed is larger than the size B of the uploading task which can be distributed by the node, dividing the uploading task with the size B from the uploading task to be distributed and distributing the uploading task to the node.
The method for processing the upload task by the nodes corresponding to the resources to be shared respectively may further include, before determining the service capabilities of the nodes:
and respectively allocating an uploading task with a preset size to each node corresponding to the resource to be shared.
A method of task allocation in a peer-to-peer network, comprising:
respectively calculating initial scores of all nodes according to attribute data of all nodes corresponding to resources to be shared;
sequentially distributing uploading tasks for the nodes according to the sequence of scores from large to small; and the resources to be shared are divided into a plurality of uploading tasks for uploading.
A task distribution apparatus in a peer-to-peer network, comprising: a processor and a memory;
the processor is used for storing a program for task allocation; when being read and executed by the processor, the program for task allocation performs the following operations:
determining the service capacity of each node according to the condition that each node corresponding to the resource to be shared processes the uploading task; the resource to be shared is divided into a plurality of uploading tasks to be uploaded;
and allocating uploading tasks for the nodes according to the service capacity of each node.
Wherein the service capability of the node may include one or more of the following parameters:
the speed of the node completing the uploading task;
the time length from sending the uploading task to the node to receiving the first resource corresponding to the uploading task;
the average speed of the node's transmission resources;
the real-time speed of the node transmission resource;
the cost of use of the node.
Wherein, determining the service capability of each node according to the condition that each node corresponding to the resource to be shared processes the upload task may include:
respectively calculating initial scores of all nodes according to attribute data of all nodes corresponding to resources to be shared, and taking the initial scores of the nodes as scores representing the service capacity of the nodes;
after the node finishes at least one uploading task, updating a score representing the service capability of the node according to the condition that the node processes the uploading task;
the allocating the uploading task to the nodes according to the service capabilities of the nodes respectively comprises:
when the uploading tasks need to be distributed, the uploading tasks are distributed to the nodes in sequence according to the sequence that the scores representing the service capabilities of the nodes are from large to small.
Wherein, the allocating the upload task to the node according to the service capability of each node may include:
respectively calculating the size of an uploading task which can be completed by each node in a task period according to the service capacity of each node;
and allocating the uploading tasks to the nodes according to the size of the uploading tasks which can be completed by each node in the task period.
When being read and executed by the processor, the program for task allocation may further perform the following operations:
and respectively allocating an uploading task with a preset size to each node corresponding to the resource to be shared before determining the service capacity of each node according to the condition that each node corresponding to the resource to be shared processes the uploading task.
A task allocation apparatus in a peer-to-peer network, comprising:
the capacity determining module is used for determining the service capacity of each node according to the condition that each node corresponding to the resource to be shared processes the uploading task; the resource to be shared is divided into a plurality of uploading tasks to be uploaded;
and the distribution module is used for distributing the uploading task for the nodes according to the service capacity of each node.
Wherein the service capability of the node may include one or more of the following parameters:
the speed of the node completing the uploading task;
the time length from sending the uploading task to the node to receiving the first resource corresponding to the uploading task;
the average speed of the node's transmission resources;
the real-time speed of the node transmission resource;
the cost of use of the node.
The capacity determining module determines the service capacity of each node according to the condition that each node corresponding to the resource to be shared processes the upload task, where the determining the service capacity of each node may include:
the capacity determining module calculates initial scores of the nodes according to attribute data of the nodes corresponding to the resources to be shared respectively, and the initial scores of the nodes are used as scores representing the service capacity of the nodes; after the node finishes at least one uploading task, updating a score representing the service capability of the node according to the condition that the node processes the uploading task;
the distribution module distributes the uploading tasks for the nodes according to the service capacity of each node respectively, and the distribution module comprises the following steps:
and when the uploading tasks need to be distributed, the distribution module distributes the uploading tasks for the nodes in sequence according to the sequence that the scores representing the service capabilities of the nodes are from large to small.
The allocating module may allocate the upload task to the node according to the service capability of each node, respectively, and may include:
the distribution module calculates the size of an uploading task which can be completed by each node in a task period according to the service capacity of each node; and allocating the uploading tasks to the nodes according to the size of the uploading tasks which can be completed by each node in the task period.
The allocation module may be further configured to allocate an upload task of a predetermined size to each node corresponding to the resource to be shared before the capability determination module determines the service capability of each node according to a condition that each node corresponding to the resource to be shared processes the upload task.
In at least one embodiment of the application, the distribution of the uploading task is performed according to the service capacity of the node, and the distribution of the uploading task in the P2P network can be optimized, so that the performance of the whole P2P network is improved.
In at least one embodiment of the application, the service capability of the node is evaluated in the initial stage, so that the uploading task is preferentially distributed to the node with good service capability, and the completion degree of the uploading task is improved. By evaluating the nodes in the resource uploading stage, the uploading tasks can be preferentially distributed to the nodes with strong service capability, and certain opportunities are given to the nodes which do not finish the uploading tasks to try to mine the service capability of the nodes, so that the overall node resource utilization rate of the P2P network is improved.
According to at least one embodiment of the application, the service capacity of the node is evaluated according to the condition that the node processes the uploading task, the uploading task suitable for the uploading capacity of the node is dynamically allocated according to the service capacity of the node, the uploading task allocated to the node with strong service capacity is large, and the uploading task allocated to the node with weak service capacity is small. Finally, the service capacity of the P2P node is fully utilized, the overall P2P network performance is improved, and the completion degree of the uploading task of the node can be ensured.
In at least one embodiment of the present application, service capabilities of nodes may be pre-estimated, and the nodes are sorted according to the service capabilities, and the distribution of the initial upload task is performed, so that the distribution of the upload task in the P2P network may be optimized, and thus the performance of the whole P2P network may be improved.
Of course, it is not necessary for any product to achieve all of the above-described advantages at the same time for the practice of the present application.
Drawings
Fig. 1 is a flowchart of a task allocation method in a peer-to-peer network according to the first embodiment;
FIG. 2 is a flowchart of a task allocation method in a peer-to-peer network according to a fourth embodiment;
fig. 3 is a schematic diagram of a task allocation apparatus in a peer-to-peer network according to a seventh embodiment.
Detailed Description
The technical solutions of the present application will be described in more detail below with reference to the accompanying drawings and embodiments.
It should be noted that, if not conflicted, the embodiments and the features of the embodiments can be combined with each other and are within the scope of protection of the present application. Additionally, while a logical order is shown in the flow diagrams, in some cases, the steps shown or described may be performed in an order different than here.
In one configuration, a computing device that performs task distribution in a peer-to-peer network may include one or more processors (CPUs), input/output interfaces, network interfaces, and memory (memories).
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of a computer-readable medium. The memory may include one or more modules.
Computer-readable media include permanent and non-permanent, removable and non-removable storage media that can implement the storage of information by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device.
An embodiment of a method for task allocation in a peer-to-peer network, as shown in fig. 1, includes steps S110 to S120:
s110, determining the service capacity of each node according to the condition that each node corresponding to the resource to be shared processes the uploading task; the resource to be shared is divided into a plurality of uploading tasks to be uploaded;
and S120, distributing an uploading task for the nodes according to the service capacity of each node.
In this embodiment, the distribution of the upload task may be performed according to the service capability of the node, and the distribution of the upload task in the P2P network may be optimized, thereby improving the performance of the whole P2P network.
In this embodiment, the node is a P2P node, and may include, but is not limited to, a computer, a mobile phone, a tablet, and other terminals.
In this embodiment, when a P2P node needs to download some resources (such as but not limited to requesting a video), the P2P node (for the resource to be downloaded, the P2P node acts as a downloading node) may establish a downloading task, and request the required resource, i.e. the resource to be shared.
In this embodiment, the resource to be shared may be divided into a plurality of upload tasks, or alternatively, a download task established by a download node may be divided into a plurality of upload tasks (for the download node, it is a "download task", and for the node that uploads the resource, it is an "upload task"); it can be seen that the resource to be uploaded by one uploading task is a part of the resource to be shared; for example, the resource to be shared has a total of 910KB, and can be divided into 45 upload tasks of 20KB and 1 upload task of 10 KB. The division mode may not be limited to the division according to the fixed size of the resource, and the division mode may be set by itself.
In this embodiment, the node corresponding to the resource to be shared may be a node that stores the resource to be shared, that is: and the uploading node of the resource to be shared. When the download node requests the resource to be shared, the server may search for the node in the P2P network that stores the resource to be shared according to the identifier of the resource to be shared, and return information of the node searched by the download node in a node list manner.
In this embodiment, after receiving the upload task, one upload node may send the resource corresponding to the upload task to the download node one or more times.
In this embodiment, if some of the nodes storing the resources to be shared returned by the server have not processed the upload task, when determining the service capabilities of the nodes according to the condition that the nodes corresponding to the resources to be shared process the upload task, the nodes may not be included or the service capabilities of the nodes may be determined to be a default value.
In this embodiment, it is possible to allocate the upload task to only part of the nodes; for example, the service capabilities of 20 nodes are determined, but only 10 nodes with stronger service capabilities may be selected to allocate the upload task, and the other 10 nodes are not allocated. Of course, it is also possible to allocate the uploading task to the node with determined service capability or the node returned by the server and storing the resource to be shared.
In this embodiment, the resource to be shared may include a text file, data, audio, video, and the like to be shared; it may be a complete file or a part of a file.
In one implementation, the task allocation method may be performed by a P2P node that needs to download resources; may be, but is not limited to being, executed by an accelerator in the P2P node. In other implementations, the task allocation method described above may also be performed by other modules in the P2P node that need to download resources.
In this embodiment, when the execution main body of the task allocation method allocates an upload task to a node, the execution main body may establish a connection with the node first, and send the allocated upload task to the node after the connection is successfully established.
In this embodiment, during uploading the resource to be allocated, steps S110 and S120 may be two steps that are continuously repeated and parallel to each other; for example, step S110 may be performed each time a node starts processing an upload task, and step S120 may be performed in parallel when determining service capabilities. When step S120 is performed, the allocation is performed according to the currently determined service capability; for example, the service capacity is the speed of completing the upload Task, and assuming that the speed of completing the upload Task by the node a when the upload Task1 is allocated is v1, after the node a completes the allocated upload Task1, the speed of completing the upload Task by the node a becomes v 2; if the uploading task is redistributed at the moment, the speed of completing the task by taking v2 as the node a is adopted; that is, the service capacity according to which the upload task is allocated may be continuously updated according to the actual processing of the upload task by the node.
In one implementation, the service capabilities of the node may include one or more of the following parameters:
the speed of the node completing the uploading task;
the time length from sending the uploading task to the node to receiving the first resource corresponding to the uploading task;
the average speed of the node's transmission resources;
the real-time speed of the node transmission resource;
the cost of use of the node.
In this implementation, when the service capability of a node includes multiple parameters, a score representing the service capability of the node may be obtained by quantizing the parameter values and calculating according to a predetermined formula.
In this implementation manner, the speed at which the node completes the upload task may be, but is not limited to, the speed at which the node completes the last (or the latest) upload task; for example, if a node has completed 3 upload tasks, the speed may be calculated by calculating an upload task that the node has completed most recently.
Wherein, the speed of the node completing the uploading task may be equal to: the size of the upload task is divided by the length of time to complete the upload task.
The size of the upload task is the size of the resource to be uploaded by the upload task.
The time length for completing the upload task may be equal to a time length between a time when the download node receives the resource corresponding to the upload task and a time when the download node establishes a session for the upload task (or sends the upload task to the node).
The speed of the node completing the uploading task may also be an average speed of the node completing a plurality of uploading tasks, for example, the speed may be equal to a total size of the plurality of uploading tasks divided by a total time length of completing the plurality of uploading tasks, or equal to an average value of respective completion speeds of the plurality of uploading tasks.
Under the condition that the service capacity of the node does not include other parameters or the values of the included other parameters are the same, the faster the node finishes the uploading task, the higher the service capacity is.
The time length from sending the upload task to the node to receiving the first resource corresponding to the upload task may be referred to as response time; in case the service capabilities of the nodes do not comprise other parameters or the values of the comprised other parameters are all the same, the shorter the response time, the higher the service capabilities.
The real-time speed of the node transmitting the resource may refer to a current transmission speed of the node in the currently processed upload task, and may be obtained by dividing a time for transmitting the resource (for example, a time length between a time when the download node receives the first resource of the upload task and a time when the speed is calculated) by a size of the resource that the node has transmitted (for example, a size of the resource that the download node has received the upload task); or the size of the resource transmitted this time by the node (for example, the size of the resource received this time by the downloading node) in one uploading task is divided by the time length between the resource transmission this time and the resource transmission last time (for example, the difference between the time when the downloading node receives the resource corresponding to the uploading task this time and the time when the downloading node receives the resource corresponding to the uploading task last time). In the case that the service capability of the node does not include other parameters, or the values of the included other parameters are all the same, the faster the real-time speed of the node transmitting the resource, the higher the service capability.
The average speed of the node for transmitting the resource may refer to an average value of transmission speeds of the node in a plurality of uploading tasks, or an average value of transmission speeds of the node in a plurality of resource transmissions of one uploading task. In the case that the service capability of the node does not include other parameters, or the values of the included other parameters are all the same, the faster the average speed of the transmission resources of the node is, the higher the service capability is.
In practical applications, when the service capability of the node is considered, the weight occupied by the real-time speed may be greater than the weight occupied by the average speed. For example: in one embodiment, the weight of the real-time speed may be set to 80% and the weight of the average speed may be set to 20%; in yet another embodiment, the real-time speed may be weighted at 90% and the average speed may be weighted at 10%.
The use cost of the node can be obtained according to the use cost which is stored in advance and corresponds to the type of the node; for example, the types of the system are arranged from high to low according to the use cost, and comprise a district core, an ore machine, a router and a common terminal; wherein, the use cost of the common terminal may be 0. In the case where the service capability of the node does not include other parameters, or the values of the included other parameters are all the same, the higher the cost of the node, the higher the service capability.
In one implementation, step S120 may include:
and allocating uploading tasks to the nodes in sequence according to the sequence of the service capacity from high to low.
In this implementation manner, when the node has already allocated the upload task, the service capability of the node can be directly evaluated by processing the condition of the upload task by the node, and the upload task is preferentially allocated to a node with high service capability (for example, the speed of completing the upload task is fast, the response time is short, the speed of transmitting resources is fast, or the cost is low).
In this implementation manner, the nodes in the node list returned by the server may be sorted according to the service capabilities of the nodes, and the higher the service capabilities are, the higher the nodes are.
In this implementation, the uploading tasks are sequentially allocated to the nodes, which only means that the uploading tasks can be allocated in the order from high to low in service capability of the nodes, but does not mean that each node must be allocated with the uploading tasks, for example, a node with too low service capability or a node ranked in the last few bits may be specified, and no uploading task is allocated.
In other implementation manners, uploading tasks can be sequentially distributed to the nodes according to the sequence of the nodes in the node list returned by the server; or the nodes may be sorted and assigned with tasks according to other criteria, for example, the nodes may be assigned with the upload tasks in sequence according to the descending order of the number of upload tasks completed by the nodes.
Embodiment two, a task allocation method in peer-to-peer network; the present embodiment includes the solution of the first embodiment, and on this basis, the step S110 may include:
respectively calculating initial scores of all nodes according to attribute data of all nodes corresponding to resources to be shared, and taking the initial scores of the nodes as scores representing the service capacity of the nodes;
after the node finishes at least one uploading task, updating a score representing the service capability of the node according to the condition that the node processes the uploading task;
the step S120 may include:
when the uploading tasks need to be distributed, the uploading tasks are distributed to the nodes in sequence according to the sequence that the scores representing the service capabilities of the nodes are from large to small.
In the P2P network, the service capacities of the nodes are different, some nodes have good quality and strong service capacity, and some nodes have poor quality and poor service capacity. There are many uncertain factors in this, such as the upload bandwidth of the node, the number of tasks being processed by the node, whether the node is offline, and the like, which need to be determined according to the actual processing of the upload task by the node. However, many are determined and can be selected in advance. For example, between nodes far away (for example, Beijing and Guangxi), even if the service capability of a single node is strong, the service effect between the nodes is not good; for example, between nodes across operators (such as internet and mobile), the service effect is not good; for another example, the public network address connectivity is good, the private network address connectivity is poor, the wired network of the PC end is more stable, the network stability of the wireless wifi is slightly poor, and the like; these all have an impact on the service capabilities of the uploading node.
One solution is to sort the uploading tasks completed by the nodes from high to low, that is, the more the uploading tasks completed by the uploading nodes are, the higher the quality or service capability of the uploading nodes is, and the greater the chance of obtaining the uploading task allocation is. However, if the first few nodes of the node list are slow in network connection or slow in uploading service, the whole playing experience is directly affected. Moreover, for nodes which are not allocated with upload tasks but have good quality or strong service capability, because the number of completed upload tasks is 0 and the nodes are ranked in the node list, there may be no chance to receive the upload tasks all the time, and resources of the nodes are wasted. The present embodiment can overcome this drawback.
In this embodiment, if each node has never completed an upload task when the upload task needs to be allocated, the current scores indicating the service capabilities of the nodes all refer to the initial scores of the nodes; that is, when the upload task is distributed, the nodes are ranked according to their own attributes. By evaluating the attributes of the nodes in the initial stage, the nodes with high quality and high service capability (namely the initial points are high) are ranked in advance, so that the uploading tasks can be preferentially distributed to the nodes with high quality and high service capability in the first round of distribution of the uploading tasks, and the scheduling of the tasks in the whole P2P network can be optimized.
In this embodiment, in the process of uploading the resource, for a node (which may be any one of the nodes corresponding to the resource to be allocated) that has completed at least one upload task, the score calculated according to the situation that the node processes the upload task is used to replace the original score of the node; for example, after a node completes an upload task for the first time, the score calculated according to the condition that the node processes the upload task is used as a new score representing the service capability of the node instead of the initial score of the node; for another example, after a node completes an upload task Z (Z > 1) th time, the score calculated according to the situation that the node processes the upload task at this time may be used to replace the score calculated according to the situation that the node processes the upload task before.
That is to say, in this embodiment, the order of the nodes may also be adjusted according to the situation that the nodes actually process the upload task, so that the order of allocating the upload task to the nodes may be dynamically adjusted according to the actual service capabilities of the nodes, and thus, the nodes with strong service capabilities may be emphasized when the upload task is allocated.
In this embodiment, for a node, if the score representing the service capability of the node has been calculated according to the condition of processing the upload task, the score calculated according to the condition of processing the upload task may be used to replace the original score representing the service capability of the node (which may be the initial score or the score calculated last time according to the condition of processing the upload task), and the order of the node is adjusted according to the new score; for example, assume that an initial score of a node a is 88, and the 10 th node is ranked among all nodes, and the scores of the 7 th to 9 th nodes are 96, 93 and 90 respectively; under the condition that the scores of other nodes are not changed, after the score of A is updated according to the condition that A processes the uploading task for the first time, the score of A is 95, and the sequence of A is changed into the 8 th bit; after the score of A is updated for the second time according to the situation that A processes the uploading task, the score of A is 92, and the ordering of A becomes the 9 th bit. For a node, if the score is not calculated according to the situation of processing the uploading task, the initial score can be continuously used as the score of the node.
In this embodiment, the nodes are sequentially assigned with the upload tasks, which only means that the upload tasks can be assigned in the order of scores representing service capabilities of the nodes from high to low, but does not mean that each node must be assigned with the upload tasks, for example, it may be specified that the upload tasks are not assigned to nodes with scores lower than a certain value or nodes ranked in the last several digits.
In this embodiment, when an upload task needs to be allocated, the scores representing the service capabilities of the nodes may be sorted, or the scores representing the service capabilities of the nodes may be sorted each time after being updated.
In this embodiment, allocating the upload task and updating the score representing the service capability may be an alternate process, and may be sorted and allocated according to the latest score at present when allocating.
In one implementation, the calculating the score representing the service capability of the node according to the condition that the node processes the uploading task may include:
and mapping the completion speed of the node to the uploading task in a preset value interval through an arc tangent function to obtain a score representing the service capability of the node.
In this implementation manner, the completion speed of the node pair for the upload task may be the completion speed of the upload task that the node pair has been allocated for the last time, the completion speed of the upload tasks that the node pair has been allocated for the last several times, or the average completion speed of all the upload tasks that the node pair has completed.
In one implementation, the attribute data of a node may include one or more of:
terminal type, area information, operator information, network type.
In this implementation, the terminal type may be used to indicate which type of terminal the node is; may include Android (Android), which provides application services (Over The Top, OTT), apple (IOS), Router (Router), Personal Computer (PC), etc. through The internet. Each terminal type may be represented by a type code, respectively.
The area information may be used to indicate an area where the node is located; the region may include several levels, nationwide, large (e.g., east, south, etc.), province, city, district, county, etc.; each region may be represented by a respective region code.
The operator information may be used to indicate the operator used by the node; each operator may be represented by a respective operator code.
The network type may be used to indicate the type of network address used by the node; the main address can comprise a public network address and a private network address. The private Network addresses may be classified into a Full Cone NAT (Full Cone) NAT, a Symmetric NAT (Symmetric) NAT, a Port Restricted Cone NAT (Port Restricted Cone) NAT, an Address Restricted Cone NAT (addressed Restricted Cone) NAT, and the like according to Network Address Translation (NAT) types.
In other implementations, the type of attribute data may be selected on its own.
In one implementation, the initial score of a node may be equal to the result of the weighted sum of the scores of the attribute data of the node.
In this implementation manner, the score and the weight coefficient of each item of attribute data may be set as needed, for example, when the guidance of the upload traffic is mainly performed according to the terminal type, the weight coefficient of the terminal type may be increased.
In this implementation manner, the score of the terminal type of one node may be determined according to the score corresponding to each terminal type that is stored in advance. In addition, the value of a certain terminal type is set to be higher than that of other terminal types, so that the uploading flow can be more concentrated on the platform of the terminal type, and the uploading flow is pulled to a specific platform. For example, the value of the Android type can be adjusted to be higher than the value of the IOS type, so that under the condition that other attribute data are the same, the Android type terminals are sorted before the IOS type terminals, and are distributed to the Android type terminals preferentially when uploading tasks are distributed, so that the uploading flow is more concentrated on the Android platform.
In this implementation, the score of the region information of a node can be obtained by the region relationship between the node (hereinafter referred to as the upload node) and the node requesting to download the resource (hereinafter referred to as the current node). Such as: the score in the same city is 60 points, the score in the same province is 40 points, the score in the same main district is 20 points, and the score in the different main districts is 0 point. It can be seen that when the current nodes are different, the scores of the uploaded node region information may also change; for example, when the uploading node X is in Beijing and the current node is in Hainan, the score of the regional information of the node X is 0; when the current node is also in beijing, the score of the regional information of node X is 60.
In the implementation mode, the score of the information of one node operator can be obtained by judging whether the node operator is the same as the operator of the current node; for example, the score of 1 is the same operator, the score of 2 is the operator which is not the same operator, and the score of 1 is larger than the score of 2. Similar to the regional information, when the current node is different, the score of the uploaded node operator information may also change.
In this implementation manner, the score of the network type of one node is similar to the terminal type, and can be obtained through the correspondence between the network type and the score that is stored in advance.
In this implementation, the initial Score of a node may be calculated by the following mathematical model:
Score=∑(Mi×Qi)(i=1,2...T)
mi: the value of the ith attribute data is represented, and the value range can be 0-100.
Qi: and weight coefficients representing the ith attribute data, wherein the sum of the weight coefficients of the attribute data is 1.
Where T is the number of types of attribute data.
Thus, the initial scores of the nodes can be obtained by mathematically modeling the node quality.
In one implementation, the ordering of the nodes may be adjusted each time the score of a node is updated.
In one implementation, the nodes may be periodically re-ordered according to their current scores (updated scores for nodes that have been assigned upload tasks and initial scores for nodes that have not been assigned upload tasks).
In one implementation mode, the interval of the score calculated according to the condition of processing the uploading task can be different from the interval of the initial score, so that the node can be selected by the setting of the interval to be heavier than the node which is not allocated with the uploading task or the node which is allocated with the uploading task; for example, if the score interval calculated according to the situation of processing the upload task is 0 to 200 and the initial score interval is 0 to 100, the node to which the upload task is allocated is more likely to be sorted before the node to which the upload task is not allocated; however, as long as the node which is not allocated with the upload task has a higher score, the node may still be arranged before the node which is allocated with the upload task but has a lower speed, and the node may still be allocated with the upload task, and will not be left idle all the time, which causes waste of resources.
The present embodiment is described below by way of an example.
In this example, the speed of the node completing the upload task is used as the service capability, and the service capability can be divided into an initial stage and a task stage.
Initial stage
In the initial stage, the uploading task is not completed, and at this time, only a preliminary evaluation can be made on the quality or service capability of the node according to the self-attribute of the node, so as to generate an initial Score 1. The evaluation model 1 can be expressed by the following formula:
Score1=∑(Mi×Qi)(i=1,2...T)
mi: and the score of the ith attribute data is represented, and the value range is between 0 and 100.
Qi: and the weight coefficients of the ith attribute data are represented, and the sum of the weight coefficients of all the attributes is 1.
T is the number of types of attribute data.
In this example, the attribute data of the nodes used in the model and the weight sparsity of the attribute data may be made into configuration parameters, which may be dynamically adjusted according to different application scenarios, and the finally calculated initial Score1 may be between 0 and 100; in practical applications, the Score1 may have other values as the upper and lower limits.
This example selects: terminal type, area information, operator information, network type information and other attribute data of several dimensions participate in the calculation of the evaluation model 1.
Task phase
And in the task stage, the service capacity of the node can be quantified through the completion speed of the node to the latest uploading task, or through the completion speed of the node to a plurality of latest uploading tasks or the completion speed of each uploading task completed by the node and the like in actual application. Evaluation model 2 is as follows:
a) the completion speed of the uploading task is as follows: s (with KB/S unit)
S=Size×1000/(T1-T0)
Size: indicating the size of an upload task that has recently completed, e.g., 20KB, in KB.
T0: the unit of time recorded when the upload task is just sent to the node, or the time for generating session information for the upload task, is milliseconds (ms).
T1: and the unit of time recorded when the data corresponding to the uploading task are all received is ms.
b) Score of node calculated from velocity:
since the calculated value of S may have a large fluctuation, in order to reduce the fluctuation and facilitate node sequencing, the completion speed of the upload task is mathematically mapped as follows:
Score 2=(atan(S/90.0)/(π/2))×200
namely: the completion speed of the uploading task is mapped into an interval of 0-200 through an arctangent function, in practical application, the value interval of the Score2 can also be an interval with the upper limit and the lower limit of other values, and the upper limit of the value interval of the Score2 can be higher than the upper limit of the value interval of the Score 1. In this calculation, the output result of the arctangent function is in the radian system. Such as: the speed of 100KB/s is about 100 minutes, and the speed of 50KB/s is about 60 minutes. The uploading nodes can be divided into three types according to the scores:
strong node: the fraction is larger than 100 points, namely the completion speed of the uploading task is larger than 100 KB/s.
And (4) a middle node: the score is between 60 and 100, namely the completion speed of the uploading task is between 50 and 100 KB/s.
Weak node: the score is lower than 60, namely the completion speed of the uploading task is lower than 50 KB/s.
After one node gets Score2, Score2 can be used to replace Score1 as the Score of the node; a node may update Score2 once each time it completes an upload task, i.e.: the newly calculated Score2 was used in place of the original Score 2.
In this example, the Score1 obtained in the initial stage may have a value range from 0 to 100, and the Score2 obtained in the task stage may have a value range from 0 to 200, but when sorted, the nodes (whether the Score1 represents the Score of the service capability or the Score2 represents the Score of the service capability) are sorted together. The purpose of such design is mainly:
(1) since only the initial scored nodes (i.e. the nodes that have not completed the upload task) have some uncertainty, the strong nodes that have been determined may get the opportunity to assign tasks prior to the initial scored nodes, which may optimize the assignment of upload tasks.
(2) Only the nodes with better quality (between 60 and 100 points) in the initial points can obtain the opportunity of allocating the uploading task preferentially over the weak nodes, so that the resources of the nodes can be prevented from being idle.
In other embodiments, the nodes may also be sorted according to other conditions when the upload tasks are allocated, or the upload tasks may be allocated to the nodes in a random order.
In other embodiments, only the initial score may be calculated, or the score may be calculated only according to the situation of processing the upload task, and the upload tasks may be sequentially allocated to the nodes according to the size of the score.
Other implementation details of this embodiment can be found in embodiment one.
Embodiment three, a task allocation method in peer-to-peer network; the present embodiment includes the solution of the first embodiment, and on this basis, the step S120 may include:
respectively calculating the size of an uploading task which can be completed by each node in a task period according to the service capacity of each node;
and allocating the uploading tasks to the nodes according to the size of the uploading tasks which can be completed by each node in the task period.
In the embodiment, an uploading task with a proper size is allocated according to the service capacity of the node, so that the uploading node can complete the uploading task in a task period, the service capacity of the node is fully utilized, and the problems that the efficiency of a downloading end and the efficiency of an uploading end are influenced due to too small task blocks and frequent requests can be avoided.
In this embodiment, when the upload tasks are allocated to the nodes, the upload tasks may be allocated to the nodes in sequence according to the sequence from high to low of the service capabilities of the nodes or the sequence from large to small of the node scores; the scheme of sequentially distributing the uploading tasks according to the node scores can be seen in the contents of the second embodiment.
In one implementation, when the resource to be shared is an audio or video, the length of the task period of the upload task may be obtained according to a time difference between a starting point of the upload task and a preset play point. The task period may be different for different upload tasks.
In this implementation, the starting point of the upload task may refer to a starting point of a resource interval corresponding to the upload task, or a time calculated according to the starting point. For example, the upload task corresponds to a resource interval [50KB,300KB), 50KB may be the starting point of the upload task; or dividing the code rate by 50KB (in case of video serving as the resource to be shared) as the starting point of the uploading task.
In this implementation, the playing point may be configured by itself or according to a predetermined rule, and the playing point and the starting point are corresponding in form, for example, when the starting point is the starting point of the resource interval, the playing point is also represented by a certain position in the resource to be shared, for example, 900 KB.
In other implementation manners, the length of the task period can also be set according to a scene; the length of the task period can be used as a configuration parameter for self-setting when in use.
In this implementation manner, when the service capability of the node is the speed at which the node completes the upload task, the size of the upload task that the node can complete in the task period may refer to the speed at which the node completes the upload task multiplied by the length of the task period. When the service capacity of the node is other parameters or comprises a plurality of parameters, the quantized parameter values can be substituted into a predetermined formula to obtain the size of the uploading task which can be completed by the node in the task period.
In one implementation, allocating the upload task to the node according to the size of the upload task that can be completed by each node in the task period may include:
distributing N tasks with unit size to each node; for a node, N is the largest integer which can ensure that the product of N and the unit size is not larger than the size of an uploading task which can be completed by the node in a task period.
The size of the uploading task that the node can complete in the task period is divided by a predetermined size and rounded down to obtain N.
For example, the unit size is 20KB, when the size of the uploading task that the node can complete in the task period is 90KB, the uploading task allocated to the node with 4 unit sizes, that is, the size of the uploading task allocated to the node is 4 × 20KB — 80 KB; when the size of the uploading task which can be completed by the node in the task period is 132KB, the uploading task which is allocated to the node with the size of 6 units, namely the uploading task which is allocated to the node with the size of 6 multiplied by 20 KB-120 KB; and so on.
If the uploading task with the unit size is regarded as a task block of one unit, when the uploading task is distributed, the task block of an integral unit is distributed; the method can be regarded as unitizing the calculated size of the uploading task, and can reduce errors caused by uncertainty of the node service capacity. For example, according to the speed of the node completing the uploading task, it is calculated that the size of the uploading task that the node can complete in the task period is 132KB, if the uploading task with the size of 132KB is directly allocated, once the network has jitter or other emergencies, the 132KB cannot be uploaded and completed in the task period; the task block of 6 units is allocated, which is equivalent to the uploading task of 120KB, so that the method can have a certain tolerance to the emergency.
In other implementation manners, the size S2 of the upload task allocated to the node may also be determined according to the size S1 of the upload task that the node can complete in the task period, instead of allocating an integer number of units of task blocks, that is, dividing the tasks in the task pool into unit-sized task blocks, where S2 is not greater than S1; for example, S2 may be set to 90% of S1.
In one implementation, allocating the upload task to the node according to the size of the upload task that can be completed by each node in the task period may include:
the following operations are respectively carried out on each node:
when the size A of the uploading task to be distributed is not larger than the size B of the uploading task which can be distributed by the node, distributing the uploading task to be distributed to the node; the size of the uploading task which can be distributed by the node is not larger than the size of the uploading task which can be completed by the node in the task period;
and when the size A of the uploading task to be distributed is larger than the size B of the uploading task which can be distributed by the node, dividing the uploading task with the size B from the uploading task to be distributed and distributing the uploading task to the node.
In the implementation mode, the part with the size of A-B in the uploading task to be distributed is put back to the task pool and continues to be used as the uploading task to be distributed.
In this implementation, the size of the upload task that the node can allocate may be equal to N multiplied by the unit size; and N is the largest integer which ensures that the product of N and the unit size is not larger than the size of the task which can be completed by the node in the task period.
In other implementation manners, the task to be allocated may be divided into task blocks of unit size, and then the task blocks of corresponding units are allocated to the nodes according to the size of the uploading task that can be allocated by the nodes.
In one implementation, step S110 may further include:
and respectively allocating an uploading task with a preset size to each node corresponding to the resource to be shared.
In this implementation, when step S110 is performed for the first time, the service capability is determined according to a situation that the node processes the upload task of the predetermined size.
In this implementation, the predetermined size may be, but is not limited to, equal to the unit size described above, such as equal to 20 KB; the preset size can be set according to requirements, configuration and the like, so that the method is applicable to different application scenes.
The present embodiment is described below by way of an example.
In this example, the speed of the node completing the upload task is taken as the service capability, the whole distribution process can be divided into two parts, firstly, the size of the upload task which can be distributed by each upload node is calculated; and secondly, distributing an uploading task to the uploading node. And the uploading node is the node corresponding to the resource to be shared.
A first part: and calculating the size of the uploading task which can be distributed by each uploading node.
The calculation process can be divided into an initial phase and a task phase.
Initial stage
First, a minimum unit of task block is set, which has a size of M. At the initial stage, the service capability of each node is not known, and a unit of task block, such as an upload task of 20KB size, is initially allocated.
The size M of the task block of each unit (i.e., the unit size) is a configuration parameter, and can be configured on line according to different scenes to be effective in real time.
Task phase
And in the task stage, the nodes all finish at least one uploading task, and the service capacity of one node can be quantified through the finishing speed of the latest uploading task of the node.
Firstly, the completion speed of the uploading task is calculated: s (Unit is KB/S)
S=Size×1000/(T1-T0)
Size: indicating the size of an upload task that has recently completed, e.g., 20KB, in KB.
T0: the unit of time recorded when the uploading task is just sent to the node is ms.
T1: and the unit of time recorded when all the resources corresponding to the uploading task are received is ms.
Next, it is calculated that N units of task blocks can be allocated to the node in a predetermined task period based on the current completion speed of the node. The calculation formula is as follows:
N=Floor(S×T/M)
s: the completion speed of the last completed upload task.
T: the length of the task period, for example, when the resource to be shared is audio or video, the length of the task period, which can be obtained by each output task according to the distance from the starting point to the playing point, may be set to be at most 10s (T may be a configuration parameter).
Floor is a function of the Floor rounding down.
For different nodes, the calculated N is different due to different S; each node has its own corresponding N; during subsequent calculation or allocation, the size of the uploading task which can be allocated can be calculated for a node according to the N corresponding to the node, or the task blocks of N units can be allocated.
After N is obtained, calculation is not needed, the remaining uploading task is divided into task blocks with the size of M when the task is distributed, and N task blocks are distributed to the nodes when the task is distributed.
It is also possible to continue to calculate the size of the uploading task that can be allocated:
Size’=N×M
a second part: and allocating tasks to the uploading nodes.
When the downloading task is started, the downloading task is taken as a whole uploading task and is put into the task pool. Initially allocating 1 unit of task block (i.e. task of unit Size) to each node, and after a node completes one task block, calculating the Size' of the upload task that can be allocated next time according to the above formula and the speed of completing the task block last time.
During allocation, the uploading tasks in the task pool (considering that a part of the recovered uploading tasks exist in the task pool and a plurality of uploading tasks exist) are sorted from small to large according to the starting point, and the first uploading task is taken out for allocation each time.
Recording the size of the uploading task to be distributed as A; the Size of the upload task that the upload node can allocate is denoted as B (i.e., B ═ Size'). The principle of uploading task allocation is as follows:
(1) and if A <, distributing the uploading tasks to be distributed to the uploading nodes, and finishing distribution.
(2) And if A is larger than B, allocating the uploading task with the size of B to the uploading node, and returning the rest uploading tasks with the sizes of A-B to the task pool. Such as: the current uploading task to be allocated is 100KB,1000KB), the size of the uploading task which can be allocated by the node is 60KB, the uploading task allocated to the node is 100KB,160KB, and the rest of the uploading tasks [160KB,1000KB) are put back into the task pool to wait for the next allocation.
In other embodiments, step S120 in the first embodiment may be performed in other manners.
Other implementation details of the present embodiment can refer to embodiment one.
The fourth embodiment is a task allocation method in a peer-to-peer network, as shown in fig. 2, including steps S210 to S220:
s210, calculating initial scores of all nodes according to attribute data of all nodes corresponding to resources to be shared;
s220, sequentially distributing uploading tasks for the nodes according to the sequence of scores from large to small; and the resources to be shared are divided into a plurality of uploading tasks for uploading.
In this embodiment, the service capabilities of the nodes may be pre-estimated, and the nodes may be sorted accordingly to allocate the earliest upload task, so that the allocation of the upload task in the P2P network may be optimized, thereby improving the performance of the entire P2P network.
In this embodiment, details such as attribute data of the node, initial score calculation, and the like can be referred to in embodiment two; details of resources to be shared, upload tasks, nodes, and the like can be found in embodiment one.
In one implementation manner, the method of this embodiment may further include:
and respectively carrying out the following operations on each node which completes at least one uploading task:
calculating a score representing the service capability of the node according to the condition that the node processes the uploading task; the score representing the service capability of the node is updated with the calculated score.
In this implementation, the ordering of the nodes may be adjusted each time a score representing the service capabilities of the nodes is updated.
In this implementation, the nodes may be periodically reordered according to the current scores (updated scores for the nodes to which the upload task has been allocated and initial scores for the nodes to which the upload task has not been allocated) of the nodes representing the service capabilities of the nodes.
In the implementation mode, the score value interval calculated according to the condition of processing the uploading task can be different from the initial score value interval, so that the node which is not allocated with the uploading task or is allocated with the uploading task can be biased to the node which is not allocated with the uploading task when the node is selected through the setting of the score value interval; for example, if the score value interval calculated according to the situation of processing the uploading task is 0-200 and the initial score interval is 0-100, the nodes allocated with the tasks are more likely to be sequenced before the nodes not allocated with the uploading task; as long as the scores of the nodes which are not allocated with the uploading tasks are higher, the nodes still have the possibility of executing the tasks and are not left unused all the time to cause resource waste.
In one implementation, sequentially allocating the upload tasks to the nodes may include:
respectively calculating the size of an uploading task which can be completed by each node in a task period according to the service capacity of each node;
and distributing output tasks for the nodes according to the sizes of the uploading tasks which can be completed by each node in the task period.
For further details of this implementation, reference may be made to example three.
Embodiment five, a task allocation method in peer-to-peer network; the embodiment can be applied to a scene of video on demand in a P2P network, and the speed of the node completing the uploading task is taken as the service capability for explanation; in other embodiments, the service capabilities may include other parameters as well.
The present embodiment includes the following processes 501-506.
The process 501: initiating download tasks
An accelerator in a P2P node (in this embodiment, this P2P node is hereinafter referred to as a download node) 501.1 receives a HyperText Transfer Protocol (HTTP) request sent by a client application (App), where the request includes information such as a Uniform Resource Locator (URL) of a resource to be shared (in this embodiment, a video on demand), and a Range (Range) of the resource to be shared.
501.2 the accelerator parses out the URL and Range information from the request received at 501.1 and extracts the feature information (i.e., information that uniquely identifies the resource) from the URL.
501.3 the accelerator generates a resource ID by encoding according to the characteristic information extracted by 501.2, and the resource ID is used for uniquely identifying the resource in the P2P network system.
501.4 the accelerator starts the download task of the resource based on the resource ID generated by 501.3.
The process 502: obtaining a P2P node list
502.1 the accelerator, after initiating the download task at 501.4, sends a resource information request to the server, the request being in a proprietary protocol format with the resource ID generated at 501.3.
502.2 the server receives the resource information request sent by the accelerator 502.1, and parses the resource ID from the resource information request.
502.3 the server searches resource information from the local resource list according to the resource ID analyzed by 502.2, where the resource information includes information such as file size, file Message Digest Algorithm version 5 (MD 5) value, and node list corresponding to the resource.
502.4 the server packs the resource information found by 502.3 and sends the resource information to the accelerator.
502.5 the accelerator receives 502.4 the resource information packet returned by the server.
502.6 the accelerator parses 502.5 the received resource information packet and stores the information such as file size, node list, etc. in the local memory cache.
502.7 the accelerator calculates the data interval to be downloaded according to the Range information received at 501.1 and the file size information received at 502.6.
502.8 the accelerator generates a whole uploading task according to the data interval calculated by 502.7, and puts the whole uploading task into the task pool.
502.9 the accelerator sequentially traverses each node in the 502.6 node list (hereinafter referred to as upload node in this embodiment), and performs initial quality evaluation on each upload node, and calculates an initial score.
In this step, the accelerator may sequentially traverse each upload node in the node list, and respectively perform the following operations:
an upload node is taken out, the node information of the upload node is input into the above evaluation model 1, and an initial Score1 is calculated.
502.10 the accelerator sorts upload nodes in the entire node list by initial Score1, according to 502.7 calculated initial Score of upload nodes.
502.11 the accelerator takes the first L (L is a configuration parameter for controlling the number of connections) unconnected upload nodes from the sorted node list, and establishes connections with them respectively.
502.12 the accelerator sets the initial upload task size of 1 unit size for each upload node that establishes connection (these 1 unit size upload tasks are divided from the whole upload task of 502.8).
The process 503: distribution process of uploading task
503.1 the accelerator is triggered when the connection with an upload node is completed, or after a resource of an upload task has been downloaded from the upload node (i.e. the upload node completes an upload task), and records information of the upload node, including the calculated speed S at which the upload node has completed the upload task last time.
503.2 the accelerator fetches the first upload task from the task pool at 502.8, with task size denoted as a, start point denoted as X (in this case a position, e.g. 500KB), play point of the on-demand video denoted as Y (in this case a position, e.g. 1500KB), and bitrate denoted as W (unit KB/sec).
503.3 the accelerator calculates the time difference between the starting point and the playing point according to the task information of 503.2: duration ═ X-Y)/W.
503.4 the accelerator calculates the task period T according to the Duration calculated by 503.3.
a) Duration <3s, then duty cycle: t is 3 s;
b) duration > -3 s and Duration < -10 s, the duty cycle: t ═ Duration;
c) duration >10s, then duty cycle: t10 s.
503.5 the accelerator calculates the size of the upload task that can be allocated by the upload node in 503.1 according to the speed S calculated by 503.1 and the task period T calculated by 503.4: size' is the product of S and T, and is a fraction of an integer multiple of the unit Size M (to reduce errors). For example, if the speed S is 16KB/S, the task period T is 10S, and the unit size M is 50KB, the calculated product is 160KB, and the integer multiple of M is 150 KB.
503.6 the accelerator allocates a task for the uploading node. If the size of the upload task fetched in 503.2 is denoted as a, and the size of the upload task that can be allocated by the upload node calculated according to 503.5 is denoted as B, the allocation principle is as follows:
a) a < ═ B: and (3) taking the whole uploading task in 503.2, distributing the whole uploading task to the uploading node, and ending distribution.
b) A > B: and taking out the tasks with the size of the former B from the uploading tasks taken out from 503.2, distributing the tasks to the uploading node, and putting the remaining uploading tasks with the sizes of A-B back to the task pool. Such as: 503.2 the interval of the resource corresponding to the upload task taken out is [100KB,1000KB), a is 900KB, the size B of the upload task that can be allocated by the upload node is 60KB, the interval of the resource corresponding to the upload task allocated to the upload node is [100KB,160KB), and the resource [160KB,1000KB) of the remaining interval is put back as an upload task in the task pool to wait for the next allocation.
The process 504: downloading process of uploading task
504.1 the accelerator (or download node) allocates an upload task to the upload node according to the process 503, and then generates a session information together with the allocated upload task and the upload node information of 503.1, and records the current time: t0 (unit: ms).
504.2 the accelerator (or download node) adds 504.1 the created session to the current list of sessions.
504.3 the accelerator (or download node) constructs the upload task in the session created by 504.1 as an upload task request to be sent to the corresponding upload node. The request may be in a proprietary protocol, and the content includes the resource ID, the Range information of the request, and so on.
504.4 the upload node receives the upload task request sent by the download node.
504.5, the upload node parses 504.4 the received upload task request to obtain the resource ID and the Range information of the upload task.
504.6 the uploading node searches the resource information from the local resource list according to the resource ID information obtained from 504.5, including the MD5 value of the file, the storage path of the file, etc.
504.7 the upload node opens the file according to the file storage path found at 504.6.
504.8 the upload node reads the data of Range interval acquired by 4.5 according to the file opened by 504.7.
504.9 the upload node returns 504.8 the read data to the download node.
504.10 the accelerator (or download node) receives 504.9 the data from the upload node.
504.11 the accelerator (or download node) repeats step 504.10 until all data is received, recording the current time T1 (in ms).
504.12 after the accelerator (or the downloading node) finishes downloading the resource of an upload task, it resets the state of the upload node that finishes the upload task to idle state from the session node, and triggers the process 505 (node quality evaluation) and the process 506 (task check).
The process 505: secondary assessment of quality of uploading node
505.1 the accelerator triggers a secondary assessment of the quality of the upload node that completed an upload task after 504.12 completed an upload task.
505.2 the accelerator calculates the time of use of the current upload task from the task start time T0 of 504.2 and the task end time T1 of 504.11: t' T1-T0 in ms.
505.3 the accelerator calculates the speed of task completion based on the SIZE of the upload task, SIZE (in KB) and the time of use of the task at 505.2: s ═ SIZE/(T'/1000.0), unit KB/S. And updating the speed of the uploading node for completing the uploading task.
505.4 the accelerator calculates the score corresponding to the uploading node through a mathematical model according to the speed of completing the uploading task calculated by 505.3: score2 ═ (atan (S/90.0)/1.571) × 200.0. The final result maps to the interval of (0, 200). Score of upload node is updated with Score 2.
505.5 the accelerator reorders the upload nodes in the node list from high to low by scores (Score 2 for upload nodes that completed at least one upload task; Score1 for upload nodes that have not completed an upload task) based on the updated Score of 505.4.
505.6 the accelerator extracts the upload node with the highest score of service capability representing the node from the 505.5 sorted node list, and the state is the idle state.
The process 506: uploading task check (with node completing uploading task trigger and periodic trigger two trigger modes)
506.1 the accelerator traverses 504.2 the session list, checking the upload task in each session.
506.2 the accelerator checks if the upload task is out of date, or other reclamation conditions are met. If the session is not expired and any recovery condition is not met, taking out the next session for continuous inspection; if the upload task is out of date or some reclamation condition is met, step 506.3 is performed.
506.3 the accelerator calculates the remaining task amount of the upload task: the remaining task amount is the total task amount of the uploading task-the completed task amount.
506.4 the accelerator reclaims the remaining amount of tasks calculated at 506.3 to a task pool.
506.5 the accelerator pair 506.4 re-orders the reclaimed task pool from low to high according to the starting point of the uploading task. Such as after sorting to obtain:
[26KB,30KB),[60KB,70KB),[200KB,30000KB)。
506.6 the accelerator triggers a new upload task allocation according to the ordering of the upload nodes 505.6 and the new task pool 506.5, and repeats the processes 504, 505, 506 after allocation until all upload tasks are completed.
In the video-on-demand based on the P2P technology, the effects of improving the fluency, reducing the pause rate and improving the playing experience of the user can be achieved by optimizing task allocation.
In another embodiment, an apparatus for task allocation in a peer-to-peer network includes: a processor and a memory;
the processor is used for storing a program for task allocation; when being read and executed by the processor, the program for task allocation performs the following operations:
determining the service capacity of each node according to the condition that each node corresponding to the resource to be shared processes the uploading task; the resource to be shared is divided into a plurality of uploading tasks to be uploaded;
and allocating uploading tasks for the nodes according to the service capacity of each node.
In one implementation, the service capabilities of the node may include one or more of the following parameters:
the speed of the node completing the uploading task;
the time length from sending the uploading task to the node to receiving the first resource corresponding to the uploading task;
the average speed of the node's transmission resources;
the real-time speed of the node transmission resource;
the cost of use of the node.
In an implementation manner, the determining, according to a condition that each node corresponding to the resource to be shared processes the upload task, service capabilities of each node may include:
respectively calculating initial scores of all nodes according to attribute data of all nodes corresponding to resources to be shared, and taking the initial scores of the nodes as scores representing the service capacity of the nodes;
after the node finishes at least one uploading task, updating a score representing the service capability of the node according to the condition that the node processes the uploading task;
the allocating the uploading task to the nodes according to the service capabilities of the nodes respectively comprises:
when the uploading tasks need to be distributed, the uploading tasks are distributed to the nodes in sequence according to the sequence that the scores representing the service capabilities of the nodes are from large to small.
In this implementation, the attribute data of the node may include one or more of the following:
terminal type, area information, operator information, network type.
In this implementation, the initial score of a node may be equal to the result of weighted summation of scores of attribute data of each node.
In one implementation, the calculating the score representing the service capability of the node according to the condition that the node processes the uploading task may include:
and mapping the completion speed of the node to the uploading task in a preset value interval through an arc tangent function to obtain a score representing the service capability of the node.
In this implementation manner, the completion speed of the node pair for the upload task may be the completion speed of the upload task that the node pair has been allocated for the last time, the completion speed of the upload tasks that the node pair has been allocated for the last several times, or the average completion speed of all the upload tasks that the node pair has completed.
In an implementation manner, the allocating an upload task to a node according to the service capability of each node may include:
respectively calculating the size of an uploading task which can be completed by each node in a task period according to the service capacity of each node;
and allocating the uploading tasks to the nodes according to the size of the uploading tasks which can be completed by each node in the task period.
In this implementation manner, allocating the upload task to the node according to the size of the upload task that can be completed by each node in the task period may include:
for each node, respectively distributing N uploading tasks with unit size; for a node, N is the largest integer that enables the product of N and the unit size to be no greater than the size of the upload task that the node can complete in the task period.
In this implementation manner, the allocating the upload task to the node according to the size of the upload task that can be completed by each node in the task period may include:
the following operations are respectively carried out on each node:
when the size A of the uploading task to be distributed is not larger than the size B of the uploading task which can be distributed by the node, distributing the uploading task to be distributed to the node; the size of the uploading task which can be distributed by the node is not larger than the size of the uploading task which can be completed by the node in the task period;
and when the size A of the uploading task to be distributed is larger than the size B of the uploading task which can be distributed by the node, dividing the uploading task with the size B from the uploading task to be distributed and distributing the uploading task to the node.
In this implementation, when the program for performing task allocation is read and executed by the processor, the following operations may be further performed:
and respectively allocating an uploading task with a preset size to each node corresponding to the resource to be shared before determining the service capacity of each node according to the condition that each node corresponding to the resource to be shared processes the uploading task.
In this embodiment, when the program for performing task allocation is read and executed by the processor, the operations performed may correspond to steps S110 to S120 of the first embodiment; other implementation details can be found in embodiments one-three.
Seventh embodiment, a task allocation apparatus in a peer-to-peer network, as shown in fig. 3, includes:
the capacity determining module 71 is configured to determine service capacities of the nodes according to a condition that each node corresponding to the resource to be shared processes the upload task; the resource to be shared is divided into a plurality of uploading tasks to be uploaded;
and the distribution module 72 is configured to distribute the uploading task for the nodes according to the service capabilities of the nodes, respectively.
In one implementation, the service capabilities of the node may include one or more of the following parameters:
the speed of the node completing the uploading task;
the time length from sending the uploading task to the node to receiving the first resource corresponding to the uploading task;
the average speed of the node's transmission resources;
the real-time speed of the node transmission resource;
the cost of use of the node.
In an implementation manner, the determining, by the capability determining module, service capabilities of the nodes according to a condition that the nodes corresponding to the resource to be shared process an upload task may include:
the capacity determining module calculates initial scores of all nodes according to attribute data of all nodes corresponding to resources to be shared respectively, and the initial scores of the nodes are used as scores representing the service capacity of the nodes; after the node finishes at least one uploading task, updating a score representing the service capability of the node according to the speed of finishing the uploading task by the node;
the allocating module may allocate the upload task to the node according to the service capability of each node, respectively, and may include:
and when the uploading tasks need to be distributed, the distribution module distributes the uploading tasks for the nodes in sequence according to the sequence that the scores representing the service capabilities of the nodes are from large to small.
In this implementation, the attribute data of the node may include one or more of the following:
terminal type, area information, operator information, network type.
In this implementation, the initial score of a node may be equal to the result of weighted summation of scores of attribute data of each node.
In one implementation, the calculating the score representing the service capability of the node according to the condition that the node processes the uploading task may include:
and mapping the completion speed of the node to the uploading task in a preset value interval through an arc tangent function to obtain a score representing the service capability of the node.
In this implementation manner, the completion speed of the node pair for the upload task may be the completion speed of the upload task that the node pair has been allocated for the last time, the completion speed of the upload tasks that the node pair has been allocated for the last several times, or the average completion speed of all the upload tasks that the node pair has completed.
In one implementation, the allocating module, according to the service capabilities of the nodes, may allocate an upload task to the nodes, including:
the distribution module calculates the size of an uploading task which can be completed by each node in a task period according to the service capacity of each node; and allocating the uploading tasks to the nodes according to the size of the uploading tasks which can be completed by each node in the task period.
In this implementation manner, the allocating module may allocate the upload task to the node according to the size of the upload task that can be completed by each node in the task period, respectively, where:
the distribution module distributes N uploading tasks with unit size to each node respectively; for a node, N is the largest integer that enables the product of N and the unit size to be no greater than the size of the upload task that the node can complete in the task period.
In this implementation manner, the allocating module allocates the upload task to the node according to the size of the upload task that can be completed by each node in the task period, respectively, including:
the distribution module respectively performs the following operations on each node:
when the size A of the uploading task to be distributed is not larger than the size B of the uploading task which can be distributed by the node, distributing the uploading task to be distributed to the node; the size of the uploading task which can be distributed by the node is not larger than the size of the uploading task which can be completed by the node in the task period;
and when the size A of the uploading task to be distributed is larger than the size B of the uploading task which can be distributed by the node, dividing the uploading task with the size B from the uploading task to be distributed and distributing the uploading task to the node.
In this implementation manner, the allocation module may be further configured to allocate an upload task of a predetermined size to each node corresponding to the resource to be shared before the capability determination module determines the service capability of each node according to the condition that each node corresponding to the resource to be shared processes the upload task.
In this embodiment, the operations performed by the speed calculating module and the allocating module may correspond to steps S110 and S120 of the first embodiment, respectively; other implementation details can be found in embodiments one-three.
An embodiment eight, a task allocation apparatus in a peer-to-peer network, includes: a processor and a memory;
the processor is used for storing a program for task allocation; when being read and executed by the processor, the program for task allocation performs the following operations:
respectively calculating initial scores of all nodes according to attribute data of all nodes corresponding to resources to be shared;
sequentially distributing uploading tasks for the nodes according to the sequence of scores from large to small; and the resources to be shared are divided into a plurality of uploading tasks for uploading.
In this embodiment, when the program for performing task allocation is read and executed by the processor, the operations performed may correspond to steps S210 to S220 in the fourth embodiment; see example four for further implementation details.
An embodiment ninth, a task allocation apparatus in a peer-to-peer network, includes:
the evaluation module is used for calculating the initial scores of all the nodes according to the attribute data of all the nodes corresponding to the resources to be shared;
the task allocation module is used for sequentially allocating uploading tasks to the nodes according to the sequence of scores from large to small; and the resources to be shared are divided into a plurality of uploading tasks for uploading.
In this embodiment, the operations performed by the evaluation module and the task allocation module may respectively correspond to steps S210 and S220 of the second embodiment; see example four for further implementation details.
It will be understood by those skilled in the art that all or part of the steps of the above methods may be implemented by instructing the relevant hardware through a program, and the program may be stored in a computer readable storage medium, such as a read-only memory, a magnetic or optical disk, and the like. Alternatively, all or part of the steps of the above embodiments may be implemented using one or more integrated circuits. Accordingly, each module/unit in the above embodiments may be implemented in the form of hardware, and may also be implemented in the form of a software functional module. The present application is not limited to any specific form of hardware or software combination.
There are, of course, many other embodiments of the invention that can be devised without departing from the spirit and scope thereof, and it will be apparent to those skilled in the art that various changes and modifications can be made herein without departing from the spirit and scope of the invention.

Claims (17)

1. A method of task allocation in a peer-to-peer network, comprising:
updating the service capacity of each node according to the condition that each node corresponding to the resource to be shared processes the uploading task after starting to process the uploading task; the resource to be shared is divided into a plurality of uploading tasks to be uploaded;
respectively distributing an uploading task for the nodes according to the service capacity of each node;
the updating the service capacity of each node according to the condition that each node corresponding to the resource to be shared processes the uploading task after the uploading task is started, comprises:
respectively calculating initial scores of all nodes according to attribute data of all nodes corresponding to resources to be shared, and taking the initial scores of the nodes as scores representing the service capacity of the nodes;
after the node finishes at least one uploading task, updating a score representing the service capability of the node according to the condition that the node processes the uploading task;
the allocating the uploading task to the nodes according to the service capabilities of the nodes respectively comprises:
when the uploading tasks need to be distributed, the uploading tasks are distributed to the nodes in sequence according to the sequence that the scores representing the service capabilities of the nodes at present are from large to small;
the calculating the score representing the service capability of the node according to the condition that the node processes the uploading task comprises the following steps:
and mapping the completion speed of the node to the uploading task in a preset value interval through an arc tangent function to obtain a score representing the service capability of the node.
2. The task allocation method of claim 1, wherein the service capabilities of the node comprise: the speed at which the node completes the upload task.
3. The task allocation method of claim 1, wherein the attribute data of the node comprises one or more of:
terminal type, area information, operator information, network type.
4. A task allocation method according to claim 3, characterized in that:
the initial score of a node is equal to the result of the weighted summation of the scores of the attribute data of the node.
5. The task allocation method according to claim 1, wherein the allocating the upload task to the node according to the service capability of each node comprises:
respectively calculating the size of an uploading task which can be completed by each node in a task period according to the service capacity of each node;
and allocating the uploading tasks to the nodes according to the size of the uploading tasks which can be completed by each node in the task period.
6. The task allocation method according to claim 5, wherein the allocating the upload task to the node according to the size of the upload task that can be completed by each node in the task period comprises:
for each node, respectively distributing N uploading tasks with unit size; for a node, N is the largest integer that enables the product of N and the unit size to be no greater than the size of the upload task that the node can complete in the task period.
7. The task allocation method according to claim 5, wherein the allocating the upload task to the node according to the size of the upload task that can be completed by each node in the task period comprises:
the following operations are respectively carried out on each node:
when the size A of the uploading task to be distributed is not larger than the size B of the uploading task which can be distributed by the node, distributing the uploading task to be distributed to the node; the size of the uploading task which can be distributed by the node is not larger than the size of the uploading task which can be completed by the node in the task period;
and when the size A of the uploading task to be distributed is larger than the size B of the uploading task which can be distributed by the node, dividing the uploading task with the size B from the uploading task to be distributed and distributing the uploading task to the node.
8. The task allocation method according to claim 5, wherein the determining the service capability of each node before the processing of the upload task by each node corresponding to the resource to be shared, respectively, further comprises:
and respectively allocating an uploading task with a preset size to each node corresponding to the resource to be shared.
9. A method of task allocation in a peer-to-peer network, comprising:
respectively calculating initial scores of all nodes according to attribute data of all nodes corresponding to resources to be shared, and taking the initial scores of the nodes as scores representing the service capacity of the nodes;
after the node finishes at least one uploading task, updating a score representing the service capability of the node according to the condition that the node processes the uploading task;
sequentially distributing uploading tasks for the nodes according to the sequence of scores from large to small; the resource to be shared is divided into a plurality of uploading tasks to be uploaded;
wherein, according to the situation that the node processes the uploading task, updating the score representing the service capability of the node comprises:
and mapping the completion speed of the node to the uploading task in a preset value interval through an arc tangent function to obtain a score representing the service capability of the node.
10. A task allocation apparatus in a peer-to-peer network, comprising: a processor and a memory;
the method is characterized in that:
the processor is used for storing a program for task allocation; when being read and executed by the processor, the program for task allocation performs the following operations:
updating the service capacity of each node according to the condition that each node corresponding to the resource to be shared processes the uploading task after starting to process the uploading task; the resource to be shared is divided into a plurality of uploading tasks to be uploaded;
respectively distributing an uploading task for the nodes according to the service capacity of each node;
the updating the service capacity of each node according to the condition that each node corresponding to the resource to be shared processes the uploading task after the uploading task is started, comprises:
respectively calculating initial scores of all nodes according to attribute data of all nodes corresponding to resources to be shared, and taking the initial scores of the nodes as scores representing the service capacity of the nodes;
after the node finishes at least one uploading task, updating a score representing the service capability of the node according to the condition that the node processes the uploading task;
the allocating the uploading task to the nodes according to the service capabilities of the nodes respectively comprises:
when the uploading tasks need to be distributed, the uploading tasks are distributed to the nodes in sequence according to the sequence that the scores representing the service capabilities of the nodes at present are from large to small;
the calculating the score representing the service capability of the node according to the condition that the node processes the uploading task comprises the following steps:
and mapping the completion speed of the node to the uploading task in a preset value interval through an arc tangent function to obtain a score representing the service capability of the node.
11. The task distribution apparatus of claim 10, wherein the service capabilities of the node comprise: the speed at which the node completes the upload task.
12. The task allocation device according to claim 10, wherein the allocating the upload task to the node according to the service capability of each node comprises:
respectively calculating the size of an uploading task which can be completed by each node in a task period according to the service capacity of each node;
and distributing the uploading tasks for the nodes according to the size of the uploading tasks which can be completed by each node in the task period.
13. A task allocation device according to claim 12, wherein said program for task allocation, when read executed by said processor, further performs the following operations:
and respectively allocating an uploading task with a preset size to each node corresponding to the resource to be shared before determining the service capacity of each node according to the condition that each node corresponding to the resource to be shared processes the uploading task.
14. A task allocation apparatus in a peer-to-peer network, comprising:
the capacity determining module is used for updating the service capacity of each node according to the condition that each node corresponding to the resource to be shared processes the uploading task after the uploading task is started; the resource to be shared is divided into a plurality of uploading tasks to be uploaded;
the capacity determining module respectively processes the uploading task after starting to process the uploading task according to the situation that each node corresponding to the resource to be shared processes the uploading task, and the updating of the service capacity of each node comprises the following steps:
the capacity determining module calculates initial scores of the nodes according to attribute data of the nodes corresponding to the resources to be shared respectively, and the initial scores of the nodes are used as scores representing the service capacity of the nodes; after the node finishes at least one uploading task, updating a score representing the service capability of the node according to the condition that the node processes the uploading task; the updating of the score representing the service capability of the node by the capability determination module according to the condition that the node processes the upload task comprises: the capacity determining module maps the completion speed of the node to the uploading task into a preset value interval through an arc tangent function to obtain a score representing the service capacity of the node;
the distribution module is used for distributing uploading tasks for the nodes according to the service capacity of each node;
the distribution module distributes the uploading tasks for the nodes according to the service capacity of each node respectively, and the distribution module comprises the following steps:
and when the uploading tasks need to be distributed, the distribution module distributes the uploading tasks for the nodes in sequence according to the sequence that the scores representing the service capabilities of the nodes are from large to small.
15. The task distribution apparatus of claim 14, wherein the service capabilities of the node comprise: the speed at which the node completes the upload task.
16. The task allocation device according to claim 14, wherein the allocating module allocates the upload task to the node according to the service capability of each node, respectively, includes:
the distribution module calculates the size of an uploading task which can be completed by each node in a task period according to the service capacity of each node; and allocating the uploading tasks to the nodes according to the size of the uploading tasks which can be completed by each node in the task period.
17. The task assigning apparatus according to claim 16, wherein:
the distribution module is further configured to distribute an upload task of a predetermined size to each node corresponding to the resource to be shared before the capability determination module determines the service capability of each node according to the condition that each node corresponding to the resource to be shared processes the upload task.
CN201711406747.7A 2017-12-22 2017-12-22 Task allocation method and device in peer-to-peer network Active CN109962947B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201711406747.7A CN109962947B (en) 2017-12-22 2017-12-22 Task allocation method and device in peer-to-peer network

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201711406747.7A CN109962947B (en) 2017-12-22 2017-12-22 Task allocation method and device in peer-to-peer network

Publications (2)

Publication Number Publication Date
CN109962947A CN109962947A (en) 2019-07-02
CN109962947B true CN109962947B (en) 2022-05-27

Family

ID=67019519

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201711406747.7A Active CN109962947B (en) 2017-12-22 2017-12-22 Task allocation method and device in peer-to-peer network

Country Status (1)

Country Link
CN (1) CN109962947B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109995824B (en) * 2017-12-29 2022-10-04 阿里巴巴集团控股有限公司 Task scheduling method and device in peer-to-peer network
CN110650358B (en) * 2019-09-30 2022-01-28 北京奇艺世纪科技有限公司 Node distribution method, device, node distribution server and medium
CN111082982B (en) * 2019-12-12 2022-11-08 深圳市网心科技有限公司 Data transmission method, electronic device, system and medium
CN112818021B (en) * 2021-02-23 2024-02-02 东莞中国科学院云计算产业技术创新与育成中心 Data request processing method, device, computer equipment and storage medium
CN114172952A (en) * 2021-11-12 2022-03-11 杭州房象网络科技有限公司 Multi-site service data distribution method, system, equipment and medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103024081A (en) * 2013-01-04 2013-04-03 福建星网视易信息系统有限公司 Peer-to-peer communication terminal dispatching method adaptable to time-effect-guaranteed communication systems
CN103327046A (en) * 2012-03-21 2013-09-25 腾讯科技(深圳)有限公司 P2SP system scheduling method, equipment and system based on node service capacity
WO2015055100A1 (en) * 2013-10-18 2015-04-23 Tencent Technology (Shenzhen) Company Limited Peer-to-peer upload scheduling

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103686946B (en) * 2012-09-18 2016-08-24 中国科学院声学研究所 The system of selection of mobile P 2 P node and system in a kind of heterogeneous wireless network
CN106027673B (en) * 2016-07-06 2019-07-12 北京奇艺世纪科技有限公司 The control and training method, device that resource pushes in advance

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103327046A (en) * 2012-03-21 2013-09-25 腾讯科技(深圳)有限公司 P2SP system scheduling method, equipment and system based on node service capacity
CN103024081A (en) * 2013-01-04 2013-04-03 福建星网视易信息系统有限公司 Peer-to-peer communication terminal dispatching method adaptable to time-effect-guaranteed communication systems
WO2015055100A1 (en) * 2013-10-18 2015-04-23 Tencent Technology (Shenzhen) Company Limited Peer-to-peer upload scheduling

Also Published As

Publication number Publication date
CN109962947A (en) 2019-07-02

Similar Documents

Publication Publication Date Title
CN109962947B (en) Task allocation method and device in peer-to-peer network
KR101544485B1 (en) Method and apparatus for selecting a node to place a replica in cloud storage system
CN108173774B (en) Client upgrading method and system
US20170192819A1 (en) Method and electronic device for resource allocation
CN109981751B (en) File transmission method and system, computer equipment and storage medium
CN109379448B (en) File distributed deployment method and device, electronic equipment and storage medium
US10116740B2 (en) Peer-to-peer network prioritizing propagation of objects through the network
CN113181658A (en) Edge computing node scheduling method, device, equipment and medium
CN105872002A (en) Video program obtaining method and system, and device
CN101626389B (en) Network node management method
CN103327121A (en) P2P (Peer-to-Peer Network) network resource transmission method and device for same
CN105791254B (en) Network request processing method and device and terminal
CN108683730B (en) Resource scheduling method, service server, client terminal, network system and medium
CN106453460B (en) File distribution method, device and system
US20240106890A1 (en) Peer-to-peer network scheduling method and system
CN101741884A (en) Distributed storage method and device
US20240106891A1 (en) Peer-to-peer network scheduling method and system
CN111935306B (en) Node scheduling method and device
JP2012118709A (en) Distribution system, storage capacity decision program, and storage capacity decision method
CN105610869B (en) Method and device for scheduling streaming media
CN111431813A (en) Access current limiting method, device and storage medium
CN109995824B (en) Task scheduling method and device in peer-to-peer network
CN110191362B (en) Data transmission method and device, storage medium and electronic equipment
CN109474696B (en) Network service method, device, electronic equipment and readable storage medium
CN114615333B (en) Resource access request processing method, device, equipment and 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
REG Reference to a national code

Ref country code: HK

Ref legal event code: DE

Ref document number: 40010304

Country of ref document: HK

GR01 Patent grant
GR01 Patent grant