An efficient human-computer interaction method and system combining a rule engine with real-time stream processing technology

By building a hybrid index structure and introducing a context-aware mechanism, combined with SIMD parallel computing technology, the memory access mode of the rule engine is optimized, which solves the problems of low search efficiency and long response time of traditional rule engines under large-scale rule sets, and achieves efficient rule engine performance improvement.

CN120335620BActive Publication Date: 2025-10-17CHINA NAT INST OF STANDARDIZATION
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510830647.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-06-20
Publication Date
2025-10-17
Estimated Expiration
2045-06-20

AI Technical Summary

Technical Problem

Traditional rule engines have problems such as low search efficiency, long response time, non-optimized memory access, and lack of context awareness when processing large-scale rule sets. They cannot meet the real-time and accuracy requirements of modern human-computer interaction systems.

Method used

A hybrid index structure is constructed, combining hash index and tree index, using context-aware mechanism and SIMD parallel computing technology to optimize memory access pattern and achieve efficient rule search and parallel evaluation.

Benefits of technology

Significantly reduce the time delay of the rule engine, improve search efficiency by more than 60%, and reduce response time by 50%, meeting the requirements of real-time human-computer interaction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120335620B_ABST
    Figure CN120335620B_ABST
Patent Text Reader

Abstract

The application discloses a kind of efficient human-computer interaction method and system of combining rule engine with real-time stream processing technology, this method is according to rule access frequency Construction Hybrid Index Structure, high-frequency rule is implemented O (1) search using Hash Index, low-frequency rule is implemented O (log n) search using B+ tree index;Based on context-driven method, relevant rules are screened in combination with human-computer interaction characteristics, to form candidate rule set;According to access correlation, candidate rule set is rearranged in memory area, and rule condition is judged using SIMD instruction parallel processing;The application significantly reduces the time delay of rule engine by the organic combination of intelligent index, context awareness, memory optimization and parallel computing, the average response time is controlled within 100ms, the search efficiency is improved by more than 60%, to meet the performance requirements of real-time human-computer interaction.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application belongs to the technical field of computer science and artificial intelligence, and specifically relates to an efficient human-computer interaction method and system combining a rule engine and real-time stream processing technology. BACKGROUND

[0002] As a core decision component, the rule engine plays an increasingly important role in intelligent systems. Traditional rule engines face problems such as low search efficiency, long response time, and non-optimized memory access when dealing with large-scale rule sets, especially in real-time human-computer interaction scenarios, where users have extremely high requirements for system response speed.

[0003] In the prior art, the rule engine mainly uses linear search or simple index structures for rule matching, which can cause significant performance bottlenecks when the number of rules is large. At the same time, traditional methods lack deep analysis of rule access patterns and fail to fully utilize the correlation and access frequency characteristics between rules for optimization. In addition, existing systems generally lack context awareness and cannot dynamically filter relevant rules according to the current interaction scenario, resulting in a large amount of invalid calculations.

[0004] In terms of parallel processing, traditional rule engines fail to effectively utilize the SIMD (Single Instruction Multiple Data) capabilities of modern processors, and cannot achieve batch parallel evaluation of rule conditions. These technical limitations severely restrict the application effect of rule engines in high-concurrency and low-latency scenarios.

[0005] Therefore, there is an urgent need for an efficient rule engine solution that combines intelligent indexing, context awareness, memory optimization, and parallel computing technology to meet the dual requirements of real-time and accuracy in modern human-computer interaction systems. SUMMARY

[0006] The present application aims to solve the technical problems of low search efficiency, long response time, and non-optimized memory access in existing rule engine technologies, and provides an efficient human-computer interaction method and system combining a rule engine and real-time stream processing technology. This method significantly reduces the time delay of the rule engine by constructing a hybrid index structure, introducing a context awareness mechanism, optimizing memory access patterns, and utilizing SIMD parallel computing technology, thereby improving the response speed of the human-computer interaction system and user experience. The specific technical solutions are as follows:

[0007] In a first aspect, the present application provides an efficient human-computer interaction method combining a rule engine and real-time stream processing technology for reducing the time delay of the rule engine, characterized in that the method comprises:

[0008] Step S1: Based on the access frequency of each rule in the rule engine, a rule hybrid index structure is constructed to locate each rule, a hash index is used to search for high-frequency rules, and a tree index is used to search for low-frequency rules;

