CN113900776A - Task scheduling method and service system - Google Patents

Task scheduling method and service system Download PDF

Info

Publication number
CN113900776A
CN113900776A CN202010573303.8A CN202010573303A CN113900776A CN 113900776 A CN113900776 A CN 113900776A CN 202010573303 A CN202010573303 A CN 202010573303A CN 113900776 A CN113900776 A CN 113900776A
Authority
CN
China
Prior art keywords
executed
computing unit
task
unit
identification information
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
CN202010573303.8A
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.)
Hangzhou Hikvision Digital Technology Co Ltd
Original Assignee
Hangzhou Hikvision Digital Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hangzhou Hikvision Digital Technology Co Ltd filed Critical Hangzhou Hikvision Digital Technology Co Ltd
Priority to CN202010573303.8A priority Critical patent/CN113900776A/en
Publication of CN113900776A publication Critical patent/CN113900776A/en
Pending legal-status Critical Current

Links

Images

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/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • 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

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the application provides a task scheduling method and a service system, wherein the service system comprises a task scheduling unit, a resource management unit and a plurality of computing units, the resource management unit stores identification information of the computing units in advance, the corresponding relation between the algorithm types of the tasks executable by the computing units and the available resource numbers of the computing units in advance, if the tasks are to be executed, the task scheduling unit carries out inquiry requests to the resource management unit, the resource management unit inquires the available resource numbers of the computing units capable of executing the tasks to be executed according to the stored corresponding relation, and if the available resource numbers of the computing units capable of executing the tasks to be executed are not less than the resource numbers consumed by the tasks to be executed, the task scheduling unit sends the tasks to be executed to the computing units for execution. When the task is to be executed, the task scheduling unit makes a query request to the resource management unit, so that the interaction pressure of the resource management unit is reduced, and the service performance of the service system is improved.

Description

