Method for realizing dynamic rule engine based on Flink
By building a dynamic rule engine on Flink, using Java hot loading mechanism and distributed processing capabilities, the problems of low security and low processing efficiency in the existing technology are solved, real-time detection and response to malicious program attacks are realized, and security and processing efficiency are improved.
Patent Information
- Application Number
- CN202411955667.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-28
- Publication Date
- 2025-05-30
AI Technical Summary
In the prior art, the security is low, the processing efficiency is low, and the security management cost is high, making it difficult to realize real-time detection and response in complex malicious program attacks.
Using a dynamic rules engine based on Flink, user-defined rules are dynamically loaded and parsed through Java hot loading mechanism, rules are executed on Flink and real-time streaming data are processed, and rule execution performance is optimized in combination with distributed processing capabilities.
Real-time detection and response to XSS attacks is realized, which significantly reduces the window period for security vulnerabilities, improves the security of web applications, reduces security management costs, and improves the accuracy and efficiency of detection.
Smart Images

Figure CN120068066A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of dynamic rule engines, and particularly to a method for implementing a dynamic rule engine based on Flink. Background Art
[0002] With the advent of the big data era, enterprises are facing challenges in processing massive data and making real-time decisions. Apache Flink is a distributed computing framework, which, due to its low latency and high throughput characteristics, has become an ideal choice for stream processing. It can process complex events in data streams and provide enterprises with real-time decision-making capabilities. On this basis, dynamic rule engines have gradually received attention. A dynamic rule engine allows users to modify business rules at runtime without restarting or redeploying the system, thereby improving the flexibility and response speed of the system, which is particularly important in business scenarios that require frequent rule adjustments.
[0003] Flink adopts a stream-first approach to process data as unbounded or bounded streams. Its DataStream and DataSet APIs provide support for real-time streams and batch processing. Flink provides powerful state management capabilities and supports exactly-once semantics, which enables precise tracking of data state changes in complex event processing. It also provides rich window operators that can perform aggregation processing on time windows and count windows of stream data, thus supporting various real-time computing requirements.
[0004] In Java, the so-called Hot Swap technology allows new code to be dynamically loaded without stopping the application. By utilizing the Java class loader mechanism, dynamic loading and replacement of rule code can be achieved. Current dynamic rule engines generally support multiple rule expression methods. For example, rule engines such as DSL (Domain Specific Language) and Drools provide complex rule expression and reasoning capabilities, allowing users to define and manage complex business rules. In real-time processing scenarios, it is necessary to ensure the execution efficiency and scalability of the dynamic rule engine. Therefore, common implementation methods will adopt memory-based computing methods combined with efficient data structures such as the Rete algorithm to quickly match rules.
[0005] However, it is difficult to detect and respond to complex malicious program attacks in real time, resulting in a relatively long window period for exploiting security vulnerabilities and low security. Moreover, it is difficult to process large-scale data streams for various Web applications of different scales, with low processing efficiency. At the same time, there is a lot of manual intervention in the existing technology, resulting in low overall defense efficiency and high security management costs. Summary of the Invention
[0006] The technical problem to be solved by the present invention is to overcome the defects of low security, low processing efficiency, and high security management cost in the prior art, and provide a method for a dynamic rule engine implemented based on Flink.
[0007] The present invention solves the above technical problem through the following technical solutions:
[0008] The present invention provides a method for a dynamic rule engine implemented based on Flink, and the method includes the following operating steps:
[0009] Step 1, data access and preprocessing, real-time access data from multiple data sources, and perform preliminary cleaning and preprocessing;
[0010] Step 2, dynamic rule loading and parsing, dynamically load and parse user-defined rules through a self-developed Java hot loading mechanism;
[0011] Step 3, rule execution and processing, execute the dynamically loaded business rules in Step 2 on Flink, and process the real-time stream data in Step 1;
[0012] Step 4, monitoring and feedback, monitor the overall status, provide a user feedback interface at the same time, and support automatic report generation and notification.
[0013] In this technical solution, by combining Flink and a dynamic rule engine, an efficient and real-time rule processing system can be built. Flink is responsible for receiving and processing data streams and serves as the operating environment of the rule engine. The dynamic rule engine, through the hot loading mechanism, realizes the update and management of rules while keeping the system running, provides a user-friendly interface, allows users to define and modify rules online, compiles and loads rules through the Java compilation API and a custom class loader to achieve hot update, and combines the distributed processing ability of Flink to optimize the performance of rule execution, ensuring that the rule engine can still respond quickly in scenarios with massive data.
[0014] Preferably, the preprocessing in Step 1 includes duplicate removal, correction of data format, and filtering of unnecessary data.
[0015] In this technical solution, the preprocessing includes operations such as duplicate removal, correction of data format, and filtering of unnecessary data, providing clean data input for the subsequent operations of the rule engine.
[0016] Preferably, the data access in Step 1 supports Kafka, HTTP, and file system input.
[0017] In this technical solution, data access supports multiple inputs such as Kafka, HTTP, and file systems, ensuring the compatibility and flexibility of the system.
[0018] Preferably, the rules in step two are defined through DSL or UI and translated into executable Java classes.
[0019] Preferably, the rules in step two are subjected to syntax and logic verification.
[0020] In this technical solution, it is responsible for verifying the syntax and logic of the rules and ensuring that they are correct before deployment.
[0021] Preferably, the monitored metrics in step four include data processing, rule execution, and system performance.
[0022] In this technical solution, step four is responsible for monitoring the overall state of the system, including data processing, rule execution, system performance, etc., and at the same time provides a user feedback interface so that users can understand the system state and operation effect in real time.
[0023] Preferably, the specific operation steps of step one are as follows:
[0024] S1. Initialize Flink, initialize the Flink environment, and configure execution parameters;
[0025] S2. Receive data streams, configure the Kafka connector to receive real-time data streams;
[0026] S3. Set the input source, set multiple input sources, and support HTTP interfaces and file systems;
[0027] S4. Data format conversion, implement a data format conversion module to unify the data structure;
[0028] S5. Set the deduplication logic, set the deduplication logic to avoid the impact of duplicate data on the processing results;
[0029] S6. Data verification, perform data verification to identify and correct abnormal data;
[0030] S7. Set the filtering rules, apply the filtering rules to exclude unnecessary data;
[0031] S8. Data tagging, implement the data tagging function to make marks for subsequent processing;
[0032] S9. Flink parameter tuning, adjust the Flink parallelism parameters to improve data processing performance;
[0033] S10. Fault tolerance processing, monitor the latency and throughput of data access;
[0034] S11. Handle exceptions, set up an error handling mechanism, and handle access exceptions;
[0035] S12. Statistic data, and count the input data volume and data quality metrics;
[0036] S13. Reconnect for disconnection, implement a disconnection reconnection mechanism to ensure the continuity of data access;
[0037] S14. Data preprocessing, output the preprocessed data stream for subsequent modules to use. In this technical solution, step one is for data collection and preprocessing, and prepare to clean the data. Preferably, the specific operation steps of step two are as follows:
[0038] A1. Create rules, create a rule definition interface, and support DSL and UI inputs;
[0039] A2. Rule conversion, develop a rule translator to convert the rules into Java source code;
[0040] A3. Java compilation, use the Java compilation API to compile the source code into bytecode;
[0041] A4. Custom loader, implement a custom class loader to load the compiled bytecode;
[0042] A5. Verify rules, verify the syntax correctness of the rules before loading;
[0043] A6. Check logic, check the integrity of the rule logic and possible conflicts;
[0044] A7. Rule management, create a rule version management to support version rollback;
[0045] A8. Development and testing, develop test cases to verify the correctness of the rules;
[0046] A9. Hot loading implementation, implement a hot loading method to ensure that the existing process is not interrupted;
[0047] A10. Monitor performance and logs, monitor the performance and error logs of rule loading;
[0048] A11. Interface query, provide an interface to query the information of the currently loaded rules;
[0049] A12. Priority sorting, implement the priority sorting of rules;
[0050] A13. Front-end UI display, develop a UI feedback mechanism to display the loading results;
[0051] A14. Security authentication, configure security authentication to prevent unauthorized rule loading;
[0052] A15. Output rules, and output the successfully loaded rules for the execution module to use.
[0053] In this technical solution, Step 2 is implemented through hot loading in Java.
[0054] Preferably, the specific operation steps of Step 3 are as follows:
[0055] B1. Initialize the context and initialize the rule execution context environment.
[0056] B2. Receive preprocessed data and receive the preprocessed data stream in Step 1.
[0057] B3. Retrieve the effective rule set and retrieve the currently effective rule set.
[0058] B4. Allocate execution paths and allocate appropriate rule execution paths for each data event.
[0059] B5. Implement the rule matching algorithm and implement the rule matching algorithm to quickly screen applicable rules.
[0060] B6. Capture and record, capture and record events where rule matching fails.
[0061] B7. Execute the rules, execute the rule logic, and update the event status.
[0062] B8. Output the results, output the results after rule processing, and enter the downstream processing of Flink.
[0063] B9. Statistically calculate the elapsed time and data volume, and statistically calculate the elapsed time and the affected data volume for each rule execution.
[0064] B10. Implement asynchronous processing, implement asynchronous processing, and improve the parallel ability of rule execution.
[0065] B11. Monitor the resource usage, monitor the resource usage of the system.
[0066] B12. Set up an alarm mechanism, set up an alarm mechanism, and trigger it when the rule execution delay exceeds the threshold.
[0067] B13. Develop performance optimization measures.
[0068] B14. Record logs, make detailed log records for abnormal events.
[0069] B15. Provide system operation and maintenance, provide an interface for querying execution results for operation and maintenance and analysis.
[0070] In this technical solution, Step 3 designs and trains the test model.
[0071] Preferably, the specific operation steps of Step 4 are as follows:
[0072] C1. Real-time monitoring, develop a real-time monitoring dashboard to display key performance indicators;
[0073] C2. Collect system data, collect throughput and latency data of the data access module;
[0074] C3. Statistically count the number of rule executions, count the number of rule executions and the average processing time;
[0075] C4. System monitoring, monitor the system resource utilization rate;
[0076] C5. Log collection and storage, implement log collection and centralized storage;
[0077] C6. Anomaly detection, design an anomaly detection algorithm to identify system anomalies;
[0078] C7. Enterprise WeChat notification, send real-time notifications to responsible personnel through Enterprise WeChat;
[0079] C8. Report generation, develop an automatic generation function for the system health status report;
[0080] C9. Data analysis, create a historical data analysis module for trend analysis;
[0081] C10. User feedback, implement a user feedback interface to collect usage experiences;
[0082] C11. Comparison and analysis, set a performance indicator benchmark for automatic comparison and analysis;
[0083] C12. Performance optimization, adjust system parameters to optimize performance;
[0084] C13. Continuous system tuning, continuously optimize the monitoring strategy to improve the monitoring accuracy.
[0085] In this technical solution, step four mainly involves model deployment, actual application, and performance monitoring.
[0086] On the basis of conforming to the common knowledge in this field, the above-mentioned preferred conditions can be combined arbitrarily to obtain various preferred embodiments of the present invention.
[0087] The positive and progressive effects of the present invention are as follows:
[0088] Relying on the stream processing advantages of Flink, the present invention can perform real-time detection and response to XSS attacks, significantly reduce the window period for exploiting security vulnerabilities, and enhance the security of Web applications. By utilizing the powerful feature extraction ability of the convolutional neural network (CNN), it can automatically identify complex malicious program patterns, improve the accuracy and efficiency of detection, and does not rely on traditional feature engineering;
[0089] The system architecture of the present invention supports expansion, can be easily integrated into Web applications of various scales, and is capable of processing large-scale data streams to meet different business requirements;
[0090] The present invention realizes automated detection and response, reduces manual intervention, and improves the overall defense efficiency and reduces the security management cost through real-time blocking and warning functions. BRIEF DESCRIPTION OF THE DRAWINGS
[0091] Figure 1 It is a schematic diagram of the overall process of the method of the dynamic rule engine implemented based on Flink in the embodiment of the present invention.
[0092] Figure 2 is Figure 1 A schematic diagram of the data access and preprocessing process of the method of the dynamic rule engine implemented based on Flink shown in FIG.
[0093] Figure 3 is Figure 1 A schematic diagram of the dynamic rule loading and parsing process of the method of the dynamic rule engine implemented based on Flink shown in FIG.
[0094] Figure 4 is Figure 1 A schematic diagram of the rule execution and processing process of the method of the dynamic rule engine implemented based on Flink shown in FIG.
[0095] Figure 5 is Figure 1 A schematic diagram of the monitoring and feedback process of the method of the dynamic rule engine implemented based on Flink shown in FIG. DETAILED DESCRIPTION OF THE INVENTION
[0096] The present invention will be further described below by way of examples, but the present invention is not limited to the scope of the described examples.
[0097] Figures 1 to 5 Shown is a schematic structural diagram of an embodiment of the method of the dynamic rule engine implemented based on Flink of the present invention. The method of the dynamic rule engine implemented based on Flink includes the following operating steps:
[0098] Step 1, data access and preprocessing, real-time access data from multiple data sources and perform preliminary cleaning and preprocessing;
[0099] Step 2, dynamic rule loading and parsing, dynamically load and parse user-defined rules through a self-developed Java hot loading mechanism;
[0100] Step 3, rule execution and processing, execute the dynamically loaded business rules in step 2 on Flink and process the real-time stream data in step 1;
[0101] Step 4: Monitoring and Feedback. Monitor the overall status, provide a user feedback interface, and support automatic report generation and notification.
[0102] In this technical solution, by combining Flink and a dynamic rule engine, an efficient and real-time rule processing system can be built. Flink is responsible for receiving and processing data streams and serves as the operating environment for the rule engine. The dynamic rule engine, through a hot loading mechanism, realizes the update and management of rules while keeping the system running, provides a user-friendly interface that allows users to define and modify rules online, compiles and loads rules through the Java compilation API and a custom class loader to achieve hot updates, and combines with the distributed processing ability of Flink to optimize the performance of rule execution, ensuring that the rule engine can still respond quickly in scenarios with massive data.
[0103] The overall framework of the above method designs four modules, including: a data access and preprocessing module, a dynamic rule loading and parsing module, a rule execution and processing module, and a monitoring and feedback module.
[0104] The data access and preprocessing module is responsible for real-time accessing data from multiple data sources and performing preliminary cleaning and preprocessing. Through seamless integration with Flink, it ensures the stable and efficient processing of data streams. The data access module supports multiple inputs such as Kafka, HTTP, and file systems, ensuring the compatibility and flexibility of the system. The preprocessing includes operations such as deduplication, correcting data formats, and filtering unnecessary data, providing clean data input for the subsequent operations of the rule engine.
[0105] The dynamic rule loading and parsing module dynamically loads and parses user-defined rules through a self-developed Java hot loading mechanism, accepts new rules without restarting the system to maintain the real-time and flexibility of business logic. Rules are defined through DSL or a simple UI and are translated into executable Java classes. The module is also responsible for syntax and logic verification of the rules and ensures they are error-free before deployment.
[0106] The rule execution and processing module executes the dynamically loaded business rules on Flink and processes real-time stream data. After receiving the data stream passed from the preprocessing module, the module calls the previously loaded rules for event-driven and state updates, and at the same time monitors the performance of rule execution to ensure high efficiency even under high concurrency and guarantee the correctness and stability of rule execution.
[0107] The monitoring and feedback module is responsible for monitoring the overall state of the system, including data processing, rule execution, system performance, etc. At the same time, it provides a user feedback interface, enabling users to understand the system state and operation effect in real time. Key indicators are displayed through a dashboard, providing a basis for system optimization and fault troubleshooting. This module also supports the functions of automatically generating reports and notifications to ensure the healthy operation of the system.
[0108] The preprocessing in the first step includes deduplication, correcting data formats, and filtering unnecessary data.
[0109] In this technical solution, the preprocessing includes operations such as deduplication, correcting data formats, and filtering unnecessary data, providing clean data input for the subsequent operations of the rule engine.
[0110] The data access in the first step supports Kafka, HTTP, and file system inputs.
[0111] In this technical solution, the data access supports multiple inputs such as Kafka, HTTP, and file system, ensuring the compatibility and flexibility of the system.
[0112] The rules in the second step are defined through DSL or UI and translated into executable Java classes.
[0113] The rules in the second step are subjected to syntax and logical verification.
[0114] In this technical solution, it is responsible for performing syntax and logical verification on the rules and ensuring that they are correct before deployment.
[0115] The monitored metrics in the fourth step include data processing, rule execution, and system performance.
[0116] In this technical solution, in the fourth step, it is responsible for monitoring the overall state of the system, including data processing, rule execution, system performance, etc. At the same time, it provides a user feedback interface, enabling users to understand the system state and operation effect in real time.
[0117] The specific operation steps of the first step are as follows:
[0118] S1. Initialize Flink, initialize the Flink environment, and configure execution parameters;
[0119] S2. Receive data streams, configure the Kafka connector to receive real-time data streams;
[0120] S3. Set the input sources, set multiple input sources, and support HTTP interfaces and file systems;
[0121] S4. Perform data format conversion, implement the data format conversion module, and unify the data structure;
[0122] S5. Set the deduplication logic to avoid the impact of duplicate data on the processing results;
[0123] S6. Perform data verification to identify and correct abnormal data;
[0124] S7. Set the filtering rules to exclude unnecessary data;
[0125] S8. Implement data tagging to mark the data for subsequent processing;
[0126] S9. Optimize Flink parameters to adjust the parallelism parameters of Flink and improve data processing performance; S10. Perform fault tolerance processing to monitor the latency and throughput of data access;
[0127] S11. Handle exceptions by setting an error handling mechanism to handle access exceptions;
[0128] S12. Statistically analyze the data to count the input data volume and data quality metrics;
[0129] S13. Implement the reconnection mechanism to ensure the continuity of data access;
[0130] S14. Perform data preprocessing and output the preprocessed data stream for use by subsequent modules. In this technical solution, Step 1 focuses on data collection and preprocessing to prepare the data for cleaning. The specific operation steps of Step 2 are as follows:
[0131] A1. Create rules by creating a rule definition interface that supports DSL and UI input;
[0132] A2. Convert the rules by developing a rule translator to convert the rules into Java source code;
[0133] A3. Compile the Java code by using the Java compilation API to compile the source code into bytecode;
[0134] A4. Implement a custom class loader to load the compiled bytecode;
[0135] A5. Verify the rules by validating the syntax correctness of the rules before loading;
[0136] A6. Check the rule logic by examining the integrity and possible conflicts of the rule logic;
[0137] A7. Manage the rules by creating a rule version management system that supports version rollback;
[0138] A8. Develop tests by creating test cases to verify the correctness of the rules;
[0139] A9. Implement hot loading to ensure that the existing process is not interrupted;
[0140] A10. Monitor performance and logs, including the performance of monitoring rule loading and error logs.
[0141] A11. Interface query, providing an interface to query information about currently loaded rules.
[0142] A12. Priority sorting, implementing priority sorting of rules.
[0143] A13. Front-end UI display, developing a UI feedback mechanism to show the loading results.
[0144] A14. Security authentication, configuring security authentication to prevent unauthorized rule loading.
[0145] A15. Output rules, outputting successfully loaded rules for use by the execution module.
[0146] In this technical solution, step two is implemented through Java's hot loading.
[0147] The specific operation steps of step three are as follows:
[0148] B1. Initialize the context, initializing the rule execution context environment.
[0149] B2. Receive preprocessed data, receiving the preprocessed data stream from step one.
[0150] B3. Valid rule set, retrieving the currently effective rule set.
[0151] B4. Allocate execution paths, allocating appropriate rule execution paths for each data event.
[0152] B5. Rule matching algorithm, implementing the rule matching algorithm to quickly filter applicable rules.
[0153] B6. Capture and record, capturing and recording events where rule matching fails.
[0154] B7. Execute rules, executing the rule logic and updating the event status.
[0155] B8. Output results, outputting the results after rule processing and entering the Flink downstream processing.
[0156] B9. Statistic of time consumption and data volume, statistic of the time consumption and affected data volume of each rule execution; B10. Asynchronous processing, implementing asynchronous processing to improve the parallel ability of rule execution.
[0157] B11. Monitor resource usage, monitoring the resource usage of the system.
[0158] B12. Alarm mechanism: Set up an alarm mechanism to trigger when the rule execution delay exceeds the threshold; B13. Performance optimization: Develop means for performance optimization;
[0159] B14. Log recording: Make detailed log records of abnormal events;
[0160] B15. System operation and maintenance: Provide an interface for querying execution results for operation and maintenance and analysis. In this technical solution, step three designs and trains a test model.
[0161] The specific operation steps of step four are as follows:
[0162] C1. Real-time monitoring: Develop a real-time monitoring dashboard to display key performance indicators;
[0163] C2. Collect system data: Collect throughput and latency data of the data access module;
[0164] C3. Count the number of rule executions: Count the number of rule executions and the average processing time;
[0165] C4. System monitoring: Monitor the system resource utilization rate;
[0166] C5. Log collection and storage: Implement log collection and centralized storage;
[0167] C6. Anomaly detection: Design an anomaly detection algorithm to identify system anomalies;
[0168] C7. Enterprise WeChat notification: Send real-time notifications to responsible personnel through Enterprise WeChat;
[0169] C8. Report generation: Develop an automatic generation function for the system health status report;
[0170] C9. Data analysis: Create a historical data analysis module for trend analysis;
[0171] C10. User feedback: Implement a user feedback interface to collect usage experiences;
[0172] C11. Comparison and analysis: Set a performance indicator benchmark for automatic comparison and analysis;
[0173] C12. Performance optimization: Adjust system parameters to optimize performance;
[0174] C13. Continuous system tuning: Continuously optimize the monitoring strategy to improve monitoring accuracy.
[0175] In this technical solution, step four mainly involves model deployment, actual application, and performance monitoring.
[0176] The present invention combines Flink and a dynamic rule engine to build an efficient and real-time rule processing system. Flink is responsible for receiving and processing data streams and serves as the operating environment for the rule engine. The dynamic rule engine, through a hot loading mechanism, realizes the update and management of rules while keeping the system running, provides a user-friendly interface that allows users to define and modify rules online, compiles and loads rules through the Java compilation API and a custom class loader to achieve hot updates, combines the distributed processing capabilities of Flink to optimize the performance of rule execution, and ensures that the rule engine can still respond quickly in scenarios with massive data.
[0177] Although the specific implementation manners of the present invention are described above, those skilled in the art should understand that this is only an example. The protection scope of the present invention is defined by the appended claims. Without departing from the principles and essence of the present invention, those skilled in the art can make various changes or modifications to these implementation manners, but these changes and modifications all fall within the protection scope of the present invention.
Claims
1. A method for implementing a dynamic rule engine based on Flink, characterized in that: The method comprises the following steps: Step 1: Data access and preprocessing: access data from multiple data sources in real time and perform preliminary cleaning and preprocessing; Step 2: Dynamic rule loading and parsing: Dynamically load and parse user-defined rules through the self-developed Java hot loading mechanism; Step 3: Rule execution and processing: Execute the dynamically loaded business rules in step 2 on Flink and process the real-time stream data in step 1. Step 4: Monitoring and feedback: monitor the overall status, provide a user feedback interface, and support automatic generation of reports and notifications.
2. The method for implementing a dynamic rule engine based on Flink according to claim 1, characterized in that: The preprocessing in step 1 includes deduplication, correction of data format, and filtering of unnecessary data.
3. The method for implementing a dynamic rule engine based on Flink according to claim 1, characterized in that: The data access in step 1 supports Kafka, HTTP, and file system input.
4. The method for implementing a dynamic rule engine based on Flink according to claim 1, characterized in that: The rules in step 2 are defined through DSL or UI and translated into executable Java classes.
5. The method for implementing a dynamic rule engine based on Flink according to claim 1, characterized in that: In the step 2, the rules are subjected to syntax and logic verification.
6. The method for implementing a dynamic rule engine based on Flink according to claim 1, characterized in that: The indicators monitored in step 4 include data processing, rule execution and system performance.
7. The method for implementing a dynamic rule engine based on Flink according to claim 1, characterized in that: The specific operation steps of step one are: S1. Initialize Flink, initialize the Flink environment, and configure execution parameters; S2. Receive data streams and configure the Kafka connector to receive real-time data streams. S3, set input source, set multiple input sources, support HTTP interface and file system; S4, data format conversion, implement data format conversion module and unify data structure; S5. Set deduplication logic to avoid duplicate data affecting processing results; S6, data verification, performing data verification, identifying and correcting abnormal data; S7, set filtering rules, apply filtering rules, and exclude unnecessary data; S8, data labeling, realize data labeling function, and mark it for subsequent processing; S9, Flink parameter tuning, adjust Flink parallelism parameters to improve data processing performance; S10, fault-tolerant processing, monitoring the delay and throughput of data access; S11, handle exceptions, set up error handling mechanisms, and handle access exceptions; S12. Statistical data, including input data volume and data quality indicators; S13, disconnection and reconnection, implement disconnection and reconnection mechanism to ensure the continuity of data access; S14: Data preprocessing, outputting the preprocessed data stream for use by subsequent modules.
8. The method for implementing a dynamic rule engine based on Flink according to claim 1, characterized in that: The specific operation steps of step 2 are: A1. Create rules and create rule definition interface, supporting DSL and UI input; A2. Rule conversion: developing a rule translator to convert rules into Java source code; A3, Java compilation, using the Java compilation API to compile the source code into bytecode; A4. Custom loader, implement custom class loader to load compiled bytecode; A5. Verify the rules. Verify the syntax correctness of the rules before loading. A6. Verify logic to check the integrity of rule logic and possible conflicts; A7. Rule management, create rule version management, and support version rollback; A8. Development testing: Develop test cases to verify the correctness of the rules; A9. Hot loading implementation, implement hot loading method to ensure that the existing process is not interrupted; A10. Monitor performance and logs. Monitor rule loading performance and error logs. A11, interface query, providing interface query information of currently loaded rules; A12, priority sorting, implements the priority sorting of rules; A13. Front-end UI display, develop UI feedback mechanism to display loading results; A14. Security authentication: Configure security authentication to prevent unauthorized rule loading. A15. Output rules: Output the successfully loaded rules for use by the execution module.
9. The method for implementing a dynamic rule engine based on Flink according to claim 1, characterized in that: The specific operation steps of step three are: B1. Initialize context, initialize the rule execution context environment; B2, receiving preprocessed data, receiving the data stream preprocessed in step 1; B3, effective rule set, retrieve the currently effective rule set; B4. Allocate execution paths and assign appropriate rule execution paths to each data event; B5. Rule matching algorithm: Implement the rule matching algorithm to quickly screen applicable rules; B6. Capture and record: capture and record events where rule matching fails; B7, execute rules, execute rule logic, and update event status; B8. Output results. Output the results after rule processing and enter Flink downstream processing. B9. Count the time and data volume, and count the time consumed by each rule execution and the amount of data affected; B10, asynchronous processing, realize asynchronous processing and improve the parallel execution capability of rules; B11. Monitor resource usage and monitor system resource usage; B12. Alarm mechanism: Set an alarm mechanism to be triggered when the rule execution delay exceeds the threshold; B13. Performance optimization, development of performance optimization methods; B14. Log records: Detailed log records of abnormal events; B15. System operation and maintenance, providing execution result query interface for operation and maintenance and analysis.
10. The method for implementing a dynamic rule engine based on Flink according to claim 1, characterized in that: The specific operation steps of step 4 are: C1. Real-time monitoring, develop a real-time monitoring dashboard to display key performance indicators; C2, collect system data, collect throughput and delay data of data access module; C3, count the number of rule executions, count the number of rule executions and the average processing time; C4, system monitoring, monitoring system resource usage; C5. Log collection and storage: implement log collection and centralized storage; C6, anomaly detection, design anomaly detection algorithms to identify system anomalies; C7, WeChat notification: send real-time notification to the responsible personnel through WeChat; C8. Report generation, develop the automatic generation function of system health status report; C9, data analysis, create a historical data analysis module for trend analysis; C10, user feedback, implement the user feedback interface to collect user experience; C11, comparison and analysis, setting performance index benchmarks, automatic comparison and analysis; C12, performance optimization, adjust system parameters to optimize performance; C13. Continuously tune the system and optimize the monitoring strategy to improve monitoring accuracy.
Citation Information
Cited By
Method for automatically monitoring and identifying dangerous driving behavior based on driving scene
CN120708438A