CN109684080A - Centralized method for scheduling task, system and storage medium - Google Patents

Centralized method for scheduling task, system and storage medium Download PDF

Info

Publication number
CN109684080A
CN109684080A CN201811503773.6A CN201811503773A CN109684080A CN 109684080 A CN109684080 A CN 109684080A CN 201811503773 A CN201811503773 A CN 201811503773A CN 109684080 A CN109684080 A CN 109684080A
Authority
CN
China
Prior art keywords
task
execution machine
allocated
available
tasks
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.)
Pending
Application number
CN201811503773.6A
Other languages
Chinese (zh)
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.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Priority to CN201811503773.6A priority Critical patent/CN109684080A/en
Publication of CN109684080A publication Critical patent/CN109684080A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • G06F9/5033Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals considering data affinity
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5083Techniques for rebalancing the load in a distributed system
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/50Indexing scheme relating to G06F9/50
    • G06F2209/5022Workload threshold

Abstract

The present invention relates to load dispatch technology, a kind of centralized method for scheduling task, system and storage medium are provided.This method comprises the following steps: obtaining the available mode of execution machine, calculates the quantity that can use execution machine;Task to be allocated is obtained, the cryptographic Hash of the task to be allocated is calculated according to the attribute information of the task to be allocated;Utilize the cryptographic Hash and the available execution machine that the task to be allocated can be calculated with the quantity of execution machine;According to the relationship in execution number of tasks and preset threshold of the available execution machine being calculated and other available execution machines, selection executes the available execution machine of the task to be allocated.Using the present invention, balance can be obtained between resource multiplex and load balancing, is conducive to raising task treatment effeciency, can also improve the stability and resource utilization of centralized task scheduling system.

Description

