CN114138435A - Distributed scheduling method, device and medium under micro-service architecture - Google Patents

Distributed scheduling method, device and medium under micro-service architecture Download PDF

Info

Publication number
CN114138435A
CN114138435A CN202111408109.5A CN202111408109A CN114138435A CN 114138435 A CN114138435 A CN 114138435A CN 202111408109 A CN202111408109 A CN 202111408109A CN 114138435 A CN114138435 A CN 114138435A
Authority
CN
China
Prior art keywords
service
micro
determining
threads
task
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
CN202111408109.5A
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.)
Inspur General Software Co Ltd
Original Assignee
Inspur General Software 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 Inspur General Software Co Ltd filed Critical Inspur General Software Co Ltd
Priority to CN202111408109.5A priority Critical patent/CN114138435A/en
Publication of CN114138435A publication Critical patent/CN114138435A/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
    • G06F9/4881Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • G06F9/5038Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals considering the execution order of a plurality of tasks, e.g. taking priority or time dependency constraints into consideration
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • G06F9/505Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals considering the load
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5083Techniques for rebalancing the load in a distributed system

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The application discloses a distributed scheduling method, equipment and medium under a micro-service architecture, wherein the method comprises the following steps: determining a plan task to be distributed, wherein the plan task refers to a business logic executed according to a set timer rule; dividing the server into a scheduling execution micro-service unit and a service micro-service unit according to different service types, and performing distributed deployment on the service micro-service unit; determining tenant databases respectively corresponding to the scheduling execution micro service units, wherein the tenant databases only allow the corresponding scheduling execution micro service units to access; determining the number of threads and the working state of the threads corresponding to the micro-service unit for scheduling and executing respectively, and determining the information of a planned task; and distributing the plan tasks in the tenant database to other scheduling execution micro-service units and the service micro-service units through the scheduling execution micro-service units according to the number of the threads, the working states of the threads and the plan task information.

Description

