CN107977257A - A kind of method for scheduling task and device - Google Patents
A kind of method for scheduling task and device Download PDFInfo
- Publication number
- CN107977257A CN107977257A CN201610937469.7A CN201610937469A CN107977257A CN 107977257 A CN107977257 A CN 107977257A CN 201610937469 A CN201610937469 A CN 201610937469A CN 107977257 A CN107977257 A CN 107977257A
- Authority
- CN
- China
- Prior art keywords
- task
- computing resource
- subtask
- resource value
- processing
- 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
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/46—Multiprogramming arrangements
- G06F9/48—Program initiating; Program switching, e.g. by interrupt
- G06F9/4806—Task transfer initiation or dispatching
- G06F9/4843—Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5005—Allocation of resources, e.g. of the central processing unit [CPU] to service a request
- G06F9/5027—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
Abstract
The embodiment of the invention discloses a kind of method for scheduling task and device, the described method includes:Receive the vacant computing resource value of processing server feedback;Judge in task queue with the presence or absence of the task of non-cutting;If it does, calculate the processing computing resource value of all required by task in processing task queue;According to vacant computing resource value and processing computing resource value, cutting is carried out to the task of non-cutting, obtains the subtask of the task of non-cutting;According to vacant computing resource value, the subtask in task queue is sent to processing server, so that:Processing server docks received subtask and is handled.Since management server carries out cutting according to vacant computing resource value to the task of non-cutting and sends, so it effectively prevent the problem of processing server can not handle subtask, ensure that loss or redundancy will not occur for data, while the computing resource of processing server is rationally utilized.
Description
Technical field
The present invention relates to network technique field, more particularly to a kind of method for scheduling task and device.
Background technology
The processing of task generally has regular hour constraint, in particular for the real-time task for carrying out processing analysis in real time
Requirement higher to the time, i.e., have more stringent regulation to the deadline of task processing.In video monitoring, common reality
When task include real-time video task and real time picture task dispatching.Above-mentioned real-time task is generally carried out by distributed real-time systems
Processing, distributed real-time systems generally comprise:Management server and at least one processing server, wherein, management server is used
In obtaining real-time task and it being scheduled, real-time task is sent into processing server, and then processing server is to receiving
To real-time task carry out the processing such as analyzing.For distributed real-time systems, scheduling of the management server to real-time task
Directly affect the real-time performance of real-time system.
In correlation technique, management server is usually to carry out random cutting to real-time task to the scheduling mode of real-time task
The subtask of real-time task is obtained afterwards, first subtask is sent to processing server at random, treats first subtask processing
After the completion of, second subtask is sent at random to processing server.
When handling real-time task using this scheduling mode, since real-time task is by random cutting, so after cutting in real time
The data volume of the subtask of task is also random.When sending subtask at random, for the processing server chosen, it is empty
Remaining computing resource value A is likely to mismatch with handling the computing resource value B needed for the subtask received, if A is less than B, that
Processing server just can not handle the subtask received, in turn result in loss of data or redundancy;If A is more than B, then place
The computing resource of reason server is just wasted.In summary as it can be seen that processing task when, the computing resource of processing server easily can not
Rationally utilized.
The content of the invention
The embodiment of the invention discloses the dispatching method and device of a kind of task, to solve relevant task scheduling mode
Present in loss of data or redundancy and computing resource the problem of can not rationally utilizing.Technical solution is as follows:
In a first aspect, an embodiment of the present invention provides a kind of method for scheduling task, the described method includes:
Receive the vacant computing resource value of processing server feedback;
Judge in task queue with the presence or absence of the task of non-cutting;
If it does, calculate the processing computing resource value for handling all required by task in the task queue;
According to the vacant computing resource value and the processing computing resource value, the task of the non-cutting is cut
Point, obtain the subtask of the task of the non-cutting;
According to the vacant computing resource value, subtask in the task queue is sent to corresponding processing server,
So that:The processing server docks received subtask and is handled.
Optionally, it is described according to the vacant computing resource value and described processing computing resource value, to the non-cutting
Task carry out cutting the step of, including:
Calculate the summation of the vacant computing resource value;
Calculate the ratio of the processing computing resource value and the summation;
According to the relation between default ratio and data volume, determine that the task of the non-cutting corresponds to the target of subtask
Data volume, cutting is carried out by the task of the non-cutting according to the target data amount.
Optionally, it is described according to the vacant computing resource value, send subtask to the place in the task queue
Before the step of managing server, the method further includes:
Set Detection task of the data volume as preset data amount;
It is described according to the vacant computing resource value, send subtask in the task queue to the processing server
The step of, including:
According to the vacant computing resource value, the subtask in the Detection task and the task queue is sent to institute
State processing server;
After Detection task described in the processing server start to process is determined, recycle and delete the Detection task, and
Indicate the subtask that the processing server start to process receives.
Optionally, it is described according to the vacant computing resource value, send subtask to the place in the task queue
The step of managing server, including:
Calculate the first computing resource value needed for the subtask in the every task queue of processing;
According to the first computing resource value and the vacant computing resource value, determine to send to each processing server
The subtask;
Identified subtask is sent to alignment processing server.
Optionally, the method further includes:
Detect whether to obtain the first task that priority is higher than the subtask being presently processing, if so, calculating is handled
The second computing resource value needed for the first task;
Detect the current vacant computing resource value of the processing server;
Identify that estimated available resources value is not less than the corresponding processing server of the second computing resource value, wherein, it is described
It is expected that the computing resource value that available resources value is equal to the current vacant computing resource value and the subtask that is handling takes it
With;
Judge whether the time that the first processing server processing is completed needed for current subtask is not less than preset value;
If the time that the first processing server processing is completed needed for current subtask is not less than preset value, institute is recycled
Current subtask is stated, and the first task is sent to first processing server, so that:First processing server pair
The first task is handled.
Second aspect, the embodiment of the present invention additionally provide a kind of task scheduling apparatus, and described device includes:
Vacant computing resource value receiving module, for receiving the vacant computing resource value of processing server feedback;
Task judgment module, for judging in task queue with the presence or absence of the task of non-cutting;
Computing resource value computing module is handled, during for there is the task of non-cutting in the task queue, at calculating
Manage the processing computing resource value of all required by task in the task queue;
Task cutting module, for according to the vacant computing resource value and it is described processing computing resource value, to it is described not
The task of cutting carries out cutting, obtains the subtask of the task of the non-cutting;
Module is sent in subtask, for according to the vacant computing resource value, sending the subtask in the task queue
To corresponding processing server, so that:The processing server docks received subtask and is handled.
Optionally, the task cutting module includes:
Sum calculation unit, for calculating the summation of the vacant computing resource value;
Computation unit, for calculating the ratio of the processing computing resource value and the summation;
Task cutting unit, for according to the relation between default ratio and data volume, determining appointing for the non-cutting
The target data amount of the corresponding subtask of business, cutting is carried out by the task of the non-cutting according to the target data amount.
Optionally, described device further includes:
Detection task setting module, for according to the vacant computing resource value, sending the son in the task queue
Before task to the processing server, Detection task of the data volume as preset data amount is set;
Module is sent in the subtask to be included:
First sends unit, for according to the vacant computing resource value, by the Detection task and the task queue
In subtask send to the processing server;
Unit is deleted in recycling, for after Detection task described in the processing server start to process is determined, recycling and deleting
Except the Detection task, and indicate the subtask that the processing server start to process receives.
Optionally, the subtask is sent module and is included:
Computing resource value computing unit, based on calculating first needed for the subtask handled in the every task queue
Calculate resource value;
Subtask determination unit, for according to the first computing resource value and the vacant computing resource value, under determining
Group to the subtask of each processing server;
Second sends unit, for sending identified subtask to alignment processing server.
Optionally, described device further includes:
Task detection module, for detecting whether it is first higher than the subtask being presently processing to obtain priority
Business, if so, calculating the second computing resource value handled needed for the first task;Detect the current sky of the processing server
Remaining computing resource value;Identify that estimated available resources value is not less than corresponding first processing server of the second computing resource value;
Judge whether the time that the first processing server processing is completed needed for current subtask is not less than preset value;If described
The time that the processing of one processing server is completed needed for current subtask is not less than preset value, recycles the current subtask, and will
The first task is sent to first processing server, so that:First processing server carries out the first task
Processing;Wherein, the subtask that the estimated available resources value is equal to the current vacant computing resource value and is handling takes
The sum of computing resource value.
In scheme provided in an embodiment of the present invention, management server receives the vacant calculating money of processing server feedback first
Source value, judges to whether there is the task of non-cutting in task queue, if it does, just calculating all tasks in processing task queue
Required processing computing resource value, then according to vacant computing resource value and processing computing resource value, to the task of non-cutting into
Row cutting, obtains the subtask of the task of non-cutting, finally according to vacant computing resource value, sends the subtask in task queue
To processing server, so that:Processing server docks received subtask and is handled.Since management server is according to according to sky
Remaining computing resource value and processing computing resource value, cutting is carried out to the task of non-cutting, and according to vacant computing resource value, is sent
Subtask in task queue, so effectively prevent the problem of processing server can not handle the subtask received, ensures
Data will not occur to lose or redundancy, while the computing resource of processing server can be made rationally to be utilized.
Brief description of the drawings
In order to illustrate more clearly about the embodiment of the present invention or technical scheme of the prior art, below will be to embodiment or existing
There is attached drawing needed in technology description to be briefly described, it should be apparent that, drawings in the following description are only this
Some embodiments of invention, for those of ordinary skill in the art, without creative efforts, can be with
Other attached drawings are obtained according to these attached drawings.
The flow chart for the first method for scheduling task that Fig. 1 is provided by the embodiment of the present invention;
The flow chart for second of method for scheduling task that Fig. 2 is provided by the embodiment of the present invention;
A kind of structure diagram for task scheduling apparatus that Fig. 3 is provided by the embodiment of the present invention.
Embodiment
Below in conjunction with the attached drawing in the embodiment of the present invention, the technical solution in the embodiment of the present invention is carried out clear, complete
Site preparation describes, it is clear that described embodiment is only part of the embodiment of the present invention, instead of all the embodiments.It is based on
Embodiment in the present invention, those of ordinary skill in the art are obtained every other without creative efforts
Embodiment, belongs to the scope of protection of the invention.
In order to solve loss of data or redundancy, and the computing resource of processing server easily occur during task scheduling
The problem of can not rationally utilizing, an embodiment of the present invention provides a kind of method for scheduling task and device.
The first method for scheduling task provided first below the embodiment of the present invention is introduced.This method can answer
For the management server in task processing system.
As shown in Figure 1, a kind of method for scheduling task, the described method includes:
S101, receives the vacant computing resource value of processing server feedback;
Management server and at least one processing server are generally comprised in task processing system, processing server can be with every
Every preset duration, the vacant computing resource value of periodic detection itself, and the vacant computing resource value is fed back into management server,
Wherein, required various resources when computing resource is processing server processing task.It should be noted that the preset duration
It can be set by those skilled in the art according to factors such as the type of task, processing required by task times, such as can be 5
Second or 10 seconds etc., it is not specifically limited herein.
Under normal circumstances, it is directly that this is vacant after processing server can be with the vacant computing resource value of periodic detection itself
Computing resource value feeds back to management server, if without vacant computing resource, then the vacant meter fed back to management server
It is just 0 to calculate resource value.Alternatively, can not also be to counting more than management server feedback air without the processing server of vacant computing resource
Calculate resource value, then management server just will not send subtask to the processing server.
Asked alternatively, management server can also periodically be sent to processing server, processing server receives the request
Afterwards, the current vacant computing resource value of itself is just fed back to management server, this is also rational.
S102, judges to whether there is the task of non-cutting in task queue, if it does, performing step S103;
After management server receives the vacant computing resource value of processing server feedback, it can be determined that be in task queue
No there is non-cutting of the task.The task queue is to be currently needed for the queue that the task queue of processing is formed.Task queue
Wait the computing resource of processing spec processing server at this time more nervous, if the computing resource of processing server is very sufficient,
So task just need not be waited in line, but directly be handled, and would not also form task queue, and then also avoid the need for
The cutting of carry out task.
By taking real-time video task as an example, current time is at 3 points in afternoon, has 10 tasks to be required for opening from current time at this time
Begin processing real-time video, and the computing resource of processing server is more nervous at this time, then this 10 tasks just need to wait in line
Processing, and then form task queue.
S103, calculates the processing computing resource value for handling all required by task in the task queue;
When judging to exist in task queue the task of non-cutting, in order to handle the task in task queue as early as possible, pipe
Suitably cutting can be carried out to task by managing server, then management server can calculate institute in processing task queue first
There is the processing computing resource value of required by task.
It should be noted that herein, the first computing resource value represents:It is every in processing server processing task queue
The computing resource value of slice, thin piece required by task;Computing resource value is handled to represent:All tasks in processing server processing task queue
Required computing resource value.
Since processing computing resource value is generally related with the specific processing operation that the type of task and needing carries out task,
For example, different processing computing resource values is generally required for log analysis task and video analytic tasks, so management service
Device can first determine the type of task and need the specific processing operation carried out to task, and the processing then can be calculated
Computing resource value.For some special tasks, its corresponding processing computing resource value is also possible to related with other factors, then
Management server can also be according to these because usually calculating processing computing resource value.
S104, according to the vacant computing resource value and the processing computing resource value, to the task of the non-cutting into
Row cutting, obtains the subtask of the task of the non-cutting;
After calculating above-mentioned processing computing resource value, management server can be according to the processing computing resource value and reception
The vacant computing resource value arrived, cutting is carried out to the task of the non-cutting in task queue, and then obtains the task of the non-cutting
Subtask.
As a kind of embodiment of the embodiment of the present invention, management server according to the processing computing resource value that calculates and
The vacant computing resource value received, can include the mode of the task progress cutting of the non-cutting in task queue:
Calculate the summation of the vacant computing resource value;
Calculate the ratio of the processing computing resource value and the summation;
According to the relation between default ratio and data volume, determine that the task of the non-cutting corresponds to the target of subtask
Data volume, cutting is carried out by the task of the non-cutting according to the target data amount.
Relation between above-mentioned default ratio and data volume can be by those skilled in the art according to processing server
The factors such as the type of disposal ability and task determine, are not specifically limited herein.According to this default ratio and data volume it
Between the non-cutting of relation cutting task, due to being fixed with the data volume of an obtained subtask of cutting, then place
Time used in these subtasks of reason server process is also fixed, and the computing resource of such processing server can be regular
Release, can reach the effect of dynamic cutting and dynamic dispatching, and then effectively improve the flexibility of task scheduling.
For example, if above-mentioned task is video task, due to data volume and the duration pass in direct ratio of video task
System, then the relation that can be preset between ratio and data volume is:If ratio is about 6 and more than 6, duration is corresponded to
For 10 minutes;If ratio is about 5, a length of 20 minutes when corresponding to;If ratio is about 4, a length of 30 minutes when corresponding to;Such as
Fruit ratio is about 3, then a length of 40 minutes when corresponding to;If ratio is about 2, a length of 50 minutes when corresponding to;If ratio is about 1
Times, then a length of 60 minutes etc. when corresponding to.If above-mentioned task is picture task, then can also preset ratio and picture frame
Relation between quantity etc..
Management server can determine above-mentioned non-cutting according to the relation between above-mentioned default ratio and data volume
Task corresponds to the target data amount of subtask, and then the task of the non-cutting can be cut according to the target data amount
Point.For example, if task is video task, management server calculates the total of processing computing resource value and vacant computing resource value
The ratio of sum is about 4, then can determine that target data amount is according to the relation between above-mentioned default ratio and data volume
30 minutes, and then can be to the task for cutting according to every progress cutting in 30 minutes.
It should be noted that be not necessarily with above-mentioned target data amount can be whole for the data volume of the task of above-mentioned non-cutting
The relation removed, if the task of the non-cutting is carried out cutting according to the target data amount, remaining piece of data amount is less than the mesh
Mark the task of data volume, then under just the data volume is come less than the task of the target data amount as a piece of subtask at this time
Group, has no effect on the processing procedure of task.
S105, according to the vacant computing resource value, subtask to the corresponding processing sent in the task queue takes
Business device, so that:The processing server docks received subtask and is handled.
In one embodiment of the invention, processing server has multiple, management server can receive it is all
After the vacant computing resource value of processing server feedback, then perform step S102.
, can be by these subtasks after task progress cutting of the management server to non-cutting obtains corresponding subtask
Send to processing server and handled.Sending the mode of subtask can include:
Calculate the first computing resource value needed for the subtask in the every task queue of processing;
According to the first computing resource value and the vacant computing resource value, determine to send to each processing server
Subtask;
Identified subtask is sent to alignment processing server.
Receive the corresponding subtask of alignment processing server process of subtask.
Due to the computing resource value needed for the subtask in every task queue of processing, i.e. the first computing resource value may not
Together, so management server can be calculated handling per the first computing resource value of slice, thin piece required by task.Need what is illustrated
It is, due to being to carry out cutting according to same target data amount during a same segmentation task, so for a cutting institute
Obtained subtask, it is identical to handle per the first computing resource value of slice, thin piece required by task, in order to mitigate management server
Pressure is calculated, for a same obtained subtask of cutting, management server can a wherein a piece of subtask of calculating processing
The first required computing resource value, and then can determine that the obtained all subtasks corresponding first of this cutting calculate money
Source value.
When sending subtask, management server is according to first meter of the above-mentioned processing being calculated per slice, thin piece required by task
The vacant resource value of resource value and each processing server is calculated, the processing that subtask is sent to the capable processing subtask is taken
Business device.If the vacant computing resource of processing server can handle multi-disc subtask, then just send the multi-disc subtask extremely
The processing server;If the vacant computing resource value of processing server may only handle a certain subtask, then just send
The piece subtask is to the processing server;If the vacant computing resource value deficiency of processing server, can not be handled any a piece of
Subtask, then just do not send subtask to the processing server.In this way, processing server can after receiving the subtask
It is handled, is not in the problem of computing resource deficiency causes task not handle, processing can also be made full use of to take
The computing resource of business device.
In one embodiment of the invention, in order to avoid the waste of processing server computing resource, under management server
When sending above-mentioned subtask, every subtask is only sent to a processing server in all processing servers, i.e., appoints per slice, thin piece
Business is not repeatedly sent.That is, management server can be every in task queue from all processing servers
Piece subtask determines a corresponding server, then sends into corresponding server subtask and is handled.
It should be noted that there is the real-time task being strict with, cutting to performing the time for real-time video task dispatching
After task obtains corresponding subtask, management server can be according to time requirement be performed, first will be every according to above-mentioned mode of sending
Corresponding first subtask of a task is sent to processing server, after the completion for the treatment of first subtask processing, then sends second
Piece subtask is to processing server.Handle the processing server of first subtask and handle the processing of second subtask
Server can be same processing server or different processing servers, this is all rational.
As it can be seen that in the scheme that the present embodiment is provided, management server receives the vacant meter of processing server feedback first
Resource value is calculated, judges to whether there is the task of non-cutting in task queue, owns if it does, just calculating in processing task queue
The processing computing resource value of required by task, then according to vacant computing resource value and processing computing resource value, appoints non-cutting
Business carries out cutting, obtains the subtask of the task of non-cutting, finally according to vacant computing resource value, sends the son in task queue
Task to processing server so that:Processing server docks received subtask and is handled.Since management server is according to root
According to vacant computing resource value and processing computing resource value, cutting is carried out to the task of non-cutting, and according to vacant computing resource value,
The subtask in task queue is sent, so the problem of processing server can not handle the subtask received is effectively prevent,
Ensure that loss or redundancy will not occur for data, while the computing resource of processing server can be made rationally to be utilized.
As a kind of embodiment of the embodiment of the present invention, the above method can also include:
Detect whether to obtain the first task that priority is higher than the subtask being presently processing, if so, calculating is handled
The second computing resource value needed for the first task;
Detect the current vacant computing resource value of the processing server;
Identify that estimated available resources value is not less than corresponding first processing server of the second computing resource value, wherein,
The estimated available resources value is equal to the computing resource of the current vacant computing resource value and the subtask occupancy handled
The sum of value;
Judge whether the time that the first processing server processing is completed needed for current subtask is not less than preset value;
If it is not, the recycling current subtask, and the first task is sent to the described first processing and is serviced
Device, so that:First processing server handles the first task.
When management server detects that obtaining priority is higher than the first task for the subtask being presently processing (below
Referred to as high-priority task) when, since high-priority task needs to handle as early as possible, then management server just requires to look up one
Computing resource suitable processing server handles the high-priority task.Management server can working as with detection process server
Computing resource shared by preceding vacant computing resource value, definite current vacant computing resource value and the current subtask handled
The summation of value is estimated available resources value, and then according to the estimated available resources value, identifies that estimated available resources value is not less than
Handle corresponding first processing server of the second computing resource value needed for the high-priority task.So first processing is taken
The current subtask that business device is being handled is interrupted, and the computing resource of first processing server just can handle the high priority and appoint
Business.
In order to ensure the complete process of task, data are not lost, after interrupting the current subtask handled, are generally required
Recycled, after the completion for the treatment of above-mentioned high-priority task processing, send the current subtask being recovered again.If interrupt just
In the current subtask of processing the current subtask in processed part can be caused to be repeatedly processed through vaporization, condensation and absorption, increase to a certain extent is handled
Time and cost.
In consideration of it, management server can detect identified first after above-mentioned first processing server is identified
The time needed for current subtask is completed in processing server processing, and then judges whether the time is not less than preset value, if should
Time is not less than preset value, illustrates that identified the first processing server processing completes time needed for current subtask also very
It is long, that is to say, that first processing server is likely to just start to process current subtask.So management server is just
The current subtask can be recycled, and above-mentioned high-priority task is sent to the first processing server identified to this, this
One processing server can be handled first changing high-priority task.It can so reduce to the greatest extent and interrupt current subtask band
The processing time come and the increase of cost.It should be noted that the preset value can be by those skilled in the art according to subtask
The factor such as data volume determine, such as can be 10 minutes or 15 minutes etc., be not especially limited herein.
After the completion for the treatment of the processing of above-mentioned high-priority task, management server can by the current subtask being recovered again under
Group is to above-mentioned the first identified processing server, it is of course also possible to according to the mode described in step S105 and cutting
Subtask afterwards is together sent, and is not specifically limited herein.
The embodiment of the present invention additionally provides second of method for scheduling task, second provided below the embodiment of the present invention
Kind method for scheduling task is introduced.This method can also be applied to the management server in task processing system.
As shown in Fig. 2, a kind of method for scheduling task, the described method includes:
S201, receives the vacant computing resource value of processing server feedback;
S202, judges to whether there is the task of non-cutting in task queue, if it does, performing step S203;
S203, calculates the processing computing resource value for handling all required by task in the task queue;
S204, according to the vacant computing resource value and the processing computing resource value, to the task of the non-cutting into
Row cutting, obtains the subtask of the task of the non-cutting;
Aforementioned four step is similar to step S101, step S102, step S103 and step S104 respectively, related part ginseng
See the part explanation of step S101, step S102, step S103 and step S104, details are not described herein.
S205, sets Detection task of the data volume as preset data amount;
In some cases, the vacant resource value of processing server may change at any time, in order to ensure the son sent
Task can smoothly be processed, and management server can set Detection task of the data volume as preset data amount, for examining
Survey whether processing server has vacant computing resource.
Above-mentioned preset data amount can be by those skilled in the art according to data volume of above-mentioned subtask and task type etc.
Factor determines, is not specifically limited herein, can be the corresponding data volume of 5 minutes durations for example, for video task;
Then can be corresponding data volume of 3 frame pictures etc. for picture task.
Can be to be each it should be noted that in order to which all tasks ensured in task queue can be handled smoothly
The subtask sent is determined into corresponding Detection task.
S206, according to the vacant computing resource value, by under the subtask in the Detection task and the task queue
Send to the processing server;
After setting above-mentioned Detection task, management server can be by the Detection task and according to the vacant of processing server
The subtask to be sent that computing resource value determines, together sends to corresponding processing server, can so save scheduling
Time, makes sending for task easier.For example, for real-time video task, management server can set current time and arrive
The task of 5 minutes is Detection task before current time, then by first subtask one obtained by the Detection task and cutting
It is same to send to corresponding processing server.
S207, after Detection task described in the processing server start to process is determined, recycles and deletes the detection and appoint
Business, and indicate the subtask that the processing server start to process receives.
When detecting the above-mentioned Detection task of processing server start to process, illustrate the vacant computing resource of processing server
Do not have occupied, the task no more than preset data amount can be handled, then management server can return the Detection task
Receive and delete, and indicate that the processing server start to process together receives subtask with the Detection task.In this manner it is possible to keep away
Exempt from after the task in task queue is sent since the situation that vacant computing resource is inadequate and can not be done occurs.
As it can be seen that in the scheme that the embodiment of the present invention is provided, the task of management server non-cutting in task queue
Carry out after cutting obtains corresponding subtask, can set Detection task, and by the subtask in Detection task and task queue
To send to processing server, task to be detected starts processed server process, just recycles and deletes Detection task, and at instruction
The subtask that reason server start to process receives.It so may further ensure that being successfully processed for task, avoid processing from servicing
The problem of device computing resource task caused by unexpected take can not perform, and then avoid the danger that loss of data occurs.
As a kind of embodiment of the embodiment of the present invention, the above method can also include:
Detect whether to obtain the first task that priority is higher than the subtask being presently processing, if so, calculating is handled
The second computing resource value needed for the first task;
Detect the current vacant computing resource value of the processing server;
Identify that estimated available resources value is not less than corresponding first processing server of the second computing resource value, wherein,
The estimated available resources value is equal to the computing resource of the current vacant computing resource value and the subtask occupancy handled
The sum of value;
Judge whether the time that the first processing server processing is completed needed for current subtask is not less than preset value;
If the time that the first processing server processing is completed needed for current subtask is not less than preset value, institute is recycled
Current subtask is stated, and the first task is sent to first processing server, so that:First processing server pair
The first task is handled.
Processing mode during high-priority task is obtained for management server, in the first above-mentioned task scheduling side
It is described in detail in method, related part may refer to the part explanation in the first above-mentioned method for scheduling task, herein not
Repeat again.
Corresponding to above method embodiment, the embodiment of the present invention additionally provides a kind of task scheduling apparatus.Below to this hair
A kind of task scheduling apparatus that bright embodiment is provided is introduced.The device can be the management service in task processing system
Device.
As shown in figure 3, a kind of task scheduling apparatus, described device include:
Vacant computing resource value receiving module 310, for receiving the vacant computing resource value of processing server feedback;
Task judgment module 320, for judging in task queue with the presence or absence of the task of non-cutting;
Computing resource value computing module 330 being handled, during for there is the task of non-cutting in the task queue, being calculated
Handle the processing computing resource value of all required by task in the task queue;
Task cutting module 340, for according to the vacant computing resource value and it is described processing computing resource value, to described
The task of non-cutting carries out cutting, obtains the subtask of the task of the non-cutting;
Module 350 is sent in subtask, for according to the vacant computing resource value, the son sent in the task queue to be appointed
It is engaged in corresponding processing server, so that:The processing server docks received subtask and is handled.
As it can be seen that in the scheme that the present embodiment is provided, management server receives the vacant meter of processing server feedback first
Resource value is calculated, judges to whether there is the task of non-cutting in task queue, owns if it does, just calculating in processing task queue
The processing computing resource value of required by task, then according to vacant computing resource value and processing computing resource value, appoints non-cutting
Business carries out cutting, obtains the subtask of the task of non-cutting, finally according to vacant computing resource value, sends the son in task queue
Task to processing server so that:Processing server docks received subtask and is handled.Since management server is according to sky
Remaining computing resource value and processing computing resource value, cutting is carried out to the task of non-cutting, and according to vacant computing resource value, is sent
Subtask in task queue, so effectively prevent the problem of processing server can not handle the subtask received, ensures
Data will not occur to lose or redundancy, while the computing resource of processing server can be made rationally to be utilized.
As a kind of embodiment of the embodiment of the present invention, the task cutting module 340 can include:
Sum calculation unit (not shown), for calculating the summation of the vacant computing resource value;
Computation unit (not shown), for calculating the ratio of the processing computing resource value and the summation;
Task cutting unit (not shown), for according to the relation between default ratio and data volume, determining institute
The stating non-cutting of the task corresponds to the target data amount of subtask, and the task of the non-cutting is carried out according to the target data amount
Cutting.
As a kind of embodiment of the embodiment of the present invention, described device can also include:
Detection task setting module (not shown), for according to the vacant computing resource value, sending described appoint
It is engaged in before subtask to the processing server in queue, sets Detection task of the data volume as preset data amount;
Module 350 is sent in the subtask to be included:
First sends unit (not shown), for according to the vacant computing resource value, by the Detection task and
Send to the processing server subtask in the task queue;
Unit (not shown) is deleted in recycling, for determining Detection task described in the processing server start to process
Afterwards, recycle and delete the Detection task, and indicate the subtask that the processing server start to process receives.
As a kind of embodiment of the embodiment of the present invention, module 350 is sent in the subtask to be included:
Computing resource value computing unit (not shown), for calculating the subtask handled in a piece of task queue
The first required computing resource value;
Subtask determination unit (not shown), for the first computing resource value and the vacant computing resource value, really
Fix and send to the subtask of each processing server;
Second sends unit (not shown), for sending identified subtask to alignment processing server.
As a kind of embodiment of the embodiment of the present invention, described device can also include:
Task detection module (not shown), appoints for detecting whether obtaining priority and being higher than the son being presently processing
The first task of business, if so, calculating the second computing resource value handled needed for the first task;Detect the processing service
The current vacant computing resource value of device;Identify estimated available resources value not less than at the second computing resource value corresponding first
Manage server;Judge whether the time that the first processing server processing is completed needed for current subtask is not less than preset value;
If the time that the first processing server processing is completed needed for current subtask is not less than preset value, the current son is recycled
Task, and the first task is sent to first processing server, so that:First processing server is obtained to described
Obtaining for task is handled;Wherein, the estimated available resources value is equal to the current vacant computing resource value with handling
The sum of the computing resource value that takes of subtask.
It should be noted that herein, relational terms such as first and second and the like are used merely to a reality
Body or operation are distinguished with another entity or operation, are deposited without necessarily requiring or implying between these entities or operation
In any this actual relation or order.Moreover, term " comprising ", "comprising" or its any other variant are intended to
Non-exclusive inclusion, so that process, method, article or equipment including a series of elements not only will including those
Element, but also including other elements that are not explicitly listed, or further include as this process, method, article or equipment
Intrinsic key element.In the absence of more restrictions, the key element limited by sentence "including a ...", it is not excluded that
Also there are other identical element in process, method, article or equipment including the key element.
Each embodiment in this specification is described using relevant mode, identical similar portion between each embodiment
Divide mutually referring to what each embodiment stressed is the difference with other embodiment.It is real especially for device
For applying example, since it is substantially similar to embodiment of the method, so description is fairly simple, related part is referring to embodiment of the method
Part explanation.
Can one of ordinary skill in the art will appreciate that realizing that all or part of step in above method embodiment is
To instruct relevant hardware to complete by program, the program can be stored in computer read/write memory medium,
The storage medium designated herein obtained, such as:ROM/RAM, magnetic disc, CD etc..
The foregoing is merely illustrative of the preferred embodiments of the present invention, is not intended to limit the scope of the present invention.It is all
Any modification, equivalent replacement, improvement and so within the spirit and principles in the present invention, are all contained in protection scope of the present invention
It is interior.
Claims (10)
- A kind of 1. method for scheduling task, it is characterised in that the described method includes:Receive the vacant computing resource value of processing server feedback;Judge in task queue with the presence or absence of the task of non-cutting;If it does, calculate the processing computing resource value for handling all required by task in the task queue;According to the vacant computing resource value and the processing computing resource value, cutting is carried out to the task of the non-cutting, is obtained To the subtask of the task of the non-cutting;According to the vacant computing resource value, the subtask in the task queue is sent to corresponding processing server, so that The processing server docks received subtask and is handled.
- 2. the method as described in claim 1, it is characterised in that described according to the vacant computing resource value and described processing Computing resource value, the step of cutting is carried out to the task of the non-cutting, including:Calculate the summation of the vacant computing resource value;Calculate the ratio of the processing computing resource value and the summation;According to the relation between default ratio and data volume, determine that the task of the non-cutting corresponds to the target data of subtask Amount, cutting is carried out by the task of the non-cutting according to the target data amount.
- 3. method as claimed in claim 2, it is characterised in that it is described according to the vacant computing resource value, send described appoint It is engaged in before subtask to the step of processing server in queue, the method further includes:Set Detection task of the data volume as preset data amount;It is described that subtask in the task queue is sent to the processing server according to the vacant computing resource value, with The processing server is set to dock the step of received subtask is handled, including:According to the vacant computing resource value, the subtask in the Detection task and the task queue is sent to the place Manage server;After Detection task described in the processing server start to process is determined, recycle and delete the Detection task, and indicate The subtask that the processing server start to process receives.
- 4. the method as described in claim 1, it is characterised in that it is described according to the vacant computing resource value, send described appoint Be engaged in queue in subtask to corresponding processing server the step of, including:Calculate the first computing resource value needed for the subtask in the every task queue of processing;According to the first computing resource value and the vacant computing resource value, determine to send to described in each processing server Subtask;Identified subtask is sent to alignment processing server.
- 5. such as claim 1-4 any one of them methods, it is characterised in that the method further includes:Detect whether to obtain the first task that priority is higher than the subtask being presently processing, if so, described in calculating processing The second computing resource value needed for first task;Detect the current vacant computing resource value of the processing server;Determine that estimated available resources value is not less than the first processing server of the second computing resource value, wherein, it is described estimated Available resources value is equal to the sum of the current vacant computing resource value and the computing resource value of subtask occupancy handled;Judge whether the time that the first processing server processing is completed needed for current subtask is not less than preset value;If the time that the first processing server processing is completed needed for current subtask is not less than preset value, recycling is described to work as Preceding subtask, and the first task is sent to first processing server, so that:First processing server is to described First task is handled.
- 6. a kind of task scheduling apparatus, it is characterised in that described device includes:Vacant computing resource value receiving module, for receiving the vacant computing resource value of processing server feedback;Task judgment module, for judging in task queue with the presence or absence of the task of non-cutting;Handle computing resource value computing module, in the task queue exist non-cutting task when, calculate processing institute State the processing computing resource value of all required by task in task queue;Task cutting module, for according to the vacant computing resource value and it is described processing computing resource value, to the non-cutting Task carry out cutting, obtain the subtask of the task of the non-cutting;Module is sent in subtask, for according to the vacant computing resource value, sending the subtask in the task queue to right The processing server answered, is handled so that the processing server docks received subtask.
- 7. device as claimed in claim 6, it is characterised in that the task cutting module includes:Sum calculation unit, for calculating the summation of the vacant computing resource value;Computation unit, for calculating the ratio of the processing computing resource value and the summation;Task cutting unit, for according to the relation between default ratio and data volume, the task pair of the definite non-cutting The target data amount of subtask is answered, the task of the non-cutting is subjected to cutting according to the target data amount.
- 8. device as claimed in claim 7, it is characterised in that described device further includes:Detection task setting module, for according to the vacant computing resource value, sending the subtask in the task queue Before to the processing server, Detection task of the data volume as preset data amount is set;Module is sent in the subtask to be included:First sends unit, for according to the vacant computing resource value, by the Detection task and the task queue Send to the processing server subtask;Unit is deleted in recycling, for after Detection task described in the processing server start to process is determined, recycling and deleting institute Detection task is stated, and indicates the subtask that the processing server start to process receives.
- 9. device as claimed in claim 6, it is characterised in that module is sent in the subtask to be included:Computing resource value computing unit, money is calculated for calculating first needed for the subtask handled in the every task queue Source value;Subtask determination unit, for according to the first computing resource value and the vacant computing resource value, determine to send to The subtask of each processing server;Second sends unit, for sending identified subtask to alignment processing server.
- 10. such as claim 6-9 any one of them devices, it is characterised in that described device further includes:Task detection module, for detecting whether obtaining the first task that priority is higher than the subtask being presently processing, such as Fruit is to calculate the second computing resource value handled needed for the first task;Detect the current vacant meter of the processing server Calculate resource value;Identify that estimated available resources value is not less than the first processing server of the second computing resource value;Described in judgement Whether the time that the processing of the first processing server is completed needed for current subtask is not less than preset value;If the first processing clothes The time that business device processing is completed needed for current subtask be not less than preset value, the recycling current subtask, and by described first Task is sent to first processing server, so that:First processing server handles the first task;Its In, the estimated available resources value is equal to the current vacant computing resource value and the calculating of the subtask occupancy handled provides The sum of source value.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610937469.7A CN107977257A (en) | 2016-10-25 | 2016-10-25 | A kind of method for scheduling task and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610937469.7A CN107977257A (en) | 2016-10-25 | 2016-10-25 | A kind of method for scheduling task and device |
Publications (1)
Publication Number | Publication Date |
---|---|
CN107977257A true CN107977257A (en) | 2018-05-01 |
Family
ID=62004906
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201610937469.7A Pending CN107977257A (en) | 2016-10-25 | 2016-10-25 | A kind of method for scheduling task and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN107977257A (en) |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110175072A (en) * | 2019-05-28 | 2019-08-27 | 广州小鹏汽车科技有限公司 | Task executing method, system and vehicle |
WO2019228346A1 (en) * | 2018-05-31 | 2019-12-05 | 杭州海康威视数字技术股份有限公司 | Method and apparatus for executing task by scheduling device |
CN111026546A (en) * | 2019-11-22 | 2020-04-17 | 北京奇艺世纪科技有限公司 | Task scheduling method and device, storage medium and electronic device |
CN111552569A (en) * | 2020-04-28 | 2020-08-18 | 咪咕文化科技有限公司 | System resource scheduling method, device and storage medium |
CN113965481A (en) * | 2021-10-11 | 2022-01-21 | 山东星维九州安全技术有限公司 | Network asset detection multitask scheduling optimization method |
CN114489942A (en) * | 2022-01-19 | 2022-05-13 | 西安交通大学 | Application cluster-oriented queue task scheduling method and system |
Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101308468A (en) * | 2008-06-13 | 2008-11-19 | 南京邮电大学 | Grid calculation environment task cross-domain control method |
CN101715001A (en) * | 2009-10-21 | 2010-05-26 | 南京邮电大学 | Method for controlling execution of grid task |
CN102096602A (en) * | 2009-12-15 | 2011-06-15 | 中国移动通信集团公司 | Task scheduling method, and system and equipment thereof |
CN102163302A (en) * | 2010-02-24 | 2011-08-24 | 北大方正集团有限公司 | Link task processing method and device |
CN102567086A (en) * | 2010-12-30 | 2012-07-11 | 中国移动通信集团公司 | Task scheduling method, equipment and system |
US8225320B2 (en) * | 2006-08-31 | 2012-07-17 | Advanced Simulation Technology, Inc. | Processing data using continuous processing task and binary routine |
CN102945185A (en) * | 2012-10-24 | 2013-02-27 | 深信服网络科技(深圳)有限公司 | Task scheduling method and device |
CN103699445A (en) * | 2013-12-19 | 2014-04-02 | 北京奇艺世纪科技有限公司 | Task scheduling method, device and system |
-
2016
- 2016-10-25 CN CN201610937469.7A patent/CN107977257A/en active Pending
Patent Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8225320B2 (en) * | 2006-08-31 | 2012-07-17 | Advanced Simulation Technology, Inc. | Processing data using continuous processing task and binary routine |
CN101308468A (en) * | 2008-06-13 | 2008-11-19 | 南京邮电大学 | Grid calculation environment task cross-domain control method |
CN101715001A (en) * | 2009-10-21 | 2010-05-26 | 南京邮电大学 | Method for controlling execution of grid task |
CN102096602A (en) * | 2009-12-15 | 2011-06-15 | 中国移动通信集团公司 | Task scheduling method, and system and equipment thereof |
CN102163302A (en) * | 2010-02-24 | 2011-08-24 | 北大方正集团有限公司 | Link task processing method and device |
CN102567086A (en) * | 2010-12-30 | 2012-07-11 | 中国移动通信集团公司 | Task scheduling method, equipment and system |
CN102945185A (en) * | 2012-10-24 | 2013-02-27 | 深信服网络科技(深圳)有限公司 | Task scheduling method and device |
CN103699445A (en) * | 2013-12-19 | 2014-04-02 | 北京奇艺世纪科技有限公司 | Task scheduling method, device and system |
Cited By (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2019228346A1 (en) * | 2018-05-31 | 2019-12-05 | 杭州海康威视数字技术股份有限公司 | Method and apparatus for executing task by scheduling device |
US11526377B2 (en) | 2018-05-31 | 2022-12-13 | Hangzhou Hikvision Digital Technology Co., Ltd. | Method for executing task by scheduling device, and computer device and storage medium |
CN110175072A (en) * | 2019-05-28 | 2019-08-27 | 广州小鹏汽车科技有限公司 | Task executing method, system and vehicle |
CN111026546A (en) * | 2019-11-22 | 2020-04-17 | 北京奇艺世纪科技有限公司 | Task scheduling method and device, storage medium and electronic device |
CN111552569A (en) * | 2020-04-28 | 2020-08-18 | 咪咕文化科技有限公司 | System resource scheduling method, device and storage medium |
CN111552569B (en) * | 2020-04-28 | 2023-10-20 | 咪咕文化科技有限公司 | System resource scheduling method, device and storage medium |
CN113965481A (en) * | 2021-10-11 | 2022-01-21 | 山东星维九州安全技术有限公司 | Network asset detection multitask scheduling optimization method |
CN114489942A (en) * | 2022-01-19 | 2022-05-13 | 西安交通大学 | Application cluster-oriented queue task scheduling method and system |
CN114489942B (en) * | 2022-01-19 | 2024-02-23 | 西安交通大学 | Queue task scheduling method and system for application cluster |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107977257A (en) | A kind of method for scheduling task and device | |
CN111399989B (en) | Container cloud-oriented task preemption and scheduling method and system | |
CN106802826B (en) | Service processing method and device based on thread pool | |
CN110515704B (en) | Resource scheduling method and device based on Kubernetes system | |
US9235440B2 (en) | Managing job execution | |
CN107992359B (en) | Task scheduling method for cost perception in cloud environment | |
CN104731647B (en) | Task processing method and system | |
US8352621B2 (en) | Method and system to automatically optimize execution of jobs when dispatching them over a network of computers | |
US20130283266A1 (en) | Remediating Resource Overload | |
CN106708622A (en) | Cluster resource processing method and system, and resource processing cluster | |
US8868855B2 (en) | Request management system and method for dynamically managing prioritized requests | |
CN111506423B (en) | Resource scheduling method and device, electronic equipment and storage medium | |
Panagos et al. | Reducing escalation-related costs in WFMSs | |
WO2005062533A1 (en) | System and method predicting and managing network capacity requirements | |
CN109815011A (en) | A kind of method and apparatus of data processing | |
CN106610870B (en) | A kind of processing number of nodes method of adjustment and device | |
CN106371903B (en) | The method for scheduling task of aircraft airborne credible calculating platform | |
US20140023185A1 (en) | Characterizing Time-Bounded Incident Management Systems | |
CN109710416A (en) | Resource regulating method and device | |
Dimitriou | A preemptive resume priority retrial queue with state dependent arrivals, unreliable server and negative customers | |
CN113886034A (en) | Task scheduling method, system, electronic device and storage medium | |
US8001341B2 (en) | Managing dynamically allocated memory in a computer system | |
CN108153583A (en) | Method for allocating tasks and device, real-time Computational frame system | |
CN103853713B (en) | The efficient storage method of mass data | |
CN105550025B (en) | Distributed infrastructure services (IaaS) dispatching method 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 | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20180501 |