Task scheduling method and device, medium, electronic equipment and program product

By dividing tasks into multiple groups and evenly configuring them to multiple schedulers, the problem of untimely task scheduling in Quartz Scheduler is solved, achieving timely task scheduling and reducing database pressure.

CN118689604APending Publication Date: 2024-09-24BEIJING ZITIAO NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410758733.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-12
Publication Date
2024-09-24

AI Technical Summary

Technical Problem

Quartz Scheduler adopts a preemptive method in task scheduling, resulting in huge load differences between nodes and unable to ensure the timeliness of task scheduling.

Method used

Divide all tasks into multiple task groups, and configure these groups to multiple schedulers in a balanced manner. Each scheduler schedules its scheduled task groups and sends them to the message queue. Finally, the executor executes the message queue. tasks in.

Benefits of technology

The task grouping method reduces the task volume of each scheduler, ensuring the timeliness of task scheduling, and decouples scheduling and execution through message queues, avoiding additional pressure on the task storage database.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118689604A
    Figure CN118689604A
Patent Text Reader

Abstract

The invention relates to a task scheduling method and device, a medium, electronic equipment and a program product, belongs to the technical field of computers, and can ensure the timeliness of task scheduling. The task scheduling method comprises the following steps: dividing all tasks into a plurality of task groups; uniformly configuring the plurality of task groups to a plurality of schedulers; each scheduler schedules the tasks in the task groups scheduled by the scheduler and sends the scheduled tasks to a message queue; and executing the tasks in the message queue by an executor.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, and in particular, to a task scheduling method, device, medium, electronic device and program product. Background Art

[0002] Quartz Scheduler is a powerful open source scheduled task library suitable for Java applications. Quartz closely combines scheduling and execution, and uses preemptive mode to allocate tasks, which may cause huge differences in load between nodes and cannot ensure the timeliness of task scheduling. Summary of the invention

[0003] This summary is provided to introduce concepts in a brief form that will be described in detail in the detailed description below. This summary is not intended to identify key features or essential features of the claimed technical solution, nor is it intended to limit the scope of the claimed technical solution.

[0004] In a first aspect, the present disclosure provides a task scheduling method, comprising: dividing all tasks into multiple task groups; balancing the multiple task groups to multiple schedulers; each of the schedulers separately scheduling the tasks in the task groups scheduled by it and sending the scheduled tasks to a message queue; and an executor executing the tasks in the message queue.

[0005] In a second aspect, the present disclosure provides a task scheduling device, comprising a division module, a configuration module, multiple schedulers and an executor, wherein: the division module is used to divide all tasks into multiple task groups; the configuration module is used to evenly configure the multiple task groups to the multiple schedulers; the multiple schedulers are used to respectively schedule the tasks in the task groups scheduled by them and send the scheduled tasks to a message queue; the executor is used to execute the tasks in the message queue.

[0006] In a third aspect, the present disclosure provides a computer-readable medium having a computer program stored thereon, which, when executed by a processing device, implements the steps of any one of the methods described in the first aspect.

[0007] In a fourth aspect, the present disclosure provides an electronic device, including:

[0008] a storage device having a computer program stored thereon;

[0009] A processing device is used to execute the computer program in the storage device to implement the steps of any one of the methods in the first aspect.

[0010] In a fifth aspect, the present disclosure provides a computer program product, comprising a computer program, which, when executed by a processor, implements the steps of any one of the methods in the first aspect.

[0011] By adopting the above technical solution, on the one hand, a large number of tasks are subdivided into multiple small sets through the task grouping method, so that each scheduler is only responsible for the scheduling of a limited number of tasks, reducing the amount of tasks undertaken by each scheduler and ensuring the timeliness of task scheduling. On the other hand, with the help of message queues, task scheduling and task execution are decoupled, ensuring the timeliness of task execution. On the other hand, the frequency of interaction between the scheduler and the database that stores tasks is not affected by the total number of tasks, but is only related to the number of schedulers. Therefore, even if the number of tasks increases, it will hardly bring additional pressure to the database that stores tasks.

[0012] Other features and advantages of the present disclosure will be described in detail in the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS

[0013] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and the originals and elements are not necessarily drawn to scale. In the drawings:

