State Machine Instance for Complex Event Processing Memory Optimization
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
In complex real-time service scenarios, CEP systems face increased memory overheads due to the need for multiple state machine instances to cover longer event windows, leading to inefficient pattern matching and potential event missing during sliding windows.
Innovation Solution
A state machine instance performs matching across multiple periods using the start time of each event, allowing for repeated execution with a single instance, thereby reducing the need for multiple instances and avoiding memory overheads.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If a longer window is used to cover more events in complex scenarios, then event coverage is improved, but the quantity of state machine instances increases greatly, leading to increased memory overheads
Solution Approach 1:
The patent merges multiple state machine instances into a single state machine instance that can handle multiple events within a window. Instead of creating separate state machine instances for each event, the system uses one instance to process all events in the window, thereby reducing memory overhead while maintaining complete event coverage.
Solution Approach 2:
The state machine instance is designed to be universal and multi-functional, capable of handling multiple different events within a window. This single instance performs the work of what would traditionally require multiple specialized instances, reducing the total quantity of state machine instances while maintaining the ability to cover all events in the extended window.
2Reliability
If multiple state machine instances are created to cover longer windows, then event coverage is improved, but device complexity increases due to managing multiple instances
Solution Approach 1:
The patent combines the functionality of multiple state machine instances into a single instance, thereby simplifying the system architecture. This single instance manages all events within the window, eliminating the complexity associated with creating, managing, and coordinating multiple separate instances.
Solution Approach 2:
Instead of the conventional approach where multiple instances are created to handle different events, the patent inverts this by using a single instance that handles multiple events. This inversion simplifies instance management while maintaining comprehensive event coverage across extended windows.
3Speed
If a sliding window is used for pattern matching, then real-time matching is achieved, but events may be missed when the window slides and previous events fall out of the window
Solution Approach 1:
The system performs preliminary actions by maintaining a state machine instance that retains information about previous events within the window. This allows the system to continue matching patterns across window boundaries without losing track of events that occur near the edges of the sliding window, thereby preventing event loss while maintaining real-time processing.
Solution Approach 2:
The state machine instance maintains continuous operation across multiple events and window positions, ensuring that pattern matching is performed continuously without interruption. This continuity ensures that no events are missed as the window slides, as the single instance persists and processes all events within its scope throughout the matching period.
Data Source
Figure 1~2
Figure 3~4
Figure 5
AI summary
Embodiments of the present invention relate to the field of data processing technologies, and disclose an event processing method and apparatus, which can reduce memory overheads when a CEP system performs pattern matching in a complex scenario. The method in the embodiments of the present invention includes: after the Xth event occurs, performing, by a state machine instance, matching in a current matching period; when no result indicating successful matching is obtained, detecting, by the state machine instance, whether a quantity of events that have currently occurred is greater than 1; and if the quantity of events that have currently occurred is greater than 1, using a time when the (X+1)th event occurs as a start time of a next matching period, and performing matching again in the next matching period. The present invention is applicable to a device on which a system having a pattern matching function runs.