CN109962947A - Method for allocating tasks and device in a kind of peer-to-peer network - Google Patents

Method for allocating tasks and device in a kind of peer-to-peer network Download PDF

Info

Publication number
CN109962947A
CN109962947A CN201711406747.7A CN201711406747A CN109962947A CN 109962947 A CN109962947 A CN 109962947A CN 201711406747 A CN201711406747 A CN 201711406747A CN 109962947 A CN109962947 A CN 109962947A
Authority
CN
China
Prior art keywords
node
task
upload
upload task
resource
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201711406747.7A
Other languages
Chinese (zh)
Other versions
CN109962947B (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

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 the method for allocating tasks and device in a kind of peer-to-peer network, wherein the method for allocating tasks in peer-to-peer network includes: the case where uploading task according to the corresponding each node processing of resource to be shared respectively, to determine the service ability of each node;Wherein, the resource to be shared is divided into multiple upload tasks and is uploaded;Respectively according to the service ability of each node, upload task is distributed for node.At least one embodiment of the application can optimize the distribution that task is uploaded in peer-to-peer network, improve transfer efficiency in the resource of peer-to-peer network.

Description

Method for allocating tasks and device in a kind of peer-to-peer network
Technical field
The present invention relates to the method for allocating tasks and device in network field more particularly to a kind of peer-to-peer network.
Background technique
Reciprocity (Peer to Peer, P2P) is a kind of point that task and workload are distributed between fellow (Peer) A kind of networking or latticed form that cloth application architecture, which is P2P computing model, to be formed in application layer.It is every in P2P network system A terminal is properly termed as a P2P node.In P2P network system, shared resource between node and node can mutually divide Resource is enjoyed, for example uploads and download resource between each other;In first resource sharing, the P2P node for downloading resource is properly termed as Node is downloaded, the P2P node for uploading resource is properly termed as uploading nodes.
In the P2P network system for serving video on demand, in order to guarantee that user plays the fluency of video, to P2P skill Art has very high requirement.
In P2P network system, in the links of resource downloading, scheduling, the distribution of screening and task to P2P node It is very important a ring.
Currently, there is a kind of detailed process of the distribution method of P2P task to include the following steps 101~106:
101, the accelerator in the P2P node to be downloaded starts downloading task, should to the request of the server of P2P network The corresponding node listing of resource.
Wherein, accelerator can refer to the P2P program run on P2P node, can be integrated in inside application (App) One dynamic base or static library are also possible to an independent executable program.
102, downloading task (is also referred to as uploaded appoint hereinafter by accelerator by the P2P task that fixed size resolves into fritter Business), for example, the fritter task of 20KB or so, is uniformly put into task pool, and sort from small to large by the starting point of task.
103, accelerator successively takes out node and establishes connection from the node listing that server returns.
104, for accelerator to the node that connection has been established, the task that foremost is taken out from task pool distributes to the section Being distributed for task is sent to correspondence by network connection by point (node is uploading nodes for the task), accelerator Uploading nodes.
105, accelerator receives the data that uploading nodes are sent, if the data of current downloading task all receive It is complete, number is completed to the task of the uploading nodes and adds 1.Next upload task is got from current task pond again, is distributed on this Pass node.
106, accelerator periodically goes to check current ongoing task list, finds out expired or impossible Its remaining task is recycled, is put into task pool, resequenced by business.
Above scheme has following defect:
(1) for the good node of service ability, task block is too small, will increase the protocol interaction portion of each upload task The network overhead divided, and the efficiency downloaded is lower;For the node of service ability difference, task block seems excessive, will lead to Its completion rate reduces, and is easy to be eliminated.
(2) for uploading nodes, what is received is all the discontinuous task block of fritter, from disk read data when It is very low to wait efficiency, when number of tasks more than one, disk input and output (IO), which will become, restricts the bottleneck that network uploads.
Summary of the invention
The application provides the method for allocating tasks and device in a kind of peer-to-peer network, can optimize to upload in P2P network and appoint The distribution of business improves transfer efficiency in the resource of P2P network.
The application adopts the following technical scheme that.
A kind of method for allocating tasks in peer-to-peer network, comprising:
The case where uploading task according to the corresponding each node processing of resource to be shared respectively, determines the service energy of each node Power;Wherein, the resource to be shared is divided into multiple upload tasks and is uploaded;
Respectively according to the service ability of each node, upload task is distributed for node.
Wherein, the service ability of the node may include following one or more parameters:
The speed of node completion upload task;
From upload task is issued to the node, the time until receiving the corresponding first part of resource of the upload task is long Degree;
The average speed of the node-node transmission resource;
The real-time speed of the node-node transmission resource;
The use cost of the node.
Wherein, described the case where task is uploaded according to resource to be shared corresponding each node processing respectively, each node is determined Service ability may include:
Respectively according to the attribute data of the corresponding each node of resource to be shared, the initial score of each node is calculated, it will Score of the initial score of node as the service ability for indicating the node;
After node completes at least one upload task, according to the node processing upload task the case where, update indicate should The score of the service ability of node;
It is described respectively according to the service ability of each node, distributing upload task for node may include:
When needing to distribute upload task, according to the sequence of the current score for indicating node serve ability from big to small, according to It is secondary to distribute upload task for node.
Wherein, the attribute data of the node may include one or more of:
Terminal type, area information, operator's informaiton, network type.
Wherein, the initial score of a node can be equal to the knot of the score value weighted sum of the node items attribute data Fruit.
Wherein, described the case where task is uploaded according to the node processing, the score for indicating the service ability of the node is calculated May include:
The node is mapped in scheduled value interval, is obtained by arctan function to the completion speed of the task of upload To the score for the service ability for indicating the node.
Wherein, described respectively according to the service ability of each node, distributing upload task for node may include:
Respectively according to the service ability of each node, the big of the upload task that each node can be completed in duty cycle is calculated It is small;
The size for the upload task that can be completed in duty cycle according to each node respectively distributes upload task for node.
Wherein, the size of the upload task that can be completed in duty cycle according to each node respectively is distributed for node Upload task may include:
For each node, the upload task of N number of unit-sized is distributed respectively;For a node, N is the largest, can make N It is not more than the integer of the size for the upload task that the node can be completed in duty cycle with the product of unit-sized.
Wherein, the size of the upload task that can be completed in duty cycle according to each node respectively is distributed for node Upload task may include:
Each node can be proceeded as follows respectively:
It, will be described as size B of the size A of upload task to be allocated no more than the upload task that the node can distribute Upload task to be allocated distributes to the node;Wherein, the size for the upload task which can distribute exists no more than the node The size for the upload task that can be completed in duty cycle;
When the size A of the upload task to be allocated is greater than the size B for the upload task that the node can distribute, from institute State be partitioned into upload task to be allocated size be B upload task distribute to the node.
Wherein, described the case where task is uploaded according to resource to be shared corresponding each node processing respectively, each node is determined Service ability before can also include:
Distribute the upload task an of predefined size respectively for the corresponding each node of resource to be shared.
A kind of method for allocating tasks in peer-to-peer network, comprising:
Respectively according to the attribute data of the corresponding each node of resource to be shared, the initial score of each node is calculated;
According to the sequence of score from big to small, it is followed successively by node distribution upload task;Wherein, the resource to be shared divides It is uploaded into multiple upload tasks.
Task allocation apparatus in a kind of peer-to-peer network, comprising: processor and memory;
The processor is used to save the program for carrying out task distribution;The program for carrying out task distribution exists When reading execution by the processor, proceed as follows:
The case where uploading task according to the corresponding each node processing of resource to be shared respectively, determines the service energy of each node Power;Wherein, the resource to be shared is divided into multiple upload tasks and is uploaded;
Respectively according to the service ability of each node, upload task is distributed for node.
Wherein, the service ability of the node may include following one or more parameters:
The speed of node completion upload task;
From upload task is issued to the node, the time until receiving the corresponding first part of resource of the upload task is long Degree;
The average speed of the node-node transmission resource;
The real-time speed of the node-node transmission resource;
The use cost of the node.
Wherein, described the case where task is uploaded according to resource to be shared corresponding each node processing respectively, each node is determined Service ability may include:
Respectively according to the attribute data of the corresponding each node of resource to be shared, the initial score of each node is calculated, it will Score of the initial score of node as the service ability for indicating the node;
After node completes at least one upload task, according to the node processing upload task the case where, update indicate should The score of the service ability of node;
It is described respectively according to the service ability of each node, distributing upload task for node includes:
When needing to distribute upload task, according to the sequence of the current score for indicating node serve ability from big to small, according to It is secondary to distribute upload task for node.
Wherein, described respectively according to the service ability of each node, distributing upload task for node may include:
Respectively according to the service ability of each node, the big of the upload task that each node can be completed in duty cycle is calculated It is small;
The size for the upload task that can be completed in duty cycle according to each node respectively distributes upload task for node.
Wherein, the program for carrying out task distribution can also carry out such as when reading execution by the processor Lower operation:
The case where uploading task according to the corresponding each node processing of resource to be shared respectively, the service energy of each node is determined Before power, the upload task an of predefined size is distributed respectively for the corresponding each node of resource to be shared.
A kind of task allocation apparatus in peer-to-peer network, comprising:
Ability determining module, for the case where corresponding each node processing of basis resource to be shared uploads task respectively, really The service ability of fixed each node;Wherein, the resource to be shared is divided into multiple upload tasks and is uploaded;
Distribution module, for according to the service ability of each node, distributing upload task respectively for node.
Wherein, the service ability of the node may include following one or more parameters:
The speed of node completion upload task;
From upload task is issued to the node, the time until receiving the corresponding first part of resource of the upload task is long Degree;
The average speed of the node-node transmission resource;
The real-time speed of the node-node transmission resource;
The use cost of the node.
Wherein, the ability determining module uploads the feelings of task according to the corresponding each node processing of resource to be shared respectively Condition determines that the service ability of each node may include:
The ability determining module according to the attribute data of the corresponding each node of resource to be shared, calculates each section respectively The initial score of point, using the initial score of node as the score for the service ability for indicating the node;When node completes at least one After a upload task, according to the node processing upload task the case where, update indicate the node service ability score;
Respectively according to the service ability of each node, distribute upload task for node includes: the distribution module
The distribution module when needing to distribute upload task, according to the current score for indicating node serve ability from greatly to Small sequence is followed successively by node distribution upload task.
Wherein, respectively according to the service ability of each node, distribute upload task for node may include: the distribution module
The distribution module respectively according to the service ability of each node, calculate each node can be completed in duty cycle it is upper The size of biography task;The size for the upload task that can be completed in duty cycle according to each node respectively uploads for node distribution Task.
Wherein, the distribution module can be also used for corresponding according to resource to be shared respectively in the ability determining module Each node processing uploads the case where task, before the service ability for determining each node, for the corresponding each node difference of resource to be shared Distribute the upload task an of predefined size.
In at least one embodiment of the application, the distribution of upload task is carried out according to the service ability of node, can be optimized The distribution that task is uploaded in P2P network, to promote the performance of entire P2P network.
In at least one embodiment of the application, by being assessed in service ability of the initial stage to node, it can make Upload task preferentially distributes to the good node of service ability, improves the completeness of upload task.By uploading the stage to resource Node evaluation, can the node strong to service ability preferentially distribute upload task, and taken into account again to not completing upload task The certain chance of node go to attempt, the service ability of these nodes is excavated, to improve the node resource benefit of P2P network entirety With rate.
In at least one embodiment of the application, the case where task is uploaded according to node processing, to the service ability of node into Row assessment, according to the service ability of node, the dynamic upload task for distributing suitable node upload ability is strong for service ability Big, weak for the service ability node of the upload task that is assigned to of node, the upload task being assigned to is small.Finally, save P2P The service ability of point is all fully utilized, and promotes entirety P2P network performance, and can guarantee the upload task of node again Completeness.
In at least one embodiment of the application, the service ability of node can be estimated, and carry out most to node sequencing with this The distribution of the upload task of beginning, so as to optimize the distribution for uploading task in P2P network, to promote entire P2P network Performance.
Certainly, any product for implementing the application does not necessarily require achieving all the advantages described above at the same time.
Detailed description of the invention
Fig. 1 is the flow chart of the method for allocating tasks in the peer-to-peer network of embodiment one;
Fig. 2 is the flow chart of the method for allocating tasks in the peer-to-peer network of example IV;
Fig. 3 is the schematic diagram of the task allocation apparatus in the peer-to-peer network of embodiment seven.
Specific embodiment
It is described in detail below in conjunction with technical solution of the accompanying drawings and embodiments to the application.
It should be noted that each feature in the embodiment of the present application and embodiment can be tied mutually if do not conflicted It closes, within the scope of protection of this application.In addition, though logical order is shown in flow charts, but in certain situations Under, it can be with the steps shown or described are performed in an order that is different from the one herein.
In one configuration, the calculating equipment for carrying out the task distribution in peer-to-peer network may include one or more processors (CPU), input/output interface, network interface and memory (memory).
Memory may include the non-volatile memory in computer-readable medium, random access memory (RAM) and/or The forms such as Nonvolatile memory, such as read-only memory (ROM) or flash memory (flash RAM).Memory is computer-readable medium Example.Memory may include one or more modules.
Computer-readable medium includes permanent and non-permanent, removable and non-movable storage medium, can be by appointing What method or technique realizes that information stores.Information can be computer readable instructions, data structure, the module of program or other Data.The example of the storage medium of computer includes, but are not limited to phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other kinds of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory techniques, CD-ROM are read-only Memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, disk storage or other magnetic Property storage equipment or any other non-transmission medium, can be used for storing and can be accessed by a computing device information.
A kind of method for allocating tasks in embodiment one, peer-to-peer network, as shown in Figure 1, including step S110~S120:
S110, the case where uploading task according to the corresponding each node processing of resource to be shared respectively, determine the clothes of each node Business ability;Wherein, the resource to be shared is divided into multiple upload tasks and is uploaded;
S120, respectively according to the service ability of each node, distribute upload task for node.
In the present embodiment, the distribution of upload task can be carried out according to the service ability of node, can be optimized in P2P network The distribution of upload task, to promote the performance of entire P2P network.
In the present embodiment, above-mentioned node is P2P node, can be, but not limited to include the terminals such as computer, mobile phone, plate.
In the present embodiment, when a P2P node needs to download certain resources (being such as but not limited to one video of program request), The P2P node (for the resource to be downloaded, the P2P node is as downloading node) can establish a downloading task, right Required resource makes requests, required resource, that is, above-mentioned resource to be shared.
In the present embodiment, resource to be shared can be divided into multiple upload tasks, or it may also be said that downloading node institute It (is " downloading task " for downloading node, for uploading that the downloading task of foundation, which can be divided into multiple upload tasks, It for the node of the resource, is " uploading task ");As can be seen that a upload task resource to be uploaded, is wait share money A part in source;For example resource to be shared shares 910KB, can be divided into upload task and 1 that 45 sizes are 20KB Size is the upload task of 10KB.Wherein, division mode can singly be not limited to be divided according to the resource of fixed size, can be certainly Row setting division mode.
In the present embodiment, the corresponding node of resource to be shared can be the node for preserving resource to be shared, it may be assumed that it is described to Share the uploading nodes of resource.Wherein, when downloading node is requested when sharing resource, server can be according to resource to be shared In identifier lookup P2P network, the node of the resource to be shared is preserved, and returns to downloading node institute in a manner of node listing The information of the node found.
It, can be by the corresponding resource point one of the upload task after a uploading nodes receive upload task in the present embodiment It is secondary or be repeatedly sent to downloading node.
In the present embodiment, if some node was not in the node for preserving resource to be shared that server is returned The case where processed upload task, the then corresponding each node processing of basis resource to be shared uploads task respectively, determine each node Service ability when, this part of nodes can not included or determine the service ability of this part of nodes at a default value.
In the present embodiment, it is possible to only distribute upload task for part of nodes;For example the service energy of 20 nodes is determined Power, but the stronger 10 nodes distribution upload task of wherein service ability may be only selected, and another 10 nodes are then without dividing Match.It is of course also possible to which the node for preserving resource to be shared returned to the node for determining service ability or server is all Distribute upload task.
In the present embodiment, resource to be shared may include text file to be shared, data, audio, video etc.;It can be One complete file, a part being also possible in file.
In a kind of implementation, above-mentioned method for allocating tasks can be executed by the P2P node for needing to download resource;Can with but It is not limited to be executed by the accelerator in the P2P node.In other implementations, under above-mentioned method for allocating tasks can also be by needing The other modules carried in the P2P node of resource execute.
In the present embodiment, the executing subject of above-mentioned method for allocating tasks, can be with when distributing upload task for a node First and the node establishes connection, establishes after successful connection and the upload task distributed is sent to the node again.
In the present embodiment, during uploading resource to be allocated, step S110 and S120, which can be, constantly to be repeated, is parallel Two steps;For example can be carried out step S110 after thering is node to start to process upload task, determining service ability When can carry out step S120 parallel.It when carrying out step S120, is allocated according to currently determining service ability;For example it takes Business ability is to complete the speed of upload task, it is assumed that the speed of node a completion upload task is when distribution uploads task task 1 V1, after distributed upload task task 1 is completed in node a, the speed that node a completes upload task becomes v2;If this When reallocation upload task, then be using v2 as node a complete task speed;That is, foundation when distribution upload task Service ability, can with the actual treatment of node upload task the case where constantly update.
In a kind of implementation, the service ability of the node may include following one or more parameters:
The speed of node completion upload task;
From upload task is issued to the node, the time until receiving the corresponding first part of resource of the upload task is long Degree;
The average speed of the node-node transmission resource;
The real-time speed of the node-node transmission resource;
The use cost of the node.
In this implementation, when the service ability of node includes multiple parameters, can by quantization parameter value and according to The mode that predetermined formula calculates, obtains the score for the service ability for indicating the node.
In this implementation, the speed that node completes upload task can be, but not limited to refer to that node completes the last one The speed of (or nearest one) upload task;For example a node has been completed that 3 upload tasks can then when calculating speed To be that a upload task being recently completed to the node calculates.
Wherein, the speed that node completes upload task can be equal to: the size of the upload task is appointed divided by the upload is completed The time span of business.
Wherein, the size of task is uploaded, that is, uploads the size of the task resource to be uploaded.
Wherein, the time span of the upload task is completed, it is corresponding the upload task can be received equal to downloading node Resource at the time of, at the time of with downloading node being the upload task creation session (issuing upload task in other words to node) it Between the time span that is separated by.
Wherein, the speed that node completes upload task may also mean that node completes the average speed of multiple upload tasks, For example the total size that can be equal to this multiple upload task or is equal to divided by the total time length for completing this multiple upload task The respective average value for completing speed of this multiple upload task.
Wherein, all identical feelings of value for not including other parameters or included other parameters in the service ability of node Under condition, the speed that node completes upload task is faster, then service ability is higher.
Wherein, from upload task is issued to the node, until receiving the corresponding first part of resource of the upload task Time span is properly termed as the response time;It does not include other parameters or included other parameters in the service ability of node It is worth in all identical situation, the response time is shorter, then service ability is higher.
Wherein, the real-time speed of node-node transmission resource can refer to that the node is current in currently processed upload task Transmission speed, can (for example to have been received by the upload task corresponding for downloading node with the size of the resource that the node has transmitted The size of resource), divided by the time used in transfer resource (such as downloading node receive the upload task first part of resource when The time span being separated by between at the time of quarter and calculating speed) it obtains;Or can be with the node in a upload task, this The size (such as size of downloading this resource received of node) of the resource of secondary transmission, divided by this and last transfer resource Between be separated by time span (such as downloading node this at the time of receive the corresponding resource of the upload task with the last time it Difference) it obtains.In all identical situation of value that the service ability of node does not include other parameters or included other parameters, The real-time speed of node-node transmission resource is faster, then service ability is higher.
Wherein, the average speed of node-node transmission resource can refer to the node in multiple upload tasks transmission speed it is flat Mean value, and can the node one upload task multiple resource transmission in, the average value of transmission speed.In the clothes of node Business ability does not include in all identical situation of value of other parameters or included other parameters, and node-node transmission resource is averaged Speed is faster, then service ability is higher.
In practical applications, when considering the service ability of node, weight shared by real-time speed can be greater than average speed The shared weight of degree.Such as: in one embodiment, the weight of real-time speed can be set to 80%, and average speed Weight can be set to 20%;And in another embodiment, the weight of real-time speed can be set to 90%, and average fast The weight of degree can be set to 10%.
Wherein, the use cost of node can the use cost according to corresponding to the pre-save, node affiliated type It obtains;For example arranged from high to low according to use cost, type includes area's core, mine machine, router, ordinary terminal;Wherein, commonly The use cost of terminal can be 0.The service ability of node do not include the value of other parameters or included other parameters all In identical situation, the cost of node is higher, then service ability is higher.
In a kind of implementation, step S120 may include:
According to the sequence of service ability from high to low, it is followed successively by node distribution upload task.
In this implementation, when node the allocated upload task, so that it may upload task by node processing The case where, directly assess the service ability of node, and preferentially to service ability it is high (such as complete upload task speed it is fast or Response time is short or the speed of transfer resource is fast or at low cost) node distribute upload task.
In this implementation, can according to the service ability of node, the node in node listing that server is returned into Row sequence, the higher node of service ability are more forward.
In this implementation, it is followed successively by node distribution upload task, only meaning that can be according to node serve ability from height The distribution of upload task is carried out to low sequence, but do not represent each node to distribute upload task, for example can advise The fixed node or ranking too low for service ability do not distribute upload task in last several nodes.
In other implementations, the sequence for the node listing interior joint that can also be returned according to server, successively for node Distribute upload task;Or to node sequencing and task can be distributed according to other standards, for example complete to upload according to node and appoint The sequence of the number of business from big to small is followed successively by node distribution upload task.
A kind of method for allocating tasks in embodiment two, peer-to-peer network;The present embodiment includes the scheme of embodiment one, herein On the basis of, above-mentioned steps S110 may include:
Respectively according to the attribute data of the corresponding each node of resource to be shared, the initial score of each node is calculated, by node Score of the initial score as the service ability for indicating the node;
After node completes at least one upload task, according to the node processing upload task the case where, update indicate should The score of the service ability of node;
Above-mentioned steps S120 may include:
When needing to distribute upload task, according to the sequence of the current score for indicating node serve ability from big to small, according to It is secondary to distribute upload task for node.
In P2P network, the service ability of each node be it is irregular, some nodes are high-quality, and service ability is strong, Some nodes are of poor quality, and service ability is poor.Here there are many uncertain factors, such as the uploading bandwidth of node, node is being located Whether the number of tasks of reason, node are offline etc., need to upload task according to node actual treatment to determine.But also have very much Be it is determining, can screen in advance.Such as between the node of distance remote (such as Beijing and Guangxi), even if individual node Service ability is very strong, and mutual service effectiveness will not be fine;The node of cross operator (such as connection and movement) for another example Between, service effectiveness will not be fine;For another example, public network address connectivity is good, private net address poor connectivity, the wired network at the end PC Network is more stable, and the network stabilization of wireless wifi is slightly worse, etc.;These can be had an impact to the service ability of uploading nodes 's.
A solution is that the upload number of tasks completed by node sorts from high to low, i.e. the upload of uploading nodes completion Number of tasks is more, it is believed that service ability is higher in other words for the quality of the uploading nodes, and the chance for obtaining the distribution of upload task is got over Greatly.But if several leading a node of node listing is slow because being connected to the network slow or upload service, it will have a direct impact on and entirely broadcast Put experience.And for unallocated upload task, but high-quality or strong service ability node, due to the upload task of completion Number is 0, and ranking behind in node listing wastes this portion it is therefore possible to never have chance to get upload task The resource of partial node.The present embodiment can then overcome this drawback.
In the present embodiment, if when needing to distribute upload task, each node all also from upload task was not completed, then when The score of the preceding service ability for indicating node, all refers to the initial score of node;That is, being according to section when distributing upload task The attribute of point itself is ranked.By being assessed in attribute of the initial stage to node itself, by high quality, service ability The ranking of the node of high (i.e. initial score is high) shifts to an earlier date, and can preferentially distribute upload when the first round distributing upload task in this way The node that task is high to quality, service ability is high, therefore the scheduling of task in entire P2P network can be optimized.
It, (can be with for node that at least one uploads task was completed during uploading resource in the present embodiment It is any of node corresponding to resource to be allocated), then it is to be calculated with the case where uploading task according to the node processing Score out substitutes the original score of the node;For example, being the equal of using after a node completes upload task for the first time The calculated score of the case where uploading task according to node processing institute, substitutes the initial score of the node, as new expression The score of the service ability of the node;It for another example, can be at this time after a node Z (Z > 1) secondary completion upload task The calculated score of the case where uploading task according to node processing institute, the instead preceding feelings that task is uploaded according to the node processing The calculated score of condition institute.
That is, the case where task can also be uploaded according to node actual treatment in the present embodiment, the sequence to node It is adjusted, in this way can be according to the active service ability of node, dynamic adjustment distributes the sequence of upload task to node, thus The strong node of service ability can be laid particular emphasis on when upload task is distributed.
In the present embodiment, for a node, if being calculated according to the case where processing upload task indicates the section The score of point service ability then can indicate the node with according to score substitution calculated the case where handling upload task originally The score of service ability (the case where can be initial score, being also possible to the last upload task according to processing calculates Score), and adjust according to new score the sequence of the node;For example assume that the initial score of a node A is 88, all The 10th is come in node, the 7th~9 score is 96,93,90 respectively;Assuming that in the case that other node scores are constant, After the case where handling upload task according to A for the first time updates the score of A, the score of A is 95, then the sequence of A becomes the 8th;? Second updates the score of A the case where handling upload task according to A after, the score of A is 92, then the sequence of A becomes the 9th.It is right In a node, if not calculating score according to the case where processing upload task, initial score can be continued to use Score as the node.
In the present embodiment, it is followed successively by node distribution upload task, only meaning that can be according to expression node serve ability The sequence of score from high to low carries out the distribution of upload task, but does not represent each node and must distribute upload task, than It such as can specify that for score lower than the node of some value or ranking in last several nodes, do not distribute upload task.
In the present embodiment, the score for indicating node serve ability can be ranked up when needing to distribute upload task, It can also be just ranked up after the score every time to expression node serve ability had update.
In the present embodiment, distribution upload task and the score for updating expression service ability can be process alternately, It can be in distribution and be ranked up and distribute according to current newest score.
In a kind of implementation, described the case where task is uploaded according to the node processing, the service for indicating the node is calculated The score of ability may include:
The node is mapped in scheduled value interval, is obtained by arctan function to the completion speed of the task of upload To the score for the service ability for indicating the node.
In this implementation, node can be the node to the upper of the last time distribution to the completion speed of the task of upload The completion speed of biography task is also possible to the node to the completion speed of the upload task of nearest several sub-distribution, can also be this Average completion speed of the node to completed all upload tasks.
In a kind of implementation, the attribute data of node may include one or more of:
Terminal type, area information, operator's informaiton, network type.
In this implementation, terminal type can be used to indicate that node is which type of terminal;It may include Android (Android), application service (Over The Top, OTT) is provided by internet, apple (IOS), router (Router), Several classes such as personal computer (PC).Each terminal type can be indicated with type code respectively.
Area information can be used to indicate that the region where node;Region may include the whole nation, great Qu (such as East China, south China Deng), it saves, city, area, several ranks such as county;Each region can be indicated with respective area code respectively.
Operator's informaiton can be used to indicate that operator used in node;Each operator can be respectively with respective operation Shang dynasty code indicates.
Network type can be used to indicate that the type of network address used in node;It may include mainly public network address, Private net address.Wherein, private net address again can be according to network address translation (Network Address Translation, NAT) Type is divided into complete pyramid type (Full Cone) NAT, and symmetrical (Symmetric) NAT, port limits pyramid type (Port Restricted Cone) NAT, address limits several classes such as pyramid type (AddressRestricted Cone) NAT.
In other implementations, the type of attribute data can be voluntarily selected.
In a kind of implementation, the initial score of a node, the score value that can be equal to the node items attribute data add Weigh the result of summation.
In this implementation, the score value and weight coefficient of every attribute data can according to need self-setting, such as main When to carrying out uploading the guidance of flow according to terminal type, the weight coefficient of terminal type can be aggravated.
In this implementation, the score value of the terminal type of a node can be according to each terminal type institute pre-saved Corresponding score value determines.In addition, can make to upload by the way that the score value setting of some terminal type is higher than other terminal types Flow focuses more on the platform of the terminal type, uploads the traction of flow toward particular platform to realize.For example it can incite somebody to action The score value of Android type is tuned into the score value higher than IOS type, in this way in the identical situation of other attribute datas, Android The sequence of type terminals can more preferably distribute to Android type end prior to IOS type terminals when being equivalent to distribution upload task End, therefore the flow uploaded can focus more on Android platform.
In this implementation, the score value of a node region information can pass through the node (hereinafter referred to as uploading nodes) Regional relation between the node (hereinafter referred to as present node) of request downloading resource obtains.Such as: the score value in the same city It is 60 points, only the score value of the same province is 40 points, and only the score value of the same great Qu is 20 points, is not 0 point in the same great Qu. As can be seen that the score value of uploading nodes area information is also possible to change when present node difference;For example uploading nodes X is in north Capital, for present node at Hainan, the score value of the area information of nodes X is 0;Present node also at Beijing, believe by the region of nodes X The score value of breath is 60.
In this implementation, the score value of a node operator information can pass through the operation of the node and present node The whether identical acquisition of quotient;For example belong to the same operator, it is score value 1, is not belonging to the same operator, is score value 2, score value 1 Greater than score value 2.Similar to area information, when present node difference, the score value of uploading nodes operator's informaiton is also possible to change.
In this implementation, the score value of a meshed network type is similar with terminal type, can be by pre-saving Corresponding relationship between network type and score value obtains.
In this implementation, score Score that can be initial by following mathematical model calculate node:
Score=∑ (Mi × Qi) (i=1,2...T)
Mi: the score value of ith attribute data is indicated, value range can be between 0~100.
Qi: indicate that the weight coefficient of ith attribute data, the sum of weight coefficient of each attribute data are 1.
Wherein, T is the type number of attribute data.
It in this way can be by carrying out mathematical modeling to node quality, to obtain the initial score of node.
In a kind of implementation, as soon as can be after the update of the score of node, the sequence of adjustment node.
It, can be periodically according to the current score of each node (for having distributed the task of upload in a kind of implementation It is updated score for node, is initial score for the also unallocated node for crossing upload task), to each node Re-start sequence.
In a kind of implementation, the section of the score calculated according to the case where processing upload task can be with initial score Section it is different, can enable to select to bias toward the unallocated node for crossing upload task when node by the setting in section in this way, Or the node of the task of upload was distributed;For example the section of the score calculated according to the case where processing upload task is 0-200, just The section of the score of beginning is 0-100, then the node for distributing the task of upload may sort in unallocated upload task excessively Before node;As long as but the unallocated node score for crossing upload task is higher, has distributed upload task it is possible to coming But before slow node, i.e., result in waste of resources it is possible to being assigned upload task without being idle always.
Illustrate the present embodiment with an example below.
In this example, the speed for completing upload task using node is segmented into initial stage and task as service ability Two stages of stage.
Initial stage
Upload task had not been completed in initial stage, at this point, can only be according to the self attributes of node, to node Service ability does a preliminary assessment to quality in other words, generates an initial score Score1.Assessment models 1 can be with such as Under formula indicate:
Score1=∑ (Mi × Qi) (i=1,2...T)
Mi: the score value of ith attribute data is indicated, value range is between 0-100.
Qi: indicate that the weight coefficient of ith attribute data, the sum of weight coefficient of all properties are 1.
T is the type number of attribute data.
In this example, the attribute data of node used in the model and weight of attribute data is sparse to do It at configuration parameter, can be adjusted according to different application scenarios dynamics, the initial score Score1 finally calculated can be with Between 0-100;In practical applications, the value interval of Score1 is also possible to the section that upper and lower limit is other numerical value.
This example has chosen: terminal type, area information, the category of several dimensions such as operator's informaiton and network type information Property data, to participate in the calculating of above-mentioned assessment models 1.
Task phase
Task phase indicates that at least one node had completed at least one upload task, can pass through node pair Nearest one uploads the completion speed of task to quantify the service ability of node, in practical application, can also pass through node pair The completion speed of multiple upload tasks or the completion speed etc. by the completed each upload task of node recently, to quantify to take Business ability.Assessment models 2 are as follows:
A) upload the completion speed of task: S (unit is KB/s)
S=Size × 1000/ (T1-T0)
Size: the size of be recently completed upload task is indicated, for example 20KB, unit are KB.
T0: indicating that the upload task has just been emitted to the time recorded when node, generates session in other words for the upload task The time of information, unit are millisecond (ms).
T1: the time recorded when the corresponding data of upload task all receive is indicated, unit is ms.
B) score of the node calculated according to speed:
Since the above-mentioned calculated value for S might have biggish fluctuation, in order to reduce fluctuation in order to node row It is as follows to carry out mathe-matical map to the completion speed of above-mentioned upload task for sequence:
Score 2=(atan (S/90.0)/(pi/2)) × 200
That is: the completion speed for the task that uploads is mapped in the section of 0-200, by arctan function in practical application In, the value interval of Score2 is also possible to the section that upper and lower limit is other numerical value, and the upper limit of the value interval of Score2 can be with The upper limit of value interval higher than Score1.In this computation, the output result of arctan function uses Circular measure.Such as: The speed of 100KB/s is about 100 points, and the speed of 50KB/s is about 60 points.Uploading nodes can be divided into three classes according to the score:
Strong node: score is greater than 100 points, i.e. the completion speed of upload task is greater than 100KB/s.
Interior joint: score is between 60-100, i.e., the completion speed of upload task is between 50-100KB/s.
Weak bus: score is lower than 60 points, i.e. the completion speed of upload task is lower than 50KB/s.
After one node obtains Score2, Score1 can be substituted with Score2, the score as the node;One node Whenever completing a upload task, a Score2 can be updated, it may be assumed that replace using new calculated Score2 original Score2。
In this example, the value interval for the score Score1 that the initial stage obtains be can be from 0-100, and in task phase The value interval of obtained score Score2 can be from 0-200, but when sequence, each node (is either used Score1 indicates the node of the score of service ability, or indicates with Score2 the node of the score of service ability) it is to arrange together Sequence.The purpose so designed mainly has:
(1) due to only having the node of initial score (not completed upload task) to possess some uncertainties, So, it has been determined that strong node can prior to only have the node of initial score obtain distribution task chance, in this way may be used To optimize the distribution of upload task.
(2) in the node for there was only initial score, the node of quality relatively good (60-100/) can compare weak bus The preferential chance for obtaining distribution upload task can prevent the resource of this part of nodes idle in this way.
In other embodiments, node can also be ranked up according to other conditions when distributing upload task, or press Upload task is distributed to node according to random sequence.
In other embodiments, initial score can also be only calculated, or is only calculated and is divided according to the case where processing upload task Number, and upload task is sequentially allocated to node according to the size of score.
Other realization details of the present embodiment can be found in embodiment one.
Embodiment three, the method for allocating tasks in a kind of peer-to-peer network;The present embodiment includes the scheme of embodiment one, herein On the basis of, step S120 may include:
Respectively according to the service ability of each node, the big of the upload task that each node can be completed in duty cycle is calculated It is small;
The size for the upload task that can be completed in duty cycle according to each node respectively distributes upload task for node.
It is to distribute an appropriately sized upload task, so both according to the service ability of node itself in the present embodiment It can guarantee that uploading nodes can complete the upload task in a duty cycle, make full use of the service ability of node, and can keep away It is too small to exempt from task block, frequent requests influence downloading end and upload the efficiency at end.
It, can be according to service ability from high to low suitable of node when distributing upload task to node in the present embodiment The sequence of sequence or node score from big to small successively distributes upload task to node;Wherein, it is sequentially allocated according to node score The scheme of upload task can be found in the content of embodiment two.
In a kind of implementation, when sharing resource is audio or video, the length of the duty cycle of task is uploaded, it can To be obtained according to the time difference between the starting point of the upload task and preset broadcast point.The duty cycle of different upload tasks It can be different.
In this implementation, the starting point for uploading task can refer to the starting point in the corresponding resource section of the upload task, Or according to the starting point calculated moment.Such as upload task correspond to resource section [50KB, 300KB), then 50KB can make For the starting point of the upload task;Or with 50KB divided by code rate (assuming that the case where resource to be shared is video), as on this The starting point of biography task.
In this implementation, broadcast point can be configured voluntarily or according to pre-defined rule configuration, broadcast point and starting point Form is corresponding, for example when starting point is the starting point in resource section, broadcast point is also with wait share some position in resource It indicates, such as 900KB.
In other implementations, the length of duty cycle can also be according to scene settings;The length of duty cycle can be made For a configuration parameter, self-setting when for using.
In this implementation, when the service ability of node is the speed that node completes upload task, node is in task week The size of the interim upload task that can be completed can refer to that the node completes the speed of upload task, multiplied by the length of duty cycle Degree.When the service ability of node is other parameters, or when comprising multiple parameters, the parameter value of quantization can be substituted into predetermined public affairs Formula obtains the size for the upload task that node can be completed in duty cycle.
In a kind of implementation, the size for the upload task that can be completed in duty cycle according to each node respectively, for section Point distributes upload task
For each node, the task of N number of unit-sized is distributed respectively;For a node, N is to make N and unit-sized The size of the upload task that can be completed in duty cycle no more than the node of product, maximum integer.
Wherein it is possible to which the size for the upload task that can be completed in duty cycle with node takes divided by predefined size and downwards It is whole, to obtain N.
For example unit-sized is 20KB, when the size for the upload task that node can be completed in duty cycle is 90KB, The upload task for distributing to 4 unit-sizeds of the node, that is, the size for distributing to the upload task of the node is 4 × 20KB= 80KB;When the size for the upload task that node can be completed in duty cycle is 132KB, it is big to distribute to 6 units of the node Small upload task, that is, giving to the size of the upload task of the node is 6 × 20KB=120KB;And so on.
Wherein, if the upload task of unit-sized to be regarded as to the task block of a unit, when distributing upload task It is the equal of the task block for distributing integer unit;The way, which can be regarded as, does the size for the upload task calculated Blocking processing, it is possible to reduce node serve ability uncertainty bring error.For example upload task is completed according to node Speed, the size for calculating the upload task that can be completed in the egress business period in office is 132KB, if directly distribution 132KB is big Small upload task, once then network has shake or has other emergency events, it will cause 132KB can not be in duty cycle on It passes and completes;And the way of the task block of 6 units is distributed, and it is equivalent to the upload task for being assigned with 120KB size, it in this way can be right Emergency event has certain tolerance.
In other implementations, the task block of integer unit can not also be distributed, i.e., is not drawn the task in task pool It is divided into the task block of unit-sized, but the size S1 for the upload task that can be completed in duty cycle according to node, determination divide The size S2, S2 of the upload task of dispensing node are not more than S1;For example S2 can be set as to the 90% of S1.
In a kind of implementation, the size for the upload task that can be completed in duty cycle according to each node respectively, for section Point distributes upload task
Each node is proceeded as follows respectively:
It, will be described as size B of the size A of upload task to be allocated no more than the upload task that the node can distribute Upload task to be allocated distributes to the node;Wherein, the size for the upload task which can distribute exists no more than the node The size for the upload task that can be completed in duty cycle;
When the size A of the upload task to be allocated is greater than the size B for the upload task that the node can distribute, from institute State be partitioned into upload task to be allocated size be B upload task distribute to the node.
In this implementation, it is equivalent to the part for being A-B by size in upload task to be allocated, is put back in task pool, Continue as upload task to be allocated.
In this implementation, the size for the upload task which can distribute can be equal to N multiplied by unit-sized;Wherein, N It is to make size of the product of N and unit-sized no more than the task that the node can be completed in duty cycle, maximum integer.
In other implementations, task to be allocated can be first divided into the task block of unit-sized, then according to section The size for the upload task that point can distribute distributes the task block of corresponding unit to node.
In a kind of implementation, can also include: before above-mentioned steps S110
Distribute the upload task an of predefined size respectively for the corresponding each node of resource to be shared.
It is the upload task according to the node processing predefined size when carrying out step S110 for the first time in this implementation The case where determine service ability.
In this implementation, predefined size can be, but not limited to be equal to above-mentioned unit-sized, for example be equal to 20KB;This is predetermined Size can according to demand, configuration etc. sets itselfs, so as to be suitable for different application scenarios.
Illustrate the present embodiment with an example below.
In this example, using the speed of node completion upload task as service ability, entire assigning process is segmented into two It is most of, first, calculate the size of the upload task that can be distributed of each uploading nodes;Second, uploading nodes distribution is uploaded and is appointed Business.Wherein, the corresponding node of uploading nodes, that is, above-mentioned resource to be shared.
First part: the size for the upload task that each uploading nodes can distribute is calculated.
Calculating process can be divided into two stages of initial stage and task phase.
Initial stage
Firstly, the task block of one minimum unit of setting, size M.In the initial stage, the service ability of each node It is not clear, the task block of one unit of original allocation, such as the upload task of 20KB size.
Wherein, size (i.e. above-mentioned unit-sized) M of the task block of each unit is a configuration parameter, can be according to not Same scene, configures on line, comes into force in real time.
Task phase
Task phase indicates that node had all completed at least one upload task, can be nearest by a node The completion speed of one upload task, to quantify the service ability of the node.
Firstly, calculating the completion speed of upload task: S (unit is KB/s)
S=Size × 1000/ (T1-T0)
Size: the size of be recently completed upload task is indicated, for example 20KB, unit are KB.
T0: indicate that the upload task has just been emitted to the time recorded when node, unit is ms.
T1: the time recorded when the corresponding resource of upload task all harvests is indicated, unit is ms.
Then, the completion speed current according to node, can calculate in defined duty cycle, can be to the node Distribute the task block of N number of unit.Calculation formula is as follows:
N=Floor (S × T/M)
S: the completion speed for the upload task that the last time completes.
T: the length of duty cycle, for example when sharing resource is audio or video, each output task rises according to it The length of distance available duty cycle of the initial point from broadcast point, it can be provided being no longer than 10s, (T can be one Configuration parameter).
Floor is the function being rounded downwards.
For different nodes, due to S difference, calculated N is different;Each node has oneself corresponding N;Rear When continuous calculating or distribution, the size for the upload task that can be distributed can be calculated for the node according to the corresponding N of a node, or Distribute the task block of N number of unit.
Here it is no longer calculated after available N, it is appointing for M that remaining upload task, which is divided into size, in the task of distribution It is engaged in block, when distribution, distributes N number of task block to node.
It can continue to calculate the size for the upload task that can be distributed:
Size '=N × M
Second part: task is distributed to uploading nodes.
When starting downloading task, it is put into task pool together using downloading task as an entire upload task.Initially give Each node distributes the task block (that is, task of unit-sized) of 1 unit, after node completes a task block, according to most The nearly primary speed for completing task block, the size Size ' for the upload task that next time can distribute is calculated according to formula above.
Distribution when, first by task pool upload task (in view of some recycling back upload task, Can have the case where multiple upload tasks in task pool) it sorts from small to large by starting point, first upload task is taken out every time It is allocated.
By the size of current upload task to be allocated, it is denoted as A;The size for the upload task that uploading nodes can distribute, note For B (i.e. B=Size ').The principle of upload task distribution is as follows:
(1) if A≤B, current upload task to be allocated is all given into the uploading nodes, distribution terminates.
(2) if A > B, to the upload task of uploading nodes distribution B size, the upload of remaining A-B size is appointed Business, puts back in task pool.Such as: current upload task to be allocated be [100KB, 1000KB), the upload task that node can distribute Size be 60KB, then the upload task distributed to the node be [100KB, 160KB), remaining upload task [160KB, It 1000KB) is put back into task pool, waits lower sub-distribution.
In other embodiments, the step S120 in embodiment one can also be carried out otherwise.
Other realization details of the present embodiment can refer to embodiment one.
A kind of method for allocating tasks in example IV, peer-to-peer network, as shown in Fig. 2, including step S210~S220:
The attribute data of S210, the respectively corresponding each node of basis resource to be shared, calculates initial point of each node Number;
S220, the sequence according to score from big to small are followed successively by node distribution upload task;Wherein, described wait share money Source is divided into multiple upload tasks and is uploaded.
In the present embodiment, the service ability of node can be estimated, and with this to node sequencing, the upload most started is appointed The distribution of business, so as to optimize the distribution for uploading task in P2P network, to promote the performance of entire P2P network.
In the present embodiment, the details such as initial score of the attribute data of node, calculating can be found in embodiment two;Wait share money The details such as source, upload task, node can be found in embodiment one.
In a kind of implementation, the method for the present embodiment can also include:
It is proceeded as follows respectively for each node that at least one uploads task is completed:
The case where uploading task according to the node processing calculates the score for indicating the service ability of the node;To calculate Score update indicate the node service ability score.
In this implementation, as soon as node can be adjusted after a score for the service ability of expression node updates Sequence.
In this implementation, can score periodically according to the service ability of the current expression node of each node it is (right It is updated score for the node for having distributed the task of upload, is for the also unallocated node for crossing upload task Initial score), sequence is re-started to each node.
In this implementation, the value interval of the score calculated according to the case where processing upload task can be with initial point Several value intervals is different, can enable to select to bias toward unallocated upload excessively when node by the setting of value interval in this way The node of task, or distributed the node of the task of upload;Such as taking according to the score calculated the case where handling upload task Value section is 0-200, and the section of initial score is 0-100, then the node for distributing task may sort unallocated It crosses before the node of upload task;As long as the unallocated node score for crossing upload task is higher, it is possible to execution task is gone, It will not be idle always and result in waste of resources.
In a kind of implementation, being followed successively by node distribution upload task may include:
Respectively according to the service ability of each node, the big of the upload task that each node can be completed in duty cycle is calculated It is small;
The size for the upload task that can be completed in duty cycle according to each node respectively distributes output task for node.
Other details of this implementation can refer to embodiment three.
A kind of method for allocating tasks in embodiment five, peer-to-peer network;The present embodiment can be applied to carry out in P2P network Under the scene of video on demand, the speed for completing upload task using node is illustrated as service ability;In other embodiments, clothes Business ability also may include other parameters.
The present embodiment includes following procedure 501~506.
Process 501: starting downloading task
Accelerator in 501.1P2P node (in the present embodiment, being known as downloading node after the P2P node) receives client The hypertext transfer protocol (HyperText Transfer Protocol, HTTP) sent using (App) is requested, in request Contain uniform resource locator (the Uniform Resoure of resource to be shared (being the video of program request in the present embodiment) Locator, URL), the information such as range (Range) of resource to be shared.
URL and Range information is parsed in the request that 501.2 accelerators are received from 501.1, and is extracted from URL Characteristic information (that is: the information of the energy unique identification resource).
The characteristic information that 501.3 accelerators are extracted according to 501.2 generates a resource ID by coding, uses Carry out unique identification resource in P2P network system.
The resource ID that 501.4 accelerators are generated according to 501.3, starts the downloading task of the resource.
Process 502: P2P node listing is obtained
502.1 accelerators 501.4 starting downloading tasks after, to server send resource information request, request with Proprietary protocol format takes the resource ID of 501.3 generations in request.
502.2 servers receive the resource information request that 502.1 accelerators are sent, and therefrom parse resource ID.
The resource ID that 502.3 servers are parsed according to 502.2 searches resource letter from local resource list Breath, resource information include file size, the Message Digest 5 the 5th edition of file (Message Digest Algorithm 5, MD5) value, the information such as corresponding node listing of resource.
The resource information that 502.4 servers are found 502.3, transmits to the accelerator.
502.5 accelerators receive the resource information packet of 502.4 servers return.
The resource information packets that 502.6 accelerators parsings 502.5 receive, and by file size, the information such as node listing It is all stored in local memory cache.
The document size information that the Range information and 502.6 that 502.7 accelerators are received according to 501.1 receive, meter Calculate the data interval to be downloaded.
The data interval that 502.8 accelerators are calculated according to 502.7 generates one and entirely uploads task, is put into task pool In.
It is (in the present embodiment, rear to be known as that 502.9 accelerators successively traverse each node in 502.6 node listings Uploading nodes), each uploading nodes are done with the initial assessment of quality respectively, and calculate an initial score.
In this step, the accelerator can successively each of traverse node list uploading nodes, execute respectively with Lower operation:
A uploading nodes are taken out, the nodal information of uploading nodes is input in assessment models 1 above, calculates one A initial score Score1.
The initial score of the uploading nodes that 502.10 accelerators are calculated according to 502.7, in entire node listing Uploading nodes are sorted from large to small by initial score Score1.
502.11 accelerators are from the node listing after sequence, and taking out first L, (L is a configuration parameter, for controlling Connection number processed) not connected uploading nodes, establish connection therewith respectively.
For 502.12 accelerators to each uploading nodes for establishing connection, it is 1 list that initial task size, which is respectively set, (the upload task of these 1 unit-sized is to mark off to come from a 502.8 entire upload task to the upload task of position size ).
Process 503: the assigning process of task is uploaded
503.1 accelerators are established when the connection with a uploading nodes and are completed, or are downloaded from the uploading nodes It is triggered after the resource (i.e. the uploading nodes complete a upload task) of complete upload task, records the letter of the uploading nodes Breath completes the speed S of upload task including the calculated uploading nodes the last time.
503.2 accelerators take out first upload task from 502.8 task pool, and task size is denoted as A, rise Initial point is denoted as X (being a position, such as 500KB in this example), and it (is a position in this example that the broadcast point of the video of program request, which is denoted as Y, Set, such as 1500KB), code rate is denoted as W (unit is KB/ seconds).
503.3 accelerators calculate time difference of the starting point from broadcast point according to 503.2 mission bit stream: Duration=(X-Y)/W.
503.4 accelerators are according to 503.3 calculated Duration, calculating task cycle T.
A) Duration < 3s, then duty cycle: T=3s;
B) Duration >=3s, and Duration≤10s, then duty cycle: T=Duration;
C) Duration > 10s, then duty cycle: T=10s.
503.5 accelerators are calculated according to the 503.1 calculated calculated duty cycle T of speed S and 503.4 The size for the upload task that uploading nodes in 503.1 can distribute: Size ' is to take the integer of unit-sized M in the product of S and T Part again (in order to reduce error).For example, speed S is 16KB/s, duty cycle T is 10s, and unit-sized M is 50KB, then counts The product calculated is 160KB, and that after taking the integral multiple of M is 150KB.
503.6 accelerators are that the uploading nodes distribute task.If the size for the upload task taken out in 503.2 is denoted as The size of A, the upload task that the uploading nodes calculated according to 503.5 can distribute are denoted as B, then distribution principle is as follows:
A) A≤B: entire upload task will be taken out in 503.2 and all gives the uploading nodes, distribution terminates.
B) A > B: in the upload task taken out from 503.2, the task of B size, distributes to the uploading nodes before taking out, and The upload task of remaining A-B size is put back in task pool.Such as: the 503.2 corresponding resources of upload task taken out Section be [100KB, 1000KB), A is 900KB, and the size B for the upload task that uploading nodes can distribute is 60KB, then on this The section for passing the corresponding resource of upload task of node distribution be [100KB, 160KB), the resource in remaining section [160KB, It 1000KB) is put back into task pool as a upload task, waits lower sub-distribution.
Process 504: the downloading process of task is uploaded
After 504.1 accelerators (downloading node in other words) distribute upload task to uploading nodes according to process 503, By the upload task distributed and 503.1 uploading nodes information, a session information is generated together, and record current time: T0 (unit: ms).
The session of 504.1 creations is added to current session list by 504.2 accelerators (downloading node in other words) The inside.
Upload task in the session of 504.1 creations is configured to by 504.3 accelerators (downloading node in other words) It passes task requests and is sent to corresponding uploading nodes.Request can use proprietary protocol, and content includes resource ID, and request Range information etc..
504.4 uploading nodes receive the upload task requests that downloading node sends over.
The 504.5 uploading nodes parsings 504.4 receive upload task requests, obtain resource ID, upload the Range of task Information.
The resource id information that 504.6 uploading nodes are obtained according to 504.5 searches resource from local resource list Information, the MD5 value including file, the store path etc. of file.
The file store path that 504.7 uploading nodes are found according to 504.6 opens file.
The file that 504.8 uploading nodes are opened according to 504.7 reads the data in the section Range that 4.5 get.
The data that 504.9 uploading nodes are read 504.8, return to downloading node.
504.10 accelerators (downloading node in other words) receive the data that 504.9 uploading nodes are sent.
504.11 accelerators (downloading node in other words) repeat step 504.10 and receive data always, until all Data all harvest, and record current time T1 (unit: ms).
After 504.12 accelerators (downloading node in other words) have downloaded the resource of a upload task, from session node In, the state that the uploading nodes of the upload task are completed in resetting is idle state, trigger process 505 (node quality evaluation) and mistake Journey 506 (task inspection).
Process 505: to the quality secondary evaluation of uploading nodes
505.1 accelerators trigger after 504.12 complete a upload task to the upload section for completing upload task The secondary evaluation of the quality of point.
505.2 accelerators according to 504.2 job start time T0 and 504.11 job end time T1, calculate Current upload task uses the time: T '=T1-T0, unit ms.
505.3 accelerators according to upload task size SIZE (unit: KB) and 505.2 task use when Between, the speed of calculating task completion: S=SIZE/ (T '/1000.0), unit K B/s.The most completion for updating the uploading nodes uploads The speed of task.
The speed for the completion upload task that 505.4 accelerators are calculated according to 505.3, is calculated by mathematical model The corresponding score of the uploading nodes: Score2=(atan (S/90.0)/1.571) × 200.0.Final result be mapped to (0, 200) section.The score of uploading nodes is updated with Score2.
505.5 accelerators are (right by score to the uploading nodes in node listing according to 505.4 updated scores In completing at least one uploading nodes for uploading task, which is Score2;For not completing the upper of the task of upload also Node is passed, which is Score1) it resequences from high to low.
505.6 accelerators take out the score for indicating the service ability of node from the node listing after 505.5 sequences Highest, state is the uploading nodes of idle state.
Process 506: task inspection (having node to complete the triggering of upload task and two kinds of triggering modes of periodic triggers) is uploaded
506.1 accelerators traverse 504.2 session lists, check the upload task in each session.
506.2 accelerators check whether the upload task is expired, or meet other recycling conditions.If without expired and It is unsatisfactory for any recycling condition, then takes out next session and continues checking;If the task of upload is expired or meets some recycling item Part thens follow the steps 506.3.
506.3 accelerators calculate the remaining task amount of the upload task: the remaining task amount=upload task is total Task amount is completed in task amount-.
The remaining task amount that 506.4 accelerators are calculated 506.3 recycles, and is put into task pool.
506.5 accelerators to 506.4 task pools after the recovery, according to the task of upload starting point from low to high, weight New sort.For example it is obtained after sequence:
[26KB,30KB),[60KB,70KB),[200KB,30000KB)。
506.6 accelerators according to 505.6 uploading nodes sequence and 506.5 new task pond, trigger new upper The distribution of biography task, repetitive process 504,505,506 after distribution, until all upload tasks are all completed.
The present embodiment it is smooth can to reach raising by optimization task distribution in the video on demand based on P2P technology Rate reduces Caton rate, promotes the effect that user plays experience.
Task allocation apparatus in embodiment six, a kind of peer-to-peer network, comprising: processor and memory;
The processor is used to save the program for carrying out task distribution;The program for carrying out task distribution exists When reading execution by the processor, proceed as follows:
The case where uploading task according to the corresponding each node processing of resource to be shared respectively, determines the service energy of each node Power;Wherein, the resource to be shared is divided into multiple upload tasks and is uploaded;
Respectively according to the service ability of each node, upload task is distributed for node.
In a kind of implementation, the service ability of the node may include following one or more parameters:
The speed of node completion upload task;
From upload task is issued to the node, the time until receiving the corresponding first part of resource of the upload task is long Degree;
The average speed of the node-node transmission resource;
The real-time speed of the node-node transmission resource;
The use cost of the node.
In a kind of implementation, described the case where task is uploaded according to resource to be shared corresponding each node processing respectively, The service ability for determining each node may include:
Respectively according to the attribute data of the corresponding each node of resource to be shared, the initial score of each node is calculated, it will Score of the initial score of node as the service ability for indicating the node;
After node completes at least one upload task, according to the node processing upload task the case where, update indicate should The score of the service ability of node;
It is described respectively according to the service ability of each node, distributing upload task for node includes:
When needing to distribute upload task, according to the sequence of the current score for indicating node serve ability from big to small, according to It is secondary to distribute upload task for node.
In this implementation, the attribute data of the node may include one or more of:
Terminal type, area information, operator's informaiton, network type.
In this implementation, the initial score of a node, the score value that can be equal to the node items attribute data is weighted The result of summation.
In a kind of implementation, described the case where task is uploaded according to the node processing, the service for indicating the node is calculated The score of ability may include:
The node is mapped in scheduled value interval, is obtained by arctan function to the completion speed of the task of upload To the score for the service ability for indicating the node.
In this implementation, node can be the node to the upper of the last time distribution to the completion speed of the task of upload The completion speed of biography task is also possible to the node to the completion speed of the upload task of nearest several sub-distribution, can also be this Average completion speed of the node to completed all upload tasks.
In a kind of implementation, described respectively according to the service ability of each node, distributing upload task for node be can wrap It includes:
Respectively according to the service ability of each node, the big of the upload task that each node can be completed in duty cycle is calculated It is small;
The size for the upload task that can be completed in duty cycle according to each node respectively distributes upload task for node.
In this implementation, the size of the upload task that can be completed in duty cycle according to each node respectively is Node distributes upload task
For each node, the upload task of N number of unit-sized is distributed respectively;For a node, N is the largest, can make N It is not more than the integer of the size for the upload task that the node can be completed in duty cycle with the product of unit-sized.
In this implementation, the size of the upload task that can be completed in duty cycle according to each node respectively is Node distributes upload task
Each node is proceeded as follows respectively:
It, will be described as size B of the size A of upload task to be allocated no more than the upload task that the node can distribute Upload task to be allocated distributes to the node;Wherein, the size for the upload task which can distribute exists no more than the node The size for the upload task that can be completed in duty cycle;
When the size A of the upload task to be allocated is greater than the size B for the upload task that the node can distribute, from institute State be partitioned into upload task to be allocated size be B upload task distribute to the node.
In this implementation, the program for carrying out task distribution may be used also when reading execution by the processor To proceed as follows:
The case where uploading task according to the corresponding each node processing of resource to be shared respectively, the service energy of each node is determined Before power, the upload task an of predefined size is distributed respectively for the corresponding each node of resource to be shared.
In the present embodiment, the program for carrying out task distribution is carried out when reading execution by the processor Operation can correspond to step S110~S120 of embodiment one;Other realization details can be found in embodiment one~tri-.
A kind of task allocation apparatus in embodiment seven, peer-to-peer network, as shown in Figure 3, comprising:
The case where ability determining module 71, each node processing upload task corresponding for basis resource to be shared respectively, Determine the service ability of each node;Wherein, the resource to be shared is divided into multiple upload tasks and is uploaded;
Distribution module 72, for according to the service ability of each node, distributing upload task respectively for node.
In a kind of implementation, the service ability of the node may include following one or more parameters:
The speed of node completion upload task;
From upload task is issued to the node, the time until receiving the corresponding first part of resource of the upload task is long Degree;
The average speed of the node-node transmission resource;
The real-time speed of the node-node transmission resource;
The use cost of the node.
In a kind of implementation, the ability determining module is uploaded according to the corresponding each node processing of resource to be shared respectively The case where task, determines that the service ability of each node may include:
The ability determining module according to the attribute data of the corresponding each node of resource to be shared, calculates each section respectively The initial score of point, using the initial score of node as the score for the service ability for indicating the node;When node completes at least one After a upload task, the speed of upload task is completed according to the node, updates the score for indicating the service ability of the node;
Respectively according to the service ability of each node, distribute upload task for node may include: the distribution module
The distribution module when needing to distribute upload task, according to the current score for indicating node serve ability from greatly to Small sequence is followed successively by node distribution upload task.
In this implementation, the attribute data of the node may include one or more of:
Terminal type, area information, operator's informaiton, network type.
In this implementation, the initial score of a node, the score value that can be equal to the node items attribute data is weighted The result of summation.
In a kind of implementation, described the case where task is uploaded according to the node processing, the service for indicating the node is calculated The score of ability may include:
The node is mapped in scheduled value interval, is obtained by arctan function to the completion speed of the task of upload To the score for the service ability for indicating the node.
In this implementation, node can be the node to the upper of the last time distribution to the completion speed of the task of upload The completion speed of biography task is also possible to the node to the completion speed of the upload task of nearest several sub-distribution, can also be this Average completion speed of the node to completed all upload tasks.
In a kind of implementation, the distribution module according to the service ability of each node, uploads for node distribution and appoints respectively Business may include:
The distribution module respectively according to the service ability of each node, calculate each node can be completed in duty cycle it is upper The size of biography task;The size for the upload task that can be completed in duty cycle according to each node respectively uploads for node distribution Task.
In this implementation, upload task that the distribution module can be completed in duty cycle according to each node respectively Size, distributing upload task for node may include:
The distribution module distributes the upload task of N number of unit-sized for each node respectively;For a node, N is Maximum, the upload task that can make the product of N and unit-sized that can be completed in duty cycle no more than the node size Integer.
In this implementation, upload task that the distribution module can be completed in duty cycle according to each node respectively Size, distributing upload task for node includes:
The distribution module proceeds as follows each node respectively:
It, will be described as size B of the size A of upload task to be allocated no more than the upload task that the node can distribute Upload task to be allocated distributes to the node;Wherein, the size for the upload task which can distribute exists no more than the node The size for the upload task that can be completed in duty cycle;
When the size A of the upload task to be allocated is greater than the size B for the upload task that the node can distribute, from institute State be partitioned into upload task to be allocated size be B upload task distribute to the node.
In this implementation, the distribution module be can be also used in the ability determining module respectively according to wait share money The case where corresponding each node processing in source uploads task, it is corresponding each for resource to be shared before the service ability for determining each node Node distributes the upload task an of predefined size respectively.
In the present embodiment, the operation that speed calculation module and distribution module are carried out can correspond respectively to embodiment one Step S110, S120;Other realization details can be found in embodiment one~tri-.
Task allocation apparatus in embodiment eight, a kind of peer-to-peer network, comprising: processor and memory;
The processor is used to save the program for carrying out task distribution;The program for carrying out task distribution exists When reading execution by the processor, proceed as follows:
Respectively according to the attribute data of the corresponding each node of resource to be shared, the initial score of each node is calculated;
According to the sequence of score from big to small, it is followed successively by node distribution upload task;Wherein, the resource to be shared divides It is uploaded into multiple upload tasks.
In the present embodiment, the program for carrying out task distribution is carried out when reading execution by the processor Operation can correspond to step S210~S220 of example IV;Other realization details can be found in example IV.
A kind of task allocation apparatus in embodiment nine, peer-to-peer network, comprising:
Evaluation module, for according to the attribute data of the corresponding each node of resource to be shared, calculating each node respectively Initial score;
Task allocating module is followed successively by node distribution upload task for the sequence according to score from big to small;Wherein, The resource to be shared is divided into multiple upload tasks and is uploaded.
In the present embodiment, the operation that evaluation module and task allocating module are carried out can correspond respectively to embodiment two Step S210, S220;Other realization details can be found in example IV.
Those of ordinary skill in the art will appreciate that all or part of the steps in the above method can be instructed by program Related hardware is completed, and described program can store in computer readable storage medium, such as read-only memory, disk or CD Deng.Optionally, one or more integrated circuits can be used also to realize in all or part of the steps of above-described embodiment.Accordingly Ground, each module/unit in above-described embodiment can take the form of hardware realization, can also use the shape of software function module Formula is realized.The application is not limited to the combination of the hardware and software of any particular form.
Certainly, the application can also have other various embodiments, ripe without departing substantially from the application spirit and its essence Various corresponding changes and modifications, but these corresponding changes and change ought can be made according to the application by knowing those skilled in the art Shape all should belong to the protection scope of claims hereof.

Claims (21)

1. the method for allocating tasks in a kind of peer-to-peer network, comprising:
The case where uploading task according to the corresponding each node processing of resource to be shared respectively, determines the service ability of each node;Its In, the resource to be shared is divided into multiple upload tasks and is uploaded;
Respectively according to the service ability of each node, upload task is distributed for node.
2. method for allocating tasks as described in claim 1, which is characterized in that the service ability of the node includes with next Or multiple parameters:
The speed of node completion upload task;
The node is given from sending upload task, the time span until receiving the corresponding first part of resource of the upload task;
The average speed of the node-node transmission resource;
The real-time speed of the node-node transmission resource;
The use cost of the node.
3. method for allocating tasks as described in claim 1, which is characterized in that described corresponding each according to resource to be shared respectively Node processing uploads the case where task, determines that the service ability of each node includes:
Respectively according to the attribute data of the corresponding each node of resource to be shared, the initial score of each node is calculated, by node Score of the initial score as the service ability for indicating the node;
After node completes at least one upload task, according to the node processing upload task the case where, update indicate the node Service ability score;
It is described respectively according to the service ability of each node, distributing upload task for node includes:
When needing to distribute upload task, according to the sequence of the current score for indicating node serve ability from big to small, it is followed successively by Node distributes upload task.
4. method for allocating tasks as claimed in claim 3, which is characterized in that the attribute data of the node includes following one kind Or it is a variety of:
Terminal type, area information, operator's informaiton, network type.
5. method for allocating tasks as claimed in claim 4, it is characterised in that:
The initial score of one node, equal to the result of the score value weighted sum of the node items attribute data.
6. method for allocating tasks as claimed in claim 3, which is characterized in that the feelings for uploading task according to the node processing Condition, calculating indicate that the score of the service ability of the node includes:
The node is mapped in scheduled value interval by arctan function to the completion speed of the task of upload, obtains table Show the score of the service ability of the node.
7. method for allocating tasks as described in claim 1, which is characterized in that it is described respectively according to the service ability of each node, Distributing upload task for node includes:
Respectively according to the service ability of each node, the size for the upload task that each node can be completed in duty cycle is calculated;
The size for the upload task that can be completed in duty cycle according to each node respectively distributes upload task for node.
8. method for allocating tasks as claimed in claim 7, which is characterized in that described respectively according to each node in duty cycle The size for the upload task that can be completed, distributing upload task for node includes:
For each node, the upload task of N number of unit-sized is distributed respectively;For a node, N is the largest, can make N and list Integer of the product of position size no more than the size for the upload task that the node can be completed in duty cycle.
9. method for allocating tasks as claimed in claim 7, which is characterized in that described respectively according to each node in duty cycle The size for the upload task that can be completed, distributing upload task for node includes:
Each node is proceeded as follows respectively:
It, will be described wait divide as size B of the size A of upload task to be allocated no more than the upload task that the node can distribute The upload task matched distributes to the node;Wherein, the size for the upload task which can distribute is no more than the node in task The size for the upload task that can be completed in period;
When the size A of the upload task to be allocated is greater than the size B of the upload task that can distribute of the node, from it is described to It is partitioned into the upload task that size is B in the upload task of distribution and distributes to the node.
10. method for allocating tasks as claimed in claim 7, which is characterized in that described corresponding according to resource to be shared respectively Each node processing uploads the case where task, before the service ability for determining each node further include:
Distribute the upload task an of predefined size respectively for the corresponding each node of resource to be shared.
11. the method for allocating tasks in a kind of peer-to-peer network, comprising:
Respectively according to the attribute data of the corresponding each node of resource to be shared, the initial score of each node is calculated;
According to the sequence of score from big to small, it is followed successively by node distribution upload task;Wherein, the resource to be shared is divided into more It is uploaded in a upload task.
12. the task allocation apparatus in a kind of peer-to-peer network, comprising: processor and memory;
It is characterized by:
The processor is used to save the program for carrying out task distribution;The program for carrying out task distribution is by institute When stating processor reading execution, proceed as follows:
The case where uploading task according to the corresponding each node processing of resource to be shared respectively, determines the service ability of each node;Its In, the resource to be shared is divided into multiple upload tasks and is uploaded;
Respectively according to the service ability of each node, upload task is distributed for node.
13. task allocation apparatus as claimed in claim 12, which is characterized in that the service ability of the node includes with next A or multiple parameters:
The speed of node completion upload task;
The node is given from sending upload task, the time span until receiving the corresponding first part of resource of the upload task;
The average speed of the node-node transmission resource;
The real-time speed of the node-node transmission resource;
The use cost of the node.
14. task allocation apparatus as claimed in claim 12, which is characterized in that described corresponding according to resource to be shared respectively Each node processing uploads the case where task, determines that the service ability of each node includes:
Respectively according to the attribute data of the corresponding each node of resource to be shared, the initial score of each node is calculated, by node Score of the initial score as the service ability for indicating the node;
After node completes at least one upload task, according to the node processing upload task the case where, update indicate the node Service ability score;
It is described respectively according to the service ability of each node, distributing upload task for node includes:
When needing to distribute upload task, according to the sequence of the current score for indicating node serve ability from big to small, it is followed successively by Node distributes upload task.
15. task allocation apparatus as claimed in claim 12, which is characterized in that described respectively according to the service energy of each node Power, distributing upload task for node includes:
Respectively according to the service ability of each node, the size for the upload task that each node can be completed in duty cycle is calculated;
The size for the upload task that can be completed in duty cycle according to each node respectively distributes upload task for node.
16. task allocation apparatus as claimed in claim 15, which is characterized in that the program for carrying out task distribution exists When reading execution by the processor, also proceed as follows:
The case where uploading task according to the corresponding each node processing of resource to be shared respectively, the service ability of each node is determined Before, distribute the upload task an of predefined size respectively for the corresponding each node of resource to be shared.
17. the task allocation apparatus in a kind of peer-to-peer network characterized by comprising
Ability determining module determines each for the case where corresponding each node processing of basis resource to be shared uploads task respectively The service ability of node;Wherein, the resource to be shared is divided into multiple upload tasks and is uploaded;
Distribution module, for according to the service ability of each node, distributing upload task respectively for node.
18. task allocation apparatus as claimed in claim 17, which is characterized in that the service ability of the node includes with next A or multiple parameters:
The speed of node completion upload task;
The node is given from sending upload task, the time span until receiving the corresponding first part of resource of the upload task;
The average speed of the node-node transmission resource;
The real-time speed of the node-node transmission resource;
The use cost of the node.
19. task allocation apparatus as claimed in claim 17, which is characterized in that the ability determining module is respectively according to wait divide The case where corresponding each node processing of resource uploads task is enjoyed, determines that the service ability of each node includes:
The ability determining module is respectively according to the attribute data of the corresponding each node of resource to be shared, at the beginning of calculating each node The score of beginning, using the initial score of node as the score for the service ability for indicating the node;When node is completed at least one After biography task, according to the node processing upload task the case where, update indicate the node service ability score;
Respectively according to the service ability of each node, distribute upload task for node includes: the distribution module
The distribution module is when needing to distribute upload task, according to the current score for indicating node serve ability from big to small Sequentially, it is followed successively by node distribution upload task.
20. task allocation apparatus as claimed in claim 17, which is characterized in that the distribution module is respectively according to each node Service ability, distributing upload task for node includes:
The distribution module calculates the upload that each node can be completed in duty cycle and appoints respectively according to the service ability of each node The size of business;The size for the upload task that can be completed in duty cycle according to each node respectively distributes upload task for node.
21. task allocation apparatus as claimed in claim 20, it is characterised in that:
The distribution module is also used in the ability determining module respectively according in the corresponding each node processing of resource to be shared The case where biography task, before the service ability for determining each node, for the corresponding each node of resource to be shared distribute respectively one it is predetermined The upload task of size.
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 true CN109962947A (en) 2019-07-02
CN109962947B 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)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109995824A (en) * 2017-12-29 2019-07-09 阿里巴巴集团控股有限公司 Method for scheduling task and device in a kind of peer-to-peer network
CN110650358A (en) * 2019-09-30 2020-01-03 北京奇艺世纪科技有限公司 Node distribution method, device, node distribution server and medium
CN111082982A (en) * 2019-12-12 2020-04-28 深圳市网心科技有限公司 Data transmission method, electronic device, system and medium
CN112818021A (en) * 2021-02-23 2021-05-18 东莞中国科学院云计算产业技术创新与育成中心 Data request processing method and device, computer equipment and storage medium