[0014] Figure 1 The present invention is a flowchart of a task scheduling method according to an embodiment of the present invention.

[0015] Figure 2 The present invention is a flowchart of each scheduler scheduling tasks in a task group scheduled by the scheduler according to an embodiment of the present invention.

[0016] Figure 3 This is another flowchart of a task scheduling method according to an embodiment of the present disclosure.

[0017] Figure 4 It is a schematic block diagram of a task scheduling device according to an embodiment of the present disclosure.

[0018] Figure 5 A schematic diagram of the structure of an electronic device suitable for implementing the embodiments of the present disclosure is shown. DETAILED DESCRIPTION

[0019] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.

[0020] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.

[0021] The term "including" and its variations used herein are open inclusions, i.e., "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.

[0022] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.

[0023] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".

[0024] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.

[0025] It is understandable that before using the technical solutions disclosed in the embodiments of the present disclosure, the types, scope of use, usage scenarios, etc. of the personal information involved in the present disclosure should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations.

[0026] For example, in response to receiving an active request from a user, a prompt message is sent to the user to clearly prompt the user that the operation requested to be performed will require obtaining and using the user's personal information. Thus, the user can autonomously choose whether to provide personal information to software or hardware such as an electronic device, application, server, or storage medium that performs the operation of the technical solution of the present disclosure according to the prompt message.

[0027] As an optional but non-limiting implementation, in response to receiving an active request from the user, the prompt information may be sent to the user in the form of a pop-up window, in which the prompt information may be presented in text form. In addition, the pop-up window may also carry a selection control for the user to choose "agree" or "disagree" to provide personal information to the electronic device.

[0028] It is understandable that the above notification and the process of obtaining user authorization are merely illustrative and do not constitute a limitation on the implementation of the present disclosure. Other methods that meet the relevant laws and regulations may also be applied to the implementation of the present disclosure.

[0029] At the same time, it is understandable that the data involved in this technical solution (including but not limited to the data itself, the acquisition or use of the data) shall comply with the requirements of relevant laws, regulations and relevant provisions.

[0030] Figure 1 FIG. 1 is a flowchart of a task scheduling method according to an embodiment of the present disclosure. The task scheduling method can be applied to various task scheduling systems, such as distributed systems, timing / periodic task systems, etc. Figure 1 As shown, the task scheduling method may include the following steps S11 to S14.

[0031] In step S11, all tasks are divided into a plurality of task groups.

[0032] In some embodiments, the same task is divided into one of the task groups. For example, for task 1, it can be divided into task group 1, and it can also be divided into task group 2, but it cannot be divided into both task group 1 and task group 2. By configuring in this way, it is possible to avoid the same task from being repeatedly scheduled.

[0033] In some embodiments, all tasks are evenly divided into the plurality of task groups, so that the balance of the number of tasks in each task group can be ensured.

[0034] In step S12, the plurality of task groups are evenly allocated to a plurality of schedulers.

[0035] In some embodiments, at the same time, one of the task groups is assigned to one of the schedulers. For example, for task group 1, at the same time, it can be assigned to scheduler 1 or to scheduler 2, but not to both scheduler 1 and scheduler 2. By configuring in this way, it is possible to avoid the same task group being repeatedly scheduled by multiple schedulers at the same time.

[0036] In step S13, each of the schedulers schedules the tasks in the task group to be scheduled by it and sends the scheduled tasks to the message queue.

[0037] In step S14, the executor executes the tasks in the message queue.

[0038] By adopting the above technical scheme, since all tasks are divided into multiple task groups, the multiple task groups are evenly allocated to multiple schedulers, each of the schedulers schedules the tasks in the task groups scheduled by it and sends the scheduled tasks to the message queue, and the executor executes the tasks in the message queue. Therefore, on the one hand, through the task grouping method, a large number of tasks are subdivided into multiple small sets, so that each scheduler is only responsible for the scheduling of a limited number of tasks, reducing the amount of tasks undertaken by each scheduler, and ensuring the timeliness of task scheduling. On the other hand, with the help of the message queue, the scheduling of tasks and the execution of tasks are decoupled, ensuring the timeliness of task execution. On the other hand, the frequency of interaction between the scheduler and the database that stores tasks is not affected by the total number of tasks, but is only related to the number of schedulers. Therefore, even if the number of tasks increases, it will hardly bring additional pressure to the database that stores tasks.