Centralized method for scheduling task, system and storage medium
Technical field
The present invention relates to computer task administrative skill field more particularly to a kind of centralized method for scheduling task, system And computer readable storage medium.
Background technique
It is wherein stored according to scheduling information and dispatching algorithm wherein executes, task scheduling system can be divided into two Class: centralized task scheduling system and distributed task dispatching system.In general, centralized task scheduling system includes a conduct Then the controller of hub scheduler and several execution machines, all tasks are redistributed to each by the controller United Dispatching A execution machine executes up.
Currently, centralized task scheduling system is appointed mostly by way of being randomly assigned between multiple execution machines to distribute Business.Since the execution duration of task is not quite similar, this mode may result in task distribution unevenness, single execution machine pressure mistake Greatly, increase task waiting time, thus influence that system is stable or multiple execution machines do not load and the case where waste of resource. In addition, this method of salary distribution does not account for yet will be assigned to identical execution machine execution with generic task, to realize resource multiplex, mention The case where high task treatment effeciency.
Summary of the invention
The main purpose of the present invention is to provide a kind of centralized method for scheduling task, system and computer-readable storage mediums Matter for improving the stability and resource utilization of centralized task scheduling system, and improves task treatment effeciency.
To achieve the above object, the present invention provides a kind of centralized method for scheduling task, is applied to centralized task schedule System, this method comprises:
Initialization step: obtaining the available mode of execution machine, calculates the quantity that can use execution machine;
Mapping step: obtaining task to be allocated, calculates the task to be allocated according to the attribute information of the task to be allocated Cryptographic Hash;
It calculates step: calculating the first remainder value of the cryptographic Hash Yu the quantity with execution machine, used from described Available execution machine corresponding with the first remainder value is determined in execution machine;And
Allocation step: when the available execution machine of the determination is executing number of tasks and is less than preset threshold, will it is described to The available execution machine that distribution task distributes to the determination executes;When the determination available execution machine execute number of tasks it is big In or when being equal to the preset threshold, by the task to be allocated distribute to it is any other execute number of tasks be less than it is described default The available execution machine of threshold value executes;Number of tasks is being executed both greater than or equal to the preset threshold with execution machine when described When, will the task to be allocated distribute to the determination available execution machine execute.
Preferably, the attribute information of the task to be allocated includes task names and task's owner name's title.
Preferably, the mapping step includes:
Hash operation is carried out using title of first hash function to the task to be allocated, obtains the first operation result;
Hash operation is carried out using owner title of second hash function to the task to be allocated, obtains the second operation As a result;
XOR operation is carried out to first operation result and second operation result, obtains third operation result, it will Cryptographic Hash of the third operation result as the task to be allocated.
Preferably, first hash function and second hash function are one or both of MD5, SHA-1.
Preferably, the task to be allocated is distributed into any other in the allocation step and executes number of tasks less than institute The process for stating the available execution machine execution of preset threshold includes the following steps:
It obtains and is less than the quantity that can use execution machine and the natural number relatively prime with the quantity with execution machine, statistics The quantity of the natural number of acquisition;
Calculate the second remainder value of the quantity of the cryptographic Hash of the task to be allocated and the natural number of the acquisition, choose with Second remainder is worth the corresponding natural number as scanning step;
According to the scanning step successively judge each available execution machine execute number of tasks whether be less than the default threshold Value;
It, will the task to be allocated distribution when executing number of tasks and being less than the preset threshold of execution machine can be used in some It can be used execution machine to execute to this, terminate the allocation step.
The present invention also provides a kind of centralized task scheduling system, which includes memory, place Device and several execution machines are managed, includes task dispatch in the memory, which is executed by the processor Shi Shixian following steps:
Initialization step: obtaining the available mode of execution machine, calculates the quantity that can use execution machine;
Mapping step: obtaining task to be allocated, calculates the task to be allocated according to the attribute information of the task to be allocated Cryptographic Hash;
It calculates step: calculating the first remainder value of the cryptographic Hash Yu the quantity with execution machine, used from described Available execution machine corresponding with the first remainder value is determined in execution machine;And
Allocation step: when the available execution machine of the determination is executing number of tasks and is less than preset threshold, will it is described to The available execution machine that distribution task distributes to the determination executes;When the determination available execution machine execute number of tasks it is big In or when being equal to the preset threshold, by the task to be allocated distribute to it is any other execute number of tasks be less than it is described default The available execution machine of threshold value executes;Number of tasks is being executed both greater than or equal to the preset threshold with execution machine when described When, will the task to be allocated distribute to the determination available execution machine execute.
The present invention also provides a kind of computer readable storage medium, task tune is stored in the computer readable storage medium Program is spent, which is performed the arbitrary steps realized in centralized method for scheduling task as described above.
Centralization method for scheduling task, system and computer readable storage medium provided by the invention, are executed by obtaining The available mode of machine calculates the quantity that can use execution machine, task to be allocated is then obtained, according to the attribute of the task to be allocated Information calculates the cryptographic Hash of the task to be allocated, calculates institute followed by the cryptographic Hash and the quantity with execution machine State the available execution machine of task to be allocated, the available execution machine being finally calculated and other available execution machines are appointed executing The relationship being engaged between number and preset threshold, selection execute the available execution machine of the task to be allocated.In the present invention, institute is utilized State cryptographic Hash and it is described can be in order to preferentially will be described with the available execution machine that the quantity of the machine of execution calculates the task to be allocated The identical task of attribute information is distributed to identical available execution machine with generic task and is executed, to realize resource multiplex, improves and appoint Business treatment effeciency.In addition, avoiding the load pressure of same available execution machine excessive by the way that the preset threshold is arranged, realize as far as possible Load balancing.Therefore, using the present invention, the stability and resource utilization of centralized task scheduling system can be improved, also Help raising task treatment effeciency.
Detailed description of the invention
Fig. 1 is the schematic diagram of the present invention one embodiment of centralized task scheduling system;
Fig. 2 is the Program modual graph of one embodiment of task dispatch in Fig. 1;
Fig. 3 is the flow diagram of the present invention one embodiment of centralized method for scheduling task.
The embodiments will be further described with reference to the accompanying drawings for the realization, the function and the advantages of the object of the present invention.
Specific embodiment
It should be understood that the specific embodiments described herein are merely illustrative of the present invention, it is not used to limit this Invention.Based on the embodiments of the present invention, those of ordinary skill in the art are obtained without making creative work The every other embodiment obtained, shall fall within the protection scope of the present invention.
The present invention provides a kind of centralized task scheduling system.Shown in referring to Fig.1, for the present invention centralized task schedule system The schematic diagram for 1 one embodiments of uniting.
The centralization task scheduling system 1 includes memory 11, processor 12, network interface 13 and executes machine cluster 14。
Wherein, the memory 11 includes the readable storage medium storing program for executing of at least one type.At least one type can Read the non-volatile memory medium that storage medium can be such as flash memory, hard disk, multimedia card, card-type memory.In some implementations In example, the readable storage medium storing program for executing can be the internal storage unit of the centralized task scheduling system 1, such as the centralization Host hard drive in task scheduling system 1.In further embodiments, the readable storage medium storing program for executing is also possible to the centralization The plug-in type hard disk being equipped on the external memory 11 of task scheduling system 1, such as the centralized task scheduling system 1, intelligence Energy storage card (Smart Media Card, SMC), secure digital (Secure Digital, SD) card, flash card (Flash Card) etc..
In the present embodiment, the readable storage medium storing program for executing of the memory 11 is commonly used in store tasks scheduler program 10.Institute Stating memory 11 can be also used for temporarily storing the data that has exported or will export.
The processor 12 include centered on scheduler controller, the controller be responsible for all tasks to be allocated into Row United Dispatching, and assign it to each execution machine in the execution machine cluster 14 and execute up.In some embodiments, The processor 12 can be a central processing unit (Central Processing Unit, CPU), microprocessor or other numbers According to processing chip, program code for being stored in run memory 11, such as execute the task dispatch 10.
The network interface 13 may include standard wireline interface and wireless interface (such as WI-FI interface).Commonly used in Communication connection is established between the centralization task scheduling system 1 and other electronic equipments or system.
The execution machine cluster 14 includes several execution machines.The execution machine can be the various electronics with calculation function Equipment, including but not limited to server, smart phone, phone wrist-watch, tablet computer, portable computer, desktop PC, Game station, E-book reader, MP3 player (Moving Picture Experts Group Audio Layer III), MP4 player (Moving Picture Experts Group Audio Layer IV), etc..In one embodiment In, when the execution machine is server, which can be rack-mount server, blade server, tower server Or the one or more of Cabinet-type server etc..In another embodiment, different execution machines can also be deployed in same In server.
In the present invention, it is assumed for convenience of description that the execution machine executed in a group of planes 14 is the execution of same type Machine, configuration having the same and processing capacity.
In one embodiment, it can determine whether each execution machine can be used by way of sending broadcasting packet, it can The broadcasting packet for determining node device available mode is sent to each execution machine, and is determined according to the response message received Each available mode information for executing machine, the available mode information can serve to indicate that whether each node device can be used.Pass through statistics The quantity that execution machine can be used in the centralized task scheduling system can be determined by analyzing the available mode information.
Fig. 1 illustrates only the centralized task scheduling system 1 with component 11-14 and task dispatch 10, but answers What is understood is, it is not required that implements all components shown, the implementation that can be substituted is more or less component.
Optionally, which can also include input unit such as keyboard (Keyboard), voice Input unit such as microphone (Microphone) etc. has the equipment and instantaneous speech power such as sound of speech identifying function Sound, earphone etc..User can be configured and adjust to the task dispatch 10 using these devices and equipment.
Optionally, which can also include display, be referred to as display screen or display is single Member.It can be light-emitting diode display, liquid crystal display, touch-control liquid crystal display and organic light-emitting diodes in some embodiments Manage (Organic Light-Emitting Diode, OLED) display etc..Display is for being shown in centralized task schedule The information that is handled in system 1 and for showing visual user interface.
The centralization task scheduling system 1 can also include radio frequency (Radio Frequency, RF) circuit, sensor, sound Frequency circuit, wireline interface and wireless interface etc., details are not described herein.
In the above-described embodiments, processor 12 execute memory 11 in store task dispatch 10 when may be implemented as Lower step:
Initialization step: obtaining the available mode of execution machine, calculates the quantity that can use execution machine;
Mapping step: obtaining task to be allocated, calculates the task to be allocated according to the attribute information of the task to be allocated Cryptographic Hash;
It calculates step: calculating the first remainder value of the cryptographic Hash Yu the quantity with execution machine, used from described Available execution machine corresponding with the first remainder value is determined in execution machine;And
Allocation step: when the available execution machine of the determination is executing number of tasks and is less than preset threshold, will it is described to The available execution machine that distribution task distributes to the determination executes;When the determination available execution machine execute number of tasks it is big In or when being equal to the preset threshold, by the task to be allocated distribute to it is any other execute number of tasks be less than it is described default The available execution machine of threshold value executes;Number of tasks is being executed both greater than or equal to the preset threshold with execution machine when described When, will the task to be allocated distribute to the determination available execution machine execute.
About being discussed in detail for above-mentioned steps, program mould of following Fig. 2 about 10 embodiment of task dispatch is please referred to The explanation of block figure and Fig. 3 about the flow chart of centralized method for scheduling task embodiment.
In other embodiments, the task dispatch 10 can be divided into multiple modules, and multiple module is deposited It is stored in memory 12, and is executed by processor 13, to complete the present invention.The so-called module of the present invention be refer to complete it is specific The series of computation machine program instruction section of function.
It is the Program modual graph of 10 1 embodiment of task dispatch in Fig. 1 referring to shown in Fig. 2.In the present embodiment, institute Stating task dispatch 10 can be divided into: initialization module 110, mapping block 120, computing module 130 and distribution module 140。
The initialization module 110 calculates the quantity that can use execution machine for obtaining the available mode of execution machine.Specifically Ground, initialization module 110 can send the broadcasting packet and basis for determining node device available mode to each execution machine The response message received calculates the quantity that can use execution machine, can also can be numbered with execution machine to described, for each institute Available execution machine distribution one uniquely available execution machine number is stated, for example, can use with incrementing integers to be each described since 0 Execution machine number: 0,1,2 ....
The mapping block 120, for obtaining task to be allocated, and being calculated according to the attribute information of the task to be allocated should The cryptographic Hash of task to be allocated.Wherein, the attribute information of the task to be allocated includes task names and task's owner name's title. In one embodiment, MD5 operation can be carried out to the title of the task to be allocated, obtains the first operation result, then to institute The owner's title for stating task to be allocated carries out SHA-1 operation, the second operation result is obtained, finally by second operation result Latter 128 of (160) with (128) progress XOR operation of first operation result, obtain third operation result, by this Cryptographic Hash of three operation results as the task to be allocated.It is understood that with generic task task usually having the same Title, task's owner name is also identical, therefore, according to above-mentioned Hash value calculating method, will obtain identical Hash with generic task Value.
The computing module 130, for calculating the first remainder value of the cryptographic Hash Yu the quantity with execution machine, From described with available execution machine corresponding with the first remainder value determining in execution machine.For example, execution machine can be used when described When number is followed successively by 0,1,2 ... i, if the cryptographic Hash of some task to be allocated and the quantity (i+1) with execution machine When remainder value is 0, then the available execution machine that number is 0 is available execution machine corresponding with the first remainder value.Because same The cryptographic Hash of generic task is identical, so, for same generic task, the available execution machine of the determination is identical.The computing module 130 Effect be, same generic task preferentially can be distributed into identical available execution machine and executed, to realize resource multiplex, improved and appoint Business execution efficiency.
The distribution module 140, for holding according to the available execution machine of the determination and other available execution machines The relationship of row number of tasks and preset threshold, selection execute the available execution machine of the task to be allocated.Specifically, when the determination Available execution machine execute number of tasks be less than preset threshold (such as 8) when, by the task to be allocated distribute to it is described really Fixed available execution machine executes;When the determination available execution machine execute number of tasks be greater than or equal to the preset threshold When, by the task to be allocated distribute to it is any other execute number of tasks be less than the preset threshold available execution machine hold Row;Number of tasks is being executed both greater than or when being equal to the preset threshold with execution machine when described, it will be to be allocated described The available execution machine that the determination is distributed in business executes.
In one embodiment, an one-dimension array can be defined, the element and the execution machine one of the array are made One is corresponding, and the value of each element is equal in execution number of tasks with each available execution machine.It is understood that in the centralization It, therefore, can will be each in the one-dimension array without in the task of execution on each available execution machine when task scheduling system 1 just starts The initial value of element is assigned to 0, and when to that can use distribution task on execution machine, the value of element is increased accordingly, when task execution is completed When, the value of element accordingly reduces, to keep the value of each element equal in execution number of tasks with each available execution machine.In addition, institute Stating one-dimension array can be dynamic one-dimension array, and when available execution machine delay machine, the number of elements of the one-dimension array can accordingly subtract It is small, when the available execution machine in the centralized task scheduling system 1 increases, the element of the one-dimension array can be increase accordingly Quantity simultaneously carries out assignment to increased element according to above-mentioned rule.
In the present embodiment, the task to be allocated is distributed into any other and executes number of tasks less than the default threshold The process that the available execution machine of value executes includes following operation:
Calculate scanning step:
Step=coprimeList (NumInvokers) .get (hash%size (coprimerList (NumInvokers)));
Calculate the number of other any available execution machines:
Invoker number=(homeInvoker+m*step) %NumInvokers;
Judge currently available execution machine is executing whether number of tasks is less than the preset threshold;
If currently available execution machine execute number of tasks be less than the preset threshold when, will the task to be allocated divide The dispensing available execution machine executes, and terminates the allocation step;
If currently available execution machine when executing number of tasks and being not less than the preset threshold, enable m=m+1, calculate another The number of one available execution machine, judge another available execution machine is executing whether number of tasks is less than the preset threshold.
Wherein, NumInvokers indicates that the quantity of execution machine can be used, and coprimeList (NumInvokers) indicates to obtain Less than NumInvokers value and the natural number list relatively prime with NumInvokers value, size (coprimeList (NumInvokers)) number of natural number in the natural number list, get (hash%size (coprimeList are indicated (NumInvokers)) it) indicates first with the cryptographic Hash of the task to be allocated to the number of natural number in the natural number list Remainder calculating is carried out, numerical value corresponding with gained remainder value is then obtained from the natural number list, homeInvoker indicates institute The number of determining available execution machine is stated, variable m indicates the integer value from 1 to NumInvokers-1.
As m=NumInvokers-1, will complete to it is all it is described with execution machine execute number of tasks with it is described pre- If the judgement of threshold value relative size.If described in all number of tasks can be being executed both greater than or equal to the default threshold with execution machine When value, then will the task to be allocated distribute to the determination available execution machine execute.
In some embodiments, the quantity of the preset threshold can be greater than 1.For example, it is assumed that the preset threshold includes First threshold and second threshold, the first threshold and the second threshold are respectively less than the upper loading limit that can use execution machine, and should First threshold is less than the second threshold, then the distribution module 140 first judges appointing in execution for the available execution machine of the determination Business number whether be less than the first threshold (such as 3), when the determination available execution machine execute number of tasks be less than this first When threshold value, the available execution machine that the task to be allocated distributes to the determination is executed;When the available execution machine of the determination Execute number of tasks be not less than the first threshold when, by the task to be allocated distribute to it is any other execute number of tasks be less than The available execution machine of the first threshold executes;When all available execution machines are executing number of tasks and are both greater than the first threshold, The first threshold is replaced with the second threshold (such as 8), re-executes above-mentioned allocation step, until by the task to be allocated It distributes in the available execution machine for executing the determination of the number of tasks less than the second threshold, or the task to be allocated is distributed To other any available execution machines for being less than the second threshold in execution number of tasks.If all available execution machines execute task Number be both greater than the second thresholds, then will the task to be allocated distribute to the determination available execution machine execute.At other In embodiment, the preset threshold can also include third threshold value, the 4th threshold value etc., and details are not described herein.
As described above, by the way that the computing module 130 and the distribution module 140 is used in combination, it is especially more when being arranged When a preset threshold, it can balance and similar task to be allocated is distributed into identical available execution machine execution and realizes load balancing The relationship of the two had not only been avoided that available execution machine load too high influenced system performance individually, but also can be in the available of the determination The available execution machine that similar task to be allocated distributes to identical determination is executed under the premise of the load of execution machine is not high, realizes money Source multiplexing, to improve task treatment effeciency, and does not interfere with the stability of centralized task scheduling system.
In addition, the present invention also provides a kind of centralized method for scheduling task.Referring to shown in Fig. 3, appoint for present invention centralization The flow diagram of the embodiment of business dispatching method.The processor 12 of centralized task scheduling system 1 executes to be deposited in memory 11 The following steps of centralized method for scheduling task are realized when the task dispatch 10 of storage:
Step S300 obtains the available mode of execution machine using the initialization module 110, calculates the number that can use execution machine Amount.In the present embodiment, by sending broadcasting packet and reception for determining node device available mode to each execution machine Response message obtains the available mode of the execution machine in the centralized task scheduling system 1, and then counts and can use execution machine Quantity.
Step S301 obtains task to be allocated using the mapping block 120, and is believed according to the attribute of the task to be allocated Breath calculates the cryptographic Hash of the task to be allocated.In this embodiment, the attribute information of the task to be allocated includes task names With task's owner name's title, the mapping block 120 first carries out MD5 operation to the title of the task to be allocated, obtains first Operation result, then SHA-1 operation is carried out to owner's title of the task to be allocated, the second operation result is obtained, finally will Latter 128 of second operation result (160) with (128) progress XOR operation of first operation result, obtain the Three operation results, using the third operation result as the cryptographic Hash of the task to be allocated.
Step S302, the forward allocator module 130 calculate the first of the cryptographic Hash and the quantity with execution machine Remainder value, from described with available execution machine corresponding with the first remainder value determining in execution machine.Because with the Kazakhstan of generic task Uncommon value is identical, so, for same generic task, the available execution machine of the determination is identical.The computing module 130 acts on In same generic task preferentially being distributed to identical available execution machine and executed, to realize resource multiplex, improve task execution effect Rate.
Step S303, using the distribution module 140 according to the available execution machine of the determination and other available execution The relationship in execution number of tasks and preset threshold of machine, selection execute the available execution machine of the task to be allocated.In this implementation In example, it is assumed that the preset threshold includes first threshold and second threshold, and the first threshold and the second threshold are respectively less than described The upper loading limit of execution machine can be used, and the first threshold is less than the second threshold, then the distribution module 140 first judges described true Fixed available execution machine is executing whether number of tasks is less than the first threshold (such as 3), when the available execution machine of the determination Execute number of tasks be less than the first threshold when, by the task to be allocated distribute to the determination available execution machine execute; When the available execution machine of the determination is executing number of tasks and is not less than the first threshold, the task to be allocated is distributed to Any other are executing available execution machine execution of the number of tasks less than the first threshold;When appointing in execution for all available execution machines When business number is both greater than the first threshold, the first threshold is replaced with the second threshold (such as 8), re-executes above-mentioned distribution step Suddenly.The specific method of salary distribution please refers to above-mentioned being discussed in detail about distribution module 140, and details are not described herein.
In addition, the computer readable storage medium can be firmly the present invention also provides a kind of computer readable storage medium Disk, multimedia card, SD card, flash card, SMC, read-only memory (ROM), Erasable Programmable Read Only Memory EPROM (EPROM), just Take any one in formula aacompactadisk read onlyamemory (CD-ROM), USB storage etc. or several any combination.It is described Include task dispatch 10 in computer readable storage medium, which is performed the following operation of realization:
Initialization step: obtaining the available mode of execution machine, calculates the quantity that can use execution machine;
Mapping step: obtaining task to be allocated, calculates the task to be allocated according to the attribute information of the task to be allocated Cryptographic Hash;
It calculates step: calculating the first remainder value of the cryptographic Hash Yu the quantity with execution machine, used from described Available execution machine corresponding with the first remainder value is determined in execution machine;And
Allocation step: when the available execution machine of the determination is executing number of tasks and is less than preset threshold, will it is described to The available execution machine that distribution task distributes to the determination executes;When the determination available execution machine execute number of tasks it is big In or when being equal to the preset threshold, by the task to be allocated distribute to it is any other execute number of tasks be less than it is described default The available execution machine of threshold value executes;Number of tasks is being executed both greater than or equal to the preset threshold with execution machine when described When, will the task to be allocated distribute to the available execution machine of the determination.
The specific embodiment of the computer readable storage medium of the present invention and above-mentioned centralized method for scheduling task sum aggregate The specific embodiment of Chinese style task scheduling system 1 is roughly the same, please refers to above-mentioned Fig. 2 about 10 embodiment of task dispatch Program modual graph and Fig. 3 be discussed in detail about the flow chart of centralized method for scheduling task embodiment, it is no longer superfluous herein It states.
It should be noted that, in this document, the terms "include", "comprise" or its any other variant are intended to non-row His property includes, so that the process, device, article or the method that include a series of elements not only include those elements, and And further include other elements that are not explicitly listed, or further include for this process, device, article or method institute it is intrinsic Element.It in addition, the technical solution between each embodiment can be combined with each other, but must be with ordinary skill people Based on member can be realized, this technical solution will be understood that when the combination of technical solution appearance is conflicting or cannot achieve Combination be not present, also not the present invention claims protection scope within.
Through the above description of the embodiments, those skilled in the art can be understood that above-described embodiment side Method can be realized by means of software and necessary general hardware platform, naturally it is also possible to by hardware, but in many cases The former is more preferably embodiment.Based on this understanding, technical solution of the present invention substantially in other words does the prior art The part contributed out can be embodied in the form of software products, which is stored in one as described above In storage medium, used including some instructions so that centralized task scheduling system executes side described in each embodiment of the present invention Method.
The above is only a preferred embodiment of the present invention, is not intended to limit the scope of the invention, all to utilize this hair Equivalent structure or equivalent flow shift made by bright specification and accompanying drawing content is applied directly or indirectly in other relevant skills Art field, is included within the scope of the present invention.

