Large-scale delay task management method and Internet of Things platform

By adopting a delayed task management method of layered storage and time window management in IoT devices, the efficiency and reliability problems of low-performance devices when handling large-scale delayed tasks are solved, and efficient task processing and real-time response capabilities are achieved.

CN119847699APending Publication Date: 2025-04-18XIAMEN LEELEN TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202411929233.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-25
Publication Date
2025-04-18

AI Technical Summary

Technical Problem

In the field of IoT, low-performance devices cannot effectively handle large-scale delay tasks, resulting in efficiency and reliability issues and cannot meet real-time response needs.

Method used

The delay task management method of hierarchical storage and lightweight management is adopted. By configuring multiple storage space and time window management mechanisms, only the current and upcoming time window data are loaded, reducing resource usage and processing overhead.

Benefits of technology

It realizes efficient storage, retrieval, scheduling and execution of tasks, improves the efficiency and reliability of IoT devices in large-scale delayed task processing, and ensures the system's real-time response capabilities.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119847699A_ABST
    Figure CN119847699A_ABST
Patent Text Reader

Abstract

The invention discloses a large-scale delay task management method and an Internet of Things platform. The method comprises the following steps: configuring three storage spaces of delay tasks; receiving a delay task to be executed, and obtaining an execution timestamp of the delay task; storing the delay task to a first storage space and a second storage space; loading an execution timestamp matched with the current time window from the second storage space to a third storage space; traversing the third storage space according to the time sequence, if the read execution timestamp is matched with the current time, extracting the corresponding delay task from the first storage space, submitting the delay task to the system for execution, and updating the execution state; when the current time window is traversed to a preset position, a new time window is generated, and the execution timestamp matched with the next time window is loaded from the second storage space to the third storage space. According to the method, resource occupation and processing overhead can be effectively reduced, and efficient storage, retrieval, scheduling and execution of tasks are realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of computer task management, and in particular relates to a large-scale delayed task management method and an Internet of Things platform. Background Art

[0002] In modern computing environments, large-scale delayed task management has become an indispensable component of high-concurrency, distributed systems. Delayed tasks are usually used in scenarios such as timed operations, event triggering, and resource coordination. They are widely used in e-commerce, financial systems, logistics scheduling, industrial automation, and other fields. Traditional delayed task management methods usually rely on simple task queues or timer mechanisms.

[0003] The Chinese invention patent application with publication number CN116610429A discloses a delayed task processing method, device, computer equipment, and storage medium. The method includes: receiving a delayed task, determining the delayed time unit of the delayed task; in response to the delay time unit being at the first level, using a message queue to perform a processing operation on the delayed task and generating a processing result of the delayed task; in response to the delay time unit being at the second level, using a timed task to perform a processing operation on the delayed task and generating a processing result of the delayed task.

[0004] Although the existing delayed task processing methods can meet the needs in small-scale scenarios, their efficiency and reliability are often limited in environments with a large number of tasks, long execution time spans, or distributed environments, especially in the field of the Internet of Things. IoT devices are usually low-power, miniaturized devices. Many IoT devices use microcontrollers (MCU) or low-power embedded processors, or sacrifice some computing performance due to energy efficiency requirements. The computing power of these processors cannot be compared with high-performance desktop computers, servers, or cloud computing platforms. As a result, when it is necessary to process a large amount of data or complex computing tasks, the data processing and analysis capabilities are insufficient, and the device may not be able to complete the task in time, resulting in processing delays or even task failures, causing the system to be unable to meet real-time response requirements. Summary of the invention

[0005] The present invention provides a large-scale delayed task management method and an Internet of Things platform, aiming to solve the problems of efficiency and reliability in large-scale delayed task processing due to computing power in the field of the Internet of Things.

[0006] In order to solve the above technical problems, the delayed task management method proposed in the present invention comprises the following steps:

[0007] S1: configure the storage space for delayed tasks. The first storage space is used to store the complete data of delayed tasks, the second storage space is used to store the execution timestamp and execution status of delayed tasks, and the third storage space is used to store the execution timestamp within the current time window;

[0008] S2: receiving a delayed task to be executed, and obtaining an execution timestamp of the delayed task;

[0009] S3: Saving the delayed task to the first storage space and the second storage space;