Citations (5)

* 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
CN103686946A (en) * 2012-09-18 2014-03-26 中国科学院声学研究所 Mobile P2P (peer-to-peer) node selection method and system in heterogeneous wireless network
WO2015055100A1 (en) * 2013-10-18 2015-04-23 Tencent Technology (Shenzhen) Company Limited Peer-to-peer upload scheduling
CN106027673A (en) * 2016-07-06 2016-10-12 北京奇艺世纪科技有限公司 Resource pre-push control and training method and device

Patent Citations (5)

* 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
CN103686946A (en) * 2012-09-18 2014-03-26 中国科学院声学研究所 Mobile P2P (peer-to-peer) node selection method and system in heterogeneous wireless network
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
CN106027673A (en) * 2016-07-06 2016-10-12 北京奇艺世纪科技有限公司 Resource pre-push control and training method and device

Cited By (8)

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

Also Published As

Publication number Publication date
CN109962947B (en) 2022-05-27

Similar Documents

Publication Publication Date Title
CN109962947A (en) Method for allocating tasks and device in a kind of peer-to-peer network
CN107688493B (en) Method, device and system for training deep neural network
CN104052803A (en) Decentralized distributed rendering method and system
CN103327121A (en) P2P (Peer-to-Peer Network) network resource transmission method and device for same
CN108810052B (en) Live broadcast server selection method and device
CN106453460B (en) File distribution method, device and system
CN101626389B (en) Network node management method
CN103685511B (en) Data distributing method, device and system
CN108307198A (en) flow service node dispatching method, device and scheduling node
CN101841557B (en) P2P streaming media downloading method and system based on orthogonal list
CN106850720A (en) Method for upgrading software, apparatus and system
CN105681828A (en) Node connection adjusting method and device
CN111935242B (en) Data transmission method, device, server and storage medium
CN109995824B (en) Task scheduling method and device in peer-to-peer network
EP3902279A1 (en) Audio and video stream distribution method in audio and video stream distribution system, and dynamic parent node
US8762481B2 (en) Information distribution system, terminal apparatus used in same system, and recording medium on which information processing program is recorded so as to be computer readable, as well as information processing method
US20160294940A1 (en) Data download method and device
CN112231481A (en) Website classification method and device, computer equipment and storage medium
CN114492849B (en) Model updating method and device based on federal learning
CN103179191A (en) P2P (peer to peer) network control device and P2P network control architecture
CN103281395B (en) A kind of data slice based on client terminal quantity divides equally selective system and method
CN115796275A (en) Block chain-based federal learning method and device, electronic equipment and storage medium
Zhou et al. An adaptive cloud downloading service
CN111614966B (en) Synchronization method, system, device, equipment and storage medium based on synchronization tree
CN109474696A (en) A kind of network service method, device, electronic equipment and readable storage medium storing program for executing

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