A real-time rule engine construction method based on edge cloud originality
Patent Information
- Application Number
- CN202310738034.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-21
- Publication Date
- 2026-10-27
- Estimated Expiration
- 2043-06-21
AI Technical Summary
然而,随着触发的规则数量增加,决策空间呈指数级增长,计算最优解的时间开销远大于实时规则引擎的时延要求
[0021]与现有技术相比,本发明的有益效果是:引入一种基于动态规划的边缘云原生实时规则引擎构建方法,支持对多个规则的资源分配,并且拥有较强的可扩展性。相比于暴力等枚举算法,有效降低了资源分配的计算开销,提高规则引擎的执行效率。
Smart Images

Figure CN116954891B_ABST
Abstract
Description
Technical Field
[0001] This invention provides a method for building a real-time rule engine based on edge cloud native. Background Technology
[0002] With the rise of containerization, rule engines, as fundamental middleware for edge cloud IoT platforms, are also gradually moving towards containerization. In many existing solutions, rule engines are already running in containerized environments, leveraging the isolation, portability, and convenience of containers to deliver more efficient data processing and decision-making mechanisms. Edge cloud-native rule engines typically execute actions within rules as containers, allowing for flexible expansion and management based on actual needs. They support event-driven rule engine models, enabling real-time data analysis and processing through custom rules, thereby achieving intelligent decision-making and automated control.
[0003] However, when running an edge cloud-native rule engine, the end-to-end latency of a single rule may differ significantly from the execution time of the corresponding container. This is because the end-to-end latency of a single rule includes not only the execution time of the container but also the container creation time, which accounts for a substantial portion and cannot be ignored. Although cold start time can be reduced by predicting event trigger times and starting containers in advance, the loose coupling between the rule engine and the container runtime means that the rule engine cannot know the actual container requirements (i.e., how many resources are needed and their deadlines). Therefore, it may provide inappropriate amounts of resources, resulting in excessively long response delays.
[0004] Therefore, once the rule engine obtains the available resources and container requirements, how to allocate resources and when to start containers becomes crucial, as this significantly impacts the end-to-end latency of the rules. A straightforward approach is to exhaustively enumerate all possible combinations, specifying the resource allocation and startup time for each container to find the solution that meets the deadline while minimizing resource consumption. However, as the number of triggered rules increases, the decision space grows exponentially, and the time overhead of calculating the optimal solution far exceeds the latency requirements of a real-time rule engine. Furthermore, dynamically adjusting decisions based on different QoE levels further complicates the problem. Summary of the Invention
[0005] To overcome the aforementioned shortcomings of existing technologies, this invention provides a scheduling algorithm and its application based on forward merge dynamic programming. Essentially, this algorithm uses deadlines and resource constraints to prune the search space, considers resource allocation schemes and temporary optimal solutions for each rule, processes other rules gradually according to a first-in-first-out order, and merges existing calculation results.
[0006] The present invention provides a method for constructing a real-time rule engine based on edge cloud native, comprising the following steps:
[0007] Step 1: For the input requests, sort them according to the difference between the predicted arrival time of the request and the creation time of each request container.
[0008] Step 1.1: For the input request deadline ddl and the predicted arrival time t pred and the creation time t of the container corresponding to each request cold , divide n requests according to (t) pred -t cold Sort the results.
[0009] Step 2: Initialize the set of prerequisite solutions s for the first request to be empty.
[0010] Step 3: Iterate through n requests, find the start time of each request, complete the global cache table gc for each request, and merge the global cache table gc into a scheme set s.
[0011] Step 3.1: For the i-th request, determine the set of available resources {r} based on the current resource quantity and the deadline of the request.
[0012] Step 3.1.1: For the i-th request, iterate through the possible resource allocation schemes r for that request. Based on the current available resources R of the system, determine whether r is less than or equal to R. If so, add r to the resource set {r}.
[0013] Step 3.1.2: For the i-th request, iterate through the possible resource schemes r for the request. If the execution time of the container, given the resource r, will not exceed the deadline of the request, then add r to the resource set {r}.
[0014] Step 3.2: For the set of optional resources {r} determined in Step 3.1, for the adjustable parameter λ, find the resource in [t] pred -t cold ,t pred The start time t of the resource r available within the range of +λ] start , and fill it into the global cache table gc.
[0015] Step 3.2.1: Use the resource set {r} generated in Step 3.1 as the first list item of the global cache table gc, which means the optional resource set of the i-th container.
[0016] Step 3.2.2: Use the resource set s of the (i-1)th request as the header of the gc table.
[0017] Step 3.2.3: For each entry in the GC table, find the start time t that can provide resource r given the resource usage of the (i-1)th request scheme set s. start If tstart In [t] pred -t cold ,t pred Within the range of +λ], then t start Enter it into the start table.
[0018] Step 3.3: For the gc table formed in step 3.2, for each two items gc′, gc″ in the table, check whether k exists according to the following formula. If it exists, merge the two items into one item and fill it into the s table; if it does not exist, add both items to the s table.
[0019]
[0020] Step 4: After completing the GC table calculation for all requests, filter the eligible strategies based on the deadline of the last request, and select the strategy with the least end-to-end latency and resource consumption.
[0021] Compared with existing technologies, the advantages of this invention are: it introduces a method for building an edge cloud-native real-time rule engine based on dynamic programming, which supports resource allocation for multiple rules and has strong scalability. Compared with brute-force and other enumeration algorithms, it effectively reduces the computational overhead of resource allocation and improves the execution efficiency of the rule engine. Attached Figure Description
[0022] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0023] Figure 1 This is a data structure diagram of the method of the present invention.
[0024] Figure 2 This is a flowchart of the process of the method of the present invention. Detailed Implementation
[0025] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the protection scope of the present invention.
[0026] This invention provides an IoT smart home control method based on an edge cloud-native real-time rule engine construction approach. Essentially, the core algorithm of this method uses deadlines and resource constraints to prune the search space, considers resource allocation schemes and provisional optimal solutions for each rule, processes other rules gradually according to a first-in-first-out order, and merges existing calculation results.
[0027] Specifically, the following steps are included:
[0028] Step 1: For requests corresponding to the input rules, sort them according to the difference between the predicted arrival time of the request and the creation time of each request container.
[0029] Step 1.1: For the input rule request deadline ddl and the predicted arrival time t pred and the creation time t of the container corresponding to each request cold , divide n requests according to (t) pred -t cold Sort the results.
[0030] Step 2: Initialize the set of prerequisite solutions s for the first request to be empty.
[0031] Step 3: Iterate through n requests and complete the global cache table gc and scheme set s for each request.
[0032] Step 3.1: For the i-th request, determine the set of available resources {r} based on the current resource quantity and the deadline of the request.
[0033] Step 3.1.1: For the i-th request, iterate through the possible resource allocation schemes r for that request. Based on the current available resources R of the system, determine whether r is less than or equal to R. If so, add r to the resource set {r}.
[0034] Step 3.1.2: For the i-th request, iterate through the possible resource schemes r for the request. If the execution time of the container, given the resource r, will not exceed the deadline of the request, then add r to the resource set {r}.
[0035] Step 3.2: For the set of optional resources {r} determined in Step 3.1, for the adjustable parameter λ, find the resource in [t] pred -t cold ,t pred The start time t of the resource r available within the range of +λ] start , and fill it into the global cache table gc.
[0036] Step 3.2.1: Use the resource set {r} generated in Step 3.1 as the first list item of the global cache table gc, which means the optional resource set of the i-th container.
[0037] Step 3.2.2: Use the resource set s of the (i-1)th request as the header of the gc table.
[0038] Step 3.2.3: For each entry in the GC table, find the start time t that can provide resource r given the resource usage of the (i-1)th request scheme set s. start If t start In [t] pred -t cold ,t pred Within the range of +λ], then t start Enter it into the start table.
[0039] Step 3.3: For the gc table formed in step 3.2, for each two items gc′, gc″ in the table, check whether k exists according to the following formula. If it exists, merge the two items into one item and fill it into the s table; if it does not exist, add both items to the s table.
[0040]
[0041] Step 4: After completing the GC table calculation for all requests, filter the eligible strategies based on the deadline of the last request, and select the strategy with the least end-to-end latency and resource consumption.
[0042] Step 5: Based on steps 1-4, allocate resources for rule execution in the IoT smart home.
[0043] The input rules are calculated according to the results of the GC table and S table in steps 1-4. Based on the calculation results, CPU, memory and other resources are allocated to the action execution corresponding to the IoT rule, such as turning off the lights or turning on the air conditioner. The action of the IoT rule is started at the corresponding time point, thereby completing the intelligent triggering control of a series of IoT rules.
[0044] The embodiments described in this specification are merely examples of implementations of the inventive concept. The scope of protection of this invention should not be considered as limited to the specific forms stated in the embodiments. The scope of protection of this invention also extends to equivalent technical means that can be conceived by those skilled in the art based on the inventive concept.
Claims
1. A method for building a real-time rule engine based on edge cloud native technology, comprising the following steps: Step 1: For the input requests, sort them according to the difference between the predicted arrival time of the request and the creation time of each request container; Step 2: Set the solutions for the first request. Initially empty; Step 3: Traverse For each request, find its start time and complete the global cache table for that request. Calculate and store the global cache table. Merge into a set of solutions Specifically, this includes: Step 3.1: For the first For each request, determine the available resource set based on the current resource availability and the request's deadline. ; Step 3.1.1: For the first For each request, iterate through the resource allocation schemes for that request. Based on the current available system resources ,judge Is it less than or equal to? If so, then Add to optional resource collection ; Step 3.1.2: For the first For each request, iterate through the resource allocation schemes for that request. If the first The container corresponding to each request is in the resource allocation scheme In this case, if the execution time will not exceed the deadline of the request, then... Add to optional resource collection ; Step 3.2: For the set of optional resources determined in Step 3.1 For adjustable parameters Searching for Resource allocation schemes can be provided within the scope. Start time of the corresponding resource Fill in the global cache table middle; Step 3.2.1: Combine the optional resource set generated in Step 3.1 As a global cache table The first list item, meaning the first A collection of optional resources for each container; Step 3.2.2: [The text appears to be incomplete and contains several grammatical errors. A more accurate translation A set of solutions for each request As Table header; Step 3.2.3: For For each entry in the table, find the entry for the first... A set of request schemes When resources are occupied, a resource allocation scheme can be provided. Start time of the corresponding resource ,like exist Within the range, then Fill in In the table; Step 3.3: For the product formed in step 3.2 The table, for each of the two items in the table. The following formula is used to check if it exists. If they exist, merge these two entries into one and fill it into the solution set. If neither of these entries exists, add both entries to the solution set. , Step 4: After completing all requests After the table is calculated, a filtering strategy is used based on the completion time of the last request not exceeding the deadline, and then the strategy with the least end-to-end latency and the least resource consumption is selected.
2. The method for constructing a real-time rule engine based on edge cloud native as described in claim 1, characterized in that: Step 1 specifically includes: setting the deadline for input requests. Predicted arrival time and the creation time of the container corresponding to each request ,Will The request is made according to The results are sorted.
Citation Information
Patent Citations
System and method for facilitating dynamic policy engine with recursive key selection
CN115695305A
Implementing an interface between tuple and message-driven control entities
US20170091004A1