[0039] Figure 2 FIG. 1 is a flowchart of each scheduler scheduling tasks in a task group scheduled by the scheduler according to an embodiment of the present disclosure. Figure 2 As shown, the process includes the following steps S131 to S134. In addition, steps S131 to S134 are described from the perspective of one of the schedulers.

[0040] In step S131 , all tasks in the scheduled task group are read.

[0041] For example, scheduler 1 is configured with task group 1 and task group 2. Scheduler 1 currently needs to schedule tasks in task group 1, so scheduler 1 will read all tasks in task group 1.

[0042] In step S132, the position of each task in the scheduled task group in the time wheel is determined according to the task information.

[0043] The task information may include at least one of the following: task ID, task creation time, task attributes, and other task information.

[0044] The time wheel is a cache algorithm optimized for time. The algorithm divides time into multiple segments, each segment represents a specific period of time, and the tasks to be processed within these time ranges are placed in the corresponding time slots. As time goes by, these tasks are processed in turn.

[0045] In some embodiments, a hash value may be calculated based on the task information, and the position of each task in the scheduled task group in the time wheel may be determined based on the hash value.

[0046] In step S133, all tasks in the scheduled task group are placed in the determined corresponding positions respectively.

[0047] In some embodiments, since the periods of each task in the scheduled task group may not be the same, the period of some tasks may be lower than the period of the time wheel, for example, half of the period of the time wheel or even lower, and the period of some tasks may be higher than the period of the time wheel. Therefore, in order to be able to more accurately schedule tasks with periods lower than the period of the time wheel, step S133 may also include: determining the tasks in the scheduled task group whose periods are lower than the period of the time wheel; taking the position determined according to the task information as the starting position; based on the periods of the tasks whose periods are lower than the period of the time wheel, placing the tasks whose periods are lower than the period of the time wheel into corresponding positions starting from the starting position in the direction in which the pointer of the time wheel rotates.

[0048] For example, if the period of task 1 is 10 seconds, the period of the time wheel is 60 seconds, and the pointer of the time wheel rotates clockwise, then the starting position of task 1 in the time wheel can be determined based on the task information of task 1 and task 1 can be placed at the starting position. Then, starting from the starting position, task 1 can be placed every 10 seconds in the time wheel in a clockwise direction, and so on, to complete the placement of task 1 in the time wheel. In this way, task 1 can be placed at the appropriate position in the time wheel, and accurate scheduling of task 1 can be achieved.

[0049] In step S134, the pointer of the time wheel is set to point to the most recent scheduled time.

[0050] In this way, the time wheel is constructed. After that, when the time wheel starts to run, the pointer of the time wheel will point to different paragraphs in turn; when it points to a paragraph, the to-do task in that paragraph is triggered and sent to the message queue. In addition, after being triggered and sent to the message queue, the time of this operation can be recorded in the database that stores the task, so as to facilitate the subsequent review of the task scheduling time.

[0051] By adopting the above technical solution, the tasks in the task group can be put into the corresponding time slots of the time wheel, completing the construction of the time wheel, thereby ensuring accurate scheduling of tasks in the face of a large number of scheduled / periodic tasks.

[0052] In some embodiments, under normal circumstances, each task grouping will be managed by a configured scheduler, and the schedulers are load balanced. If changes such as the increase, decrease, replacement, or failure of schedulers occur, it is necessary to reconfigure the task groups between the schedulers to ensure that the balance between the schedulers is not affected. Based on this, the task scheduling method according to the embodiment of the present disclosure may also include: monitoring changes in the multiple schedulers, such as monitoring whether the schedulers are increased or decreased, whether the schedulers are replaced, whether the schedulers are faulty, etc.; then, if changes are detected in the multiple schedulers, the multiple task groups are re-balanced to the multiple schedulers.

[0053] For example, if some schedulers fail, in this case, the multiple task groups will be re-equilibrium configured to other normally running schedulers. Moreover, the schedulers configured with task groups can restore the time wheel state according to the last update time of the database storing the tasks to continue task scheduling and avoid any possible omission or duplicate processing problems.