[0009] Step S2: Based on the context-driven approach, the rules in the rule engine are screened in combination with the contextual features of the current human-computer interaction, and a candidate rule set is obtained by searching based on the constructed rule hybrid index structure;

[0010] In step S3, the candidate rule sets are rearranged in the memory area according to access relevance, and the rearranged candidate rule sets are processed simultaneously according to SIMD instructions, thereby reducing the time delay of the rule engine.

[0011] Furthermore, the method for constructing the hybrid index structure in step S1 is:

[0012] Statistical rule sets Each rule Frequency of visits , calculate the frequency threshold ,in, is the average visit frequency, is the standard deviation of access frequency, is the standard deviation coefficient;

[0013] will satisfy The rules are classified as high-frequency rule sets , using hash index conduct Rapid location of time complexity;

[0014] will satisfy The rules are classified as low-frequency rule sets ,use Tree Index conduct Time complexity of ordered search;

[0015] Building a mixed index , achieving average search time ,in, is the proportion of high-frequency rules.

[0016] Furthermore, the hash index The construction method is: extract high-frequency rule sets The key feature vector of each rule in ,in, is the rule type, For priority, is the conditional quantity;

[0017] Using locality sensitive hash function Compute hash value, where is the hash parameter, is the hash table size, set the hash table size to keep the load factor at 0.5, minimizing the impact of hash collisions on lookup time.

[0018] Further, the tree index is constructed by: sorting the low-frequency rule set according to the composite key , where the priority is the primary key, the rule type is the secondary key, and the rule ID is the unique identifier;

[0019] Construct a tree structure, set the node size to 4KB, and the degree of the tree : ; store complete rule information in leaf nodes and only store index key values in internal nodes.

[0020] Further, the context-driven method is specifically: for each rule predefine a set of applicable contexts , calculate the matching degree of the rule with the current context :

[0021] ; find the candidate rule set by searching the constructed rule hybrid index structure for rules with a matching degree greater than 0.5 .

[0022] Further, the candidate rule set is rearranged in the memory area according to access correlation, and the access correlation between rules in the candidate rule set is calculated , and the simultaneous access probability of rules is calculated : where, is the number of times rules and are accessed simultaneously, is the total number of accesses;

[0023] Based on the correlation, the rules are clustered, and rules that meet are assigned to the same memory block.

[0024] Further, the rules in each memory block are evaluated in parallel, and the condition judgment of multiple rules is processed simultaneously using SIMD instructions to achieve single-instruction multiple-data parallel acceleration.

[0025] ​Further, the specific method for processing the rearranged candidate rule set according to the SIMD instruction simultaneously is:

[0026] The rule conditions in the same memory block are converted into a vectorized representation, and for a memory block containing rules, a condition matrix C is constructed , wherein is the maximum number of conditions.

[0027] Using the AVX-512 instruction set, 16 32-bit condition values are processed at a time, and the rule conditions are evaluated in batches:

[0028] , wherein represents a vectorized logical bitwise AND operation; is the k-th condition column, that is, all rows of the matrix C are taken, the k-1 column; the rule index that satisfies the condition is identified through a bitmask operation, and the time delay of the rule engine is reduced.

[0029] Further, the method further includes a rule engine dynamic optimization step:

[0030] Step S4, a time window statistical model of rule access frequency is established, and a sliding window is used to collect rule access data in a time period, and the dynamic frequency of the rule in the time window is calculated : ; wherein is a smoothing factor, is the number of times the rule is accessed in the time window, is the number of times all rules are accessed in the time window.

[0031] Step S5, according to the dynamic frequency change, the rule hotness migration is detected, and when is satisfied, the index structure reconstruction is triggered, wherein the change threshold is not greater than 0.3.

[0032] Step S6, when the dynamic frequency of the rule in two adjacent windows is greater than , the rule hybrid index structure is updated, and through the incremental hash table expansion and B+ tree node splitting operation, the real-time requirement of the average response time is maintained.

[0033] In a second aspect, the present application provides an efficient human-computer interaction system combining a rule engine and real-time stream processing technology, which is used to execute the method of the first aspect, and the system includes a hybrid index module, a context awareness module, a memory optimization module, and a SIMD execution engine.​

[0034] The hybrid index module is used to construct a rule hybrid index structure according to the access frequency of each rule in the rule engine, and locate each rule, adopt a hash index to find high-frequency rules, and adopt a tree index to find low-frequency rules.

