The embodiments discussed herein are directed to a complex event processing apparatus and a complex event processing method.
Complex event processing (CEP), in which data generated in a system is monitored in real-time as a stream and a certain process is executed depending on the pattern of the data thus monitored, has been increasingly becoming popular in recent years. While CEP is sometimes referred to as event stream processing (ESP), ESP is herein included in CEP and collectively referred to as CEP.
As an example of CEP, a fluctuation of a stock price or a currency exchange rate is received as a stream, and transactions are executed automatically corresponding to the pattern of the fluctuation. As another example, a temperature detected with a temperature sensor installed outdoor or indoor is received as a stream, and a sprinkler is caused to operate automatically corresponding to a temperature change.
In CEP, a received stream is matched against a condition expression, which is referred to as a query or a rule, to detect an event, and the event thus detected is executed. As an example, a server performing CEP stores therein a query X for executing an event X when a phenomenon A, a phenomenon B, and a phenomenon C are detected consecutively, and a query Y for executing an event Y when the phenomenon A, the phenomenon B, and a phenomenon D are received within a predetermined time period.
The server detects a phenomenon from a received stream and stores the phenomenon in a memory or the like as intermediate data. When the phenomenon A, the phenomenon B, and the phenomenon C are stored consecutively as intermediate data, the server executes the event X. When the phenomenon A, the phenomenon B, and the phenomenon D are stored as intermediate data within the predetermined time period, the server executes the event Y. A related-art example is described in IT Architect, Vol. 23, IDG Japan, 2009, pp. 128-132.
In CEP, a detecting complex event condition expression (rule) is sometimes changed. However, because data streams keep arriving continuously, problems such as those described below might occur when a rule in CEP is changed.
In a conventional technology, once CEP is stopped and restarted after the rule is changed, the CEP becomes incapable of detecting events while the CEP is stopped and for a certain time period after restart. In addition, even when the load of the CEP is dynamically distributed based on a stream load, such a condition of the load distribution may not be inherited.
According to an aspect of an embodiment of the invention, a complex event processing apparatus for processing a complex event by detecting an establishment status of a plurality of conditions so as to process an event includes a comparing unit that compares, when a detecting complex event condition expression is changed, complex event condition expressions before and after the change, an identifying unit that identifies a changed portion based on a result of comparison, and a parallel operating unit that operates the complex event condition expressions before and after the change in parallel, for the detecting complex event condition expression including the changed portion identified by the identifying unit.
According to another aspect of an embodiment of the invention, a complex event processing apparatus for processing a complex event by detecting an establishment status of a plurality of conditions so as to process an event includes a storing unit that stores the establishment status of the conditions, a stopping unit that stops detection of the establishment status of the conditions, a starting unit that restarts the detection, and a replaying unit that replays changes in the establishment status of the conditions having occurred at least during a period from when the detection is stopped to when the detection is restarted, after the starting unit restarts the detection.
According to still another aspect of an embodiment of the invention, a complex event processing apparatus for processing a complex event by detecting an establishment status of a plurality of conditions so as to process an event includes a creating unit that creates, when a detecting complex event condition expression is changed, a complex event condition expression after the change in a test mode, a parallel operating unit that operates the complex event condition expression before the change in parallel with the complex event condition expression after the change in the test mode, and a notifying unit that notifies the complex event condition expression in the test mode of the establishment status of the conditions in the complex event condition expression before the change, and reflects the establishment status to the complex event condition expression in the test mode.
The object and advantages of the embodiment will be realized and attained by means of the elements and combinations particularly pointed out in the claims.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory and are not restrictive of the embodiment, as claimed.
Preferred Embodiments of the Present Invention will be explained with reference to accompanying drawings. These embodiments are not intended to limit the technologies disclosed herein.
The manager 11 includes a CEP engine 40 and a rule change processing unit 41. The CEP engine 40 makes a reference to a CEP definition database 21 to control data streams and to manage the CEP. In
The rule change processing unit 41 performs a process of changing a CEP rule that is a detecting complex event condition expression. The rule change processing unit 41 includes a rule comparing unit 51, a changed portion identifying unit 52, and a parallel operating unit 53.
When a detecting complex event condition expression is changed, the rule comparing unit 51 compares complex event condition expressions before and after the change. Upon comparing the condition expressions, the rule comparing unit 51 may compare the rule descriptions specifying the conditions themselves, or CEP status management records and the like that are currently in operation. The changed portion identifying unit 52 identifies which portion of the rule is changed based on the comparison result. The parallel operating unit 53 operates the rules before and after the change in parallel, for the rule including the changed portion thus identified.
The parallel operating unit 53 also deletes the rule before the change, after event management information associated with the complex event condition expression before the change is exported as the management information for the rule after the change and the rule after the change is activated.
In this manner, the rule change processing unit 41 changes a CEP rule dynamically without stopping the operation of the CEP, by causing the rule comparing unit 51, the changed portion identifying unit 52, and the parallel operating unit 53 to operate.
Conditions and combinations of such conditions included in a rule are registered in the CEP definition database 21. The number of conditions in a rule being satisfied at a certain point in time is managed as intermediate status management. The intermediate status management may be loaded onto the memory of the manager 11 or the servers 31 to 34. The manager 11 also manages the performance of, the amount of resources in, and restrictions on the servers 31 to 34. More specifically, the manager 11 manages central processing units (CPUs), memories, networks, and real-time performance and the like.
Similarly, the sub-rule R1b is met when the conditions E1 and E6 are satisfied after the condition E2 is satisfied, and the conditions E5 and E4 are satisfied after the condition E1 is satisfied.
An example of changing the rule R1 to a rule R1′ will now be explained. The rule R1′ is a rule in which the condition E1 in the sub-rule R1b of the rule R1 is replaced with a condition E7, thus changing the sub-rule R1b to a sub-rule R1b′.
The rule comparing unit 51 compares the rule R1 before the change with the rule R1′ after the change. The changed portion identifying unit 52 identifies that a condition in the sub-rule R1b′ has been changed based on the result of the comparison between these rules. The parallel operating unit 53 temporarily operates both of the sub-rule R1b before the change and the sub-rule R1b′ after the change in parallel, adds and merges the window and the intermediate status management record and the like related to the sub-rule R1b′, which is the new rule, and deletes the sub-rule R1b, which is the old rule, when the new rule becomes active. As ways for activating the sub-rule after the change, activation may be delayed until a predetermined range completes, or the sub-rule may be activated quickly by tracking back a stream log and replaying the log.
When an addition, instead of a change, is made to the rule, the new rule, and the window and the intermediate status management record and the like related to the new rule are added immediately. When a rule is deleted, the old rule to be deleted, and the window and the intermediate status management record and the like related to the old rule can simply be deleted immediately.
In this manner, the rule change processing unit 41 specifies and detects a portion having been changed (or added or deleted) in the CEP rule, and designates a new and changed (or added or deleted) rule to the old rule that is currently in operation. The old and the new rules are then compared to determine the portion having been changed in the rule description or the operation environment. An example of the operation environment includes intermediate status management.
When the rule is not changed (NO at S104) but is added (YES at S108), the rule change processing unit 41 adds the management information corresponding to the new rule (S109), and ends the process.
When the rule is not added (NO at S108) but deleted (YES at 5110), the rule change processing unit 41 deletes the management information corresponding to the old rule (5111), and ends the process. If no rule is deleted (NO at 5110), in other words, if there is no difference between the new rule and the old rule, the process is ended as it is.
As described above, in the complex event processing apparatus according to the first embodiment, when a detecting complex event condition expression is changed, the rule comparing unit 51 compares the complex event condition expressions before and after the change. The changed portion identifying unit 52 then identifies a changed portion based on the comparison result, and the parallel operating unit 53 operates the complex event condition expression after the change in parallel with the complex event condition expression before the change, for the detecting complex event condition expression including the changed portion thus identified. Therefore, the complex event processing apparatus disclosed herein can dynamically change the detecting complex event condition expression used in the complex event processing.
The rule change processing unit 42 includes a status storing unit 61, a stopping unit 62, a starting unit 63, and a replaying unit 64. The status storing unit 61 stores the establishment status of a plurality of conditions of a rule as a checkpoint in the checkpoint database 23. The stopping unit 62 stops the rule so as to stop detecting the establishment status of the conditions. The stream storing process may be notified that the CEP or a rule has been stopped, or the identifier of the last stream completed with the CEP process may be stored (marked) on the side of the CEP checkpoint process, for example. The starting unit 63 restarts the rule to restart detecting the establishment status of the conditions.
The replaying unit 64 reads changes in the establishment status of the conditions having occurred during the period at least from when the detection is stopped to when the detection is started from the stream log database 22, and replays the changes after the starting unit 63 restarts the rule.
The stream log storing unit 44 keeps obtaining data streams continuously both while the CEP is in operation and is stopped, and stores the data streams in the stream log database 22.
When the CEP is stopped, the status storing unit 61 stores the CEP management record (e.g., the window or the intermediate status management) in the checkpoint database 23. The stream log storing process is then notified that the CEP has been stopped. This notification is a part of the checkpoint. The stream storing process may be notified that the CEP has been stopped, or the identifier of the last stream completed with the CEP process may be stored (marked) on the side of the CEP checkpoint process, for example.
The CEP management record is then restored from the checkpoint when the rule is restarted. The replaying unit 64 then replays the stream log corresponding to the period while the CEP is stopped to detect phenomena therefrom while the CEP is stopped. The replaying unit 64 replays the stream log so as to replay the phenomena in the data streams. Therefore, the data streams may be replayed at faster occurrence timing of the phenomena than that in the original, in other words, may be replayed at a faster speed. The restarted CEP receives and processes the replayed data streams to generate events.
If no change has been made while the CEP is stopped, the replaying unit 64 replays the streams for the period while the CEP is stopped (S209), and ends the process. If any change has been made to the rules while the CEP is stopped (YES at S205), the replaying unit 64 tracks back the stream log by the new window, and creates the new window and the management information (S206). The rule change processing unit 42 then releases the resources used for the old rule (S207), and deletes the old rule (S208). The replaying unit 64 then replays the streams (S209), and ends the process.
As described above, in the complex event processing apparatus according to the second embodiment, the status storing unit 61 creates a checkpoint, and the replaying unit 64 replays the streams for the period from when the CEP is stopped by the stopping unit 62 and to when the CEP is restarted by the starting unit 63. If a change is made to a rule while the CEP is stopped, the replaying unit 64 tracks back the log by the new window and replays the streams. Therefore, even if the CEP is stopped, the complex event processing apparatus disclosed herein can detect events during the time the CEP is stopped and after the CEP is restarted. Furthermore, a rule can be changed while the CEP is stopped. If the load of the CEP has been distributed dynamically based on the stream load, such a condition of load distribution can also be inherited.
The rule change processing unit 43 includes a test mode creating unit 71, a resource notifying unit 72, a parallel operating unit 73, and a rule replacing unit 74. When a rule is changed, the test mode creating unit 71 creates the rule after the change in a test mode. The parallel operating unit 73 operates the rule before the change in parallel with the rule after the change in the test mode. The resource notifying unit 72 then notifies and reflects the establishment status of the conditions of the rule before the change to the rule in the test mode. The rule replacing unit 74 then changes the mode of the rule after the change from the test mode to a normal mode, and deletes the rule before the change.
The rule change processing unit 43 at first operates the rules R21 to R23 that are new rules in the “test mode”, and entire related parties recognize the “test mode” concerning related applications and data, for example.
The old rules R11 to R13 then notify the new rules R21 to R23 of resources (a condition of a parallel distribution, for example), and synchronize the resource conditions with the new rules R21 to R23. At this time, if an extra capacity is available in the same resource as the old rules (server), the new rules are assigned to that resource. If an extra capacity is not available in the resource, it is preferable to assign the new rules to a different resource.
After operating and validating the new rules R21 to R23 in the test mode for a certain time period, the old rules R11 to R13 are replaced with the new rules R21 to R23. In other words, the old rules R11 to R13 are shifted to the test mode, and the new rules R21 to R23 are shifted to the normal mode. If no problem occurs after replacing the rules, the new rules R21 to R23 are kept being operated as the official version, and the operations of the old rules R11 to R13 are stopped. In this manner, the rule change processing unit 43 inherits the condition of the resources (the condition of the parallel distribution, for example) to the new rules.
As described above, in the complex event processing apparatus according to the embodiment, the test mode creating unit 71 operates the new rules in the test mode in parallel with the old rules, and the resource notifying unit 72 notifies the new rules of the resources utilized by the old rules. Therefore, the complex event processing apparatus disclosed herein can dynamically change a detecting complex event condition expression used in the complex event processing. In addition, when the load of the CEP has been dynamically distributed based on the stream load, such a condition of the load distribution can be inherited.
The complex event processing apparatuses disclosed in the first to the third embodiments may also be realized as computer programs. Such complex event processing programs are executed on a computer, in other words, the programs are loaded onto a memory, and each procedure thereof is sequentially executed by a processor to cause the computer to perform the same operations as those performed by the complex event processing apparatus as described above. Furthermore, the complex event processing programs can be stored in a non-transitory computer-readable storage medium such as Solid State Drive (SSD), Hard Disk Drive (HDD) and the like.
The complex event processing apparatus, the complex event processing method, and the complex event processing program disclosed in the present application can dynamically change a detecting complex event condition expression in complex event processing.
All examples and conditional language recited herein are intended for pedagogical purposes to aid the reader in understanding the invention and the concepts contributed by the inventor to furthering the art, and are to be construed as being without limitation to such specifically recited examples and conditions, nor does the organization of such examples in the specification relate to a showing of the superiority and inferiority of the invention. Although the embodiments of the present invention have been described in detail, it should be understood that the various changes, substitutions, and alterations could be made hereto without departing from the spirit and scope of the invention.
Number | Date | Country | Kind |
---|---|---|---|
2010-226077 | Oct 2010 | JP | national |
This application is a continuation of application Ser. No. 13/187,627, filed Jul. 21, 2011, which is based upon and claims the benefit of priority of the prior Japanese Patent Application No. 2010-226077, filed on Oct. 5, 2010, the entire contents of which are incorporated herein by reference.
Number | Date | Country | |
---|---|---|---|
Parent | 13187627 | Jul 2011 | US |
Child | 15004306 | US |