[0010] S4: Loading the execution timestamp matching the current time window from the second storage space to the third storage space;

[0011] S5: traverse the third storage space in chronological order, and if the read execution timestamp matches the current time, extract the corresponding delayed task from the first storage space and submit it to the system for execution, and update the execution status;

[0012] S6: When traversing the current time window to a preset position, a new time window is generated, and an execution timestamp matching the next time window is loaded from the second storage space to the third storage space;

[0013] S7: Repeat steps S5 and S6 until the set stop condition is reached.

[0014] Preferably, the step S3 further saves the execution timestamp to the third storage space based on the current time window, and the saving rule is:

[0015] If the execution timestamp of the delayed task is within the current time window, the execution timestamp is added to the third storage space, and the delayed task is recorded in the first storage space and the second storage space;

[0016] If the execution timestamp of the delayed task is not within the current time window, the task is only stored in the first storage space and the second storage space.

[0017] Preferably, the execution timestamp is saved in the third storage space, specifically by:

[0018] S31: Get the execution timestamp of the delayed task, and check whether the execution timestamp exceeds the end time of the current time window. If yes, execute step S36, otherwise execute step S32;

[0019] S32: Check whether the execution timestamp exceeds the current time, if yes, go to step S34, otherwise go to step S33;

[0020] S33: Check whether the system setting allows adding an execution timestamp before the current time, if yes, go to step S34, otherwise go to step S36;

[0021] S34: Check whether the execution timestamp is already in the third storage space, if so, execute step S36, otherwise execute step S35;

[0022] S35: adding the execution timestamp to the third storage space and ending the task;

[0023] S36: Refuse to add the execution timestamp to the third storage space, and end the task.

[0024] Preferably, the access speed of the third storage space is greater than that of the first storage space and the second storage space.

[0025] Preferably, the first storage space indexes delayed tasks according to execution timestamps.

[0026] Preferably, the execution timestamps stored in the second storage space and the third storage space are both unique.

[0027] Preferably, in step S5, the execution method of the delay task is specifically as follows:

[0028] The task delivery unit obtains the executable execution timestamp from the third storage space and generates an executable execution timestamp cache;

[0029] The task execution module reads the execution timestamp from the execution timestamp cache, and acquires the delayed task from the first storage space according to the read execution timestamp;

[0030] The task execution module allocates the delayed task to the task execution unit, and updates the execution status of the corresponding delayed task in the first storage space;

[0031] All delayed tasks of the current execution timestamp are executed, the corresponding cache in the execution timestamp cache is deleted, and the execution status of the corresponding execution timestamp in the second storage space is updated.

[0032] Preferably, in step S5, the execution status is stored in a first storage space and a second storage space, the execution status stored in the first storage space is the execution status of each delayed task, and the execution status stored in the second storage space is the execution status of each execution timestamp.

[0033] Preferably, the stop condition set in step S7 includes a preset time threshold, a task completion status and a system interruption event.

[0034] Another aspect of the present invention further provides a large-scale delayed task management Internet of Things platform, which is used to implement the above-mentioned large-scale delayed task management method, including:

[0035] A storage module is used to store delayed tasks, and is configured with a first storage space, a second storage space, and a third storage space; wherein the first storage space is used to store the complete data of the delayed tasks and is indexed by the execution timestamp; the second storage space is used to store the execution timestamp and execution status of the delayed tasks, and each execution timestamp is unique; the third storage space is used to store the execution timestamp within the current time window, and the access speed is greater than that of the first storage space and the second storage space;

[0036] A task receiving module, used for receiving a delayed task to be executed, extracting the execution timestamp of the delayed task, and storing the delayed task in a first storage space and a second storage space. If the execution timestamp is within the current time window, the execution timestamp is also stored in a third storage space.

[0037] A time window management module, used for dynamically maintaining the time window, and loading the execution timestamp matching the current time window from the second storage space to the third storage space;

[0038] Task execution module, including task delivery unit and task execution unit;

[0039] The task delivery unit obtains the executable execution timestamp from the third storage space and generates an executable execution timestamp cache;