[0054] In addition, after reconfiguration, the records of the database storing the tasks also need to be updated to keep the information synchronized.

[0055] By adopting the above technical solution, it is possible to reconfigure task groups to multiple schedulers when there are changes in the schedulers, thereby ensuring accurate and timely scheduling of tasks.

[0056] In some embodiments, the task scheduling method according to the embodiment of the present disclosure may also include: each of the schedulers periodically checks whether the task grouping scheduled by it has changed. For example, each scheduler may periodically compare the information of the task grouping it is currently scheduling with the latest configuration information of the task grouping to the scheduler in the database storing the tasks. If the scheduler finds that the task grouping configured to itself has changed, the scheduler will update or reconstruct the time wheel according to the latest configuration information. In this way, it is possible to ensure that the scheduler can schedule the tasks in the task grouping in a timely and accurate manner.

[0057] In some embodiments, the task scheduling method according to the embodiment of the present disclosure may also include: monitoring the total task volume; if it is monitored that the total task volume has increased, adding a new scheduler, dividing the added tasks into multiple new task groups, and evenly allocating the multiple new task groups to the new scheduler.

[0058] Adding a new scheduler can be achieved in the following ways: starting a new scheduler, registering the new scheduler in the database that stores tasks, and updating the database in seconds.

[0059] The number of new schedulers can be determined based on the amount of tasks added and the number of tasks each scheduler undertakes. For example, if N tasks are added and each scheduler undertakes M tasks on average, then N / M schedulers need to be added.

[0060] By adopting the above technical solution, in the face of an increase in the number of tasks, new schedulers can be added to cope with it, so that horizontal expansion can be quickly achieved and the scheduling capacity can be quickly increased. Moreover, the increase in the number of tasks will not bring additional pressure to the database that stores the tasks, because the frequency of interaction between the scheduler and the database that stores the tasks is not affected by the total number of tasks, but only related to the number of schedulers.

[0061] Figure 3 This is another flowchart of a task scheduling method according to an embodiment of the present disclosure.

[0062] like Figure 3 As shown in the figure, the database will store the tasks that need to be scheduled. These tasks will be divided into various task groups, such as Figure 3 As shown in the figure, there are task groups 11, 12, etc. These task groups are evenly allocated to multiple schedulers, for example, task group 11 is allocated to scheduler 1, and task group n1 is allocated to scheduler n. The scheduler schedules the tasks in the task groups, for example, using a time wheel for scheduling. The scheduled tasks are sent to the message queue. The executor reads the tasks from the message queue and executes them.

[0063] By adopting the above technical solution, since all tasks are divided into multiple task groups, the multiple task groups are evenly allocated to multiple schedulers, each scheduler schedules the tasks in the task group scheduled by it and sends the scheduled tasks to the message queue, and the executor executes the tasks in the message queue. Therefore, on the one hand, through the task grouping method, a large number of tasks are subdivided into multiple small sets, so that each scheduler is only responsible for the scheduling of a limited number of tasks, reducing the amount of tasks undertaken by each scheduler, and ensuring the timeliness of task scheduling. On the other hand, with the help of the message queue, the scheduling of tasks and the execution of tasks are decoupled, ensuring the timeliness of task execution. On the other hand, the frequency of interaction between the scheduler and the database that stores tasks is not affected by the total number of tasks, but is only related to the number of schedulers. Therefore, even if the number of tasks increases, it will hardly bring additional pressure to the database that stores tasks.

[0064] Figure 4 1 is a schematic block diagram of a task scheduling device according to an embodiment of the present disclosure. The task scheduling device can be applied to various task scheduling systems, such as distributed systems, timing / periodic task systems, etc. Figure 4As shown, the task scheduling device may include a partitioning module 41 , a configuration module 42 , a plurality of schedulers 43 and an executor 44 .

[0065] The division module 41 is used to divide all tasks into multiple task groups.

[0066] The configuration module 42 is used to configure the multiple task groups to the multiple schedulers in a balanced manner.

[0067] The multiple schedulers 43 are used to respectively schedule the tasks in the task group scheduled by them and send the scheduled tasks to the message queue.

[0068] The executor 44 is used to execute the tasks in the message queue.