[0035] The context awareness module filters each rule in the rule engine based on a context-driven method, in combination with the context features of the current human-computer interaction, and finds a candidate rule set according to the constructed rule hybrid index structure.

[0036] The memory optimization module rearranges the candidate rule set in a memory area according to access correlation.

[0037] The SIMD execution engine supports an AVX-512 instruction set, simultaneously processes the rearranged candidate rule set according to a SIMD instruction, and reduces the time delay of the rule engine.

[0038] Compared with the prior art, the present application has the following beneficial effects:

[0039] The present application constructs a hybrid index structure, adopts a hash index with time complexity for high-frequency rules, and adopts a B+ tree index for low-frequency rules. The present application constructs a hybrid index structure, adopts a hash index with time complexity for high-frequency rules, and adopts a B+ tree index for low-frequency rules. The present application realizes a substantial optimization of the average search time, improves the search efficiency by more than 60% compared with the traditional linear search method, controls the system average response time within 100 ms, reduces the delay by more than 50% compared with the traditional method, and meets the strict requirements of real-time human-computer interaction. BRIEF DESCRIPTION OF DRAWINGS

[0040] Figure 1 It is a high-efficiency human-computer interaction method flowchart combining a rule engine and real-time stream processing technology.

[0041] Figure 2 It is a composition schematic diagram of a high-efficiency human-computer interaction system combining a rule engine and real-time stream processing technology. DETAILED DESCRIPTION

[0042] To make the purpose, technical scheme and advantages of the present application clearer, the technical scheme in the present application is described clearly and completely below. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor fall within the protection scope of the present application.

[0043] Embodiment 1

[0044] As Figure 1As shown, it is a high-efficiency human-computer interaction method flow chart combining a rule engine and real-time stream processing technology, used for reducing the time delay of the rule engine, and the method comprises the following steps:

[0045] In step S1, according to the access frequency of each rule in the rule engine, a rule hybrid index structure is constructed to locate each rule, a high-frequency rule is found by using a hash index, and a low-frequency rule is found by using a tree index.

[0046] The rule engine usually contains 1000 to 100000 rules, and each rule contains rule ID, rule type (such as verification rule, business rule, security rule), priority (1-10 level), condition number (1-20 conditions) and other attributes. The access frequency statistics adopts a sliding time window mechanism, and the window size is set to 1 hour to 24 hours, and the statistical data is updated every 15 minutes.

[0047] For example, in an e-commerce recommendation system containing 5000 rules, it is found by statistics that the access frequencies of user login verification rules, commodity recommendation rules and price calculation rules are 45%, 35% and 20% respectively, which belong to high-frequency rules; and the access frequencies of refund processing rules and abnormal processing rules are only 2-5%, which belong to low-frequency rules. Through this classification, 80% of the search requests can be completed in O(1) time through the hash index; it should be noted that O(1) represents constant time complexity, that is, no matter how large the data size is, the time required for algorithm execution remains constant and does not increase with the increase of input data; 1 does not mean 1 second or 1 millisecond, but a constant, which may be 1 operation, or 5, 10 operations, but the key is that the number of times is fixed; when the data increases from 100 to 1 million, the execution time of the O(1) algorithm is basically the same.

[0048] The construction method of the hybrid index structure in step S1 is as follows:

[0049] Statistical rule set Access frequency of each rule in the rule set , calculate the frequency threshold , wherein, is the average access frequency, is the standard deviation of the access frequency, is the standard deviation coefficient, and a dynamic adjustment strategy is adopted, when the rule set size is less than 1000, the coefficient is 0.5; when the size is between 1000 and 10000, the coefficient is 0.8; when the size exceeds 10000, the coefficient is 1.2. Ensure that the proportion of high-frequency rule sets remains between 20-30%.

[0050] will satisfy The rules are classified as high-frequency rule sets , using hash index conduct Rapid location of time complexity;

[0051] will satisfy The rules are classified as low-frequency rule sets ,use Tree Index conduct Time complexity of ordered search; The tree is specially designed for disk storage and large data volume search. Compared with ordinary binary trees, it has the following advantages: lower tree height (reduced number of search levels), support for range query, cache-friendly, good concurrency performance; for low-frequency rule sets, Tree The time complexity means that even if there are 1 million low-frequency rules, it only takes about 20 comparisons at most to find the target rule.