Distributed scheduling method, device and medium under micro-service architecture
Technical Field
The present application relates to the field of architecture design, and in particular, to a distributed scheduling method, device, and medium under a micro service architecture.
Background
With the deep development of enterprise management cloud end and automation, the requirements of various asynchronously executed planning tasks (such as payment, pushing and calling tasks) are increasingly on schedule, and the multi-tenant, micro-service architecture and distributed deployment also provide urgent requirements for high concurrency and high availability of the system.
However, in the existing system, the architectural sophistication and availability of task distribution and the scheduling execution of designated microservice units in a multi-tenant environment are not ideal. Therefore, a distributed scheduling method under the micro-service architecture is needed.
Disclosure of Invention
In order to solve the above problem, the present application provides a distributed scheduling method, device, and medium under a micro service architecture, where the method includes:
determining a plan task to be distributed, wherein the plan task refers to a business logic executed according to a set timer rule; dividing a server into a scheduling execution micro-service unit and a service micro-service unit according to different service types, and performing a distributed part on the scheduling execution micro-service unit and the service micro-service unit; determining tenant databases respectively corresponding to the scheduling execution micro service units, wherein the tenant databases only allow the corresponding scheduling execution micro service units to access; determining the number of threads respectively corresponding to the scheduling execution micro-service units and the working state of the threads, and determining the planned task information; and distributing the planned tasks in the tenant database to other scheduling execution micro service units and the service micro service unit through the scheduling execution micro service unit according to the number of the threads, the working state of the threads and the planned task information.
In one example, prior to determining the planned tasks to be distributed, the method further comprises: receiving a micro-service request sent by a tenant, and converting the micro-service request into the plan task; storing the planned tasks to the tenant database, and updating the task state of the planned tasks to be distributed in the tenant database; and sending response success information to the tenant.
In one example, determining the tenant databases respectively corresponding to the scheduling execution micro service units specifically includes: determining a planned task in the tenant database, and recording the scheduling execution micro-service unit which accesses the tenant database for the first time; and taking the scheduling execution micro-service unit as a scheduling execution micro-service unit corresponding to the tenant database.
In one example, determining the number of threads respectively corresponding to the scheduling execution microserver unit and the working state of the threads, and determining the scheduled task information specifically includes: determining the number of threads in an idle state in the threads in the server according to the working state of the threads; determining whether the planned task requires a designated business microservice unit to execute to determine the planned task information; if yes, distributing the planning task to the specified service micro-service unit through remote procedure call; and if not, distributing the plan task to the scheduling execution micro-service unit with the maximum number of threads in the idle state.
In one example, determining the number of threads respectively corresponding to the scheduling execution microserver unit and the working state of the threads, and determining the scheduled task information specifically includes: determining whether the planned task requires a designated business microservice unit to execute to determine the planned task information; determining the planned task load of the thread in the occupied state in the threads in the server according to the working state of the thread; and determining that all threads in the server are in an occupied state, and selecting the thread with the minimum load of the planned tasks to distribute the planned tasks to be distributed.
In one example, the method further comprises: determining a workload of the planned task; and if the workload is greater than a preset threshold value, persistently storing the intermediate data during the execution of the planned task into a task scheduling library of a main library or a non-tenant database.
In one example, after distributing the planned tasks within the tenant database to the servers, the tasks further include: determining that all threads in the server are in an occupied state and the execution authority of the planned task is the prior execution; judging whether the plan task with the execution permission of priority execution requires the business microservice unit to execute or not; if yes, stopping the current plan task executed by the appointed service micro service unit, and distributing the plan task with the execution permission of being executed preferentially to the appointed service micro service unit; if not, selecting a random server to stop executing the current plan task, and distributing the plan task with the execution authority of priority execution to the random server.
In one example, the timing schedule bottom layer of the planning task is based on a Quartz implementation.
The present application further provides a distributed scheduling device under the micro-service architecture, including: at least one processor; and a memory communicatively coupled to the at least one processor; wherein the memory stores instructions executable by the at least one processor to enable the at least one processor to: determining a plan task to be distributed, wherein the plan task refers to a business logic executed according to a set timer rule; dividing a server into a scheduling execution micro-service unit and a service micro-service unit according to different service types, and performing a distributed part on the scheduling execution micro-service unit and the service micro-service unit; determining tenant databases respectively corresponding to the scheduling execution micro service units, wherein the tenant databases only allow the corresponding scheduling execution micro service units to access; determining the number of threads respectively corresponding to the scheduling execution micro-service units and the working state of the threads, and determining the planned task information; and distributing the planned tasks in the tenant database to other scheduling execution micro service units and the service micro service unit through the scheduling execution micro service unit according to the number of the threads, the working state of the threads and the planned task information.
The present application further provides a non-volatile computer storage medium storing computer-executable instructions configured to: determining a plan task to be distributed, wherein the plan task refers to a business logic executed according to a set timer rule; dividing a server into a scheduling execution micro-service unit and a service micro-service unit according to different service types, and performing a distributed part on the scheduling execution micro-service unit and the service micro-service unit; determining tenant databases respectively corresponding to the scheduling execution micro service units, wherein the tenant databases only allow the corresponding scheduling execution micro service units to access; determining the number of threads respectively corresponding to the scheduling execution micro-service units and the working state of the threads, and determining the planned task information; and distributing the planned tasks in the tenant database to other scheduling execution micro service units and the service micro service unit through the scheduling execution micro service unit according to the number of the threads, the working state of the threads and the planned task information.
By the method, the system can uniformly manage the planned tasks of all the tenants or part of the tenants in the environment under the multi-tenant environment; under the micro service architecture, the system can assign the micro service unit nodes related to the service to distribute the operation resources to execute the planning task. The architecture mode can simultaneously meet various asynchronously executed planning tasks, and has good high concurrency and usability for multi-tenant, micro-service architectures and distributed deployments.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the application and together with the description serve to explain the application and not to limit the application. In the drawings:
fig. 1 is a schematic flowchart of a distributed scheduling method under a micro service architecture in an embodiment of the present application;
FIG. 2 is a schematic diagram of a microservice architecture according to an embodiment of the present application;
fig. 3 is a schematic diagram of a distributed scheduling apparatus under a micro-service architecture in an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the technical solutions of the present application will be described in detail and completely with reference to the following specific embodiments of the present application and the accompanying drawings. It should be apparent that the described embodiments are only some 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.
The analysis method according to the embodiment of the present application may be implemented by a terminal device or a server, and the present application is not limited to this. For convenience of understanding and description, the following embodiments are described in detail by taking a terminal device as an example.
The technical solutions provided by the embodiments of the present application are described in detail below with reference to the accompanying drawings.
As shown in fig. 1 and fig. 2, an embodiment of the present application provides a distributed scheduling method under a micro service architecture, including:
s101: and determining a planning task to be distributed, wherein the planning task refers to business logic executed according to a set timer rule.
Before scheduling, the terminal device first needs to determine a scheduling task to be distributed, where the scheduling task refers to a service logic executed according to a timer rule, for example, sending a reminder at seven o' clock every morning or backing up various data of the terminal device every hour. That is, something is done at a regular point in time, and this law can be very complex.
S102: according to different service types, a server is divided into a scheduling execution micro-service unit and a service micro-service unit, and the scheduling execution micro-service unit and the service micro-service unit are deployed in a distributed mode.
The single framework mode is convenient to develop, test, deploy and operate when the project is small in initial stage. However, as applications advance over time, more and more functionality is added, and eventually become huge, with potentially millions of lines of code in a project. In order to prevent the situation that the whole system cannot normally operate due to errors in the execution of one type of service, one system can be divided into a plurality of modules and services. Therefore, the terminal device needs to divide the server into a scheduling execution micro-service unit and a service micro-service unit according to the service type. The scheduling execution micro-service unit is used for accessing a table in a tenant database and distributing a plan task to each server, the scheduling execution micro-service unit can also be used for executing the plan task, and the service micro-service unit is specially used for processing a specific service decomposed according to a function requirement. The scheduling execution micro-service unit and the service micro-service unit support distributed deployment.
For example, the system is provided with a financial module and a human module, the financial module is responsible for reimbursement, and the human module is responsible for recruitment, so that two micro services can be detached, and when one module is down, the service of the other module can still be normally developed. It should be noted that the server corresponding to the service unit may be a single device, or may be a system composed of multiple devices, that is, a distributed server, and this application is not limited to this specifically.
S103: and determining tenant databases respectively corresponding to the scheduling execution micro service units, wherein the tenant databases only allow the corresponding scheduling execution micro service units to access.
After the terminal device splits the whole system into a plurality of micro-services according to the functional requirements of the system, the number of scheduling execution micro-service units and the number of service micro-service units which are responsible for distributing the planning tasks need to be determined. Meanwhile, in order to prevent a plurality of scheduling execution micro-service units from simultaneously accessing the same single task in the same tenant database, the tenant database can be locked in the distribution stage of the single task.
S104: and determining the number of threads respectively corresponding to the scheduling execution micro-service units and the working state of the threads, and determining the planned task information.
In order to reasonably utilize computing resources, when distributing tasks, the terminal device needs to count the number of threads in the server and the working state of each thread, that is, count idle computing resources of each server. There is also a need to determine various types of information for the planning task, such as the service functions that the planning task may invoke, the amount of computing resources that may be required, and whether a particular business microservice unit is required to perform the planning task, etc.
S105: and distributing the planned tasks in the tenant database to other scheduling execution micro service units and the service micro service unit through the scheduling execution micro service unit according to the number of the threads, the working state of the threads and the planned task information.
After the terminal device counts the number of threads in each server, the working state of the threads and the information of the scheduled tasks, the scheduling execution micro-service unit distributes the scheduled tasks to be distributed to the servers according to the information.
In one embodiment, before distributing the task, if the tenant does not receive the response notice of the microservice request for a long time, the software use experience of the tenant is reduced. Based on this, before task distribution, the terminal device determines a received micro-service request sent by a tenant, converts the micro-service request into a planned task, stores the planned task in a database of the tenant, and updates the task state of the planned task to be distributed. After the scheduled task is determined to be successfully stored, the information of successful response is sent to the tenant, so that the user experience of the tenant is improved.
In one embodiment, when determining tenant databases respectively corresponding to the scheduling execution micro service units, the terminal device first needs to determine a scheduled task stored in the tenant database, record a scheduling execution micro service unit accessing the tenant database for the first time, and establish a correspondence between the scheduling execution micro service unit and the tenant database, so that only the scheduling execution micro service unit is allowed to access a single task in the tenant database. For example, the tenant is T1, and there are two scheduling execution microservices, SU1 and SU 2. When the single task in the tenant database of T1 is distributed, if SU1 accesses the data in the T1 database first, at this time, the scheduling execution microserver unit SU1 locks the tenant database of tenant T1, and then SU2 accesses T1, the single task data in T1 is omitted, that is, the single task in T1 is only distributed by SU 1.
In one embodiment, after determining the corresponding relationship between the scheduling execution micro service unit and the tenant database, the terminal device needs to determine the number of threads inside the server and the working states of the threads, where the working states of the threads include an idle state and an occupied state. And determining the number of idle threads in the corresponding thread pool in each server, namely determining idle computing resources corresponding to each server. It is also necessary to determine whether the planning task requires a designated business microservice unit to execute. For example, the financial-related micro-service request made by the financial staff is executed by the split business micro-service unit which is specially responsible for the work of the financial module.
After determining the idle computing resources corresponding to the server, if the scheduled task does not need to be executed by the designated service micro-service unit, the scheduling execution micro-service unit allocates the scheduling execution micro-service unit with the most idle computing resources to the scheduling execution micro-service unit. That is, if the scheduled scheduling task does not specify the business microservice unit, the scheduling task is executed in the scheduling execution microservice unit by default. If the planning task needs to be executed through the specified business microservice unit, the planning task is distributed to the specified business microservice unit in a remote procedure call mode.
Further, if it is found through statistics that all threads in the scheduling execution micro service units are in an occupied state, at this time, in order to improve the scheduling tightness of the scheduled tasks, the terminal device may count task load amounts of the scheduling execution micro service units, and may reserve and estimate an approximate time for the scheduling execution micro service units to complete all scheduled tasks of the current load, and then select the scheduling execution micro service unit with the smallest task load amount, that is, the scheduling execution micro service unit that completes all current load scheduled tasks earliest, to distribute.
In one embodiment, the present architecture provides two basic job storage types, one of which is memory storage, i.e., in the case of a human, in which running information for task scheduling is stored in memory, which provides the best performance because data access in memory is fastest. The disadvantage is the lack of data persistence, and when a program stops halfway or the system crashes, all running information is lost. The other method is to store the scheduled running information into a table of a Scheduler library of a main library or a non-tenant database through JDBC job storage for persistence processing, and although the running speed is slightly slow, even if the program stops midway, intermediate data still remain in the main library and the non-tenant database. Therefore, two job storage types can be flexibly selected according to the requirements of the planned tasks, and if the workload of the planned tasks is large, in order to prevent data loss, a job storage mode of JDBC can be selected to persistently store the intermediate data into a task scheduling library of a main library or a non-tenant database.
In one embodiment, some scheduled tasks are important, the execution authority is a priority execution, if all threads in all servers are in an occupied state at this time, it needs to be judged first whether the scheduled task whose execution authority is the priority execution requires the designated service microserver unit to execute, if necessary, the scheduled task whose execution authority is the priority execution is distributed to the service microserver unit, and the currently-ongoing scheduled task of the service microserver unit is stopped. If not, randomly selecting one scheduling execution micro-service unit for distribution, and stopping the current scheduling task of the scheduling server.
In one example, the timing schedule bottom layer of the planning task may be implemented based on Quartz.
As shown in fig. 3, an embodiment of the present application further provides a distributed scheduling apparatus under a micro-service architecture, including:
at least one processor; and the number of the first and second groups,
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to: determining a plan task to be distributed, wherein the plan task refers to a business logic executed according to a set timer rule; dividing a server into a scheduling execution micro-service unit and a service micro-service unit according to different service types, and performing distributed deployment on the service micro-service unit; determining tenant databases respectively corresponding to the scheduling execution micro service units, wherein the tenant databases only allow the corresponding scheduling execution micro service units to access; determining the number of threads respectively corresponding to the scheduling execution micro-service units and the working state of the threads, and determining the planned task information; and distributing the planned tasks in the tenant database to other scheduling execution micro service units and the service micro service unit through the scheduling execution micro service unit according to the number of the threads, the working state of the threads and the planned task information.
An embodiment of the present application further provides a non-volatile computer storage medium storing computer-executable instructions, where the computer-executable instructions are configured to: determining a plan task to be distributed, wherein the plan task refers to a business logic executed according to a set timer rule; dividing a server into a scheduling execution micro-service unit and a service micro-service unit according to different service types, and performing distributed deployment on the service micro-service unit; determining tenant databases respectively corresponding to the scheduling execution micro service units, wherein the tenant databases only allow the corresponding scheduling execution micro service units to access; determining the number of threads respectively corresponding to the scheduling execution micro-service units and the working state of the threads, and determining the planned task information; and distributing the planned tasks in the tenant database to other scheduling execution micro service units and the service micro service unit through the scheduling execution micro service unit according to the number of the threads, the working state of the threads and the planned task information.
The embodiments in the present application are described in a progressive manner, and the same and similar parts among the embodiments can be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the device and media embodiments, the description is relatively simple as it is substantially similar to the method embodiments, and reference may be made to some descriptions of the method embodiments for relevant points.
The device and the medium provided by the embodiment of the application correspond to the method one to one, so the device and the medium also have the similar beneficial technical effects as the corresponding method, and the beneficial technical effects of the method are explained in detail above, so the beneficial technical effects of the device and the medium are not repeated herein.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (fl ash RAM). Memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include transitory computer readable media (trans) such as modulated data signals and carrier waves.
It should also be noted that 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 like elements in a process, method, article, or apparatus that comprises the element.
The above description is only an example of the present application and is not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.