[0069] By adopting the above technical scheme, since all tasks are divided into multiple task groups, the multiple task groups are evenly allocated to multiple schedulers, each of the schedulers schedules the tasks in the task groups scheduled by it and sends the scheduled tasks to the message queue, and the executor executes the tasks in the message queue. Therefore, on the one hand, through the task grouping method, a large number of tasks are subdivided into multiple small sets, so that each scheduler is only responsible for the scheduling of a limited number of tasks, reducing the amount of tasks undertaken by each scheduler, and ensuring the timeliness of task scheduling. On the other hand, with the help of the message queue, the scheduling of tasks and the execution of tasks are decoupled, ensuring the timeliness of task execution. On the other hand, the frequency of interaction between the scheduler and the database that stores tasks is not affected by the total number of tasks, but is only related to the number of schedulers. Therefore, even if the number of tasks increases, it will hardly bring additional pressure to the database that stores tasks.

[0070] Optionally, the division module 41 divides all tasks into a plurality of task groups, including:

[0071] The same task is divided into one of the task groups.

[0072] Optionally, the division module 41 divides all tasks into a plurality of task groups, including:

[0073] All tasks are evenly divided into the multiple task groups.

[0074] Optionally, the configuration module 42 configures the plurality of task groups to a plurality of schedulers in a balanced manner, including:

[0075] At the same time, one of the task groups is assigned to one of the schedulers.

[0076] Optionally, each of the schedulers schedules tasks in the task group scheduled by it, respectively, including:

[0077] Read all tasks in the scheduled task group;

[0078] According to the task information, determine the position of each task in the scheduled task group in the time wheel;

[0079] Put all tasks in the scheduled task group into the determined corresponding positions respectively;

[0080] The pointer of the time wheel is set to point to the most recent scheduling time.

[0081] Optionally, each of the schedulers schedules the tasks in the task group scheduled by it, respectively, further comprising:

[0082] Determine the tasks in the scheduled task group whose period is lower than the period of the time wheel;

[0083] Using the position determined according to the task information as the starting position;

[0084] Based on the period of the task with a period lower than the period of the time wheel, the task with a period lower than the period of the time wheel is placed into a corresponding position starting from the starting position according to the direction in which the pointer of the time wheel rotates.

[0085] Optionally, the task scheduling device further includes:

[0086] A first monitoring module, configured to monitor changes of the plurality of schedulers;

[0087] The configuration module 42 is further configured to re-balance the multiple task groups to the multiple schedulers if changes are detected in the multiple schedulers.

[0088] Optionally, each of the schedulers also periodically checks whether the task grouping scheduled by it has changed.

[0089] Optionally, the task scheduling device further includes:

[0090] The second monitoring module is used to monitor the total task volume;

[0091] An additional module is used to add a new scheduler if it is detected that the total task volume increases;

[0092] The division module 41 is also used to divide the added tasks into a plurality of new task groups;

[0093] The configuration module 42 is further configured to group the multiple new tasks in a balanced manner and configure them to the new scheduler.

[0094] The specific implementation of the operations performed by each module in the task scheduling device according to the embodiment of the present disclosure has been described in detail in the relevant task scheduling method, and will not be repeated here.

[0095] The present disclosure also provides a computer-readable medium having a computer program stored thereon, and when the computer program is executed by a processing device, the steps of any method described in the present disclosure are implemented.

[0096] The present disclosure also provides an electronic device, comprising:

[0097] a storage device having a computer program stored thereon;

[0098] A processing device is used to execute the computer program in the storage device to implement the steps of any method described in the present disclosure.

[0099] The present disclosure also provides a computer program product, comprising a computer program, which implements the steps of any one of the methods of the present disclosure when executed by a processor.

