Disclosure of Invention
The invention aims to provide a method and a system for distributed task scheduling of a cross-PaaS center architecture, which are used for intelligently realizing multi-center flexible scheduling of tasks without changing the scheduling mode or codes of the existing service end, solving the problem of single point of task scheduling and ensuring the accuracy of task scheduling.
To achieve the above object, the present invention proposes a method for distributed task scheduling across PaaS center architecture, comprising:
receiving different registration requests sent by task nodes, dividing the registration requests according to the nodes or tasks, and storing the registration requests in corresponding management units;
reading cluster region coding information of the scheduling probe, and modifying code bytes in corresponding management units according to different registration requests;
and performing task scheduling issuing to the task nodes.
In one embodiment, the different registration requests sent by the task node include: a first registration request and a second registration request;
the task node sends different task requests, including the following steps:
reading service information of a dispatching management center from a configuration center;
judging whether to register the node information to a dispatching management center by reading dispatching management center node service information in dispatching management center service information, if so, initiating a first registration request;
and judging whether to register the timing task information to the dispatching management center by reading the project task annotation information in the service information of the dispatching management center, and if so, initiating a second registration request.
In one embodiment, the management unit comprises: a node registration management unit and a scheduling task management unit;
dividing and storing the nodes or tasks in corresponding management units, wherein the nodes or tasks comprise:
the first registration request is classified as a node registration management unit, and the second registration request is classified as a scheduling task management unit.
In one embodiment, the code byte modification is performed at the corresponding management unit for different registration requests, including:
aiming at the first registration request, requesting code byte modification to combine the cluster region coding information with node information in the first registration request and store the cluster region coding information in a database;
and aiming at the second registration request, selecting code byte modification through query conditions to increase cluster region coding information in a task registration management unit for screening task scheduling real nodes.
In one embodiment, performing task scheduling issue to a task node includes:
according to the task triggering time, a task table in a database is queried regularly, and a target task which needs to be executed immediately is determined;
screening node information in the node registration management unit according to the information of the target task and the cluster region coding information to obtain a target node capable of triggering and executing the target task;
and scheduling the target node and sending the target task to enable the target node to execute the target task.
To achieve the above object, the present invention also proposes a system for distributed task scheduling across PaaS-centric architecture, comprising at least two interconnected clusters, each cluster comprising:
a configuration center;
the task node reads service information of the dispatching management center from the configuration center and sends a registration request;
the dispatching management center receives the registration request sent by the task node and performs task dispatching issuing to the task node, the dispatching management center comprises a dispatching probe, the dispatching management center reads cluster area coding information of the dispatching probe, and corresponding code byte modification is performed for different registration requests;
the data management system comprises a plurality of clusters, a plurality of configuration centers and a plurality of scheduling management centers, wherein all the clusters share a database, the database comprises a master library and at least one slave library, the master library is positioned in one cluster, the master library is used for carrying out data management on all the configuration centers and the scheduling management centers, the at least one slave library is respectively positioned in the other clusters, and the slave library is connected with the master library so as to copy all the data in the master library.
In one embodiment, the at least two interconnected clusters comprise a first cluster and a second cluster that are interconnected;
the first cluster includes:
a first configuration center;
the first task node reads service information of a dispatching management center from a first configuration center, and sends a registration request;
the first scheduling management center receives a registration request sent by a first task node and performs task scheduling issuing to the first task node;
the second cluster includes:
a second configuration center;
the second task node reads service information of the dispatching management center from a second configuration center and sends a registration request;
the second scheduling management center receives the registration request sent by the second task node and performs task scheduling issuing to the second task node;
the first cluster further includes:
the main library is used for carrying out data management on the first configuration center, the first dispatching management center, the second configuration center and the second dispatching management center;
the second cluster further includes:
the slave library is connected with the master library to copy all data in the master library;
the first scheduling management center or the second scheduling management center comprises a scheduling probe, reads cluster area coding information of the scheduling probe, and modifies corresponding code bytes according to different registration requests.
In one embodiment, the first task node or the second task node comprises at least one task module, and the first scheduling management center or the second scheduling management center further comprises at least one management unit;
the management units are in one-to-one correspondence with the task modules, the first scheduling management center or the second scheduling management center receives the registration requests sent by the task modules in the first task nodes or the second task nodes and stores the registration requests in the corresponding management units, and the management units perform task scheduling issuing to the corresponding task nodes.
In one embodiment, the at least one task module comprises a registration task module and a timing task module, and the at least one management unit comprises a node registration management unit and a scheduling task management unit;
the registration task module corresponds to the node registration management unit, and sends a first registration request to the node registration management unit so as to register node information;
the timing task module corresponds to the scheduling task management unit, and sends a second registration request to the scheduling task management unit so as to register timing task information.
In one embodiment, the scheduling probe is connected with the node registration management unit and the scheduling task management unit respectively;
aiming at the node registration unit, after the cluster region coding information of the scheduling probe is read, aiming at a first registration request, requesting code byte modification so as to combine the cluster region coding information with the node information in the first registration request and store the cluster region coding information into a database;
and aiming at the dispatching task management unit, after the cluster region coding information of the dispatching probe is read, aiming at a second registration request, selecting code byte modification through query conditions so as to increase the cluster region coding information in the task registration management unit, and screening the real node of the task dispatching.
The method and the system for distributed task scheduling crossing the PaaS center architecture have the following beneficial effects:
the scheduling management center can support the flexible scheduling supporting capability of the cloud host or the cloud protogenic container architecture in a lower layer, which means that the scheduling management center can adapt to different computing environments, including the cloud host and the cloud protogenic container, and diversity and flexibility are provided to meet the requirements of different workloads and application programs. This helps to achieve highly scalable and resilient task scheduling to ensure efficient utilization of resources and smooth execution of tasks.
The invention solves the problem of single point of task scheduling and ensures the accuracy of task scheduling. The invention solves the problem that the timed task is easy to call failure, and improves the reliability and the execution success rate of the task. The invention intelligently realizes the multi-center flexible scheduling of tasks and improves the efficiency and quality of task scheduling. The invention determines and calls the nodes capable of executing the timing tasks in time, ensures the tasks to be executed on time, and reduces waiting time and delay.
In a comprehensive view, the method and the system for distributed task scheduling across PaaS center architecture can manage scheduling of timing tasks in an intelligent manner, and ensure that the scheduling of the timing tasks is timely executed on a proper node. This is important to improve the performance, availability and flexibility of the distributed task scheduling system.
Detailed Description
The present invention will be described in further detail with reference to the drawings and examples, in order to make the objects, technical solutions and advantages of the present invention more apparent. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the invention.
The present invention provides a method for distributed task scheduling across PaaS (Platform as a Service ) central architectures, which refers to a method for task scheduling and coordination across multiple different PaaS central architectures. PaaS is a cloud computing service model that provides the platforms and tools required for application development and deployment, such as databases, storage, message queues, container services, and the like.
As shown in fig. 1, the method for distributed task scheduling across PaaS center architecture provided by the present invention includes:
receiving different registration requests sent by task nodes, dividing the registration requests according to the nodes or tasks, and storing the registration requests in corresponding management units;
reading cluster region coding information of the scheduling probe, and modifying code bytes in corresponding management units according to different registration requests;
and performing task scheduling issuing to the task nodes.
Further, the different registration requests sent by the task node include: a first registration request and a second registration request. The task node sends different task requests, including the following steps:
reading service information of a dispatching management center from a configuration center;
judging whether to register the node information to a dispatching management center by reading dispatching management center node service information in dispatching management center service information, if so, initiating a first registration request;
and judging whether to register the timing task information to the dispatching management center by reading the project task annotation information in the service information of the dispatching management center, and if so, initiating a second registration request.
In one embodiment, as shown in fig. 2, the flow of task nodes sending different task requests is as follows:
the task node initiates a node registration request;
judging whether the registration center configuration exists, if so, entering the next step, and if not, ending the flow;
judging whether the project timing task needs to be registered, if so, registering the project timing task, and if not, ending the flow.
Still further, the management unit includes: the node registration management unit and the scheduling task management unit. Dividing and storing the nodes or tasks in corresponding management units, wherein the nodes or tasks comprise: the first registration request is classified as a node registration management unit, and the second registration request is classified as a scheduling task management unit.
Still further, for different registration requests, code byte modifications are made at the corresponding management units, including:
aiming at the first registration request, requesting code byte modification to combine the cluster region coding information with node information in the first registration request and store the cluster region coding information in a database;
and aiming at the second registration request, selecting code byte modification through query conditions to increase cluster region coding information in a task registration management unit for screening task scheduling real nodes.
In this embodiment, the request code byte modification to merge the cluster region code information with the node information in the first registration request generally involves the steps of:
a. analyzing byte codes: first, the bytecode of the first registration request needs to be analyzed to see how the relevant portion is located and modified.
b. Inserting new bytecodes: among the bytecodes of the registration request, you need to insert new bytecodes to add cluster area code information. This may be accomplished through a Byte code operation library (e.g., ASM, byte add, etc.).
c. Combining information: the cluster region coding information is combined with the node information to ensure that they are stored in the correct location in the requested data.
Once the request code bytes are successfully modified, the following is a concrete implementation of storing the modified request in the database:
a. is connected to a database.
b. Constructing an insertion statement: a SQL INSERT statement is created and the modified registration request data is inserted into the database table. The statement should include the table name and the fields to be inserted, as well as the data of the registration request.
c. Performing an insert operation: the data is inserted into the database table using the database connection execution SQL INSERT statement. This will store the combined request information in a database.
d. Processing the database response: the response of the database operation is processed to check whether the insert operation was successful. Database errors or anomalies are captured and appropriate measures are taken to handle.
For the second registration request, the code byte modification is selected by the query condition, generally comprising the steps of:
based on the information of the task and the cluster region coding information, a query condition is constructed to determine which code bytes should be modified. The query condition may relate to a particular requirement of the task, such as a desired computing resource, task property, or other relevant condition.
The modified code should be executed in the task registration management unit to select the appropriate task scheduling real node according to the cluster region coding information and the query condition.
Further, performing task scheduling issue to the task node, including:
according to the task triggering time, a task table in a database is queried regularly, and a target task which needs to be executed immediately is determined;
screening node information in the node registration management unit according to the information of the target task and the cluster region coding information to obtain a target node capable of triggering and executing the target task;
and scheduling the target node and sending the target task to enable the target node to execute the target task.
In one embodiment, as shown in fig. 3, the task scheduling issuing procedure to the task node is as follows:
querying a database task table;
judging whether the task is expired and needs to be executed, if yes, entering the next step, and if not, ending the flow;
screening task registration nodes according to cluster region coding information;
judging whether a task executable node exists or not, if yes, entering the next step, and if not, ending the flow;
the dispatching management center initiates a timing task execution request with a task center;
the task node receives the timed task execution request and executes a specific task.
The invention also provides a system for distributed task scheduling across PaaS-centric architecture, comprising at least two interconnected clusters. Wherein, each cluster comprises: configuration center, task node and dispatch management center. The task node reads the service information of the dispatching management center from the configuration center, and the task node sends a registration request. And the scheduling management center receives the registration request sent by the task node and performs task scheduling issuing to the task node. The dispatching management center comprises dispatching probes, reads cluster area coding information of the dispatching probes, and modifies corresponding code bytes aiming at different registration requests.
Wherein all clusters share a database. The database comprises a master library and at least one slave library, wherein the master library is positioned in a cluster, and the master library performs data management on all configuration centers and scheduling management centers. At least one slave library is located in the remaining clusters, respectively, the slave library being connected to the master library to replicate all data in the master library.
The cluster is preferably a Kubernetes cluster. The database is a MySQL database, including a MySQL Master (MySQL Master) and one or more MySQL Slave (MySQL Slave).
It should be appreciated that the source of cluster region encoding information for the dispatch probes is typically a configuration or environmental setting of the distributed task dispatch system. This information is typically used to identify or categorize different nodes or resources so that the distributed task scheduling system can make decisions based on cluster region coding. The source of cluster region coding information can be configuration files, environment variables, node metadata and network topology information, and manual configuration can be performed.
Further, as shown in fig. 4, the at least two interconnected clusters include a first cluster and a second cluster that are interconnected. The first cluster includes: the system comprises a first configuration center, a first task node and a first scheduling management center. The first task node reads the service information of the dispatching management center from the first configuration center, and the first task node sends a registration request. The first scheduling management center receives a registration request sent by the first task node and performs task scheduling issuing to the first task node. The second cluster includes: the system comprises a second configuration center, a second task node and a second scheduling management center. And the second task node reads the service information of the dispatching management center from the second configuration center, and sends a registration request. The second scheduling management center receives a registration request sent by the second task node and performs task scheduling issuing to the second task node.
The first cluster further comprises a main library, and the main library performs data management on the first configuration center, the first dispatching management center, the second configuration center and the second dispatching management center. The second cluster also includes a slave library that is coupled to the master library to replicate all of the data in the master library. The first scheduling management center or the second scheduling management center comprises scheduling probes, reads cluster area coding information of the scheduling probes, and modifies corresponding code bytes according to different registration requests.
Still further, the first task node or the second task node comprises at least one task module, and the first scheduling management center or the second scheduling management center further comprises at least one management unit.
The management units are in one-to-one correspondence with the task modules, the first scheduling management center or the second scheduling management center receives the registration requests sent by the task modules in the first task nodes or the second task nodes and stores the registration requests in the corresponding management units, and the management units perform task scheduling issuing to the corresponding task nodes.
Still further, the at least one task module includes a registration task module and a timing task module, and the at least one management unit includes a node registration management unit and a scheduling task management unit;
the registration task module corresponds to the node registration management unit, and sends a first registration request to the node registration management unit so as to register node information;
the timing task module corresponds to the scheduling task management unit, and sends a second registration request to the scheduling task management unit so as to register timing task information.
Still further, the scheduling probe is connected to the node registration management unit and the scheduling task management unit, respectively, see fig. 4.
After the cluster region code information of the scheduling probe is read for the node registration unit, code byte modification is requested for the first registration request to combine the cluster region code information with the node information in the first registration request and store the combined cluster region code information in the database.
And aiming at the dispatching task management unit, after the cluster region coding information of the dispatching probe is read, aiming at a second registration request, selecting code byte modification through query conditions so as to increase the cluster region coding information in the task registration management unit, and screening the real node of the task dispatching.
The method and the system for distributed task scheduling crossing the PaaS center architecture have the following beneficial effects:
the scheduling management center can support the flexible scheduling supporting capability of the cloud host or the cloud protogenic container architecture in a lower layer, which means that the scheduling management center can adapt to different computing environments, including the cloud host and the cloud protogenic container, and diversity and flexibility are provided to meet the requirements of different workloads and application programs. This helps to achieve highly scalable and resilient task scheduling to ensure efficient utilization of resources and smooth execution of tasks.
The invention solves the problem of single point of task scheduling and ensures the accuracy of task scheduling. The invention solves the problem that the timed task is easy to call failure, and improves the reliability and the execution success rate of the task. The invention intelligently realizes the multi-center flexible scheduling of tasks and improves the efficiency and quality of task scheduling. The invention determines and calls the nodes capable of executing the timing tasks in time, ensures the tasks to be executed on time, and reduces waiting time and delay.
In a comprehensive view, the method and the system for distributed task scheduling across PaaS center architecture can manage scheduling of timing tasks in an intelligent manner, and ensure that the scheduling of the timing tasks is timely executed on a proper node. This is important to improve the performance, availability and flexibility of the distributed task scheduling system.
While, for purposes of simplicity of explanation, the methodologies are shown and described as a series of acts, it is to be understood and appreciated that the methodologies are not limited by the order of acts, as some acts may, in accordance with one or more embodiments, occur in different orders and/or concurrently with other acts from that shown and described herein or not shown and described herein, as would be understood and appreciated by those skilled in the art.
As used in this application and in the claims, the terms "a," "an," "the," and/or "the" are not specific to the singular, but may include the plural, unless the context clearly dictates otherwise. In general, the terms "comprises" and "comprising" merely indicate that the steps and elements are explicitly identified, and they do not constitute an exclusive list, as other steps or elements may be included in a method or apparatus.
Furthermore, the terms "first," "second," and the like, are used for descriptive purposes only and are not to be construed as indicating or implying relative importance.
The above embodiments are merely further illustrative of the present invention and are not intended to limit the present invention in any way, and various other embodiments are possible. Various modifications and variations may be made by those skilled in the art in light of the present disclosure without departing from the spirit and scope of the present disclosure, and such modifications and variations are intended to fall within the scope of the present disclosure.