[0052] Explanation of the specific meaning of complexity: Assumption The degree of the tree is 170 (each node has at most 170 key values), so: 10,000 rules: at most ≈ 2 layers, 2 node visits, 100,000 rules: requires at most ≈ 3 layers, 3 node visits, 1 million rules: requires at most ≈ 3 layers, 3 node visits.

[0053] The node size of the tree is set to 4KB to ensure that each node access can fully utilize the CPU cache. The storage format of the composite key is: priority (4 bytes) + rule type (4 bytes) + rule ID (8 bytes), a total of 16 bytes, plus an 8-byte pointer, each key-value pair occupies 24 bytes; each node can store about 170 key-value pairs, corresponding to the degree of the tree .

[0054] Building a mixed index , achieving average search time ,in, is the proportion of high-frequency rules.

[0055] The hash index The construction method is: extract high-frequency rule sets The key feature vector of each rule in ,in, is the rule type, For priority, is the conditional quantity;

[0056] Using locality sensitive hash function Calculate the hash value, where is the hash parameter, For hash table size, set the hash table size , to keep the load factor at 0.5 and minimize the impact of hash collisions on lookup time.

[0057] when When the ratio is 3:2:1, the hash distribution is the most uniform. Specifically, for the rule type value range 1-10, the priority value range 1-10, and the condition number value range 1-20, you can set (Prime numbers are chosen to reduce collisions).

[0058] Hash parameters need to be adjusted for different business scenarios. For example, in financial risk control systems, the priorities vary greatly, so you can increase In content recommendation systems, a relatively even distribution of rule types can balance the weights of the three parameters. The hash table size M also needs to consider memory limitations. When available memory is limited, the load factor can be appropriately reduced to 0.3-0.4, trading time for space.

[0059] described Tree Index The construction method is: the low-frequency rule set By composite key Sort by priority as the primary key, rule type as the secondary key, and rule ID as the unique identifier;

[0060] Build Tree structure, set the node size to 4KB, the degree of the tree : ; Store complete rule information in leaf nodes and only store index key values ​​in internal nodes.

[0061] Step S2, based on a context-driven approach, combined with the contextual features of the current human-computer interaction, screens the rules in the rule engine, and searches for a candidate rule set based on the constructed rule hybrid index structure.

[0062] Contextual features include multiple dimensions, including user characteristics (age, gender, region, preferences), session characteristics (access time, access path, and duration of stay), device characteristics (device type, network environment, and screen resolution), and business characteristics (transaction type, product category, and price range). Each dimension is represented using a bit vector. For example, user age is represented using 8 bits to represent different age groups, and product category is represented using 16 bits to represent different categories.

[0063] The context-driven method is specifically: for each rule Predefine a set of applicable contexts , calculate the rule Matching degree with the current context :

[0064] ; according to the constructed rule mixing index structure, find the rule with a matching degree greater than 0.5 to form a candidate rule set .

[0065] The matching degree calculation uses Similarity, the value range is [0, 1], and the threshold is 0.5. In the e-commerce scenario, when the user is "25-year-old female, browsing clothing products, using mobile devices", the matching degree of the rule related to clothing recommendation is between 0.7-0.9, and the matching degree of the rule related to electronic products is less than 0.3.

[0066] Step S3, rearrange the candidate rule set in the memory area according to the access relevance, and process the rearranged candidate rule set according to the SIMD instruction at the same time, to realize the reduction of the time delay of the rule engine.

[0067] Rearrange the candidate rule set in the memory area according to the access relevance, calculate the access relevance between the rules in the candidate rule set , and calculate the simultaneous access probability of the rules : , where is the number of times that rules and are accessed simultaneously, is the total number of accesses; The window size is set to 1000-10000 access records, and the threshold of the probability is 0.3. When the threshold is too low (such as 0.1), it will cause the memory block to be too large and the cache efficiency to decrease; when the threshold is too high (such as 0.7), it will cause the related rules to be scattered to different memory blocks, losing the clustering effect.

[0068] Based on the relevance, the rules are clustered, and the rules that meet

[0069] are allocated to the same memory block; the memory block size is set to 64KB, which is half of the size of the processor L1 cache, to ensure that the entire memory block can be completely loaded into the cache; each memory block can accommodate about 200-500 rules. In order to avoid memory fragmentation, the memory pool technology is used to pre-allocate memory blocks of a fixed size.