Claims (10)

1. a kind of centralization method for scheduling task, is applied to centralized task scheduling system, which is characterized in that this method comprises:
Initialization step: obtaining the available mode of execution machine, calculates the quantity that can use execution machine;
Mapping step: obtaining task to be allocated, and the Hash of the task to be allocated is calculated according to the attribute information of the task to be allocated Value;
It calculates step: calculating the first remainder value of the cryptographic Hash Yu the quantity with execution machine, from described with execution Available execution machine corresponding with the first remainder value is determined in machine;And
Allocation step:, will be described to be allocated when the available execution machine of the determination is executing number of tasks and is less than preset threshold The available execution machine that task distributes to the determination executes;When the determination available execution machine execute number of tasks be greater than or When equal to the preset threshold, the task to be allocated is distributed into any other and is executing number of tasks less than the preset threshold Available execution machine execute;Number of tasks is being executed both greater than or when being equal to the preset threshold with execution machine when described, still The available execution machine that the task to be allocated distributes to the determination is executed.
2. centralization method for scheduling task as described in claim 1, which is characterized in that the attribute information of the task to be allocated Including task names and task's owner name's title.
3. centralization method for scheduling task as claimed in claim 2, which is characterized in that the mapping step includes:
Hash operation is carried out using title of first hash function to the task to be allocated, obtains the first operation result;
Hash operation is carried out using owner title of second hash function to the task to be allocated, obtains the second operation knot Fruit;
XOR operation is carried out to first operation result and second operation result, obtains third operation result, by this Cryptographic Hash of three operation results as the task to be allocated.
4. centralization method for scheduling task as claimed in claim 3, which is characterized in that first hash function and described the Two hash functions are one or both of MD5, SHA-1.
5. the centralized method for scheduling task as described in any one of Claims 1-4, which is characterized in that the distribution step The task to be allocated any other are distributed in rapid to hold in the available execution machine for executing number of tasks and being less than the preset threshold Capable process includes the following steps:
It obtains and is less than the quantity that can use execution machine and the natural number relatively prime with the quantity with execution machine, count and obtain Natural number quantity;
Calculate the second remainder value of the quantity of the cryptographic Hash of the task to be allocated and the natural number of the acquisition, choose with this Two remainders are worth the corresponding natural number as scanning step;
According to the scanning step successively judge each available execution machine execute number of tasks whether be less than the preset threshold;
When some can be used execution machine execute number of tasks be less than the preset threshold when, the task to be allocated is distributed to this It can be executed with execution machine, terminate the allocation step.
6. a kind of centralization task scheduling system, including memory, processor and several execution machines, which is characterized in that described to deposit Include task dispatch in reservoir, which realizes following steps when being executed by the processor:
Initialization step: obtaining the available mode of execution machine, calculates the quantity that can use execution machine;
Mapping step: obtaining task to be allocated, and the Hash of the task to be allocated is calculated according to the attribute information of the task to be allocated Value;
It calculates step: calculating the first remainder value of the cryptographic Hash Yu the quantity with execution machine, from described with execution Available execution machine corresponding with the first remainder value is determined in machine;And
Allocation step:, will be described to be allocated when the available execution machine of the determination is executing number of tasks and is less than preset threshold The available execution machine that task distributes to the determination executes;When the determination available execution machine execute number of tasks be greater than or When equal to the preset threshold, the task to be allocated is distributed into any other and is executing number of tasks less than the preset threshold Available execution machine execute;Number of tasks is being executed both greater than or when being equal to the preset threshold with execution machine when described, still The available execution machine that the task to be allocated distributes to the determination is executed.
7. centralization task scheduling system as claimed in claim 6, which is characterized in that the attribute information of the task to be allocated Including task names and task's owner name's title.
8. centralization task scheduling system as claimed in claim 7, which is characterized in that the mapping step includes:
Hash operation is carried out using title of first hash function to the task to be allocated, obtains the first operation result;
Hash operation is carried out using owner title of second hash function to the task to be allocated, obtains the second operation knot Fruit;
XOR operation is carried out to first operation result and second operation result, obtains third operation result, by this Cryptographic Hash of three operation results as the task to be allocated.
9. centralization task scheduling system as claimed in claim 6, which is characterized in that will be described wait divide in the allocation step Any other, which are distributed to, with task is executing the process of available execution machine execution of the number of tasks less than the preset threshold including such as Lower step:
It obtains and is less than the quantity that can use execution machine and the natural number relatively prime with the quantity with execution machine, count and obtain Natural number quantity;
Calculate the second remainder value of the quantity of the cryptographic Hash of the task to be allocated and the natural number of the acquisition, choose with this Two remainders are worth the corresponding natural number as scanning step;
According to the scanning step successively judge each available execution machine execute number of tasks whether be less than the preset threshold;
When some can be used execution machine execute number of tasks be less than the preset threshold when, the task to be allocated is distributed to this It can be executed with execution machine, terminate the allocation step.
10. a kind of computer readable storage medium, which is characterized in that include task schedule in the computer readable storage medium Program, the task dispatch are performed the centralized task schedule side realized as described in any one of claim 1 to 5 The step of method.
CN201811503773.6A 2018-12-10 2018-12-10 Centralized method for scheduling task, system and storage medium Pending CN109684080A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811503773.6A CN109684080A (en) 2018-12-10 2018-12-10 Centralized method for scheduling task, system and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811503773.6A CN109684080A (en) 2018-12-10 2018-12-10 Centralized method for scheduling task, system and storage medium