[0040] The task execution unit extracts the delayed task from the first storage space according to the read execution timestamp from the execution timestamp cache, assigns the extracted delayed task to the task execution node, and the task execution node runs the delayed task according to the logic defined by the delayed task, and updates the corresponding execution status in the first storage space and the second storage space;

[0041] The system control module is used to monitor the progress of task execution and determine whether the termination conditions are met. The termination conditions include a preset time threshold, task completion status, or system interruption event.

[0042] Compared with the prior art, the present invention has the following technical effects:

[0043] 1. The delayed task management method proposed in the present invention avoids directly processing massive data in low-performance devices in the field of the Internet of Things through hierarchical storage and lightweight management. The third storage space only loads the current and upcoming time window data, which can effectively reduce resource usage and processing overhead, and realize efficient storage, retrieval, scheduling and execution of tasks.

[0044] 2. The delayed task management method proposed in the present invention performs data slicing based on time windows, switches storage data according to time windows, effectively utilizes storage resources in the field of the Internet of Things, and improves applicability in the field of the Internet of Things.

[0045] 3. The delayed task management method proposed in the present invention uses a buffer mechanism and preloading technology. Even if the device performance is limited, it can seamlessly connect the task execution of the current time window and the next time window when switching tasks, thereby ensuring the real-time response capability of the system.

[0046] 4. The delayed task management method proposed in the present invention dynamically adjusts the size of the time window when the equipment pressure is high or the tasks are sparse, which can effectively balance the real-time and performance requirements and ensure the smooth operation of task scheduling of weak-performance equipment. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] Figure 1 It is a schematic diagram of the process of the management method of the present invention;

[0048] Figure 2 is a schematic diagram of the structure of the management system according to an embodiment of the present invention;

[0049] Figure 3 is a logic diagram of the task receiving module according to the embodiment of the present invention writing into the third storage space; DETAILED DESCRIPTION

[0050] In order to make the objectives, technical solutions and advantages of the present invention more clear, the technical solutions of the present invention will be clearly and completely described below in combination with specific embodiments of the present application and with reference to the accompanying drawings.

[0051] Embodiment 1

[0052] This embodiment is a large-scale delayed task management method. Figure 1 As shown, the following steps are included:

[0053] S1: Configure the storage space for delayed tasks. The first storage space is used to store the complete data of delayed tasks, the second storage space is used to store the execution timestamp and execution status of delayed tasks, and the third storage space is used to store the execution timestamp within the current time window.

[0054] See also Figure 2 , wherein the third storage space, the second storage space and the first storage space shown are the storage spaces configured in this embodiment. The third storage space and the second storage space store the execution timestamps of the delayed tasks in seconds (or milliseconds, minutes), each execution timestamp represents the execution time of a task or a group of tasks, and the timestamps are sorted in ascending order by time. The difference is that the third storage space sets a time window for storing an acceptable future time range, and only stores the execution timestamps within the current time window, while the second storage space stores the execution timestamps of all delayed tasks.

[0055] The first storage space is configured to index tasks according to execution timestamps and record the execution status of each task and execution timestamp to ensure the persistence and recovery capability of task data.

[0056] The access speed of the third storage space is greater than that of the first storage space and the second storage space. Specifically, the third storage space may be a storage space divided in a RAM (Random Access Memory), and the first storage space and the second storage space may be a storage space divided in a ROM (Read Only Memory) or other external memory.

[0057] The execution timestamps stored in the second storage space and the third storage space are both unique.

[0058] S2: Receive the delayed task to be executed and obtain the execution timestamp of the delayed task. Specifically, in this embodiment, the delayed task is received by the task receiving module, which receives the delay task addition request and extracts the execution timestamp, task execution data and other information of the delayed task.

[0059] S3: Save the delayed task to the first storage space and the second storage space.

[0060] The delayed task information stored in the first storage space is completed data, such as execution timestamp, task identifier, task type, task status, priority, execution parameters, dependencies, retry strategy, callback or notification mechanism, execution environment or context, etc., while the second storage space only stores the execution timestamp of the delayed task and the execution status corresponding to the timestamp. In a typical storage structure such as a database, the first storage space and the second storage space are both tables in the database, and the two are connected by configuring foreign keys.