Claims (10)

1. A distributed scheduling method under a micro-service architecture is characterized by comprising the following steps:
determining a plan task to be distributed, wherein the plan task refers to a business logic executed according to a set timer rule;
dividing a server into a scheduling execution micro-service unit and a service micro-service unit according to different service types, and performing distributed deployment on the scheduling execution micro-service unit and the service micro-service unit;
determining tenant databases respectively corresponding to the scheduling execution micro service units, wherein the tenant databases only allow the corresponding scheduling execution micro service units to access;
determining the number of threads respectively corresponding to the scheduling execution micro-service units and the working state of the threads, and determining the planned task information;
and distributing the planned tasks in the tenant database to other scheduling execution micro service units and the service micro service unit through the scheduling execution micro service unit according to the number of the threads, the working state of the threads and the planned task information.
2. The method of claim 1, wherein prior to determining the planned tasks to be distributed, the method further comprises:
receiving a micro-service request sent by a tenant, and converting the micro-service request into the plan task;
storing the planned tasks to the tenant database, and updating the task state of the planned tasks to be distributed in the tenant database;
and sending response success information to the tenant.
3. The method according to claim 1, wherein determining the tenant databases respectively corresponding to the scheduling execution micro service units specifically comprises:
determining a planned task in the tenant database, and recording the scheduling execution micro-service unit which accesses the tenant database for the first time;
and taking the scheduling execution micro-service unit as a scheduling execution micro-service unit corresponding to the tenant database.
4. The method according to claim 1, wherein determining the number of threads and the working state of the threads corresponding to the micro service unit for scheduling execution, and determining the scheduled task information specifically include:
determining the number of threads in an idle state in the threads in the server according to the working state of the threads;
determining whether the planned task requires a designated business microservice unit to execute to determine the planned task information;
if yes, distributing the planning task to the specified service micro-service unit through remote procedure call;
and if not, distributing the plan task to the scheduling execution micro-service unit with the maximum number of threads in the idle state.
5. The method according to claim 1, wherein determining the number of threads and the working state of the threads corresponding to the micro service unit for scheduling execution, and determining the scheduled task information specifically include:
determining whether the planned task requires a designated business microservice unit to execute to determine the planned task information;
determining the planned task load of the thread in the occupied state in the threads in the server according to the working state of the thread;
and determining that all threads in the server are in an occupied state, and selecting the thread with the minimum load of the planned tasks to distribute the planned tasks to be distributed.
6. The method of claim 1, further comprising:
determining a workload of the planned task;
and if the workload is greater than a preset threshold value, persistently storing the intermediate data during the execution of the planned task into a task scheduling library of a main library or a non-tenant database.
7. The method of claim 1, wherein after distributing the planned tasks within the tenant database to the server, the tasks further comprise:
determining that all threads in the server are in an occupied state and the execution authority of the planned task is the prior execution;
judging whether the plan task with the execution permission of priority execution requires the business microservice unit to execute or not;
if yes, stopping the current plan task executed by the appointed service micro service unit, and distributing the plan task with the execution permission of being executed preferentially to the appointed service micro service unit;
if not, selecting a random server to stop executing the current plan task, and distributing the plan task with the execution authority of priority execution to the random server.
8. The method of claim 1, wherein the timing scheduling underlay for the planned task is implemented based on Quartz.
9. A distributed scheduling apparatus under a micro-service architecture, comprising:
at least one processor; and a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to cause the at least one processor to perform:
determining a plan task to be distributed, wherein the plan task refers to a business logic executed according to a set timer rule;
dividing a server into a scheduling execution micro-service unit and a service micro-service unit according to different service types, and performing distributed deployment on the service micro-service unit;
determining tenant databases respectively corresponding to the scheduling execution micro service units, wherein the tenant databases only allow the corresponding scheduling execution micro service units to access;
determining the number of threads respectively corresponding to the scheduling execution micro-service units and the working state of the threads, and determining the planned task information;
and distributing the planned tasks in the tenant database to other scheduling execution micro service units and the service micro service unit through the scheduling execution micro service unit according to the number of the threads, the working state of the threads and the planned task information.
10. A non-transitory computer storage medium storing computer-executable instructions, the computer-executable instructions configured to:
determining a plan task to be distributed, wherein the plan task refers to a business logic executed according to a set timer rule;
dividing a server into a scheduling execution micro-service unit and a service micro-service unit according to different service types, and performing distributed deployment on the service micro-service unit;
determining tenant databases respectively corresponding to the scheduling execution micro service units, wherein the tenant databases only allow the corresponding scheduling execution micro service units to access;
determining the number of threads respectively corresponding to the scheduling execution micro-service units and the working state of the threads, and determining the planned task information;
and distributing the planned tasks in the tenant database to other scheduling execution micro service units and the service micro service unit through the scheduling execution micro service unit according to the number of the threads, the working state of the threads and the planned task information.
CN202111408109.5A 2021-11-19 2021-11-19 Distributed scheduling method, device and medium under micro-service architecture Pending CN114138435A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111408109.5A CN114138435A (en) 2021-11-19 2021-11-19 Distributed scheduling method, device and medium under micro-service architecture

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111408109.5A CN114138435A (en) 2021-11-19 2021-11-19 Distributed scheduling method, device and medium under micro-service architecture