[0100] Reference below Figure 5 , which shows a schematic diagram of the structure of an electronic device 600 suitable for implementing the embodiment of the present disclosure. The terminal device in the embodiment of the present disclosure may include but is not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle terminals (such as vehicle navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 5 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.

[0101] like Figure 5 As shown, the electronic device 600 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage device 608 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the electronic device 600 are also stored. The processing device 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.

[0102] Typically, the following devices may be connected to the I / O interface 605: an input device 606 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 607 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 608 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 609. The communication device 609 may allow the electronic device 600 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 5 The electronic device 600 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.

[0103] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device 609, or installed from a storage device 608, or installed from a ROM 602. When the computer program is executed by the processing device 601, the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.

[0104] It should be noted that the computer-readable medium disclosed above may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.

[0105] In some embodiments, the client and the server may communicate using any currently known or future developed network protocol such as HTTP (HyperText Transfer Protocol), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future developed network.

[0106] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.

[0107] The above-mentioned computer-readable medium carries one or more programs. When the above-mentioned one or more programs are executed by the electronic device, the electronic device: divides all tasks into multiple task groups; evenly allocates the multiple task groups to multiple schedulers; each of the schedulers schedules the tasks in the task groups scheduled by it and sends the scheduled tasks to the message queue; and the executor executes the tasks in the message queue.

[0108] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages ​​or a combination thereof, including, but not limited to, object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0109] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0110] The modules involved in the embodiments described in the present disclosure may be implemented by software or hardware. The name of a module does not limit the module itself in some cases. For example, a partitioning module may also be described as a "module for partitioning all tasks into multiple task groups".

[0111] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.

[0112] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0113] According to one or more embodiments of the present disclosure, Example 1 provides a task scheduling method, including:

[0114] Divide all tasks into multiple task groups;

[0115] Allocating the plurality of task groups to a plurality of schedulers in a balanced manner;

[0116] Each of the schedulers schedules the tasks in the task group scheduled by it and sends the scheduled tasks to the message queue;

[0117] The tasks in the message queue are executed by the executor.

[0118] According to one or more embodiments of the present disclosure, Example 2 provides the method of Example 1, wherein the dividing all tasks into a plurality of task groups includes:

[0119] The same task is divided into one of the task groups.

[0120] According to one or more embodiments of the present disclosure, Example 3 provides the method of Example 1, wherein the dividing all tasks into a plurality of task groups includes:

[0121] All tasks are evenly divided into the multiple task groups.

[0122] According to one or more embodiments of the present disclosure, Example 4 provides the method of Example 1, wherein the grouping of the multiple tasks in a balanced manner to multiple schedulers includes:

[0123] At the same time, one of the task groups is assigned to one of the schedulers.

[0124] According to one or more embodiments of the present disclosure, Example 5 provides the method of Example 1, wherein each of the schedulers schedules the tasks in the task group scheduled by the scheduler, respectively, including:

[0125] Read all tasks in the scheduled task group;

[0126] According to the task information, determine the position of each task in the scheduled task group in the time wheel;

[0127] Put all tasks in the scheduled task group into the determined corresponding positions respectively;

[0128] The pointer of the time wheel is set to point to the most recent scheduling time.

[0129] According to one or more embodiments of the present disclosure, Example 6 provides the method of Example 5, wherein the scheduling by each of the schedulers respectively schedules the tasks in the task group scheduled by the scheduler, further comprising:

[0130] Determine the tasks in the scheduled task group whose period is lower than the period of the time wheel;

[0131] Using the position determined according to the task information as the starting position;

[0132] Based on the period of the task with a period lower than the period of the time wheel, the task with a period lower than the period of the time wheel is placed into a corresponding position starting from the starting position according to the direction in which the pointer of the time wheel rotates.

[0133] According to one or more embodiments of the present disclosure, Example 7 provides the method of Example 1, wherein the task scheduling method further includes:

[0134] monitoring changes of the plurality of schedulers;

[0135] If changes are detected in the multiple schedulers, the multiple task groups are reallocated to the multiple schedulers in a balanced manner.

[0136] According to one or more embodiments of the present disclosure, Example 8 provides the method of Example 1, wherein the task scheduling method further includes:

[0137] Each of the schedulers periodically checks whether the task grouping scheduled by it has changed.

[0138] According to one or more embodiments of the present disclosure, Example 9 provides the method of Example 1, wherein the task scheduling method further includes:

[0139] Monitor the total workload;

[0140] If it is monitored that the total task amount increases, a new scheduler is added to divide the added tasks into a plurality of new task groups, and the plurality of new task groups are evenly allocated to the new scheduler.