[0061] For multiple delayed tasks with the same execution timestamp in the first storage space, only one execution timestamp is saved in the second storage space, and when execution is required, the task execution unit extracts all corresponding delayed tasks in the first storage space according to the execution timestamp. The execution timestamp in the second storage space and the specific delayed tasks in the first storage space can be in a one-to-one relationship or a one-to-many relationship.

[0062] S4: Load the execution timestamps matching the current time window from the second storage space to the third storage space. The time window is a preset time span, such as 100 seconds, 200 seconds, 1 minute, 5 minutes, 10 minutes, etc. If the time window is set to 5 minutes, the current time is 14:02:15, and if the start time is 14:00, the current time window is 14:00:00-14:05:00. Then load all execution timestamps between 14:00:00 and 14:05:00 from the second storage space to the third storage space.

[0063] S5: traverse the third storage space in chronological order. If the read execution timestamp matches the current time, extract the corresponding delayed task from the first storage space and submit it to the system for execution, and update the execution status.

[0064] Specifically, the execution method of the delayed task is:

[0065] The task delivery unit obtains executable execution timestamps from the third storage space and generates an executable execution timestamp cache. Since the execution timestamps in the third storage space are sorted in ascending order by time, the first execution timestamp can be directly read to check whether it matches the current system time. If it matches, it is marked as an executable timestamp. If it does not match, it waits for a set time and then continues to check.

[0066] For timestamps marked as executable, they are added to the execution timestamp cache. The cache structure can be in the form of a queue or a hash table to ensure efficient access.

[0067] The task execution unit reads the execution timestamp from the execution timestamp cache, and obtains the delayed task from the first storage space according to the read execution timestamp. The task list of the first storage space has been indexed according to the execution timestamp, so the task execution unit can directly extract the delayed task data associated with the timestamp from the first storage space according to the timestamp index. The extracted data includes the specific execution logic of the task (such as callback functions, parameters, dependent tasks, etc.). Specifically, the first storage space records the refined execution status of each task (such as "to be executed", "executing", "success", "failure", etc.), and stores the execution results of the task (such as return values, logs, etc.).

[0068] The task execution unit distributes the delayed task to the task execution node and updates the execution status of the corresponding delayed task in the first storage space. Figure 2 As shown, the task execution unit of this embodiment includes multiple task execution nodes, which can perform task allocation according to predefined allocation rules, and can be executed synchronously, asynchronously, or in batches. After each delayed task is executed, the execution status of the delayed task is synchronized to the first storage space.

[0069] The task execution unit completes task allocation and execution according to the following rules:

[0070] Resource allocation, dynamically allocating execution node resources based on the resource requirements of the task (such as CPU, memory, I / O, etc.);

[0071] Parallel execution, supporting multi-task parallel processing, improving task execution efficiency;

[0072] Dependency resolution: if there are dependencies between tasks, the dependent tasks will be executed first.

[0073] The execution mode supports both synchronous and asynchronous modes, which are determined by task priority.

[0074] All delayed tasks of the current execution timestamp are executed, the corresponding cache in the execution timestamp cache is deleted, and the execution status of the corresponding execution timestamp in the second storage space is updated. Since the timestamp of the second storage space and the tasks of the first storage space can be a one-to-many relationship, the execution status of the corresponding execution timestamp in the second storage space will not be updated until all tasks of the timestamp are executed. Specifically, the second storage space updates the execution status of the corresponding timestamp and marks it as "completed" or "failed" for subsequent scheduling and statistical analysis. If a task fails to execute, you can choose to retry immediately or postpone rescheduling according to the system configuration policy.

[0075] The execution status is stored in the first storage space and the second storage space. The execution status stored in the first storage space is the execution status of each delayed task, and the execution status stored in the second storage space is the execution status of each execution timestamp.

[0076] In some embodiments of the present invention, when all the associated tasks of the current timestamp are completed, the timestamp is removed from the execution timestamp cache to release the cache resources. The completed timestamps can also be removed from the third storage space to reduce the possibility of invalid traversal.

[0077] S6: When traversing the current time window to a preset position, a new time window is generated, and an execution timestamp matching the next time window is loaded from the second storage space to the third storage space.

[0078] Specifically, as in the above example, if the current time is 14:02:15, the current time window is 14:00:00-14:05:00, and the pre-update time interval is set to 5 seconds, the system will load all execution timestamps in the range of 14:05:00-14:10:00 from the second storage space to the third storage space at 14:04:55.

