Method for processing IOT equipment data based on high-utilization-rate non-blocking queue

By adopting a priority-based non-blocking queue processing method in IOT device data processing and dynamically adjusting the queue and fault queue processing, the problem of message backlog and avalanche effect caused by insufficient processing capacity of the IOT device data interface is solved, and the message consumption efficiency is improved. and queue utilization.

CN118567882APending Publication Date: 2024-08-30GUANGXI DONGXIN DIGITAL CONSTR INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410762462.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-13
Publication Date
2024-08-30

AI Technical Summary

Technical Problem

IoT device data interfaces are prone to message backlogs or avalanche effects when their processing capabilities cannot keep up. Traditional queue division methods lead to uneven message consumption rates, resulting in low queue utilization and inability to effectively avoid blocking and message extrusion.

Method used

Adopt a priority-based non-blocking queue processing method to ensure that messages are processed as scheduled by generating business messages, querying execution indicators, scheduling them to designated queues, distributing messages according to priority, and performing post-processing tasks, including dynamic queue adjustment and fault queue processing. Prioritize timely consumption.

Benefits of technology

It improves the overall message consumption efficiency, reduces the risk of blocking, improves the utilization of the queue, avoids blocking or idleness of the message queue in extreme situations, and dynamically monitors and schedules to prevent the occurrence of the avalanche effect.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118567882A
    Figure CN118567882A
Patent Text Reader

Abstract

The invention discloses a method for processing IOT equipment data based on a high-utilization-rate non-blocking queue, and relates to IOT equipment data processing, which comprises the following steps: generating service messages according to different service scenes; querying an execution index corresponding to the message type according to the message type of the service message, querying a message priority of the service message according to the execution index, and scheduling the service message to a specified queue according to the message priority; according to the message type, carrying out message distribution on the service message according to the priority so as to distribute the service message to a consumption end; and obtaining an execution result of the message distribution, and executing a post-processing task of the service message according to the execution result. According to the method, the message types and the execution indexes are combined to coordinate the execution sequence of the message tasks, and the congestion risk is reduced by dynamically adjusting the execution queues of the tasks, so that the purpose of improving the overall message consumption efficiency is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to IOT device data processing, and more particularly, to a method for processing IOT device data based on a high-utilization non-blocking queue. Background Art

[0002] The IoT device data interface carries a large amount of device data, including device status data, operation data, log data, statistical data, etc. As the business volume of the IoT platform increases, the pressure on the device data interface increases significantly. At present, the common practice of the IoT platform is to use queues to decouple the data production end and the consumer module to avoid interface blocking. However, if the processing capacity of the consumer module cannot keep up, it is very easy to generate message backlogs in the queue, and even avalanche effects in severe cases.

[0003] At the same time, in the process of message consumption, due to the timeliness of information consumption of devices of different types and scenarios, the traditional way of dividing queues by scenarios may cause some messages to be consumed at a fast rate, resulting in low idle utilization of queues; while some queues have slow consumption rates, resulting in message squeeze or even blocking. Based on this background, it is necessary to seek a more efficient and non-blocking message consumption mechanism to optimize the entire IOT device message processing scenario, ensure system availability, and improve the overall data consumption performance. Summary of the invention

[0004] The technical problem to be solved by the present invention is to provide a method for processing IOT device data based on a high-utilization non-blocking queue in view of the deficiencies in the prior art, thereby reducing the risk of blocking and achieving the purpose of improving the overall message consumption efficiency.

[0005] The present invention provides a method for processing IOT device data based on a high-utilization non-blocking queue, the method comprising the following steps:

[0006] Step 1: Generate business messages according to different business scenarios;

[0007] Step 2: querying the execution indicator corresponding to the message type according to the message type of the business message, querying the message priority of the business message according to the execution indicator, and scheduling the business message to a specified queue according to the message priority;

[0008] Step 3: Distribute the service message according to the priority level based on the message type, so as to distribute the service message to the consumer end;

[0009] Step 4: Obtain the execution result of the message distribution, and perform post-processing tasks of the business message according to the execution result.

[0010] As a further improvement, in step 2, if the message priority corresponding to the business message cannot be found, the business message is scheduled to the medium priority queue; if the message priority corresponding to the business message is found, the business message is scheduled to the queue of the specified priority.

[0011] Furthermore, the queue includes a high priority queue, a medium priority queue, a low priority queue and a slow processing queue.

[0012] As a further improvement, in step three, the business messages in the same queue are distributed in a first-in-first-out order.