Task scheduling method and service system
Technical Field
The present application relates to the field of computer technologies, and in particular, to a task scheduling method and a service system.
Background
With the development of technologies such as cloud computing and big data and the increasing maturity of service systems such as cloud platforms, more and more tasks are migrated to the service systems to be executed, and with the increase of tasks in the service systems, how to scientifically schedule a plurality of tasks and reasonably allocate resources becomes the core of the service systems.
As shown in fig. 1, a current service system includes a resource management unit and a plurality of computing units, where the resource management unit is configured to manage resources provided by each computing unit in the service system, the computing units are configured to execute specific tasks, and the computing units actively send task execution requests to the resource management unit when idle, where the task execution requests include idle resources of the computing units. When the client side has a task to be executed, the client side sends the task to be executed to the resource management unit, the resource management unit judges which computing units send task execution requests, and sends the task to be executed to the computing units of which idle resources meet the resources required by the task to be executed for execution.
It can be seen that, as long as the computing units have idle resources, the computing units will send task execution requests to the resource management unit, and as the number of the computing units is increasingly huge, each computing unit will actively send task execution requests to the resource management unit when there are idle resources, which undoubtedly increases the interaction pressure of the resource management unit, resulting in poor service performance of the service system.
Disclosure of Invention
An object of the embodiments of the present application is to provide a task scheduling method and a service system, so as to improve service performance of the service system. The specific technical scheme is as follows:
in a first aspect, an embodiment of the present application provides a task scheduling method, which is applied to a task scheduling unit in a service system, where the service system includes the task scheduling unit, a resource management unit, and multiple computing units, and the method includes:
acquiring a task to be executed, an algorithm type of the task to be executed and the number of resources consumed by the task to be executed;
sending a query request to a resource management unit, wherein the query request comprises an algorithm type of a task to be executed, so that the resource management unit queries identification information and available resource number corresponding to the algorithm type based on the algorithm type in the query request, and feeds back a query result to a task scheduling unit, wherein the resource management unit stores the corresponding relation among the identification information of a computing unit, the algorithm type of the task executable by the computing unit and the available resource number of the computing unit in advance;
receiving a query result fed back by the resource management unit;
and sending the task to be executed to a first computing unit which has the available resource number not less than the resource number consumed by the task to be executed and the identification information according to the identification information and the available resource number in the query result, so that the first computing unit executes the task to be executed.
Optionally, the number of the tasks to be executed is multiple;
according to the identification information and the number of available resources in the query result, the step of sending the task to be executed to the first computing unit, which has the identification information and the number of available resources not less than the number of resources consumed by the task to be executed, includes:
calculating the total number of resources consumed by all tasks to be executed in the same algorithm type;
according to the identification information and the number of available resources of the computing unit corresponding to the same algorithm type in the query result, if the number of available resources in the query result is less than the total number of resources consumed by all tasks to be executed, sending part of the tasks to be executed of the same algorithm type to a first computing unit with the identification information in the query result, wherein the total number of resources consumed by part of the tasks to be executed is not more than the number of available resources in the query result;
and if the number of the available resources in the query result is not less than the total number of the resources consumed by all the tasks to be executed, sending all the tasks to be executed of the same algorithm type to a first computing unit with the identification information in the query result.
Optionally, a plurality of computing units capable of executing the same algorithm type to-be-executed task are provided; the query result comprises identification information and available resource number of each computing unit which can execute the task to be executed in the same algorithm type;
according to the identification information and the number of available resources in the query result, the step of sending the task to be executed to the first computing unit, which has the identification information and the number of available resources not less than the number of resources consumed by the task to be executed, includes:
if the tasks to be executed of the same algorithm type are determined to be sent to the first computing unit in the computing units according to the identification information of the computing units in the query result, and the number of available resources of the first computing unit is larger than zero, the tasks to be executed of the same algorithm type are continuously sent to the first computing unit until the number of available resources of the first computing unit is zero, the tasks to be executed of the same algorithm type are sent to the second computing unit in the computing units, wherein the second computing unit is any computing unit except the first computing unit in the computing units.
Optionally, a plurality of computing units capable of executing the same algorithm type to-be-executed task are provided; the query result comprises identification information, available resource number and computing unit state of each computing unit capable of executing the tasks to be executed in the same algorithm type, and the computing unit state represents whether the computing unit has received the tasks to be executed;
according to the identification information and the number of available resources in the query result, the step of sending the task to be executed to the first computing unit, which has the identification information and the number of available resources not less than the number of resources consumed by the task to be executed, includes:
if the fact that the first computing unit in each computing unit has received the tasks to be executed in the same algorithm type and the number of available resources of the first computing unit is larger than zero is determined according to the identification information and the state of the computing unit in the query result, the tasks to be executed in the same algorithm type are continuously sent to the first computing unit until the number of available resources of the first computing unit is zero, the tasks to be executed in the same algorithm type are sent to a second computing unit in each computing unit, wherein the second computing unit is any one of the computing units except the first computing unit.
Optionally, after the step of sending the to-be-executed task to the first computing unit, where the number of the available resources is not less than the number of resources consumed by the to-be-executed task and the first computing unit has the identification information, according to the identification information and the number of the available resources in the query result, the method further includes:
and sending a first resource number updating message to the resource management unit, wherein the first resource number updating message comprises the identification information of the first computing unit and the sent resource number consumed by the task to be executed. And the resource management unit subtracts the number of the resources consumed by the sent task to be executed from the number of the available resources of the first calculation unit according to the identification information in the resource number updating message to obtain the updated number of the available resources of the first calculation unit.
And receiving a notification message sent by the first computing unit after the first computing unit finishes executing the task to be executed, and sending a second resource number updating message to the resource management unit, wherein the second resource number updating message comprises the identification information of the first computing unit and the number of resources consumed by the executed task to be executed. And the resource management unit adds the number of the available resources of the first computing unit to the number of the resources consumed by the executed task to be executed according to the identification information in the resource number updating message to obtain the updated number of the available resources of the first computing unit.
In a second aspect, an embodiment of the present application provides a task scheduling method, which is applied to a resource management unit in a service system, where the service system includes the task scheduling unit, the resource management unit, and multiple computing units, and the method includes:
receiving a query request sent by a task scheduling unit, wherein the query request comprises an algorithm type of a task to be executed;
based on the algorithm type in the query request, querying the identification information and the available resource number corresponding to the algorithm type from the pre-stored corresponding relationship among the identification information of the computing unit, the algorithm type of the executable task of the computing unit and the available resource number of the computing unit;
and generating a query result according to the found identification information and the number of available resources, and feeding the query result back to the task scheduling unit, so that the task scheduling unit sends the to-be-executed task to the first computing unit with the identification information, wherein the number of the available resources is not less than the number of the resources consumed by the to-be-executed task, and the number of the available resources is not less than the number of the to-be-executed task.
Optionally, after the step of feeding back the query result to the task scheduling unit, the method further includes:
receiving a first resource number updating message sent by a task scheduling unit, wherein the first resource number updating message comprises identification information of a first computing unit and the number of resources consumed by a sent task to be executed; according to the identification information in the resource number updating message, subtracting the transmitted resource number consumed by the task to be executed from the available resource number of the first calculating unit to obtain an updated available resource number of the first calculating unit;
receiving a second resource number updating message sent by the task scheduling unit, wherein the second resource number updating message comprises identification information of the first computing unit and the number of resources consumed by the executed task to be executed; and according to the identification information in the resource number updating message, adding the number of the available resources of the first computing unit to the number of the resources consumed by the executed task to be executed to obtain the updated number of the available resources of the first computing unit.
Optionally, the method further includes:
receiving heartbeat information reported by each computing unit at regular time;
updating the state of each computing unit according to the heartbeat information;
based on the algorithm type in the query request, querying the identification information and the available resource number corresponding to the algorithm type from the pre-stored corresponding relationship among the identification information of the computing unit, the algorithm type of the executable task of the computing unit and the available resource number of the computing unit, wherein the step comprises the following steps:
and inquiring the identification information and the available resource number of the computing unit in the normal state corresponding to the algorithm type from the pre-stored corresponding relation among the identification information of the computing unit, the algorithm type of the executable task of the computing unit and the available resource number of the computing unit based on the algorithm type in the inquiry request.
Optionally, the number of the tasks to be executed is multiple, and the number of the computing units capable of executing the tasks to be executed of the same algorithm type is multiple;
generating a query result according to the searched identification information and the number of available resources, and feeding the query result back to the task scheduling unit, wherein the steps comprise:
forming a query result by the found identification information of each computing unit capable of executing the task to be executed of the same algorithm type, the available resource number of each computing unit and the computing unit state of each computing unit, wherein the computing unit state represents whether the computing unit has received the task to be executed or not;
and feeding back the query result to the task scheduling unit, so that if the task scheduling unit determines that the first computing unit in each computing unit has received the tasks to be executed in the same algorithm type and the available resource number of the first computing unit is greater than zero according to the identification information and the computing unit state of each computing unit in the query result, the task to be executed in the same algorithm type is continuously sent to the first computing unit until the available resource number of the first computing unit is zero, and the tasks to be executed in the same algorithm type are sent to the second computing unit in each computing unit, wherein the second computing unit is any computing unit except the first computing unit in each computing unit.
In a third aspect, an embodiment of the present application provides a task scheduling unit, including a processor and a machine-readable storage medium, where the machine-readable storage medium stores machine-executable instructions executable by the processor, and the processor is caused by the machine-executable instructions to: the method provided by the first aspect of the embodiments of the present application is implemented.
In a fourth aspect, embodiments of the present application further provide a computer program product containing instructions, which when executed on a computer, cause the computer to perform the method provided by the first aspect of the embodiments of the present application.
In a fifth aspect, embodiments of the present application provide a resource management unit, including a processor and a machine-readable storage medium, the machine-readable storage medium storing machine-executable instructions executable by the processor, the processor being caused by the machine-executable instructions to: the method provided by the second aspect of the embodiment of the present application is implemented.
In a sixth aspect, embodiments of the present application further provide a computer program product containing instructions, which when run on a computer, cause the computer to perform the method provided by the second aspect of the embodiments of the present application.
In a seventh aspect, an embodiment of the present application provides a service system, where the service system includes a task scheduling unit, a resource management unit, and multiple computing units;
the task scheduling unit is used for acquiring the tasks to be executed, the algorithm types of the tasks to be executed and the number of resources consumed by the tasks to be executed; sending a query request to a resource management unit, wherein the query request comprises the algorithm type of a task to be executed;
the resource management unit is used for receiving the query request sent by the task scheduling unit; based on the algorithm type in the query request, querying the identification information and the available resource number corresponding to the algorithm type from the pre-stored corresponding relationship among the identification information of the computing unit, the algorithm type of the executable task of the computing unit and the available resource number of the computing unit; generating a query result according to the searched identification information and the number of available resources, and feeding the query result back to the task scheduling unit;
the task scheduling unit is also used for receiving the query result fed back by the resource management unit; according to the identification information and the number of available resources in the query result, sending the task to be executed to a computing unit, wherein the number of available resources is not less than the number of resources consumed by the task to be executed and the computing unit is provided with the identification information in the query result;
and the computing unit is used for executing the task to be executed.
Optionally, the system further includes a monitoring unit;
and the monitoring unit is used for monitoring the states of the task scheduling unit, the resource management unit and each computing unit.
The task scheduling method and the service system provided by the embodiment of the application comprise a task scheduling unit, a resource management unit and a plurality of computing units, wherein the task scheduling unit acquires a task to be executed, an algorithm type of the task to be executed and the number of resources consumed by the task to be executed, and sends a query request to the resource management unit, the resource management unit queries the identification information and the number of available resources corresponding to the algorithm type from the pre-stored identification information of the computing unit, the algorithm type of the task executable by the computing unit and the corresponding relation of the number of available resources of the computing unit based on the algorithm type carried by the query request, and feeds back a query result to the task scheduling unit, the task scheduling unit receives the query result fed back by the resource management unit, and sends the number of the available resources to be executed to the number of resources which is not less than the number of resources consumed by the task to be executed according to the identification information and the number of available resources in the query result, And the first computing unit with the identification information executes the task to be executed after receiving the task to be executed.
In the embodiment of the application, the resource management unit stores identification information of the computing unit, the corresponding relation between the algorithm type of the executable task of the computing unit and the available resource number of the computing unit in advance, when the task is to be executed, the task scheduling unit carries out query request to the resource management unit, the resource management unit queries the available resource number of the computing unit capable of executing the task to be executed according to the stored corresponding relation, and if the available resource number of the computing unit capable of executing the task to be executed is not less than the resource number consumed by the task to be executed, the task scheduling unit sends the task to be executed to the computing unit for execution. Therefore, in the embodiment of the application, the computing unit does not actively send the task execution request to the resource management unit when idle resources exist, but the task scheduling unit sends the query request to the resource management unit when the task is to be executed, so that the interaction pressure of the resource management unit is reduced, and the service performance of the service system is improved.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
FIG. 1 is a schematic flow chart of task scheduling performed by a service system in the prior art;
fig. 2 is a flowchart illustrating a task scheduling method applied to a task scheduling unit according to an embodiment of the present application;
FIG. 3 is a data flow diagram of a prior art service system;
FIG. 4 is a schematic diagram illustrating an execution flow of a resource application thread according to an embodiment of the present application;
FIG. 5 is a flowchart illustrating an execution of an update resource thread according to an embodiment of the present application;
fig. 6 is a flowchart illustrating a task scheduling method applied to a resource management unit according to an embodiment of the present application;
FIG. 7 is a flowchart illustrating a resource management unit processing a resource application according to an embodiment of the present application;
FIG. 8 is a flowchart illustrating a resource management unit processing resource update according to an embodiment of the present application;
FIG. 9 is a schematic structural diagram of a task scheduling unit according to an embodiment of the present application;
FIG. 10 is a schematic structural diagram of a resource management unit according to an embodiment of the present application;
FIG. 11 is a schematic structural diagram of a service system according to an embodiment of the present application;
fig. 12 is a schematic diagram illustrating an internal interaction flow of the service system according to the embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
In order to improve service performance of a service system, the embodiment of the application provides a task scheduling method and a service system. Next, a task scheduling method provided in the embodiment of the present application is first described. The method is applied to a service system, and the service system can be a hardware device or system capable of providing big data service, such as a cloud platform server, a cloud platform service system and the like. The service system comprises a task scheduling unit, a resource management unit and a plurality of computing units, and the task scheduling method provided by the embodiment of the application is specifically realized by the interaction of the task scheduling unit, the resource management unit and the computing units in the service system.
As shown in fig. 2, a task scheduling method provided in the embodiment of the present application, applied to a task scheduling unit in the service system, may include the following steps.
S201, acquiring a task to be executed, an algorithm type of the task to be executed and the number of resources consumed by the task to be executed.
S202, sending a query request to the resource management unit, wherein the query request comprises the algorithm type of the task to be executed.
And the resource management unit queries the identification information and the available resource number corresponding to the algorithm type based on the algorithm type carried by the query request and feeds back a query result to the task scheduling unit, wherein the resource management unit prestores the corresponding relation among the identification information of the computing unit, the algorithm type of the executable task of the computing unit and the available resource number of the computing unit.
S203, receiving the query result fed back by the resource management unit.
And S204, according to the identification information and the number of the available resources in the query result, sending the task to be executed to the first computing unit, wherein the number of the available resources is not less than the number of the resources consumed by the task to be executed and the first computing unit has the identification information, so that the first computing unit executes the task to be executed.
By applying the embodiment of the application, the task scheduling unit acquires the task to be executed, the algorithm type of the task to be executed and the number of resources consumed by the task to be executed, and sends the query request to the resource management unit, so that the resource management unit queries the identification information and the number of available resources corresponding to the algorithm type from the pre-stored identification information of the computing unit, the algorithm type of the task to be executed by the computing unit and the corresponding relation of the number of available resources of the computing unit based on the algorithm type carried by the query request, and feeds back the query result to the task scheduling unit, the task scheduling unit receives the query result fed back by the resource management unit, and sends the task to be executed to the first computing unit, which has the identification information and the number of available resources and has the available resources number not less than the number of resources consumed by the task to be executed, according to the identification information and the number of available resources in the query result. When the task is to be executed, the task scheduling unit carries out a query request to the resource management unit, the resource management unit queries identification information and available resource number of a computing unit capable of executing the task to be executed and feeds back the identification information and the available resource number to the task scheduling unit in a query result mode, and if the available resource number of the computing unit capable of executing the task to be executed is not less than the resource number consumed by the task to be executed, the task scheduling unit sends the task to be executed to the computing unit for execution. Therefore, in the embodiment of the application, the computing unit does not actively send the task execution request to the resource management unit when idle resources exist, but the task scheduling unit sends the query request to the resource management unit when the task is to be executed, so that the interaction pressure of the resource management unit is reduced, and the service performance of the service system is improved.
In a traditional service system, a resource management unit cannot be expanded and is easy to encounter performance bottleneck problems, in order to improve the service performance of the service system, the resource management unit originally providing resource management services is expanded to form a plurality of services (such as interface services, storage services, resource management services, task scheduling services and the like), the services can be provided by the same equipment or can be provided by a plurality of equipment respectively, and under a general condition, the resource management unit can be set to expand other services except the resource management services. A data flow diagram of the entire system is shown in fig. 3, complex interaction is required between different services, each computing unit needs to report resources to a resource management service, the reporting time interval is several milliseconds to several hundred milliseconds, and a locking operation may be required to process a resource request of a task scheduling service midway, which severely limits the performance of the entire service system.
In order to solve the above problem, in view of that the number of the resource management units is much less than that of the computing units, in the embodiment of the present application, a traditional resource management unit is split and is split into a resource management unit and a task scheduling unit, the resource management unit is configured to manage resources provided by the computing units, and the task scheduling unit is configured to apply for resources to the resource management unit after acquiring a task to be executed.
When a task to be executed needs to be executed, the client sends the task to be executed to the service system, and the task scheduling unit provides an external interface of the service system, so that the task to be executed is received by the task scheduling unit, and the algorithm type of the task to be executed and the number of resources needed to be consumed when the task to be executed is executed can be obtained by analyzing the task to be executed.
After acquiring the task to be executed, the algorithm type of the task to be executed, and the number of resources consumed by the task to be executed, the task scheduling unit needs to send a query request to the resource management unit for applying for resources, where the query request includes the algorithm type of the task to be executed, and the algorithm type refers to algorithm information corresponding to an algorithm of the task to be executed, such as an algorithm name, an algorithm version, and the like. In practical application, different algorithm types can be distinguished through the algorithm names composed of the functions realized by the algorithm and the adopted means, for example, the algorithm types can include a geometric feature algorithm based on obstacle recognition, a local feature algorithm based on vehicle recognition, a eigenface algorithm based on face recognition, an elastic model algorithm based on voice recognition, a neural network algorithm based on target detection, and the like; different algorithm types may also be distinguished by version number, for example, the algorithm types may include pedestrian tracking algorithm V1.0, pedestrian tracking algorithm V2.0, pedestrian tracking algorithm V3.0, and so on. The resource management unit stores the corresponding relation among the identification information of the computing unit, the algorithm type of the executable task of the computing unit and the available resource number of the computing unit, so that after receiving the query request, the resource management unit can query the identification information and the available resource number corresponding to the algorithm type of the task to be executed from the stored corresponding relation and feed the queried identification information and resource number back to the task scheduling unit in a query result mode.
The resource management unit generally sets a corresponding relationship between the tasks and the computing units according to the video memory of the service system, how many computing units are set in the service system are known, and the size of the video memory occupied by each task is also known, so that the video memory occupied by the computing units can be allocated according to the video memory of the service system, the number of the computing units and the size of the video memory occupied by each task, so that the video memory of each computing unit can meet the requirement of the corresponding task on the size of the video memory, and the corresponding relationship between the identification information of the computing units, the algorithm type of the tasks executable by the computing units and the available resource number of the computing units is obtained.
Therefore, after receiving the query result, the task scheduling unit can know which computing units can execute the task to be executed and the number of available resources of the computing units according to the identification information and the number of available resources in the query result. In order to ensure the normal execution of the task to be executed, the task to be executed is sent to the first computing unit, the number of available resources of which is not less than the number of resources consumed by the task to be executed and which has the identification information in the query result, and the first computing unit executes the task to be executed.
Optionally, the number of tasks to be executed is multiple.
S204 may be specifically implemented by the following steps:
the method comprises the first step of calculating the total number of resources consumed by all tasks to be executed in the same algorithm type.
And secondly, according to the identification information and the number of available resources of the computing unit corresponding to the same algorithm type in the query result, if the number of available resources in the query result is less than the total number of resources consumed by all tasks to be executed, sending part of the tasks to be executed of the same algorithm type to the first computing unit with the identification information in the query result, wherein the total number of resources consumed by part of the tasks to be executed is not more than the number of available resources in the query result.
And thirdly, if the number of available resources in the query result is not less than the total number of resources consumed by all the tasks to be executed, sending all the tasks to be executed of the same algorithm type to a first computing unit with identification information in the query result.
The task scheduling unit generally applies for resources from the resource management unit by a resource application thread in the task scheduling unit, the task scheduling unit can start the thread at regular time, wherein the time for the task scheduling unit to start the resource application thread is configurable, the execution flow of the resource application thread is shown in fig. 4. And calling a resource application interface of the resource management unit, receiving a query result sent by the resource management unit, and acquiring the identification information and the available resource number of the computing unit. And judging whether the number of the available resources in the query result is less than the total number of the resources consumed by all the tasks to be executed. If the number of the resources consumed by the part of the tasks to be executed is less than the number of the available resources in the query result, sending the part of the tasks to be executed in the waiting queue to a first computing unit with identification information in the query result for execution, and waking up the application resource thread again; and if not, sending all the tasks to be executed in the waiting queue to the first computing unit with the identification information in the query result for execution.
Optionally, a plurality of computing units capable of executing the same algorithm type to-be-executed task are provided; the query result comprises identification information and available resource number of each computing unit which can execute the tasks to be executed with the same algorithm type. S204 may specifically be: if the tasks to be executed of the same algorithm type are determined to be sent to the first computing unit in the computing units according to the identification information of the computing units in the query result, and the number of available resources of the first computing unit is larger than zero, the tasks to be executed of the same algorithm type are continuously sent to the first computing unit until the number of available resources of the first computing unit is zero, the tasks to be executed of the same algorithm type are sent to the second computing unit in the computing units, wherein the second computing unit is any computing unit except the first computing unit in the computing units.
In an implementation manner of the present application, the number of the to-be-executed tasks is multiple, and the number of the to-be-executed tasks that can execute the same algorithm type is multiple, when the task scheduling unit applies for the resource from the resource management unit, in order to ensure the full utilization of the computing unit, the resource of one computing unit is preferentially satisfied, determining that the tasks to be executed of the same algorithm type are sent to the first computing unit in each computing unit and the number of available resources of the first computing unit is greater than zero according to the identification information of each computing unit in the query result, continuing to send the tasks to be executed of the same algorithm type to the first computing unit until the number of available resources of the first computing unit is zero, at which time the first computing unit is fully configured, the tasks to be executed of the same algorithm type are sent to any second computing unit of the computing units except the first computing unit.
Optionally, a plurality of computing units capable of executing the same algorithm type to-be-executed task are provided; the query result comprises identification information, available resource number and computing unit state of each computing unit capable of executing the tasks to be executed of the same algorithm type, and the computing unit state represents whether the computing unit has received the tasks to be executed. S204 may specifically be: if the fact that the first computing unit in each computing unit has received the tasks to be executed in the same algorithm type and the number of available resources of the first computing unit is larger than zero is determined according to the identification information and the state of the computing unit in the query result, the tasks to be executed in the same algorithm type are continuously sent to the first computing unit until the number of available resources of the first computing unit is zero, the tasks to be executed in the same algorithm type are sent to a second computing unit in each computing unit, wherein the second computing unit is any one of the computing units except the first computing unit.
In another implementation of the present application, the resource management unit may identify whether each computing unit has received a task to be performed, and the identified state of the computing unit is carried in the query result and fed back to the task scheduling unit, so that the task scheduling unit can determine that the first computing unit in each computing unit has received the task to be executed in the same algorithm type and the available resource number of the first computing unit is more than zero according to the identification information and the state of each computing unit in the query result, continuing to send the tasks to be executed of the same algorithm type to the first computing unit until the number of available resources of the first computing unit is zero, at which time the first computing unit is fully configured, the tasks to be executed of the same algorithm type are sent to any second computing unit of the computing units except the first computing unit.
Optionally, after performing S204, the method provided in the embodiment of the present application may further include the following steps:
and sending a first resource number updating message to the resource management unit, wherein the first resource number updating message comprises the identification information of the first computing unit and the sent resource number consumed by the task to be executed. And the resource management unit subtracts the number of the resources consumed by the sent task to be executed from the number of the available resources of the first calculation unit according to the identification information in the resource number updating message to obtain the updated number of the available resources of the first calculation unit.
And receiving a notification message sent by the first computing unit after the first computing unit finishes executing the task to be executed, and sending a second resource number updating message to the resource management unit, wherein the second resource number updating message comprises the identification information of the first computing unit and the number of resources consumed by the executed task to be executed. And the resource management unit adds the number of the available resources of the first computing unit to the number of the resources consumed by the executed task to be executed according to the identification information in the resource number updating message to obtain the updated number of the available resources of the first computing unit.
After sending the task to be executed to the first computing unit, the task scheduling unit executes the task to be executed by the first computing unit, and in order to prevent the task to be executed from being subsequently requested to be executed by the task of the same type, the task scheduling unit is also allocated to the first computing unit, so that the first computing unit is overloaded, the task scheduling unit sends a first resource number updating message to the resource management unit after sending the task to be executed to the first computing unit, and after receiving the updating message, the resource management unit subtracts the number of resources consumed by the sent task to be executed from the number of available resources of the first computing unit according to the identification information in the first resource updating message, so as to obtain the updated number of available resources of the first computing unit. Due to the fact that the number of the available resources of the first computing unit is reduced, if the task to be executed of the same algorithm type is received again, the task to be executed cannot be sent to the first computing unit continuously because the number of the available resources of the first computing unit cannot meet the number of the resources consumed by the task to be executed.
After the first computing unit finishes executing the task to be executed, the first computing unit sends a notification message to the task scheduling unit to notify the task scheduling unit, the first computing unit finishes executing the task to be executed, the task scheduling unit enables the resource management unit to reduce the stored available resource number of the first computing unit by sending a first resource number updating message, and the first computing unit releases the resources after finishing executing the task to be executed, so that the task scheduling unit sends a second resource number updating message to the resource management unit, and the resource number updating message comprises identification information of the first computing unit and the number of resources consumed by the executed task to be executed. After receiving the update message, the resource management unit adds the number of the available resources of the first computing unit to the number of the resources consumed by the executed task to be executed according to the identification information in the second resource update message to obtain the updated number of the available resources of the first computing unit, and recovers the original number of the available resources of the first computing unit.
Specifically, the process of recovering the resource number is implemented by an update resource thread, the task scheduling unit may start the thread at regular time, wherein the time for the task scheduling unit to start the update resource thread is configurable, the execution process of the update resource thread is as shown in fig. 5, and in an implementation manner, a completion queue is provided for recording the executed tasks. And inquiring the number of executed completed tasks from the completion queue. And judging whether the number of the tasks in the completion queue is greater than 0. If not, setting the updating resource thread to be in a dormant state; if the number of the resources is larger than 0, calling an update resource interface of the resource management unit, returning the corresponding resources (namely adding the number of the resources provided by the first computing unit which has already executed and completed the task to be executed to the number of the resources consumed by the task to be executed which has already been executed), and awakening the update resource thread again.
As shown in fig. 6, a task scheduling method provided in the embodiment of the present application, applied to a resource management unit in the service system, may include the following steps.
S601, receiving an inquiry request sent by a task scheduling unit, wherein the inquiry request comprises an algorithm type of a task to be executed.
S602, based on the algorithm type in the query request, querying the identification information and the available resource number corresponding to the algorithm type from the pre-stored corresponding relationship among the identification information of the computing unit, the algorithm type of the executable task of the computing unit and the available resource number of the computing unit.
S603, generating a query result according to the found identification information and the number of available resources, and feeding the query result back to the task scheduling unit, so that the task scheduling unit sends the to-be-executed task to the first computing unit with the identification information, wherein the number of the available resources is not less than the number of the resources consumed by the to-be-executed task, and the number of the available resources is not less than the number of the to-be-executed task.
By applying the embodiment of the application, the resource management unit receives the query request sent by the task scheduling unit, queries the identification information and the available resource number corresponding to the algorithm type from the pre-stored corresponding relationship among the identification information of the computing unit, the algorithm type of the executable task of the computing unit and the available resource number of the computing unit based on the algorithm type carried by the query request, and feeds back the query result to the task scheduling unit, so that the task scheduling unit receives the query result fed back by the resource management unit, and sends the to-be-executed task to the first computing unit, which has the identification information and the available resource number and is not less than the resource number consumed by the to-be-executed task, to execute the to-be-executed task according to the identification information and the available resource number in the query result. When the task is to be executed, the task scheduling unit carries out a query request to the resource management unit, the resource management unit queries identification information and available resource number of a computing unit capable of executing the task to be executed and feeds back the identification information and the available resource number to the task scheduling unit in a query result mode, and if the available resource number of the computing unit capable of executing the task to be executed is not less than the resource number consumed by the task to be executed, the task scheduling unit sends the task to be executed to the computing unit for execution. Therefore, in the embodiment of the application, the computing unit does not actively send the task execution request to the resource management unit when idle resources exist, but the task scheduling unit sends the query request to the resource management unit when the task is to be executed, so that the interaction pressure of the resource management unit is reduced, and the service performance of the service system is improved.
As shown in fig. 2, after acquiring the to-be-executed task, the algorithm type of the to-be-executed task, and the number of resources consumed by the to-be-executed task, the task scheduling unit sends a query request to the resource management unit for applying for resources, where the query request includes the algorithm type of the to-be-executed task. The resource management unit stores the corresponding relation among the identification information of the computing unit, the algorithm type of the executable task of the computing unit and the available resource number of the computing unit, so that after receiving the query request, the resource management unit can query the identification information and the available resource number corresponding to the algorithm type of the task to be executed from the stored corresponding relation and feed the queried identification information and the queried available resource number back to the task scheduling unit in a query result mode. After the task scheduling unit receives the query result, it can know which computing units can execute the task to be executed and the number of available resources of the computing units according to the identification information and the number of available resources in the query result. In order to ensure the normal execution of the task to be executed, the task to be executed is sent to the first computing unit, the number of available resources of which is not less than the number of resources consumed by the task to be executed, and the first computing unit has the identification information in the query result to execute the task.
Optionally, after performing S603, the method may further include the steps of:
receiving a first resource number updating message sent by a task scheduling unit, wherein the first resource number updating message comprises identification information of a first computing unit and the number of resources consumed by a sent task to be executed; according to the identification information in the resource number updating message, subtracting the transmitted resource number consumed by the task to be executed from the available resource number of the first calculating unit to obtain an updated available resource number of the first calculating unit;
receiving a second resource number updating message sent by the task scheduling unit, wherein the second resource number updating message comprises identification information of the first computing unit and the number of resources consumed by the executed task to be executed; and according to the identification information in the resource number updating message, adding the number of the available resources of the first computing unit to the number of the resources consumed by the executed task to be executed to obtain the updated number of the available resources of the first computing unit.
After the task scheduling unit sends the task to be executed to the first computing unit, the first computing unit executes the task to be executed, in order to prevent the following tasks with the same type from requesting execution and being allocated to the first computing unit to cause overload of the first computing unit, the task scheduling unit sends a first resource number updating message to the resource management unit after sending the task to be executed to the first computing unit, and after receiving the updating message, the resource management unit subtracts the number of the resources consumed by the sent task to be executed from the number of the available resources of the first computing unit according to the identification information in the first resource updating message to obtain the updated number of the available resources of the first computing unit. Due to the fact that the number of the available resources of the first computing unit is reduced, if the task to be executed of the same algorithm type is received again, the task to be executed cannot be sent to the first computing unit continuously because the number of the available resources of the first computing unit possibly cannot meet the number of the resources consumed by the task to be executed.
In an implementation manner of the embodiment of the present application, a flow of processing a resource application by a resource management unit is shown in fig. 7, where a task scheduling unit calls a resource application interface of the resource management unit, the number of the task scheduling units may be multiple, the resource management unit obtains information such as a task scheduling unit ID of the resource application, the number of tasks to be executed, and the total number of resources consumed by each task to be executed, searches for computing units that can execute the tasks, and determines the number of available resources of the computing units, and if there are resources in the computing units, determines whether the number of available resources of the computing units is greater than the total number of consumed resources. If yes, subtracting the total number of consumed resources from the available resource number of the computing unit, recording the ID of the task scheduling unit applying for updating the resource number, and entering the next cycle; if not, the available resource number of the computing unit is cleared, the computing unit is inquired from other computing nodes, the task scheduling unit ID applying for updating the resource number is recorded, the available resource number of other computing units is updated, and the like.
The application of the resource to the resource management unit is realized by a resource application thread in the task scheduling unit, the task scheduling unit can start the thread at fixed time, and the time for the task scheduling unit to start the resource application thread is configurable.
After the first computing unit finishes executing the task to be executed, the first computing unit sends a notification message to the task scheduling unit to notify the task scheduling unit, the first computing unit finishes executing the task to be executed, the task scheduling unit enables the resource management unit to reduce the stored available resource number of the first computing unit by sending a first resource number updating message, and the first computing unit releases the resources after finishing executing the task to be executed, so that the task scheduling unit sends a second resource number updating message to the resource management unit, and the resource number updating message comprises identification information of the first computing unit and the number of resources consumed by the executed task to be executed. After receiving the update message, the resource management unit adds the number of the available resources of the first computing unit to the number of the resources consumed by the executed task to be executed according to the identification information in the second resource update message to obtain the updated number of the available resources of the first computing unit, and recovers the original number of the available resources of the first computing unit.
In an implementation manner of the embodiment of the present application, a resource management unit processes a resource update process as shown in fig. 8, where a task scheduling unit calls an update resource interface of the resource management unit, the resource management unit receives identification information of a computing unit that has completed a task and a number of resources consumed by a task that has been executed and is sent by the task scheduling unit, and according to the identification information, adds the number of available resources of the corresponding computing unit to the number of resources consumed by the task that has been executed and is to be executed, to obtain an updated number of available resources.
Optionally, the method may further include the steps of:
receiving heartbeat information reported by each computing unit at regular time; and updating the state of each computing unit according to the heartbeat information.
Correspondingly, S602 may specifically be: and inquiring the identification information and the available resource number of the computing unit in the normal state corresponding to the algorithm type from the pre-stored corresponding relation among the identification information of the computing unit, the algorithm type of the executable task of the computing unit and the available resource number of the computing unit based on the algorithm type in the inquiry request.
Each computing unit can report heartbeat information at regular time, the heartbeat information specifically comprises information such as the capability value of the computing unit, the algorithm type of an executable task, the resource loading condition and the like, and the heartbeat information can directly or indirectly reflect the state of the computing unit, so that the state of each computing unit can be updated according to the heartbeat information, and specifically, the state of each computing unit mainly comprises a normal state and an abnormal state. When responding to the resource application of the task scheduling unit, only the identification information and the available resource number of the computing unit in the normal state corresponding to the algorithm type in the query request can be fed back, so that the task scheduling unit is prevented from dispatching the task to be executed to the abnormal computing unit and influencing the normal execution of the task to be executed.
Optionally, the computing units that can execute the tasks with the same algorithm type and execute the tasks to be executed with the same algorithm type are deployed in different computing machines and different computing cards of the same computing machine, where one computing machine includes multiple computing cards and one computing card includes multiple computing units.
In one implementation, a plurality of computing machines implementing a task execution function are distributed in a service system, each computing machine includes a plurality of computing cards, each computing card includes a plurality of computing units, and then a computing unit to be executed, which has the same algorithm type and can execute the same algorithm type, of a plurality of executable tasks can be deployed in different computing machines and different computing cards of the same computing machine, that is, for the same task, secondary load balancing is performed on the computing machines and the computing cards on resources, one computing machine fails, and a computing unit which can execute the same task can also be found on another computing machine, and similarly, if one computing card fails, a computing unit which can execute the same task can also be found on another computing card.
Optionally, the number of the tasks to be executed is multiple, and the number of the computing units capable of executing the tasks to be executed of the same algorithm type is multiple; s603 may specifically be: forming a query result by the found identification information of each computing unit capable of executing the task to be executed of the same algorithm type, the available resource number of each computing unit and the computing unit state of each computing unit, wherein the computing unit state represents whether the computing unit has received the task to be executed or not; and feeding back the query result to the task scheduling unit, so that if the task scheduling unit determines that the first computing unit in each computing unit has received the tasks to be executed in the same algorithm type and the available resource number of the first computing unit is greater than zero according to the identification information and the computing unit state of each computing unit in the query result, the task to be executed in the same algorithm type is continuously sent to the first computing unit until the available resource number of the first computing unit is zero, and the tasks to be executed in the same algorithm type are sent to the second computing unit in each computing unit, wherein the second computing unit is any computing unit except the first computing unit in each computing unit.
In an implementation manner of the present application, when a task scheduling unit applies for a resource to a resource management unit, in order to ensure that the computing unit is fully utilized and preferentially satisfies the resource of one computing unit, the resource management unit may identify whether each computing unit has received a task to be executed, and feed back the identified state of the computing unit to the task scheduling unit, so that the task scheduling unit may determine that a first computing unit in each computing unit has received a task to be executed of the same algorithm type and the number of available resources of the first computing unit is greater than zero according to the identification information of each computing unit in the query result and the state of the computing unit, and then continue to send the task to be executed of the same algorithm type to the first computing unit, and sending the tasks to be executed with the same algorithm type to any second computing unit except the first computing unit in each computing unit until the number of the available resources of the first computing unit is zero and the first computing unit is fully configured.
The embodiment of the present application further provides a task scheduling unit, as shown in fig. 9, which may include a processor 901 and a machine-readable storage medium 902, where the machine-readable storage medium 902 stores machine-executable instructions capable of being executed by the processor 901, and the processor 901 is caused by the machine-executable instructions to implement the above-mentioned task scheduling method applied to the task scheduling unit.
An embodiment of the present application further provides a resource management unit, as shown in fig. 10, which may include a processor 1001 and a machine-readable storage medium 1002, where the machine-readable storage medium 1002 stores machine-executable instructions capable of being executed by the processor 1001, and the processor 1001 is caused by the machine-executable instructions to implement the above task scheduling method applied to the resource management unit.
The machine-readable storage medium may include a RAM (Random Access Memory) and a NVM (Non-Volatile Memory), such as at least one disk Memory. Alternatively, the machine-readable storage medium may be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but also a DSP (Digital Signal Processing), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component.
Data transmission between the machine-readable storage medium 902 and the processor 901, and between the machine-readable storage medium 1002 and the processor 1001 may be performed by a wired connection or a wireless connection, and the task scheduling unit and the resource management unit may communicate with other devices by a wired communication interface or a wireless communication interface. Fig. 9 shows only an example of data transmission between the processor 901 and the machine-readable storage medium 902, and fig. 10 shows only an example of data transmission between the processor 1001 and the machine-readable storage medium 1002 through a bus, which is not limited to a specific connection manner.
The embodiment of the application also provides a machine-readable storage medium, which stores machine-executable instructions and realizes the task scheduling method applied to the task scheduling unit when the machine-readable storage medium is called and executed by the processor.
The embodiment of the application also provides a machine-readable storage medium, which stores machine-executable instructions and realizes the task scheduling method applied to the resource management unit when the machine-readable storage medium is called and executed by the processor.
In yet another embodiment provided by the present application, there is also provided a computer program product comprising instructions which, when run on a computer, cause the computer to perform the above task scheduling method applied to a task scheduling unit.
In yet another embodiment provided by the present application, there is also provided a computer program product containing instructions which, when run on a computer, cause the computer to perform the above task scheduling method applied to a resource management unit.
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the application to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored on a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, from one website, computer, server, or data center to another website, computer, server, or data center via wire (e.g., coaxial cable, fiber, DSL (Digital Subscriber Line)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that incorporates one or more of the available media. The usable medium may be a magnetic medium (e.g., a floppy Disk, a hard Disk, a magnetic tape), an optical medium (e.g., a DVD (Digital Versatile Disk)), or a semiconductor medium (e.g., a SSD (Solid State Disk)), etc.
The embodiment of the present application further provides a service system, as shown in fig. 11, the system includes a task scheduling unit 1110, a resource management unit 1120, and a plurality of computing units 1130;
the task scheduling unit 1110 is configured to obtain a task to be executed, an algorithm type of the task to be executed, and a number of resources consumed by the task to be executed; sending a query request to the resource management unit 1120, wherein the query request includes an algorithm type of a task to be executed;
a resource management unit 1120, configured to receive the query request sent by the task scheduling unit 1110; based on the algorithm type in the query request, querying the identification information and the available resource number corresponding to the algorithm type from the pre-stored corresponding relationship among the identification information of the computing unit, the algorithm type of the executable task of the computing unit and the available resource number of the computing unit; generating a query result according to the found identification information and the number of available resources, and feeding the query result back to the task scheduling unit 1110;
the task scheduling unit 1110 is further configured to receive a query result fed back by the resource management unit 1120; according to the identification information and the number of available resources in the query result, the task to be executed is sent to the computing unit 1130, where the number of available resources is not less than the number of resources consumed by the task to be executed and the computing unit has the identification information in the query result;
a computing unit 1130 for performing the task to be performed.
The number of the task scheduling units 1110 and the number of the resource management units 1120 may be multiple, the task scheduling units 1110 may be expandable, and the resource management units 1120 may be active/standby.
Optionally, the system may further include a listening unit;
and the monitoring unit is used for monitoring the states of the task scheduling unit, the resource management unit and each computing unit.
By applying the embodiment of the application, the task scheduling unit acquires the task to be executed, the algorithm type of the task to be executed and the number of resources consumed by the task to be executed, and sends the query request to the resource management unit, the resource management unit queries the identification information and the number of available resources corresponding to the algorithm type from the pre-stored identification information of the computing unit, the algorithm type of the task executable by the computing unit and the corresponding relation of the number of available resources of the computing unit based on the algorithm type carried by the query request, and feeds back the query result to the task scheduling unit, the task scheduling unit receives the query result fed back by the resource management unit, and sends the task to be executed to the first computing unit, which has the identification information and the number of available resources is not less than the number of resources consumed by the task to be executed, for execution. When the task is to be executed, the task scheduling unit carries out a query request to the resource management unit, the resource management unit queries identification information and available resource number of a computing unit capable of executing the task to be executed and feeds back the identification information and the available resource number to the task scheduling unit in a query result mode, and if the available resource number of the computing unit capable of executing the task to be executed is not less than the resource number consumed by the task to be executed, the task scheduling unit sends the task to be executed to the computing unit for execution. Therefore, in the embodiment of the application, the computing unit does not actively send the task execution request to the resource management unit when idle resources exist, but the task scheduling unit sends the query request to the resource management unit when the task is to be executed, so that the interaction pressure of the resource management unit is reduced, and the service performance of the service system is improved.
Fig. 12 shows an internal interaction flow of a service system provided in the embodiment of the present application, which takes an LVS (Linux Virtual Server) as an example, and includes a plurality of task scheduling units providing scheduling services, a resource management unit providing resource management services, a Zookeeper (a monitoring unit) providing registration/monitoring services, and a plurality of computing nodes (also referred to as computing units and engines). The interaction among the services comprises: the scheduling service applies for computing node resource information to the resource management service when the task is to be executed, and returns the resource to the resource management service after the task is executed; and the resource management service acquires the resource information from the database and feeds the resource information back to the scheduling service. The resource management service regularly distributes configuration information to the computing nodes; and the computing node reports the node information to the resource management service at regular time and uploads the resource allocation information at regular time. Dispatching a task to be executed to a computing node by a dispatching service; and the computing node reports the task state to the scheduling service. And the Zookeeper monitors the states of the task scheduling unit, the resource management unit and each computing unit and finds whether the states of the task scheduling unit, the resource management unit and each computing unit are on-hook, abnormal and the like in time.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, as for the embodiments of the task scheduling unit, the resource management unit, the machine-readable storage medium, the computer program product, and the service system, since they are substantially similar to the embodiments of the method, the description is simple, and the relevant points can be referred to the partial description of the embodiments of the method.
The above description is only for the preferred embodiment of the present application and is not intended to limit the scope of the present application. Any modification, equivalent replacement, improvement and the like made within the spirit and principle of the present application are included in the protection scope of the present application.

Claims (10)

1. A task scheduling method is applied to a task scheduling unit in a service system, wherein the service system comprises the task scheduling unit, a resource management unit and a plurality of computing units, and the method comprises the following steps:
acquiring a task to be executed, an algorithm type of the task to be executed and the number of resources consumed by the task to be executed;
sending a query request to the resource management unit, wherein the query request comprises the algorithm type of the task to be executed, so that the resource management unit queries the identification information and the available resource number corresponding to the algorithm type based on the algorithm type, and feeds back a query result, and the resource management unit prestores the corresponding relationship among the identification information of the computing unit, the algorithm type of the task executable by the computing unit and the available resource number of the computing unit;
receiving the query result fed back by the resource management unit;
and sending the task to be executed to a first computing unit, which has available resource number not less than the resource number consumed by the task to be executed and has the identification information, according to the identification information and the available resource number in the query result, so that the first computing unit executes the task to be executed.
2. The method of claim 1, wherein the task to be performed is plural;
the sending the task to be executed to the first computing unit, which has the available resource number not less than the resource number consumed by the task to be executed and the identification information, according to the identification information and the available resource number in the query result, includes:
calculating the total number of resources consumed by all tasks to be executed in the same algorithm type;
according to the identification information and the number of available resources of the computing unit corresponding to the same algorithm type in the query result, if the number of available resources is less than the total number of resources consumed by all tasks to be executed, sending part of the tasks to be executed of the same algorithm type to a first computing unit with the identification information, wherein the total number of resources consumed by the part of the tasks to be executed is not more than the number of available resources;
and if the number of the available resources is not less than the total number of the resources consumed by all the tasks to be executed, sending all the tasks to be executed of the same algorithm type to a first computing unit with the identification information.
3. The method according to claim 1 or 2, characterized in that the number of computing units to be executed, which can execute the same algorithm type, is plural; the query result comprises identification information and available resource number of each computing unit capable of executing the tasks to be executed in the same algorithm type;
the sending the task to be executed to the first computing unit, which has the available resource number not less than the resource number consumed by the task to be executed and the identification information, according to the identification information and the available resource number in the query result, includes:
if it is determined that the tasks to be executed in the same algorithm type are sent to the first computing unit in the computing units according to the identification information of the computing units in the query result, and the available resource number of the first computing unit is greater than zero, the tasks to be executed in the same algorithm type are continuously sent to the first computing unit until the available resource number of the first computing unit is zero, and the tasks to be executed in the same algorithm type are sent to the second computing unit in the computing units, wherein the second computing unit is any computing unit except the first computing unit in the computing units.
4. The method according to claim 1 or 2, characterized in that the number of computing units to be executed, which can execute the same algorithm type, is plural; the query result comprises identification information, available resource number and computing unit state of each computing unit capable of executing the tasks to be executed in the same algorithm type, and the computing unit state represents whether the computing unit has received the tasks to be executed;
the sending the task to be executed to the first computing unit, which has the available resource number not less than the resource number consumed by the task to be executed and the identification information, according to the identification information and the available resource number in the query result, includes:
if it is determined that the first computing unit of the computing units has received the task to be executed of the same algorithm type and the number of available resources of the first computing unit is greater than zero according to the identification information and the computing unit state of the computing units in the query result, continuing to send the task to be executed of the same algorithm type to the first computing unit until the number of available resources of the first computing unit is zero, and sending the task to be executed of the same algorithm type to a second computing unit of the computing units, wherein the second computing unit is any computing unit of the computing units except the first computing unit.
5. The method according to claim 1, wherein after the sending the task to be executed to the first computing unit having the identification information and the number of available resources, the number of available resources being not less than the number of resources consumed by the task to be executed, according to the identification information and the number of available resources in the query result, the method further comprises:
sending a first resource number updating message to the resource management unit, where the first resource number updating message includes identification information of the first computing unit and a number of resources consumed by the sent to-be-executed task, so that the resource management unit subtracts the number of resources consumed by the sent to-be-executed task from the number of available resources of the first computing unit according to the identification information to obtain an updated number of available resources of the first computing unit;
and receiving a notification message sent by the first computing unit after the first computing unit finishes executing the task to be executed, and sending a second resource number updating message to the resource management unit, wherein the second resource number updating message comprises identification information of the first computing unit and the number of resources consumed by the executed task to be executed, so that the resource management unit adds the number of available resources of the first computing unit to the number of resources consumed by the executed task to be executed according to the identification information to obtain the updated number of available resources of the first computing unit.
6. A task scheduling method is applied to a resource management unit in a service system, wherein the service system comprises a task scheduling unit, a resource management unit and a plurality of computing units, and the method comprises the following steps:
receiving a query request sent by the task scheduling unit, wherein the query request comprises an algorithm type of a task to be executed;
based on the algorithm type, inquiring the identification information and the available resource number corresponding to the algorithm type from the pre-stored corresponding relationship among the identification information of the computing unit, the algorithm type of the executable task of the computing unit and the available resource number of the computing unit;
and generating a query result according to the found identification information and the number of available resources, and feeding the query result back to the task scheduling unit, so that the task scheduling unit sends the to-be-executed task to a first computing unit, the number of available resources of which is not less than the number of resources consumed by the to-be-executed task and which has the identification information, according to the identification information and the number of available resources in the query result.
7. The method of claim 6, wherein after the feeding back the query result to the task scheduling unit, the method further comprises:
receiving a first resource number updating message sent by the task scheduling unit, wherein the first resource number updating message comprises identification information of the first computing unit and the number of resources consumed by the sent task to be executed; according to the identification information, subtracting the number of the resources consumed by the sent task to be executed from the number of the available resources of the first computing unit to obtain an updated number of the available resources of the first computing unit;
receiving a second resource number updating message sent by the task scheduling unit, wherein the second resource number updating message comprises the identification information of the first computing unit and the number of resources consumed by the executed task to be executed; and according to the identification information, adding the number of the available resources of the first computing unit to the number of the resources consumed by the executed task to be executed to obtain the updated number of the available resources of the first computing unit.
8. The method of claim 6, further comprising:
receiving heartbeat information reported by each computing unit at regular time;
updating the state of each computing unit according to the heartbeat information;
the querying, based on the algorithm type, the identification information and the available resource number corresponding to the algorithm type from a pre-stored correspondence between the identification information of the computing unit, the algorithm type of the task executable by the computing unit, and the available resource number of the computing unit includes:
based on the algorithm type, inquiring the identification information and the available resource number of the computing unit in a normal state corresponding to the algorithm type from the pre-stored corresponding relationship among the identification information of the computing unit, the algorithm type of the executable task of the computing unit and the available resource number of the computing unit.
9. The method according to claim 6, wherein the task to be executed is plural, and the computing unit to be executed which can execute the task of the same algorithm type is plural;
the generating a query result according to the found identification information and the number of available resources and feeding the query result back to the task scheduling unit includes:
forming a query result by the found identification information of each computing unit capable of executing the task to be executed of the same algorithm type, the available resource number of each computing unit and the computing unit state of each computing unit, wherein the computing unit state represents whether the computing unit has received the task to be executed;
and feeding the query result back to the task scheduling unit, so that if the task scheduling unit determines that the first computing unit in each computing unit has received the to-be-executed task of the same algorithm type and the available resource number of the first computing unit is greater than zero according to the identification information and the computing unit state of each computing unit in the query result, the task scheduling unit continues to send the to-be-executed task of the same algorithm type to the first computing unit until the available resource number of the first computing unit is zero, and sends the to-be-executed task of the same algorithm type to a second computing unit in each computing unit, wherein the second computing unit is any one of the computing units except the first computing unit.
10. A service system, characterized in that the system comprises a task scheduling unit, a resource management unit and a plurality of computing units;
the task scheduling unit is used for acquiring a task to be executed, the algorithm type of the task to be executed and the number of resources consumed by the task to be executed; sending a query request to the resource management unit, wherein the query request comprises the algorithm type of the task to be executed;
the resource management unit is used for receiving the query request sent by the task scheduling unit; based on the algorithm type, inquiring the identification information and the available resource number corresponding to the algorithm type from the pre-stored corresponding relationship among the identification information of the computing unit, the algorithm type of the executable task of the computing unit and the available resource number of the computing unit; generating a query result according to the searched identification information and the number of available resources, and feeding the query result back to the task scheduling unit;
the task scheduling unit is further configured to receive the query result fed back by the resource management unit; according to the identification information and the number of available resources in the query result, sending the task to be executed to a computing unit, wherein the number of available resources is not less than the number of resources consumed by the task to be executed and the computing unit is provided with the identification information;
the computing unit is used for executing the task to be executed.
CN202010573303.8A 2020-06-22 2020-06-22 Task scheduling method and service system Pending CN113900776A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010573303.8A CN113900776A (en) 2020-06-22 2020-06-22 Task scheduling method and service system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010573303.8A CN113900776A (en) 2020-06-22 2020-06-22 Task scheduling method and service system

Publications (1)

Publication Number Publication Date
CN113900776A true CN113900776A (en) 2022-01-07

Family

ID=79186146

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010573303.8A Pending CN113900776A (en) 2020-06-22 2020-06-22 Task scheduling method and service system

Country Status (1)

Country Link
CN (1) CN113900776A (en)

Similar Documents

Publication Publication Date Title
CN110308983B (en) Resource load balancing method and system, service node and client
CN110096336B (en) Data monitoring method, device, equipment and medium
US8185624B2 (en) Efficient on-demand provisioning of servers for specific software sets
CN108829512B (en) Cloud center hardware accelerated computing power distribution method and system and cloud center
CN109814994B (en) Method and terminal for dynamically scheduling thread pool
WO2022105138A1 (en) Decentralized task scheduling method, apparatus, device, and medium
CN114189525B (en) Service request method and device and electronic equipment
CN111857998A (en) Configurable timing task scheduling method and system
CN111562889B (en) Data processing method, device, system and storage medium
CN114629883B (en) Service request processing method and device, electronic equipment and storage medium
US10846156B2 (en) Methods, devices and computer program products for managing software function
CN107045452B (en) Virtual machine scheduling method and device
CN117032987A (en) Distributed task scheduling method, system, equipment and computer readable medium
CN111309456B (en) Task execution method and system
CN113900776A (en) Task scheduling method and service system
CN114979286B (en) Access control method, device, equipment and computer storage medium for container service
CN114090268B (en) Container management method and container management system
CN111913784A (en) Task scheduling method and device, network element and storage medium
CN112380040B (en) Message processing method and device, electronic equipment and storage medium
CN113986523A (en) Method, system, equipment and medium for optimizing resource allocation of Flink system
CN114896337A (en) Data uplink method, system, equipment and computer readable storage medium
CN111782364A (en) Service calling method and device, electronic equipment and storage medium
CN113703930A (en) Task scheduling method, device and system and computer readable storage medium
CN116954871B (en) Asynchronous distribution task data chain management method and system
CN114679495B (en) Scheduling method and scheduling execution method for resource service operation request

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