[0079] During the loading period, the tasks between 14:04:55 and 14:05:00 will continue to be executed. Two buffers can be set in the third storage space: the current time window buffer, which is used to store the execution timestamp of the current time window; and the next time window buffer, which is used to store the time window data to be loaded. When the time window is switched, the data in the next time window buffer is switched to the current buffer to reduce data overwriting and conflict.

[0080] S7: Repeat the above steps S5 and S6 until the set stop condition is reached, the set stop condition includes a preset time threshold, task completion status and system interruption event. This embodiment sets a system control module to monitor the task execution progress and determine whether the termination condition is reached.

[0081] The step S3 also saves the execution timestamp to the third storage space based on the current time window, and the saving rule is:

[0082] If the execution timestamp of the delayed task is within the current time window, the execution timestamp is added to the third storage space, and the delayed task is recorded in the first storage space and the second storage space;

[0083] If the execution timestamp of the delayed task is not within the current time window, the task is only stored in the first storage space and the second storage space.

[0084] In addition to the time window, the configuration parameters of the third storage space also include time units, termination time, whether to allow expired timestamps, and pre-update time intervals. Among them, time units such as milliseconds, seconds, and minutes are used to control the time accuracy of the delay queue; the termination time calculates the maximum allowed time point of the time point delay queue based on the current time and time window, such as the time point 14:05:00 calculated above. Beyond this time point, it is not allowed to be added to the time point delay queue; whether to allow expired time points is a Boolean value, indicating whether it is allowed to be added to the time point queue if the execution timestamp exceeds the current time; the pre-update time interval indicates the time interval for automatically updating the termination time according to the time window before the termination time is reached. If the termination time mentioned above is 14:05:00, if the pre-update time interval is set to 5 seconds, the next time window will be updated starting at 14:04:55.

[0085] Based on the above configuration parameters, the execution timestamp is saved to the third storage space, such as Figure 3 As shown, the specific method is:

[0086] S31: Get the execution timestamp of the delayed task, check whether the execution timestamp exceeds the end time of the current time window, if so, execute step S36, otherwise execute step S32; if the current time is 14:02:15, according to the current time window, the end time is 14:05:00, if the timestamp to be added is 14:06:00, execute step 36, refuse to add the execution timestamp to the second storage space, and end the task; if the timestamp to be added is 14:06:00, execute step S32 and proceed to the next step of checking.

[0087] S32: Check whether the execution timestamp exceeds the current time. If so, execute step S34, otherwise execute step S33; this step checks whether the timestamp to be added exceeds the current time. If the timestamp to be added is 14:03:00 and exceeds the current time 14:02:15, then the timestamp exceeds the current time and is not expired, and the process goes to step S34; if the timestamp to be added is 14:03:00 and exceeds the current time 14:02:15, then the timestamp exceeds the current time and is not expired, and the process goes to step S34; if the timestamp to be added is 14:02:00 and does not exceed the current time 14:02:15, it is expired, and the process goes to step S33 for the next check.

[0088] S33: Check whether the system setting allows adding an execution timestamp before the current time. If so, execute step S34, otherwise execute step S36; the system setting here refers to whether the above-mentioned expiration time point is allowed. If it is set to allow, the above-mentioned timestamp to be added is 14:02:00, which is already an expiration time relative to the current time 14:02:15, then proceed to the next step to make an existing judgment; if it is set to not allow, all timestamps to be added whose execution timestamps are before the current time 14:02:15 are not allowed to be added to the third storage space.

[0089] By checking whether the system setting allows expired tasks, you can flexibly decide whether to process timestamp tasks before the current time according to actual needs, and adapt to diverse scenario requirements (such as delay compensation tasks). For different application scenarios, the system can dynamically configure the time window termination conditions and timestamp processing strategies to optimize the system's adaptability.

[0090] S34: Check whether the execution timestamp is already in the third storage space. If so, execute step S36, otherwise execute step S35; if the timestamp to be added from step S33 is 14:03:00, if the timestamp already exists in the third storage space, refuse to add it because the execution timestamp is unique in both the second storage space and the third storage space.

[0091] S35: adding the execution timestamp to the third storage space and ending the task;