[0070] ​​The rules in each memory block are evaluated in parallel, and the condition judgment of multiple rules is processed simultaneously using SIMD instructions to achieve single instruction multiple data parallel acceleration.

[0071] The specific method for processing the rearranged candidate rule set according to the SIMD instruction is:

[0072] The rule conditions in the same memory block are converted into vectorized representation. For a memory block containing rules, a condition matrix C is constructed , where is the maximum number of conditions;

[0073] AVX-512 instruction set is used to process 16 32-bit condition values at a time, and the rule conditions are evaluated in batches: , where represents vectorized logical bitwise AND operation; is the th condition column, that is, all rows of the matrix C are taken, and the k-1th column.

[0074] AVX-512 instruction set requires CPU to support 512-bit vector registers, which is currently mainly supported in Intel Xeon Scalable processors and some high-end desktop processors. For systems that do not support AVX-512, AVX2 (256-bit) or SSE4 (128-bit) instruction sets can be used, and the number of conditions processed at a time is reduced to 8 or 4 accordingly.

[0075] Bitmask operation is used to identify the rule index that meets the condition, achieving the reduction of the time delay of the rule engine.

[0076] The construction of the condition matrix requires standardization processing of the rule conditions, for example, the numerical condition "age>25" is converted into a 32-bit integer comparison operation, and the string condition "category == 'electronics'" is converted into a hash value comparison; for complex logical expressions, the reverse Polish representation method is used to convert into a vectorized operation sequence.

[0077] The execution time of SIMD instruction is about 1 / 16 to 1 / 8 of that of traditional scalar instruction. The specific speedup ratio depends on the condition complexity and data dependency. In order to maximize the SIMD efficiency, data alignment technology is used to ensure the vectorization of memory access, and prefetch instruction is used to reduce memory delay.

[0078] Bitmask operation uses special bit operation instructions such as _mm512_test_epi32_mask to quickly identify the rule position that meets the condition. The result processing uses parallel bit scanning instructions, and the time complexity is , where The number of candidate rules.

[0079] The method further comprises a rule engine dynamic optimization step:

[0080] Step S4, a time window statistical model of rule access frequency is established, and a sliding window The rule access data in the time period is collected, and the rule Dynamic frequency in the time window : ; wherein, is a smoothing factor, is the number of visits of the rule in the time window, is the number of visits of all rules in the time window.

[0081] The time interval of the sliding window is dynamically adjusted according to the system load, and is set to 5 minutes during high load (QPS>1000) and 30 minutes during low load; the smoothing factor is selected based on the stability of the access pattern: for a business system with a relatively stable access pattern, set to 0.8-0.9; for a system with a fast-changing access pattern, set to 0.3-0.5.

[0082] The calculation of the dynamic frequency uses the exponential weighted moving average (EWMA) algorithm, which gives higher weight to recent data, and to avoid the influence of noise data, a minimum sample size limit is also introduced. Only when the total number of visits in a certain time window exceeds 100, the dynamic frequency is updated.

[0083] Step S5, according to the dynamic frequency change, detect the rule hotness migration, when trigger the index structure reconstruction, wherein the change threshold is not greater than 0.3.

[0084] Step S6, when the rule the dynamic frequency of the two adjacent windows is greater than , update the rule hybrid index structure, and through the incremental hash table expansion and B+ tree node splitting operation, maintain the real-time requirement of the average response time .

[0085] The incremental hash table expansion uses consistent hashing technology, and the system can still serve normally during the expansion process; the expansion process is divided into three stages: 1) create a new hash table; 2) gradually migrate data; 3) switch to the new table and release the old table; the whole process is completed within 10ms.

[0086] The tree node splitting operation adopts a batch processing manner, combines and processes multiple nodes that need to be split, reduces the lock overhead, and adopts a copy-on-write technology in the splitting process.

[0087] The monitoring of response time adopts quantile statistics, focuses on P95 and P99 response times, and triggers an emergency optimization process when the P99 response time exceeds 200 ms, including temporarily increasing the size of a hash table, adjusting the size of a SIMD batch, and the like.

[0088] Embodiment 2

[0089] As shown in Figure 2 Fig. 1 is a schematic diagram of an efficient human-computer interaction system combining a rule engine and real-time stream processing technology according to an embodiment of the present application, which comprises a hybrid index module, a context awareness module, a memory optimization module, and a SIMD execution engine.