[0013] As a further improvement, when distributing messages, the business messages in the queue are first dispatched to the idle queue working thread, and then the business messages are distributed to the consumer end.

[0014] For further improvement, the post-processing tasks are specifically:

[0015] When the execution result of the message distribution is successful, an indicator analysis is performed on the execution data of the business message to obtain an execution indicator;

[0016] When the execution result of the message distribution is failure, an index analysis is performed on the execution data of the service message to obtain an execution index, and the service message is dispatched to a fault queue to wait for subsequent compensation processing;

[0017] When the execution time of the message distribution exceeds a set time threshold, the execution of the service message is forcibly terminated and the priority of the service message is downgraded.

[0018] Furthermore, the subsequent compensation process is specifically as follows:

[0019] The first step is to extract the service messages in the fault queue at a regular time and distribute them;

[0020] Step 2: Execute the service message distributed from the fault queue. If the execution is successful, perform an index analysis on the execution data of the service message to obtain the execution index. Then, push other service messages in the fault queue that are consistent with the service message to step 2 for execution.

[0021] If the execution time exceeds the set time threshold, the execution of the service message is forcibly terminated, and an indicator analysis is performed on the execution data of the service message to obtain an execution indicator.

[0022] Furthermore, the re-pushed business message is counted, and if the count of the same business message in the fault queue exceeds a set count threshold, the business message is permanently removed from the queue and a persistent backup is performed on the business message.

[0023] Furthermore, the indicator analysis is to count and average the message execution efficiency, average execution time, execution success ratio, minimum execution time, and maximum execution time of the business messages; the execution indicator is the average of the message execution efficiency, average execution time, execution success ratio, minimum execution time, and maximum execution time of the business messages in a message type.

[0024] Furthermore, in the degradation process, if the priority of the service message is low, the service message is moved to the fault queue.

[0025] Beneficial Effects

[0026] The advantages of the present invention are:

[0027] 1. The combination of message type and execution index is used to coordinate the execution order of each message task, and the blocking risk is reduced by dynamically adjusting the execution queue of each task, thereby achieving the purpose of improving the overall message consumption efficiency.

[0028] 2. Compared with traditional queues, the priority queue of the present invention can improve the utilization rate of the queue, make business processing more efficient, and avoid the situation that the queue of a certain message type is blocked and the queue of other types of messages is idle in extreme cases. While improving the utilization rate, there is also dynamic monitoring and scheduling to prevent a queue or a message from blocking the consumption of normal messages due to problems, reducing the risk of triggering avalanches. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] Figure 1 The present invention is a flowchart of a method for processing IOT device data based on a high-utilization non-blocking queue. DETAILED DESCRIPTION

[0030] The present invention will be further described below in conjunction with the embodiments, but it does not constitute any limitation to the present invention. Any limited number of modifications made by anyone within the scope of the claims of the present invention are still within the scope of the claims of the present invention.

[0031] See also Figure 1 The present invention provides a method for processing IOT device data based on a high-utilization non-blocking queue, which is mainly used to coordinate the execution order of each message task, and reduce the blocking risk by dynamically adjusting the execution queue of each task, thereby improving the efficiency of overall message consumption. It mainly includes four steps, specifically:

[0032] Step 1: Generate business messages according to different business scenarios;

[0033] Step 2: query the execution indicator corresponding to the message type according to the message type of the business message, query the message priority of the business message according to the execution indicator, and dispatch the business message to the specified queue according to the message priority;

[0034] Step 3: Distribute the business messages according to the priority level based on the message type, so as to distribute the business messages to the consumer end;

[0035] Step 4: Get the execution result of the message distribution, and perform the post-processing task of the business message according to the execution result.

[0036] In order to better introduce the method of processing IOT device data based on high-utilization non-blocking queues of the present invention, we first introduce the components that mainly participate in scheduling during its implementation, including producer module, scheduler module, priority queue module, consumer module and data statistics service. The specific uses of each component are as follows:

[0037] Producer module: The producer module is mainly responsible for the generation of business messages. Business messages include business system data such as device status data, operation data, log data, and statistical data related to IoT devices. As the business volume of the IoT platform increases, the pressure on the device data interface increases significantly, so it is necessary to use the message queue mechanism to reduce the peak and decouple the asynchronous mechanism to process business data.

[0038] The producer module will generate the business data that needs to be processed into business messages, and then send them to the scheduler module, which will then be processed through subsequent processes and finally transferred to the consumer module for business process processing.