[0141] According to one or more embodiments of the present disclosure, Example 10 provides a task scheduling device, including a partitioning module, a configuration module, a plurality of schedulers, and an executor, wherein:

[0142] The division module is used to divide all tasks into multiple task groups;

[0143] The configuration module is used to evenly configure the multiple task groups to the multiple schedulers;

[0144] The multiple schedulers are used to respectively schedule the tasks in the task group scheduled by them and send the scheduled tasks to the message queue;

[0145] The executor is used to execute the tasks in the message queue.

[0146] According to one or more embodiments of the present disclosure, Example 11 provides a computer-readable medium having a computer program stored thereon, which implements the steps of any of the methods described in Examples 1-9 when executed by a processing device.

[0147] According to one or more embodiments of the present disclosure, Example 12 provides an electronic device, including:

[0148] a storage device having a computer program stored thereon;

[0149] A processing device is used to execute the computer program in the storage device to implement the steps of the method described in any one of Examples 1-9.

[0150] According to one or more embodiments of the present disclosure, Example 13 provides a computer program product, including a computer program, which implements the steps of any one of the methods of Examples 1 to 9 when executed by a processor.

[0151] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other to form a technical solution.

[0152] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.

[0153] Although the subject matter has been described in language specific to structural features and / or method logic actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims. Regarding the device in the above embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.

Claims

1. A task scheduling method, characterized in that: include: Divide all tasks into multiple task groups; Allocating the plurality of task groups to a plurality of schedulers in a balanced manner; Each of the schedulers schedules the tasks in the task group scheduled by it and sends the scheduled tasks to the message queue; The tasks in the message queue are executed by the executor.

2. The method according to claim 1, characterized in that: All tasks are divided into multiple task groups, including: The same task is divided into one of the task groups.

3. The method according to claim 1, characterized in that All tasks are divided into multiple task groups, including: All tasks are evenly divided into the multiple task groups.

4. The method according to claim 1, characterized in that The grouping of the plurality of tasks and allocating them to the plurality of schedulers in a balanced manner comprises: At the same time, one of the task groups is assigned to one of the schedulers.

5. The method according to claim 1, characterized in that The scheduling of the tasks in the task group scheduled by each of the schedulers respectively includes: Read all tasks in the scheduled task group; According to the task information, determine the position of each task in the scheduled task group in the time wheel; Put all tasks in the scheduled task group into the determined corresponding positions respectively; The pointer of the time wheel is set to point to the most recent scheduling time.

6. The method according to claim 5, characterized in that The scheduling of the tasks in the task groups scheduled by each of the schedulers respectively further includes: Determine the tasks in the scheduled task group whose period is lower than the period of the time wheel; Using the position determined according to the task information as the starting position; Based on the period of the task with a period lower than the period of the time wheel, the task with a period lower than the period of the time wheel is placed into a corresponding position starting from the starting position according to the direction in which the pointer of the time wheel rotates.

7. The method according to claim 1, characterized in that The task scheduling method further includes: monitoring changes of the plurality of schedulers; If changes are detected in the multiple schedulers, the multiple task groups are reallocated to the multiple schedulers in a balanced manner.

8. The method according to claim 1, characterized in that The task scheduling method further includes: Each of the schedulers periodically checks whether the task grouping scheduled by it has changed.

9. The method according to claim 1, characterized in that: The task scheduling method further includes: Monitor the total workload; If it is monitored that the total task amount increases, a new scheduler is added to divide the added tasks into a plurality of new task groups, and the plurality of new task groups are evenly allocated to the new scheduler.

10. A task scheduling device, characterized in that: It includes partitioning module, configuration module, multiple schedulers and executors, among which: The division module is used to divide all tasks into multiple task groups; The configuration module is used to evenly configure the multiple task groups to the multiple schedulers; The multiple schedulers are used to respectively schedule the tasks in the task group scheduled by them and send the scheduled tasks to the message queue; The executor is used to execute the tasks in the message queue.

11. A computer readable medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processing device, the steps of the method according to any one of claims 1 to 9 are implemented.

12. An electronic device, characterized in that: include: a storage device having a computer program stored thereon; A processing device, configured to execute the computer program in the storage device to implement the steps of the method according to any one of claims 1 to 9.

13. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 9 are implemented.