[0090] The hybrid index module is used to locate each rule according to the access frequency of each rule in the rule engine, and adopts a hash index to find high-frequency rules and a tree index to find low-frequency rules.

[0091] The hybrid index module adopts a modular design and comprises an index manager, a hash index submodule, a B+ tree index submodule, and a statistical analysis submodule. The index manager is responsible for coordinating the work of each submodule and maintaining the global mapping relationship between rules and indexes; the memory occupancy of the module is dynamically allocated according to the rule scale, and for a system of 10,000 rules, the hash index usually occupies 2-4 MB of memory and the B+ tree index occupies 8-16 MB of memory.

[0092] The module supports multi-thread concurrent access and adopts a read-write lock mechanism to ensure data consistency, and read operations can be executed concurrently, while write operations need exclusive access.

[0093] The persistent storage of the index adopts a periodic snapshot plus incremental log manner, a snapshot is generated every hour, and an incremental log records index changes in real time. When the system restarts, the latest snapshot is loaded first, and then the incremental log is replayed to restore to the latest state, and the entire recovery process is completed within 1-2 minutes.

[0094] The context awareness module is based on a context-driven method and combines the context features of current human-computer interaction to filter each rule in the rule engine and find a candidate rule set according to the constructed rule hybrid index structure.

[0095] The context awareness module supports multiple context acquisition methods, including HTTP request header analysis, user portrait API calling, real-time behavior analysis, and the like.

[0096] To reduce latency, the module implements a multi-level cache mechanism: L1 cache stores the context information of the last 1000 users, L2 cache stores the hotspot context patterns, and L3 cache connects to the external user portrait system.

[0097] The calculation of context matching is optimized using bitwise operations. The context features are encoded as bit vectors, and the intersection and union are calculated quickly through bitwise AND and OR operations.

[0098] For complex context queries, context conditions in the form of Boolean expressions are supported, such as: "(age >= 25 AND gender = 'F') OR (category = 'luxury')".

[0099] The memory optimization module rearranges the candidate rule set in the memory area according to access correlation; monitors memory usage, triggers garbage collection when memory usage exceeds 80%, and cleans up unused rule cache; memory compression function can compress the storage of low-frequency access rule data, and dynamically decompress when accessed, trading time for space

[0100] The SIMD execution engine supports the AVX-512 instruction set, which processes the rearranged candidate rule set simultaneously according to SIMD instructions, reducing the time delay of the rule engine.

[0101] The engine maintains different instruction set version code paths internally, including AVX-512, AVX2, SSE4, and scalar versions.

[0102] The engine implements conditional compilation and dynamic distribution mechanisms, selecting the most suitable vectorization strategy based on the characteristics of the rule conditions. For simple numerical comparisons, integer vector instructions are used; for string matching, byte comparison instructions are used; for complex logic, a hybrid vectorization scheme is used.

[0103] To maximize SIMD efficiency, the engine implements data rearrangement and alignment optimization; input data is automatically rearranged into a SIMD-friendly format, and memory allocation ensures vector width alignment. The engine also supports pipelining, preloading the next batch of data while processing the current batch of data, hiding memory access latency.

[0104] The four modules communicate through message queues and shared memory. Message queues are used for control instruction delivery, and shared memory is used for large data transmission; the system uses an event-driven architecture, with each module registering interested events and decoupling communication through an event bus.

[0105] The system realizes complete monitoring and alarm mechanism, and monitoring indexes include query response time, index hit rate, memory usage, SIMD execution efficiency, etc. When key indexes are abnormal, the system automatically triggers alarm and executes predefined emergency processing flow.

[0106] The above detailed description of the specific embodiments, the purpose, technical solutions and beneficial effects of the present application are further described in detail, and it should be understood that the above description is only a specific embodiment of the present application and is not used to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. within the spirit and principles of the present application shall be included in the protection scope of the present application.

Claims