[0092] S36: Refuse to add the execution timestamp to the third storage space, and end the task.

[0093] Through the above scheme, the validity of the timestamp is strictly checked to prevent expired or duplicate timestamps from being added to the third storage space, saving storage resources and reducing the performance burden caused by redundant data storage; it can also reduce invalid task processing. By not adding expired tasks or tasks that do not meet the conditions, the system avoids performing redundant task scheduling operations and improves execution efficiency. Through the timestamp check mechanism, it is ensured that the task data in the third storage space is real-time and high-priority, supporting the system to respond quickly in high-task density scenarios. Only loading the current time window and unexpired tasks helps the device focus on processing tasks that need to be executed at the current moment and in the short term, ensuring the priority and accuracy of real-time task scheduling.

[0094] In addition, check whether the timestamp already exists in the third storage space to avoid duplicate storage leading to task execution conflicts or redundancy. Unique constraints are imposed on the storage and management of timestamps in the entire system to ensure the accuracy and consistency of task status and time scheduling.

[0095] It should be noted that, in order to simplify the description, the timestamp examples provided in this embodiment do not include units such as year, month, day, millisecond, etc. In specific implementation, the timestamp can be a complete time unit, including year, month, day, millisecond, etc. In addition, in the implementation steps of this embodiment, such as S1-S7, S31-S36, if the jump method or end task is not described in the step, they are all executed in sequence according to the step number.

[0096] Embodiment 2

[0097] This embodiment is a large-scale delayed task management Internet of Things platform, which is used to implement the delayed task management method as described in Example 1, including:

[0098] A storage module is used to store delayed tasks and is configured with a first storage space, a second storage space and a third storage space; wherein the first storage space is used to store the complete data of the delayed tasks and is indexed by the execution timestamp; the second storage space is used to store the execution timestamp and execution status of the delayed tasks, and each execution timestamp is unique; the third storage space is used to store the execution timestamp within the current time window, and the access speed is greater than that of the first storage space and the second storage space.

[0099] The task receiving module is used to receive the delayed task to be executed, extract the execution timestamp of the delayed task, and store the delayed task in the first storage space and the second storage space. If the execution timestamp is within the current time window, the execution timestamp will also be stored in the third storage space.

[0100] The time window management module is used to dynamically maintain the time window and load the execution timestamp matching the current time window from the second storage space to the third storage space.

[0101] The task execution module includes a task delivery unit and a task execution unit.

[0102] The task delivery unit obtains an executable execution timestamp from the third storage space and generates an executable execution timestamp cache.

[0103] The task execution unit extracts the delayed task from the first storage space according to the read execution timestamp from the execution timestamp cache, and assigns the extracted delayed task to the task execution node. The task execution node runs the delayed task according to the logic defined by the delayed task, and updates the corresponding execution status in the first storage space and the second storage space. The execution modes described in this embodiment include synchronous execution, asynchronous execution and batch execution.

[0104] The system control module is used to monitor the progress of task execution and determine whether the termination conditions are met. The termination conditions include a preset time threshold, task completion status, or system interruption event.

[0105] The above is only a preferred embodiment of the present invention. It should be pointed out that a person skilled in the art can make several modifications and improvements without departing from the inventive concept of the present invention, which all fall within the protection scope of the present invention.

Claims

1. A large-scale delayed task management method, characterized in that: The following steps are involved: S1: configure the storage space for delayed tasks. The first storage space is used to store the complete data of delayed tasks, the second storage space is used to store the execution timestamp and execution status of delayed tasks, and the third storage space is used to store the execution timestamp within the current time window; S2: receiving a delayed task to be executed, and obtaining an execution timestamp of the delayed task; S3: Saving the delayed task to the first storage space and the second storage space; S4: Loading the execution timestamp matching the current time window from the second storage space to the third storage space; S5: traverse the third storage space in chronological order, and if the read execution timestamp matches the current time, extract the corresponding delayed task from the first storage space and submit it to the system for execution, and update the execution status; S6: When traversing the current time window to a preset position, a new time window is generated, and an execution timestamp matching the next time window is loaded from the second storage space to the third storage space; S7: Repeat steps S5 and S6 until the set stop condition is reached.