Publications (1)

Publication Number Publication Date
CN114138435A true CN114138435A (en) 2022-03-04

Family

ID=80391461

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111408109.5A Pending CN114138435A (en) 2021-11-19 2021-11-19 Distributed scheduling method, device and medium under micro-service architecture

Country Status (1)

Country Link
CN (1) CN114138435A (en)

Similar Documents

Publication Publication Date Title
US11036553B2 (en) Preempting or traversing allocated resource applications based on job priority and resource demand information
CN107291545B (en) Task scheduling method and device for multiple users in computing cluster
US8893118B2 (en) Migratable unit based application migration
Han et al. A fault-tolerant scheduling algorithm for real-time periodic tasks with possible software faults
CN106406983B (en) Task scheduling method and device in cluster
CN106293893B (en) Job scheduling method and device and distributed system
CN110008018A (en) A kind of batch tasks processing method, device and equipment
CN107783842B (en) Distributed lock implementation method, device and storage device
CN110597614B (en) Resource adjustment method and device
CN110471754B (en) Data display method, device, equipment and storage medium in job scheduling
US8959518B2 (en) Window-based scheduling using a key-value data store
CN107168777B (en) Method and device for scheduling resources in distributed system
CN112328307A (en) Development, operation and maintenance integrated system
US20060090162A1 (en) Method, system, and apparatus for establishing a software configurable computing environment
CN104182295A (en) Data backup method and data backup device
CN106649000B (en) Fault recovery method of real-time processing engine and corresponding server
CN105260297A (en) Test data management system and method
CN114138435A (en) Distributed scheduling method, device and medium under micro-service architecture
CN107122892B (en) Vehicle scheduling method and equipment
CN116594734A (en) Container migration method and device, storage medium and electronic equipment
CN115098252A (en) Resource scheduling method, device and computer readable medium
US20230168940A1 (en) Time-bound task management in parallel processing environment
CN114840347A (en) MPC platform, calculation power pool allocation method and electronic equipment
CN115328608A (en) Kubernetes container vertical expansion adjusting method and device
CN114661432A (en) Task scheduling method, device, equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination