Task scheduling method and device based on buffer queue and hash ring
A task scheduling and buffer queue technology, applied in the field of information systems, can solve the problem of difficult to achieve efficient scheduling of large-scale tasks, and achieve the effect of avoiding execution time accumulation, data skew, and load balancing.
- Summary
- Abstract
- Description
- Claims
- Application Information
AI Technical Summary
Problems solved by technology
Method used
Image
Examples
Embodiment 1
[0046] In order to solve the problem of scheduling large batches of tasks in the traditional solution, it is necessary to store all tasks in the database and then scan the database frequently to pull tasks that have reached the execution time, resulting in high read and write pressure on the database, and it is difficult to achieve high efficiency for large batches of tasks. To solve the technical problem of scheduling, the present invention provides a task scheduling method and device based on a buffer queue and a hash ring. Wherein, in order to facilitate the understanding of the task scheduling method, the embodiment of the present invention first introduces the task scheduling device.
[0047] Such as figure 1 As shown, the task scheduling device provided by the embodiment of the present invention mainly includes a task receiver and a task scheduler, and the task receiver is used to receive and store task information sent by the client, including task execution frequency, ...
Embodiment 2
[0069]On the basis of the above-mentioned embodiment 1, the embodiment of the present invention provides a task scheduling method based on buffer queues and hash rings, which can be completed by using the task scheduling device in embodiment 1, such as figure 2 As shown, it mainly includes the following steps:
[0070] Step 101 , after receiving the task scheduling information, the task receiver writes the task number and task end time into the local cache, and writes the task execution frequency and execution logic into the local buffer queue.
[0071] combine figure 1 , the specific implementation process is as follows: as the initiator of task scheduling and the provider of task information, the client will figure 1 The process shown in No. 1 in the figure continuously sends task scheduling information to the task receiver, mainly including execution frequency and execution logic, so as to initiate a task scheduling request. Among them, the execution frequency of the tas...
Embodiment 3
[0093] In combination with Embodiment 1 and Embodiment 2, the embodiment of the present invention takes the task receiver using the database as an external cache and setting a precision hash ring timer in the task scheduler as an example, and further provides a buffer queue and hash-based The specific implementation of the task scheduling method of the ring, such as Figure 5 As shown, it specifically includes the following steps:
[0094] Step 201, the task receiver receives the execution frequency and execution logic of the task to be scheduled from the client, such as figure 1 Shown in the process number 1.
[0095] Step 202, the task receiver writes the task number and task end time into the local cache A. Wherein, the task number is a unique number generated by the task receiver for the received task, and is set as key; the task end time is obtained when the client sends a request to stop the task to the task receiver, and is set as value; If the received task does not...
PUM
Login to View More Abstract
Description
Claims
Application Information
Login to View More 