Publications (1)

Publication Number Publication Date
CN109684080A true CN109684080A (en) 2019-04-26

Family

ID=66187237

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811503773.6A Pending CN109684080A (en) 2018-12-10 2018-12-10 Centralized method for scheduling task, system and storage medium

Country Status (1)

Country Link
CN (1) CN109684080A (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110225082A (en) * 2019-04-30 2019-09-10 北京奇艺世纪科技有限公司 Task processing method, device, electronic equipment and computer-readable medium
CN110245009A (en) * 2019-05-14 2019-09-17 平安科技(深圳)有限公司 Periodic duty distribution method, device, computer equipment and storage medium
CN110515591A (en) * 2019-08-05 2019-11-29 湖南天河国云科技有限公司 Random digit generation method and device based on block chain
CN110716796A (en) * 2019-09-02 2020-01-21 中国平安财产保险股份有限公司 Intelligent task scheduling method and device, storage medium and electronic equipment
CN111190710A (en) * 2019-11-25 2020-05-22 泰康保险集团股份有限公司 Task allocation method and device
WO2021022706A1 (en) * 2019-08-08 2021-02-11 平安科技(深圳)有限公司 Task allocation method for distributed computing system, and related device

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105791431A (en) * 2016-04-26 2016-07-20 北京邮电大学 On-line distributed monitoring video processing task scheduling method and device
CN107087031A (en) * 2017-05-10 2017-08-22 浙江宇视科技有限公司 A kind of storage resource load-balancing method and device
CN108696581A (en) * 2018-05-07 2018-10-23 上海智臻智能网络科技股份有限公司 Caching method, device, computer equipment and the storage medium of distributed information

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105791431A (en) * 2016-04-26 2016-07-20 北京邮电大学 On-line distributed monitoring video processing task scheduling method and device
CN107087031A (en) * 2017-05-10 2017-08-22 浙江宇视科技有限公司 A kind of storage resource load-balancing method and device
CN108696581A (en) * 2018-05-07 2018-10-23 上海智臻智能网络科技股份有限公司 Caching method, device, computer equipment and the storage medium of distributed information

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110225082A (en) * 2019-04-30 2019-09-10 北京奇艺世纪科技有限公司 Task processing method, device, electronic equipment and computer-readable medium
CN110225082B (en) * 2019-04-30 2021-12-10 北京奇艺世纪科技有限公司 Task processing method and device, electronic equipment and computer readable medium
CN110245009A (en) * 2019-05-14 2019-09-17 平安科技(深圳)有限公司 Periodic duty distribution method, device, computer equipment and storage medium
CN110245009B (en) * 2019-05-14 2024-03-08 平安科技(深圳)有限公司 Periodic task allocation method, device, computer equipment and storage medium
CN110515591A (en) * 2019-08-05 2019-11-29 湖南天河国云科技有限公司 Random digit generation method and device based on block chain
WO2021022706A1 (en) * 2019-08-08 2021-02-11 平安科技(深圳)有限公司 Task allocation method for distributed computing system, and related device
CN110716796A (en) * 2019-09-02 2020-01-21 中国平安财产保险股份有限公司 Intelligent task scheduling method and device, storage medium and electronic equipment
CN111190710A (en) * 2019-11-25 2020-05-22 泰康保险集团股份有限公司 Task allocation method and device

Similar Documents

Publication Publication Date Title
CN109684080A (en) Centralized method for scheduling task, system and storage medium
CN109669775A (en) Distributed task dispatching method, system and storage medium
CN108762931A (en) Method for scheduling task, server based on distributed scheduling system and storage medium
CN109634748A (en) Cluster resource dispatching method, device, equipment and computer readable storage medium
CN107241281B (en) Data processing method and device
CN109857551B (en) Service resource scheduling method and device based on cloud computing and electronic equipment
US20160018990A1 (en) Electronic device and method for managing memory of electronic device
CN108009006A (en) The dispatching method and device of I/O requests
US20140040895A1 (en) Electronic device and method for allocating resources for virtual machines
CN110221901A (en) Container asset creation method, apparatus, equipment and computer readable storage medium
CN109906421A (en) Processor core based on thread importance divides
CN109634915A (en) File dispositions method, Cloud Server, system and storage medium
CN105589750A (en) CPU (Central Processing Unit) resource scheduling method and server
CN112988362B (en) Task processing method and device, electronic equipment and storage medium
US9075789B2 (en) Methods and apparatus for interleaving priorities of a plurality of virtual processors
CN103873587B (en) A kind of method and device that scheduling is realized based on cloud platform
US10922193B2 (en) Data backup method, storage medium, and terminal
CN110502256A (en) A kind of method for upgrading software, terminal and storage medium
CN103870339A (en) Cluster resource allocation method and cluster resource allocation device
US9063668B1 (en) Distributed memory allocation in multi-threaded programs
CN109725991A (en) Task processing method, device, equipment and readable storage medium storing program for executing
US20140047057A1 (en) Wireless storage management system
CN103713852A (en) Method for processing information, service platform and electronic devices
CN111338745B (en) Deployment method and device of virtual machine and intelligent device
CN109146446A (en) A kind of virtual objects distribution method, apparatus and system

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