1. An efficient human-computer interaction method combining a rule engine with real-time stream processing technology, used to reduce the time delay of the rule engine, characterized in that: The method comprises: Step S1: Based on the access frequency of each rule in the rule engine, a rule hybrid index structure is constructed to locate each rule, a hash index is used to search for high-frequency rules, and a tree index is used to search for low-frequency rules; Step S2: Based on the context-driven approach, the rules in the rule engine are screened in combination with the contextual features of the current human-computer interaction, and a candidate rule set is obtained by searching based on the constructed rule hybrid index structure; Step S3: rearrange the candidate rule sets in the memory area according to access relevance, and simultaneously process the rearranged candidate rule sets according to SIMD instructions, thereby reducing the time delay of the rule engine; Computing candidate rule sets The access correlation between the rules in the calculation rule The probability of simultaneous access : ,in, For rules and The number of simultaneous visits, is the total number of visits; Clustering rules based on correlation will satisfy The rules are allocated to the same memory block; Convert the rule conditions in the same memory block into vectorized representation. Regular memory blocks, building a conditional matrix ,in is the maximum number of conditions; Using the AVX-512 instruction set, it processes 16 32-bit conditional values ​​at a time and evaluates rule conditions in batches: ,in, Represents a vectorized logical bitwise AND operation; For the Condition columns, that is, take all rows and k-1 columns of matrix C; The rule index that meets the conditions is identified through bit mask operations, thereby reducing the time delay of the rule engine.

2. The method according to claim 1, characterized in that The method for constructing the hybrid index structure in step S1 is: Statistical rule sets Each rule Frequency of visits , calculate the frequency threshold ,in, is the average visit frequency, is the standard deviation of access frequency, is the standard deviation coefficient; will satisfy The rules are classified as high-frequency rule sets , using hash index conduct Rapid location of time complexity; will satisfy The rules are classified as low-frequency rule sets ,use Tree Index conduct Time complexity of ordered search; Building a mixed index , achieving average search time ,in, is the proportion of high-frequency rules.

3. The method according to claim 2, characterized in that The hash index The construction method is: extract high-frequency rule sets The key feature vector of each rule in ,in, is the rule type, For priority, is the conditional quantity; Using locality sensitive hash function Calculate the hash value, where is the hash parameter, For hash table size, set the hash table size , to keep the load factor at 0.5 and minimize the impact of hash collisions on lookup time.

4. The method according to claim 3, characterized in that described Tree Index The construction method is: the low-frequency rule set By composite key Sort by priority as the primary key, rule type as the secondary key, and rule ID as the unique identifier; Build Tree structure, set the node size to 4KB, the degree of the tree : ; Store complete rule information in leaf nodes and only store index key values ​​in internal nodes.

5. The method according to claim 4, characterized in that The context-driven method is specifically as follows: for each rule Predefined applicable context sets , calculation rules With the current context Matching degree : ; According to the constructed rule hybrid index structure, search for rules with a matching degree greater than 0.5 to form a candidate rule set .

6. The method according to claim 5, characterized in that The rules within each memory block are evaluated in parallel, and SIMD instructions are used to process the conditional judgment of multiple rules at the same time to achieve parallel acceleration of single instruction multiple data.

7. The method according to claim 6, characterized in that The method further comprises a rule engine dynamic optimization step: Step S4: Establish a time window statistical model of rule access frequency, using a sliding window Collect rule access data within a time period and calculate the rules Dynamic frequency within the time window : ;in, is the smoothing factor, For rules The number of visits within the time window, is the number of visits to all rules within the time window; Step S5, according to the dynamic frequency change detection rule heat migration, when it meets When the index structure is rebuilt, the change threshold Not more than 0.3; Step S6, when the rule The dynamic frequency of two adjacent windows is greater than When updating the regular hybrid index structure, and maintaining the average response time through incremental hash table expansion and B+ tree node splitting operations real-time requirements.

8. An efficient human-computer interaction system combining a rule engine and real-time stream processing technology, used to execute the method according to any one of claims 1 to 7, characterized in that: The system includes: a hybrid indexing module, a context awareness module, a memory optimization module and a SIMD execution engine; The hybrid index module is used to construct a rule hybrid index structure to locate each rule according to the access frequency of each rule in the rule engine, use a hash index to find high-frequency rules, and use a tree index to find low-frequency rules; The context-aware module uses a context-driven approach to filter the rules in the rule engine in combination with the contextual features of the current human-computer interaction, and searches for a candidate rule set based on the constructed rule hybrid index structure. The memory optimization module rearranges the candidate rule sets in the memory area according to access relevance; The SIMD execution engine supports the AVX-512 instruction set and processes the rearranged candidate rule sets simultaneously according to the SIMD instructions, thereby reducing the time delay of the rule engine.

Citation Information

Patent Citations

  • Rule engine system optimization method and device, computer equipment and storage medium

    CN111814458A

  • A rule engine positioning method combined with AI intelligence

    CN119782370A