Task scheduling method, electronic device, storage medium and program product
By employing a two-level scheduling design between the scheduling center and business nodes, and utilizing the Raft algorithm to optimize the allocation of scheduled tasks, the performance bottleneck in high-concurrency and large-scale task scenarios is resolved, achieving efficient scheduling and reliable execution of scheduled tasks.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- CHINA MOBILE (SUZHOU) SOFTWARE TECH CO LTD
- Filing Date
- 2026-02-27
- Publication Date
- 2026-06-26
AI Technical Summary
In high-concurrency and large-scale task scenarios, existing timed task scheduling frameworks suffer from performance bottlenecks, excessive computational pressure on the scheduling center, and difficulty in achieving large-scale timed task scheduling.
A two-level scheduling scheme based on the Raft algorithm is adopted. The scheduling center queries the business node with the least load and schedules the scheduled task instance data to the business node with the least load. The business node executes the task, realizing the first-level and second-level scheduling of scheduled tasks and reducing the computational pressure on the scheduling center.
It effectively solves the performance bottleneck in high-concurrency and large-scale task scenarios, improves task scheduling performance, and enables reliable execution of large-scale timed tasks.
Smart Images

Figure CN122285199A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of task management, and more particularly to a task scheduling method, electronic device, storage medium, and program product. Background Technology
[0002] Scheduled tasks are tasks that are executed automatically at predetermined time intervals. These tasks are very common in computer systems, software applications, and services, primarily used to perform periodic or planned operations. Scheduled tasks can help automate many routine maintenance activities, thereby reducing the need for manual intervention and improving system reliability and efficiency.
[0003] In modern distributed scenarios, scheduled tasks especially need to ensure high availability of services. They are generally deployed in the form of service clusters. In related technologies, the scheduling center server program can schedule scheduled tasks in distributed scenarios. However, the scheduling method of scheduled tasks in this solution is a first-level scheduling method implemented by the scheduling center, which increases the computing pressure on the scheduling center. In scenarios with a sudden increase in the amount of tasks and high concurrency, there is a performance bottleneck in task scheduling, which is not conducive to the implementation of large-scale scheduled task scheduling. Summary of the Invention
[0004] This application provides a task scheduling method, an electronic device, a storage medium, and a program product.
[0005] The technical solution of this application embodiment is implemented as follows: This application provides a task scheduling method applied in a scheduling center, the method comprising: When a request to create a target scheduled task is received, the business node with the lowest load is queried. The instance data of the target scheduled task is scheduled to the business node with the least load, so that the business node executes the target scheduled task according to the instance data of the target scheduled task.
[0006] This application embodiment also provides another task scheduling method, applied to a business node, the method comprising: Upon receiving instance data of the target scheduled task sent by the scheduling center, the target scheduled task is executed according to the instance data of the target scheduled task. The scheduling center is used to query the business node with the least load when it receives a request to create a target scheduled task, and schedule the instance data of the target scheduled task to the business node with the least load.
[0007] This application also provides an electronic device, which includes a processor and a memory for storing a computer program that can run on the processor; wherein the processor is used to run the computer program to perform any of the above-described task scheduling methods.
[0008] This application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements any of the above-described task scheduling methods.
[0009] This application also provides a computer program product, including a computer program or computer executable instructions, which, when executed by a processor, implements any of the above-described task scheduling methods.
[0010] As can be seen, the embodiments of this application can query the business node with the least load through the scheduling center and schedule the instance data of the target scheduled task to the business node with the least load, thereby realizing the first-level scheduling of the scheduled task; in the business node, the target scheduled task can be executed according to the instance data of the target scheduled task, thereby realizing the second-level scheduling of the scheduled task. Therefore, compared with the related technologies that only realize the first-level scheduling of scheduled tasks based on the scheduling center, it can reduce the computational pressure of the scheduling center to a certain extent. In scenarios with a sudden increase in task volume and high concurrency, it can improve the performance of task scheduling and help realize large-scale scheduled task scheduling. Attached Figure Description
[0011] Figure 1 This application provides a system architecture diagram for implementing task scheduling in its embodiments. Figure 2 This is a flowchart illustrating a task scheduling method applied to a scheduling center, as described in an embodiment of this application. Figure 3 This application provides a system architecture diagram for leader selection based on the Raft algorithm in an embodiment of the application. Figure 4 A flowchart for business node registration provided in this application embodiment; Figure 5 A flowchart illustrating instance data for creating scheduled tasks in this embodiment of the application; Figure 6 This is a task flow topology diagram provided in the embodiments of this application; Figure 7 This is a flowchart of a task scheduling method applied to a business node according to an embodiment of this application; Figure 8 This is a flowchart illustrating the execution of a scheduled task in an embodiment of this application. Figure 9 This is a schematic diagram of the structure of the task scheduling device located in the scheduling center according to the embodiments of this application; Figure 10 This is a schematic diagram of the structure of the task scheduling device located at the service node according to an embodiment of this application; Figure 11 This is a schematic diagram of the composition structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0012] Scheduled tasks typically have the following key characteristics: 1) Periodicity: The task is executed repeatedly at predetermined time intervals, such as performing data backup every morning.
[0013] 2) Automatic execution: The task starts automatically after the scheduled time, without the need for manual intervention.
[0014] 3) Scalability: The system's processing capacity can be expanded by simply adding more computing nodes.
[0015] 4) Fault tolerance: Even if some nodes fail, other nodes can take over their tasks to ensure the normal completion of the tasks.
[0016] 5) Flexibility: Resource allocation strategies can be dynamically adjusted according to the specific needs of the task.
[0017] In modern distributed environments, scheduled tasks require high availability, and are typically deployed as service clusters. In related technologies, a scheduling center server program can schedule these tasks within the distributed environment. For example, many distributed scheduled task scheduling frameworks and middleware can be used. In typical business scenarios with a small number of tasks and low concurrency, these frameworks and middleware can stably achieve scheduled task scheduling and execution. Examples include Quartz and Xxl-Job; the former integrates directly with the application service, while the latter requires a scheduling center service. All these scheduled task scheduling frameworks use relational databases to store task data and employ a single-level scheduling approach.
[0018] For example, Quartz employs a single-level weak scheduling center design, which is simple, flexible, and easily integrated with applications. However, it suffers from poor scheduling performance when there are too many scheduled tasks. Xxl-Job adopts a single-level strong scheduling center design. The server program of the scheduling center stores task data based on a relational database and implements distributed locks. In high-concurrency scenarios, the performance of the relational database is a significant bottleneck, making it unable to handle large-scale task volumes and high-concurrency scenarios.
[0019] While timed task scheduling frameworks in related technologies can achieve full-process management of timed tasks in business scenarios, they all exhibit performance bottlenecks to varying degrees under scenarios with a surge in task volume and high concurrency. For example, using a single-level scheduling method increases the computational pressure on the scheduling center, and performance bottlenecks exist in task scheduling under scenarios with a surge in task volume and high concurrency, which is not conducive to achieving large-scale timed task scheduling.
[0020] To address the technical problems existing in related technologies, this application proposes a technical solution based on embodiments of the present application. In an exemplary application scenario, this application provides a system architecture for implementing task scheduling. This system architecture may include a scheduling center and a business cluster. The scheduling center may be built based on a management cluster and consistent memory. The management cluster may include multiple management nodes. The consistent memory may be memory built based on the Raft data consistency algorithm, and the memory built based on the Raft data consistency algorithm can be denoted as Raft memory. The business cluster may include multiple business nodes and may inherit a timer program. (Refer to...) Figure 1 In this system, Management Node 1, Management Node 2, and Management Node 3 are multiple management nodes within a management cluster, while Business Node 1 and Business Node 2 are different business nodes within a business cluster. In practical applications, the scheduling center is a cluster of management nodes built based on the Raft algorithm. The scheduling center can accept requests from business nodes to create scheduled task instances. Based on the task instance information recorded in Raft memory and the business node task load balancing rules, the scheduling center schedules the scheduled task instance data to the business node with the lowest load, thus achieving first-level scheduling of scheduled tasks. After receiving the scheduled task instance data, the business node can start the scheduled task locally based on the information in the scheduled task instance data (such as cron expressions), thus achieving second-level scheduling of scheduled tasks. This second-level scheduling design, by delegating the execution of the scheduled program (i.e., second-level scheduling) to the business nodes, effectively releases the computing power of the task scheduling center, thereby achieving the goal of large-scale scheduled task scheduling. Business nodes can report performance indicators to the scheduling center on a second-by-second basis. The business node obtains more accurate load data when running its local scheduled program, allowing for more real-time and reasonable decisions on whether to distribute tasks to other low-load nodes.
[0021] The embodiments of this application will be further described in detail below with reference to the accompanying drawings and examples. It should be understood that the embodiments provided herein are merely illustrative of the embodiments of this application and are not intended to limit the embodiments of this application. Furthermore, the embodiments provided below are some embodiments for implementing this application, and not all embodiments for implementing this application. Unless otherwise specified, the technical solutions described in the embodiments of this application can be implemented in any combination.
[0022] It should be noted that, in the embodiments of this application, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a method or apparatus that includes a list of elements includes not only the elements expressly described, but also other elements not expressly listed, or elements inherent to implementing the method or apparatus. Without further limitations, an element defined by the phrase "comprising a..." does not exclude the presence of other related elements (e.g., steps in the method or units in the apparatus, such as portions of circuitry, processors, programs, or software, etc.) in the method or apparatus that includes that element.
[0023] The task scheduling method provided in this application includes a series of steps, but the task scheduling method provided in this application is not limited to the steps described. Similarly, the task scheduling device provided in this application includes a series of modules, but the device provided in this application is not limited to the modules explicitly described, and may also include modules that need to be set for obtaining relevant information or processing based on information.
[0024] This application provides a task scheduling method applied to a scheduling center. Figure 2 This is a flowchart of a task scheduling method applied to a scheduling center according to an embodiment of this application, such as... Figure 2 As shown, the process includes: Step 201: Upon receiving a request to create a target scheduled task, query the business node with the lowest load.
[0025] In this embodiment, the scheduling center includes multiple management nodes for scheduling timed tasks. In some embodiments, the scheduling center can achieve consistency of memory data among the various management nodes based on a consensus algorithm. This allows subsequently acquired data (such as task instances and execution records) to be stored in the consistent memory of the management cluster, thereby providing scalability and high-performance guarantees for read and write requests from business nodes.
[0026] For example, the consensus algorithm could be the Raft algorithm. Before achieving consistency of memory data among the management nodes in the scheduling center based on the Raft algorithm, a leader can be elected based on the Raft algorithm, and a consistent memory can be built. (See reference...) Figure 3 In the process of electing a leader based on the Raft algorithm, the leader node can broadcast append entries to the followers, and the leader node and followers represent different node states.
[0027] The process of building consistent memory may include: after electing a leader based on the Raft algorithm, defining and configuring the state machine based on the state machine mechanism provided by the Raft algorithm, submitting empty lists of timed business nodes, empty lists of task instances and empty lists of running records, initializing consistent memory, persisting log entries, and setting a timed state snapshot creation strategy.
[0028] Here, the list of business nodes is used to store business node data, and the format of the list of business nodes can be as shown in Table 1.
[0029] Table 1
[0030] The list of task instances is used to store task instance data. The format of the list of task instances can be as shown in Table 2.
[0031] Table 2
[0032] The list of execution records is used to store task execution record information. The format of the list of execution records can be as shown in Table 3.
[0033] Table 3
[0034] In practical applications, business nodes can register with the scheduling center before the scheduling center receives the request to create a target scheduled task. The following section combines... Figure 4 The registration process for business nodes is illustrated below, please refer to... Figure 4 Business Node 1 and Business Node 2 represent different business nodes, while Management Node 1, Management Node 2, and Management Node 3 represent different management nodes in the scheduling center. These different management nodes can communicate based on the Transmission Control Protocol (TCP). When a business node starts, it sends its own information to the scheduling center. The scheduling center records this information and stores it in Raft memory. As business nodes periodically send their own information to the scheduling center, the business list information in Raft memory is continuously updated, allowing the load status of each business node to be queried. Furthermore, each business node integrates a cron-based scheduled program, implemented in the programming language used by that business node. For example, if the business node's programming language is Java, the scheduled program might be ScheduledExecutorService.
[0035] In practical applications, after a business node registers, it can create instance data for scheduled tasks. During the creation of instance data for scheduled tasks, the business node can send a request to the scheduling center to create a target scheduled task. This request can specify parameters such as the task name and the timing expression.
[0036] When the scheduling center receives a request to create a target scheduled task, it can query the business node with the lowest load among all business nodes. For example, the process of the scheduling center querying the business node with the lowest load includes: querying the business node with the lowest load among all business nodes based on the performance metrics reported by each business node. In this way, by using the performance metrics reported by each business node, the business node with the lowest load among all business nodes can be determined relatively accurately.
[0037] Step 202: Schedule the instance data of the target scheduled task to the business node with the least load, so that the business node executes the target scheduled task according to the instance data of the target scheduled task.
[0038] The following is combined Figure 5 The process of creating instance data for scheduled tasks is illustrated by example, refer to Figure 5 Business Node 1 and Business Node 2 represent different business nodes, while Management Node 1, Management Node 2, and Management Node 3 represent different management nodes in the scheduling center. After receiving a request to create a scheduled task, the scheduling center can query the business node with the lowest load in Raft memory, schedule the instance data of the scheduled task to that business node, and then bind the scheduled task to that business node, thus achieving first-level scheduling of scheduled tasks. Raft memory can record a single task-business node binding information.
[0039] When a business node receives instance data of a target scheduled task sent by the scheduling center, it can execute the target scheduled task based on the instance data.
[0040] In practical applications, steps 201 to 202 can be implemented based on a processor and a communication interface. The processor can be at least one of the following: Application Specific Integrated Circuit (ASIC), Digital Signal Processor (DSP), Digital Signal Processing Device (DSPD), Programmable Logic Device (PLD), Field Programmable Gate Array (FPGA), Central Processing Unit (CPU), controller, microcontroller, and microprocessor.
[0041] As can be seen, the embodiments of this application can query the business node with the least load through the scheduling center and schedule the instance data of the target scheduled task to the business node with the least load, thereby realizing the first-level scheduling of the scheduled task; in the business node, the target scheduled task can be executed according to the instance data of the target scheduled task, thereby realizing the second-level scheduling of the scheduled task. Therefore, compared with the related technologies that only realize the first-level scheduling of scheduled tasks based on the scheduling center, it can reduce the computational pressure of the scheduling center to a certain extent. In scenarios with a sudden increase in task volume and high concurrency, it can improve the performance of task scheduling and help realize large-scale scheduled task scheduling.
[0042] In this embodiment, the execution process of scheduled tasks can be delegated to business nodes through a two-level scheduling design, which can effectively reduce the computational pressure on the task scheduling center and thus achieve the goal of large-scale scheduled task scheduling. Furthermore, the scheme of this embodiment can solve the performance bottleneck problem faced by traditional scheduled task scheduling in large-scale and high-concurrency scenarios based on the Raft consensus algorithm and two-level scheduling design.
[0043] In this embodiment of the application, the scheduling center can also obtain task operation and maintenance information, which includes at least one of the following: instance data of scheduled tasks, execution information of scheduled tasks reported by each business node, and performance indicators reported by each business node.
[0044] Here, the execution information of the scheduled task may include one or more of the following: the execution record of the scheduled task, the execution result of the scheduled task, and the information of the business node that executed the scheduled task.
[0045] It can be seen that the mission operation and maintenance information can provide effective support for the operation, maintenance and observation of subsequent missions.
[0046] For example, after a business node completes its current task, it reports the execution result to the scheduling center. The scheduling center can then construct a scheduler based on the instance data of the scheduled tasks, the execution records of the scheduled tasks, the execution results of the scheduled tasks, the information of the business nodes that executed the scheduled tasks, and the performance metrics reported by each business node. Figure 6 The task flow topology diagram shown provides effective support for the operation, maintenance, and observation of subsequent tasks. Figure 6 In this context, business node 1, business node 2, and business node 3 represent different business nodes, while management node 1, management node 2, and management node 3 represent different management nodes in the scheduling center. In this embodiment of the application, the scheduling center can accurately determine the load size of each business node based on task operation and maintenance information, which helps to solve the load imbalance problem caused by the execution of scheduled tasks in the business cluster.
[0047] The embodiments of this application can also realize the migration of scheduled tasks. In some embodiments, when the scheduling center determines that the first business node in each business node does not meet the task execution requirements, it can migrate the scheduled task of the first business node to other business nodes in each business node. The first business node can be any one of the business nodes.
[0048] Here, when it is determined that the first business node among all business nodes does not meet the task execution requirements, the scheduled task of the first business node can be considered a faulty task, requiring task migration to achieve reliable execution of the scheduled task. For example, when the first business node crashes or goes offline, it can be considered that the first business node does not meet the task execution requirements. When the first business node in the business cluster goes offline, the scheduling center can determine that the first business node is offline based on the update time of the business node data in memory, and then re-perform first-level scheduling. The subsequent process is consistent with the process of creating instance data for scheduled tasks. Based on the Raft consistent memory design, checking whether a business node is offline before scheduled task migration has higher performance, and the number of business nodes checked per second can be very large. When the first business node crashes, the scheduled tasks on that node will be migrated to other business nodes. Based on the consistent memory design of the scheduling center, periodic inspection access to consistent memory to check whether a business node is down has higher performance, and second-level scheduled task fault migration can be achieved.
[0049] It can be seen that when it is determined that the first business node in each business node does not meet the task execution requirements, the scheduled task can be reliably executed by migrating the scheduled task of the first business node to other business nodes in each business node.
[0050] This application provides a task scheduling method applied to business nodes. Figure 7This is a flowchart of a task scheduling method applied to a business node according to an embodiment of this application, such as... Figure 7 As shown, the process includes: Step 701: Upon receiving the instance data of the target scheduled task sent by the scheduling center, execute the target scheduled task according to the instance data of the target scheduled task.
[0051] The scheduling center is used to query the business node with the least load when it receives a request to create a target scheduled task, and schedule the instance data of the target scheduled task to the business node with the least load.
[0052] In practical applications, step 701 can be implemented based on a processor and a communication interface. The processor can be at least one of ASIC, DSP, DSPD, PLD, FPGA, CPU, controller, microcontroller, or microprocessor.
[0053] As can be seen, the embodiments of this application can query the business node with the least load through the scheduling center and schedule the instance data of the target scheduled task to the business node with the least load, thereby realizing the first-level scheduling of the scheduled task; in the business node, the target scheduled task can be executed according to the instance data of the target scheduled task, thereby realizing the second-level scheduling of the scheduled task. Therefore, compared with the related technologies that only realize the first-level scheduling of scheduled tasks based on the scheduling center, it can reduce the computational pressure of the scheduling center to a certain extent. In scenarios with a sudden increase in task volume and high concurrency, it can improve the performance of task scheduling and help realize large-scale scheduled task scheduling.
[0054] In this embodiment, load balancing among business nodes can be achieved based on requests from business nodes. In some embodiments, when a business node receives instance data of a target scheduled task sent by the scheduling center, it can also request load balancing from the scheduling center based on its own load status. This helps the scheduling center to achieve load balancing among various business nodes in a timely and reliable manner.
[0055] The following is combined Figure 8 The process of executing a scheduled task is illustrated with an example, refer to... Figure 8Business Node 1 and Business Node 2 represent different business nodes, while Management Node 1, Management Node 2, and Management Node 3 represent different management nodes in the scheduling center. After receiving instance data for a scheduled task, a business node can start a scheduled program locally based on the cron expression in the instance data. Since this scheduled program is based on the locally cached cron expression, it can significantly reduce the pressure on the scheduling center in scenarios with massive tasks. It should be noted that within a business node, whether the local scheduled program can execute the current round of tasks requires a task status check from the scheduling center before execution. If the task status is already stopped or the task is bound to a node other than the current business node, the current round of tasks is abandoned, and the local scheduled program is closed. When the task can be executed, the load of the current business node also needs to be checked. If the load is too high, the scheduling center is requested to query the business node with the lowest load to migrate the scheduled task to the business node with the lowest load.
[0056] In summary, this application proposes a multi-level scheduling scheme for timed tasks based on the Raft algorithm. Thanks to the Raft algorithm's ability to solve the data consistency problem among multiple nodes in a distributed scenario, the management node has very high availability. Furthermore, based on the Raft data consistency algorithm, a consistent set of memory data can be maintained in the management node. Memory-based read and write operations are highly efficient, effectively solving the task scheduling performance problem in high-concurrency scenarios.
[0057] In this embodiment, a scheduling center composed of management nodes is built based on the Raft consistent memory storage service cluster and the scheduled task data. This center is responsible for the first-level scheduling of scheduled tasks. By integrating general scheduling programs into the service nodes, the center can complete the execution of local tasks or distribute them to other low-load service nodes, thereby realizing the second-level scheduling of scheduled tasks. This effectively avoids the problem of significant performance degradation caused by a sharp increase in the number of tasks in traditional scheduled task scheduling centers.
[0058] The solutions in this application can be applied to scenarios such as cloud computing, big data, financial transaction computing, and edge computing. For example, in a financial transaction computing scenario, the solutions in this application can ensure that scheduled tasks can be executed on time and reliably in a distributed environment, and can handle large-scale data processing needs. A distributed scheduled task scheduling system ensures that transaction data is processed synchronously within a specified time, while also supporting fault recovery and fault tolerance mechanisms. In cloud computing and edge computing scenarios, cloud service providers need to dynamically adjust computing resources based on load, check system load within fixed time periods, and automatically add or remove virtual machine instances based on load conditions. A distributed scheduled task scheduling system is used to periodically execute load monitoring tasks and trigger automatic scaling actions based on load conditions. The solutions in this application can meet the relevant needs of cloud service providers.
[0059] Those skilled in the art will understand that, in the above-described method of the specific implementation, the order in which each step is written does not imply a strict execution order and does not constitute any limitation on the implementation process. The specific execution order of each step should be determined by its function and possible internal logic.
[0060] This application also proposes a task scheduling device. Figure 9 This is a schematic diagram of the structure of the task scheduling device located in the scheduling center according to the embodiments of this application, as shown below. Figure 9 As shown, the device includes: The query module 901 is used to query the business node with the least load when a request to create a target scheduled task is received. The first processing module 902 is used to schedule the instance data of the target scheduled task to the business node with the least load, so that the business node executes the target scheduled task according to the instance data of the target scheduled task.
[0061] In some embodiments, the query module 901 is specifically used to query the business node with the lowest load among the various business nodes based on the performance indicators reported by each business node.
[0062] In some embodiments, the scheduling center includes multiple management nodes for scheduling timed tasks; the first processing module 902 is further configured to achieve consistency of memory data among the various management nodes in the scheduling center based on a consensus algorithm.
[0063] In some embodiments, the first processing module 902 is further configured to acquire task operation and maintenance information, which includes at least one of the following: instance data of scheduled tasks, execution information of scheduled tasks reported by each business node, and performance indicators reported by each business node.
[0064] In some embodiments, the first processing module 902 is further configured to migrate the timed task of the first business node to other business nodes when it is determined that the first business node in each business node does not meet the task execution requirements.
[0065] In practical applications, the query module 901 and the first processing module 902 can be implemented based on a processor and a communication device.
[0066] Figure 10 This is a schematic diagram of the structure of the task scheduling device located at the service node according to the embodiments of this application, as shown below. Figure 10 As shown, the device includes: Communication module 1001 is used to establish a communication connection with the dispatch center; The second processing module 1002 is used to execute the target timed task according to the instance data of the target timed task when it receives the instance data of the target timed task sent by the scheduling center. The scheduling center is used to query the business node with the least load when it receives a request to create a target scheduled task, and schedule the instance data of the target scheduled task to the business node with the least load.
[0067] In some embodiments, the second processing module 1002 is further configured to request load balancing from the scheduling center based on its own load condition when it receives instance data of the target timed task sent by the scheduling center.
[0068] In practical applications, the communication module 1001 can be implemented based on a communication interface, and the second processing module 1002 can be implemented based on a processor.
[0069] It should be noted that the description of the above device embodiments is similar to the description of the above method embodiments, and has similar beneficial effects. For technical details not disclosed in the device embodiments of this application, please refer to the description of the method embodiments of this application for understanding.
[0070] It should be noted that, in the embodiments of this application, if the above-described methods are implemented as software functional modules and sold or used as independent products, they can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiments of this application, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a terminal, server, etc.) to execute all or part of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), magnetic disks, or optical disks. Thus, the embodiments of this application are not limited to any specific hardware and software combination.
[0071] Correspondingly, this application embodiment further provides a computer program product, the computer program product including computer executable instructions, which are used to implement any of the task scheduling methods provided in this application embodiment.
[0072] Accordingly, this application embodiment further provides a computer storage medium storing computer-executable instructions, which are used to implement any of the task scheduling methods provided in the above embodiments.
[0073] This application also provides an electronic device. Figure 11This is a schematic diagram of the composition structure of an electronic device provided in an embodiment of this application, as shown below. Figure 11 As shown, the electronic device 110 may include: Memory 1101 is used to store executable instructions; The processor 1102 is used to implement any of the above-described task scheduling methods when executing executable instructions stored in the memory 1101.
[0074] The processor 1102 mentioned above can be at least one of ASIC, DSP, DSPD, PLD, FPGA, CPU, controller, microcontroller, and microprocessor.
[0075] The aforementioned computer-readable storage medium and memory 1101 may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a magnetic random access memory (FRAM), a flash memory, a magnetic surface memory, an optical disc, or a compact disc read-only memory (CD-ROM), etc.; it may also be various terminals that include one or any combination of the above-mentioned memories, such as mobile phones, computers, tablet devices, personal digital assistants, etc.
[0076] In some embodiments, the functions or modules of the apparatus provided in this application can be used to perform the methods described in the above method embodiments. The specific implementation can be referred to the description of the above method embodiments, and for the sake of brevity, it will not be repeated here.
[0077] The description of the various embodiments above tends to emphasize the differences between the various embodiments. The similarities or similarities between them can be referred to, and for the sake of brevity, they will not be repeated here.
[0078] The methods disclosed in the various method embodiments provided in this application can be arbitrarily combined to obtain new method embodiments without conflict.
[0079] The features disclosed in the various product embodiments provided in this application can be arbitrarily combined without conflict to obtain new product embodiments.
[0080] The features disclosed in the various method or device embodiments provided in this application can be arbitrarily combined without conflict to obtain new method or device embodiments.
[0081] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0082] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims. All of these forms are within the protection scope of this application.
Claims
1. A task scheduling method, characterized in that, Applied to a scheduling center, the method includes: When a request to create a target scheduled task is received, the business node with the lowest load is queried. The instance data of the target scheduled task is scheduled to the business node with the least load, so that the business node executes the target scheduled task according to the instance data of the target scheduled task.
2. The method according to claim 1, characterized in that, The business nodes with the lowest query load include: Based on the performance metrics reported by each business node, the business node with the lowest load is queried among all the business nodes.
3. The method according to claim 1, characterized in that, The scheduling center includes multiple management nodes for scheduling timed tasks; The method further includes: Consensus algorithms are used to ensure the consistency of memory data among the management nodes in the scheduling center.
4. The method according to claim 1, characterized in that, The method further includes: Obtain task operation and maintenance information, which includes at least one of the following: instance data of scheduled tasks, execution information of scheduled tasks reported by each business node, and performance indicators reported by each business node.
5. The method according to claim 1, characterized in that, The method further includes: When it is determined that the first business node among all business nodes does not meet the task execution requirements, the timed task of the first business node is migrated to other business nodes among all business nodes.
6. A task scheduling method, characterized in that, Applied to business nodes, the method further includes: Upon receiving instance data of the target scheduled task sent by the scheduling center, the target scheduled task is executed according to the instance data of the target scheduled task. The scheduling center is used to query the business node with the least load when it receives a request to create a target scheduled task, and schedule the instance data of the target scheduled task to the business node with the least load.
7. The method according to claim 6, characterized in that, The method further includes: Upon receiving instance data of the target scheduled task sent by the scheduling center, it requests load balancing from the scheduling center based on its own load situation.
8. An electronic device, characterized in that, The electronic device includes a processor and a memory for storing computer programs capable of running on the processor; wherein, The processor is used to run the computer program to perform the method according to any one of claims 1 to 7.
9. A computer storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the computer program implements the method described in any one of claims 1 to 7.
10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the method described in any one of claims 1 to 7.