2. A large-scale delayed task management method according to claim 1, characterized in that: The step S3 also saves the execution timestamp to the third storage space based on the current time window, and the saving rule is: If the execution timestamp of the delayed task is within the current time window, the execution timestamp is added to the third storage space, and the delayed task is recorded in the first storage space and the second storage space; If the execution timestamp of the delayed task is not within the current time window, the task is only stored in the first storage space and the second storage space.

3. A large-scale delayed task management method according to claim 2, characterized in that: The specific method of saving the execution timestamp to the third storage space is as follows: S31: Get the execution timestamp of the delayed task, and check whether the execution timestamp exceeds the end time of the current time window. If yes, execute step S36, otherwise execute step S32; S32: Check whether the execution timestamp exceeds the current time, if yes, go to step S34, otherwise go to step S33; S33: Check whether the system setting allows adding an execution timestamp before the current time, if yes, go to step S34, otherwise go to step S36; S34: Check whether the execution timestamp is already in the third storage space, if so, execute step S36, otherwise execute step S35; S35: adding the execution timestamp to the third storage space and ending the task; S36: Refuse to add the execution timestamp to the third storage space, and end the task.

4. A large-scale delayed task management method according to claim 1, characterized in that: The access speed of the third storage space is greater than that of the first storage space and the second storage space.

5. A large-scale delayed task management method according to claim 1, characterized in that: The first storage space indexes the delayed tasks according to the execution timestamps.

6. A large-scale delayed task management method according to claim 1, characterized in that: The execution timestamps stored in the second storage space and the third storage space are both unique.

7. A large-scale delayed task management method according to claim 1, characterized in that: In step S5, the execution method of the delay task is specifically as follows: The task delivery unit obtains the executable execution timestamp from the third storage space and generates an executable execution timestamp cache; The task execution unit reads the execution timestamp from the execution timestamp cache, and acquires the delayed task from the first storage space according to the read execution timestamp; The task execution unit distributes the delayed task to the task execution node, and updates the execution status of the corresponding delayed task in the first storage space; All delayed tasks of the current execution timestamp are executed, the corresponding cache in the execution timestamp cache is deleted, and the execution status of the corresponding execution timestamp in the second storage space is updated.

8. A large-scale delayed task management method according to claim 1, characterized in that: In step S5, the execution status is stored in the first storage space and the second storage space. The execution status stored in the first storage space is the execution status of each delayed task, and the execution status stored in the second storage space is the execution status of each execution timestamp.

9. A large-scale delayed task management method according to claim 1, characterized in that: The stop conditions set in step S7 include a preset time threshold, a task completion status, and a system interruption event.

10. A large-scale delayed task management Internet of Things platform, characterized in that: The Internet of Things platform is used to implement the delayed task management method according to any one of claims 1 to 9, including: A storage module is used to store delayed tasks, and is configured with a first storage space, a second storage space, and a third storage space; wherein the first storage space is used to store the complete data of the delayed tasks and is indexed by the execution timestamp; the second storage space is used to store the execution timestamp and execution status of the delayed tasks, and each execution timestamp is unique; the third storage space is used to store the execution timestamp within the current time window, and the access speed is greater than that of the first storage space and the second storage space; A task receiving module, used for receiving a delayed task to be executed, extracting the execution timestamp of the delayed task, and storing the delayed task in a first storage space and a second storage space. If the execution timestamp is within the current time window, the execution timestamp is also stored in a third storage space. A time window management module, used for dynamically maintaining the time window, and loading the execution timestamp matching the current time window from the second storage space to the third storage space; Task execution module, including task delivery unit and task execution unit; The task delivery unit obtains the executable execution timestamp from the third storage space and generates an executable execution timestamp cache; The task execution unit extracts the delayed task from the first storage space according to the read execution timestamp from the execution timestamp cache, assigns the extracted delayed task to the task execution node, and the task execution node runs the delayed task according to the logic defined by the delayed task, and updates the corresponding execution status in the first storage space and the second storage space; The system control module is used to monitor the progress of task execution and determine whether the termination conditions are met. The termination conditions include a preset time threshold, task completion status, or system interruption event.

Citation Information

Patent Citations

  • Delay task processing method and device, computer equipment and storage medium

    CN116610429A