[0039] Scheduler module: The scheduler module mainly carries out several tasks: 1. Receive business messages of different message types generated by the producer module; 2. Pull the execution indicators of the data statistics service, and make judgments based on the business message execution indicators of each message type within the statistical period, such as average execution time, execution success ratio, minimum execution time, maximum execution time, etc., and then put the corresponding business messages into queues of different priorities.

[0040] When high-concurrency data is generated, data processing efficiency will be compromised. In the traditional queue mode, if the processing capacity of the consumer module cannot keep up, it is very easy to generate message backlogs in the queue, and even an avalanche effect in serious cases. The existence of the scheduler module can alleviate this problem to a certain extent. For example, if a large number of execution times suddenly increase or execution fails, the task priority will be downgraded or even thrown into the fault processing queue; if the execution time is stable and the time consumption is short, its priority will be increased. In this way, the execution status of tasks can be dynamically monitored, and the execution queue of tasks can be flexibly adjusted, so that tasks can be executed more efficiently by consumers.

[0041] Priority queue module: It includes high priority queue, medium priority queue, low priority queue and slow processing queue. The priority queue module is different from the traditional queue divided by message type or message topic. There may be business messages of multiple message types in the priority queue at the same time. The division is not based on message type, but on various execution indicators of execution within the statistical period. At the same time, different types of messages will be pushed to the corresponding message consumers for business processing according to the message type.

[0042] Consumer module: The consumer module is mainly responsible for receiving messages pushed by the priority queue module and performing different business processing according to the message type.

[0043] Data statistics service: The data statistics service is mainly responsible for statistics on message execution efficiency, average execution time, execution success ratio, minimum execution time, maximum execution time and other indicators.

[0044] After introducing the above components, the specific implementation process of the method for processing IOT device data based on a high-utilization non-blocking queue of the present invention is as follows:

[0045] Step 1: A large amount of data generated by IOT devices needs to be processed. At this time, the business data that needs to be processed will generate business messages according to different types of business scenarios through the producer module and send them to the scheduler module.

[0046] Step 2: The scheduler module queries the execution indicator corresponding to the message type according to the message type, and queries the message priority of the business message according to the execution indicator. The query results are divided into the following two situations:

[0047] A. If the message priority corresponding to the business message cannot be found, it will be dispatched to the medium priority queue by default.

[0048] B. After the message priority corresponding to the business message is queried, the message is dispatched to the queue of the specified priority according to the message priority.

[0049] Step 3: The business messages in the same queue are executed in a first-in-first-out order. The queue dispatches the business messages to the idle queue worker thread and distributes the messages through the consumer module.

[0050] Step 4: The consumer module matches and pushes the business message to the corresponding consumer end according to the message type, and obtains the corresponding execution result after the business message executes the closed loop.

[0051] Step 5: According to the execution results, there are several situations:

[0052] A. When the business message is successfully distributed, the execution data generated by the execution (including but not limited to whether the execution is successful and the execution time) is sent to the data statistics service for indicator analysis. For example, the indicator analysis is to count the message execution efficiency, average execution time, execution success ratio, minimum execution time, and maximum execution time of the business message and perform average processing. After the indicator analysis, the execution indicator is obtained, which is the average of the message execution efficiency, average execution time, execution success ratio, minimum execution time, and maximum execution time of the business message in a message type.

[0053] B. When the business message distribution fails:

[0054] 1. Send execution data (including but not limited to whether the execution is successful and the execution time) to the data statistics service for indicator analysis;

[0055] 2. Schedule the business message to the fault queue, waiting for subsequent compensation processing, and also send the execution data (including but not limited to whether the execution is successful and the execution time) to the data statistics service for indicator analysis.

[0056] C. When the execution time of message distribution exceeds the set time threshold, the consumer module will forcibly terminate the message execution and downgrade the message:

[0057] 1. If the business message is of high priority, downgrade the message to the medium priority queue.

[0058] 2. If the business message is of medium priority, or the time taken by the business message after re-execution still exceeds the time threshold, the business message will be downgraded to a low priority queue.

[0059] 3. If the business message is of low priority, or the time taken to execute the business message again exceeds the time threshold, the business message will be downgraded to the fault queue, the execution will be terminated, and the execution data (including but not limited to whether the execution is successful and the execution time) will be sent to the data statistics service.

[0060] In this embodiment, the subsequent compensation process is specifically as follows:

[0061] In the first step, the scheduler module periodically extracts business messages from the fault queue and distributes them through the consumer module.

[0062] Step 2: Execute the business message distributed from the fault queue. If the execution is successful, perform an indicator analysis on the execution data of the business message to obtain the execution indicator. Then, push other business messages in the fault queue that are consistent with the message type of the business message to the dispatcher module for execution.

[0063] If the execution time exceeds the set time threshold, the execution of the business message is forcibly terminated, and the execution data of the business message is analyzed to obtain the execution index.

[0064] In the subsequent compensation processing, if the business message is pushed back to the scheduler module, the execution count of the business message will be performed. If the count of the same business message in the fault queue exceeds the set count threshold, the business message will be permanently removed from the queue and a persistent backup will be performed on the business message.

[0065] The above is only a preferred embodiment of the present invention. It should be pointed out that for those skilled in the art, several modifications and improvements can be made without departing from the structure of the present invention, which will not affect the effect of the implementation of the present invention and the practicality of the patent.

Claims

1. A method for processing IOT device data based on a high-utilization non-blocking queue, characterized in that: The method comprises the following steps: Step 1: Generate business messages according to different business scenarios; Step 2: querying the execution indicator corresponding to the message type according to the message type of the business message, querying the message priority of the business message according to the execution indicator, and scheduling the business message to a specified queue according to the message priority; Step 3: Distribute the service message according to the priority level based on the message type, so as to distribute the service message to the consumer end; Step 4: Obtain the execution result of the message distribution, and perform post-processing tasks of the business message according to the execution result.

2. According to claim 1, a method for processing IOT device data based on a high-utilization non-blocking queue is characterized in that: In step 2, if the message priority corresponding to the business message cannot be found, the business message is scheduled to the medium priority queue; if the message priority corresponding to the business message is found, the business message is scheduled to the queue of the specified priority.

3. A method for processing IOT device data based on a high-utilization non-blocking queue according to claim 2, characterized in that: The queues include a high priority queue, a medium priority queue, a low priority queue and a slow processing queue.

4. The method for processing IOT device data based on a high-utilization non-blocking queue according to claim 1, characterized in that: In step three, the service messages in the same queue are distributed in a first-in-first-out order.

5. A method for processing IOT device data based on a high-utilization non-blocking queue according to claim 1 or 4, characterized in that: When distributing messages, the business messages in the queue are first scheduled to the idle queue working thread, and then the business messages are distributed to the consumer end.

6. The method for processing IOT device data based on a high-utilization non-blocking queue according to claim 1, characterized in that: The post-processing tasks are specifically: When the execution result of the message distribution is successful, an indicator analysis is performed on the execution data of the business message to obtain an execution indicator; When the execution result of the message distribution is failure, an index analysis is performed on the execution data of the service message to obtain an execution index, and the service message is dispatched to a fault queue to wait for subsequent compensation processing; When the execution time of the message distribution exceeds a set time threshold, the execution of the service message is forcibly terminated and the priority of the service message is downgraded.

7. A method for processing IOT device data based on a high-utilization non-blocking queue according to claim 6, characterized in that: The subsequent compensation process is specifically as follows: The first step is to extract the service messages in the fault queue at a regular time and distribute them; Step 2: Execute the service message distributed from the fault queue. If the execution is successful, perform an index analysis on the execution data of the service message to obtain the execution index. Then, push other service messages in the fault queue that are consistent with the service message to step 2 for execution. If the execution time exceeds the set time threshold, the execution of the service message is forcibly terminated, and an indicator analysis is performed on the execution data of the service message to obtain an execution indicator.

8. The method for processing IOT device data based on a high-utilization non-blocking queue according to claim 7, characterized in that: The re-pushed service message is counted, and if the count of the same service message in the fault queue exceeds a set count threshold, the service message is permanently removed from the queue, and a persistent backup process is performed on the service message.

9. The method for processing IOT device data based on a high-utilization non-blocking queue according to claim 7, characterized in that: The indicator analysis is to collect statistics on the message execution efficiency, average execution time, execution success ratio, minimum execution time, and maximum execution time of business messages and perform average processing; the execution indicator is the average of the message execution efficiency, average execution time, execution success ratio, minimum execution time, and maximum execution time of business messages in a message type.

10. The method for processing IOT device data based on a high-utilization non-blocking queue according to claim 6, characterized in that: In the degradation process, if the priority of the service message is low, the service message is moved to the fault queue.