Dynamic Complex Event Processing - Adaptive Rule Engine: Bhargavi R, Ravi Pathak, Vaidehi V

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

2013 International Conference on Recent Trends in Information Technology (ICRTIT)

Dynamic Complex Event Processing – Adaptive


Rule Engine
Bhargavi R, Ravi Pathak, Vaidehi V
Department of Information Technology,
Madras Institute of Technology, Anna University
bhargaviren@gamil.com, pathak.ravi1989@gmail.com, vaidehivijay@gmail.com

Abstract — Recently Complex Event Processing has emerged as agents (EPA) and a set of event sinks or event listeners. Event
a lightweight way to monitor multiple data streams to identify Processing Agents are continuous queries or signatures of
events or patterns of interest. Complex Event Processing is a rule patterns which perform CEP tasks like filtering, aggregating
based technology. Rules which represent the patterns of interest and correlating events or searching for event patterns. EPAs
are defined by domain experts. Existing CEP engines have interface with event sources, event listeners and some times
limitation on addition, deletion and modification of rules. Rules other EPAs. The implementation of any CEP application
are configured initially once and are not changed later. Some of consists of three steps: First, all the event sources are
the engines support initial configuration and occasionally support registered at the system, next all EPAs are defined on the
addition of rules at runtime using the polling mechanism. This event sources and finally, event listeners are registered and
paper proposes a dynamic CEP by making the rule engine
attached or connected to the corresponding EPAs. Once a CEP
adaptive by using Event driven or push based approach for
application has been deployed and started, no changes in the
updating the rules dynamically in the Complex Event Processing
System at runtime. Event driven approach facilitates
event sources or listeners or EPAs are expected. Based on this
Knowledgebase to update rules without polling or observing any most of the existing CEP engines have limitation on addition
resource and hence enhances the system performance. The or modification of rules. Rules are configured initially once
resulting CEP engine with dynamic infrastructure facilitates easy and are not changed later. In CEP reasoning is done using a
addition and deletion of the rules in an easy and efficient way. reactive EPAs/rule-based inference engine designed to deal
Index Terms— Complex Event Processing, Event Driven with a continuous stream of real-time event objects. Rules are
Architecture, Rule Based Expert System, Knowledgebase, data defined by domain experts. The system is initially configured
streams. with all the rules which define the complex events or patterns
to be identified and alerted. These domain experts need to
provide the set of basic events which serves as input to the
I. INTRODUCTION rule, their interrelationships, and the parameters of the events
Many of the distributed applications require continuous that determine the complex event. Providing all the required
monitoring and processing of information or data in a timely details is a hard task, even for experts. In addition, rules may
fashion as it flows from periphery to the system. Intrusion change over time, due to the dynamic nature of the
detection in surveillance, detection of fraudulent credit card application. This paper proposes improvements to CEP
usage, stock market analysis, healthcare monitoring are few technology by making changes to behavior of the
such applications. The key requirements of all these infrastructure dynamic. The proposed dynamic rule updation
applications are - early identification of an event or situation addresses the above mentioned issue.
of interest and quick response generation. Complex Event The core of CEP engine is a rule based Expert System
Processing Technology is being used recently to address the which is also widely used for decision making in Artificial
requirements of such time critical applications. Complex event Intelligent systems. From the most popular expert systems
processing not only perform traditional database and data DENDRAL [18] and MYCIN [19] to the present days
mining processes such as data validation, cleaning, enrichment Business Rule Management System rule based expert system
and analysis, but can also query, filter and transform data from are still marking their excellence. The major challenges in
multiple sensors to enable events to be detected in real time. Rule based Expert Systems are Knowledge Representations,
They provide the ability to automate pattern monitoring, Knowledge, Facts and Rules or Policies Management. In this
which allows events to be correlated so that event response paper we are proposing an event driven solution to dynamic
mechanisms can be developed and critical events can be rule updating in Rule based Expert system.
isolated so that efficient remediation can be taken. Recently,
CEP is used in several monitoring solutions like analyze stock Rest of the paper is organized as follows: Section II gives
markets, search for fraudulent use of credit cards or mobile the related study. Section III explains the proposed model.
phones and perform forecasting in traffic networks or power Section IV gives the implementation details. Performance of
grids [11] – [14]. CEP infrastructure consists of three main the proposed method is discussed in Section V and Section VI
components: a set of event sources, a set of event processing has the conclusion.

ISBN:978-1-4799-1024-3/13/$31.00 ©2013 IEEE 189


2013 International Conference on Recent Trends in Information Technology (ICRTIT)

II. RELATED WORK III. PROPOSED DYNAMIC CEP RULE ENGINE


This section discusses some of the works in the related area. CEP technology characterized by rule based detection
Turchin et al [10] have presented a model and a mechanism paradigm and hence static. In any CEP application all the
for automatically deriving rule parameters. Their model events of interest are analyzed, selected and added to the
provides a one-time parameter derivation mechanism as well system by a domain expert. All these events are then
as a continuous adjustment of parameters based on a correct- formulated as rules which are a combination of patterns or
predict paradigm and involves a continuous adjustment to logical, relational or spatio-temporal relationships among the
parameters using machine learning techniques. Their approach input data and action to be taken on the occurrence of event of
follows that of Kalman estimators, modified to take into interest. Initially rule engine or the expert system
account indirect, rather than direct feedback. This is like preconfigured with all the rules that need to be matched
domain experts provide feedback on the accuracy of event against the input data streams. Once the rules are defined and
materialization, rather than on the parameter values configured the system freezes i.e. rules can not be added
themselves. dynamically at run rime. But there several applications in
Paschke et al [9] have proposed a logic-based homogenous which new rules need to be added to the system after
reaction rule language and a rule and event-based middleware deploying the system for some time (hours, weeks, months,
called RuleML which combine technologies from declarative years). For example suppose Medical diagnosing system like
rule-based programming with enterprise application MYCIN is initially configured for identifying Cold, Cough
technologies for CEP and SOC. The authors have defined and Fever. At a later point in time the system may need to
interval-based event algebra with event definition, event identify cases of pneumonia also. Then arises the need to add
selection and event consumption. They also proposed a new rules in knowledge base to make the rule engine to
homogenously integrated event messaging reaction rule identify pneumonia.
language, called Prova AA. But the proposed work does not There are two approaches to dynamically update the rule
support dynamic addition or update of rules. base at run time with out stopping or restarting the system
Bastian et al [15] have proposed anomaly management 1. First approach is to poll a resource (directory or
using Complex Event Processing. Authors have discussed the URL) at regular intervals of time to check if new
need for a dynamic CEP with several applications. They rules need to be added, if needed then create new
proposed a framework for CEP infrastructure to support processing agents and add to inference engine and
dynamism by incorporating anomaly identification. However interface them with the corresponding input streams
the work does not throw any light on rule management. and output listeners.
Most of the existing CEP systems are based on event driven 2. Second approach is event driven approach in which
architecture and they use Stream Processing engines and the system gets notified whenever a new rule is to be
database system to support continuous querying, pattern added and then update the rule base by creating and
recognition and response generation in near real time. Esper adding new processing agents to inference engine and
[16] uses EsperJMX[21] for runtime management of Esper interfacing them with the corresponding input
CEP; In Esper[2] on Demand Query/rule facility provides for streams and output listeners.
ad-hoc execution of an EPL expression, but it has some
limitations like it cannot perform sub queries, some clauses The second approach/ Proposed approach is more efficient as
are not allowed in there expressions, and if it has to remain it system is notified whenever there is a need to update the rule
need to be executed explicitly all the time. Drools [17] use base rather than polling the resource again and again.
Drools Guvnor[20] for multiuser management of rules in
Drools. Internally Drools uses Knowledge Agents [1] which
uses polling mechanism to support dynamic rules/queries at
runtime. The existing CEP engines support initial
configuration and occasionally support addition of rules at
regular intervals of time using the polling mechanism. From
the literature survey it can be observed that there are several
applications [15] which demand dynamic rule engine to
support adaptability. This paper proposes improvements to
CEP technology by making changes to behavior of the
infrastructure dynamic. The proposed methodology uses Event
driven or pull based approach for updating the rules
dynamically at runtime. Event driven approach facilitates
Knowledgebase to update rules without polling or observing
any resource and hence enhances the system performance. The
resulting CEP engine with pull based architecture for dynamic
rule updation at runtime facilitates easy addition, deletion and
modification of the rules in an easy and efficient way. Figure. 1 General architecture of Rule Engine

190
2013 International Conference on Recent Trends in Information Technology (ICRTIT)

The architecture of a rule engine is shown in Figure 1.In the


following paragraph various components of the rule engine are Figure 2 shows the proposed dynamic rule engine
explained. architecture based on event driven approach.
Expert: An Expert is a domain knowledge person whose
knowledge is used to frame up rules or policies to reason the
inputs.
Rule: A rule is a prescribed method for processing the input
data/ events. Any event of interest or situation of interest is
represented as a rule. These rules are basically domain specific
rules which require expert domain knowledge. A rule is
expressed in the form of
Rule “Rule identifier”
When
(conditions)
Then
(Actions)
end Figure 2 . Proposed Event Driven Architecture for dynamic Rule Updating

Condition can be simple logical, relation or spatiotemporal Following are the functions of the proposed components:
relations across different events. An action is any reactive
action like sending SMS/email, or sending an alert etc, to be Expert Interface: It is a user interface which interacts with
taken on the occurrence of event of interest. experts and Knowledge Engineer to create new rules. Rules
Knowledge Base: Knowledge base is the repository of all the are entered in the specific format.
knowledge of the application. Knowledge base contains rules
or policies to be applied on the inputs coming from different Update Event Source: Update event source is responsible for
sources for its applicability, processes, functions and type generating the knowledge update event. This module lies in
between Expert Interface and Knowledge Listener.
models.
Working Memory: Working Memory is the short term memory Knowledge Event: Knowledge Event is an event object
which keeps recent data for querying and processing the input instance. Knowledge event triggers the Knowledge Base
data with respect to temporal data. update.
Inference Engine: Inference Engine is the reasoning module. It
Knowledge Listener: The Knowledge Base acts like a
has the functional units corresponding to all the rules. These
Knowledge Listener interface. It listens to the Knowledge
functional or processing modules are called as processing
event, and updates the Knowledge Base. This module uses the
agents. Each processing agent is associated with one or more
rules given by the expert in the Expert Interface and creates a
input streams and a sink or listener. Matching of the input data
knowledge package instance and adds it to the knowledge
or facts against the rules stored in the knowledge is done by
Base. Thus the rule base is updated dynamically.
inference engine. Working memory is used by the inference
engine for storing the required data. The engine executes by
Steps for dynamic rule updating:
performing the following match-resolve-act cycle.
1. Enter and submit the new rules to be added in the
• Match: In this first phase, the conditions of all rules Expert Interface.
are matched against the data in the working memory. 2. Generate Knowledge Event instance. Knowledge event
As a result a conflict set is obtained, which consists of instance has all the needed information for creating the
objects of all satisfied rules. new rule.
• Conflict-Resolution: In this second phase, one of the 3. Knowledge Lister gets notified on the Knowledge
rule objects in the conflict set is chosen for execution. event occurrence.
If no rules are satisfied, the engine waits for next input 4. Create knowledge package with the information
from user. collected from the Knowledge event.
• Act: In this third phase, the actions of the rules 5. Add the knowledge package to the Knowledge base.
selected in the conflict-resolution phase are executed. 6. Knowledge base is updated with the new rules as
These actions may change the contents of working added knowledge package.
memory. At the end of this phase, execution returns to
the first phase. The proposed architecture for the rule engine is highly
scalable. Consider big enterprises where huge streams of input
User Interface: User Interface is a GUI (Graphical User data generated every second and there are several rules to be
Interface) for the user is to interact with the system giving executed. A distributed CEP system with multiple CEP rule
inputs to the system and getting the experts decision as output. engines with each rule engine working with a subset of rules

191
2013 International Conference on Recent Trends in Information Technology (ICRTIT)

can be used to get better performance. In such a scenario there are send to Knowledge Listener and later gets added to
may be a subset of rule engines working with different the Knowledgebase.
knowledge bases and a subset of rule engines with multiple
replicas of the same knowledge base. 3. User Interface for adding dynamic rules: To support user
The proposed Event driven dynamic rule engine can be friendliness, a user interface is provided using which
easily scaled to update several knowledge or rule bases users/experts browse, add and compile the new rules
simultaneously in the above mentioned distributed before being added to the knowledge base.
environment. Following are the steps involved in the process:
V. EXPERIMENTAL SETUP AND VALIDATION
1. All Knowledge Listeners gets registered to registry at
Knowledge Source. The proposed event driven dynamic rule engine is validated
2. Knowledge Source gets the list of all Knowledge with tele-healthcare monitoring application.
Listeners by querying its registry.
3. Whenever Expert defines rules on the Expert Interface
and submits the rules Knowledge Event is generated.
4. The knowledge event notifies all the Knowledge
Listeners and there rule bases are updated
simultaneously.

Figure. 4. Architecture of sample Application

The application is developed to monitor the status of health


condition which is indicated by the abnormalities in vital
parameters of a person. The vital parameters like BP, heart
rate, pulse rate, spo2 etc are measured using wearable
physiological sensors. The data generated by the sensors is
transmitted to a server where the proposed event driven
dynamic rule engine is running. Initially the knowledge base
of the rule engine is configured to detect the abnormalities in
Figure.3 .Distributed Architecture for Rule Updating BP and heart rate. When the data from the sensors arrive at the
Figure 3 shows the architecture of the distributed dynamic rule engine it checks the data against the existing rules. When
CEP system the doctor finds that pulse rate and spo2 also need to monitored
continuously or some other patterns among the vital
parameters need to be added then the rules are added easily
IV. IMPLEMENTATION
using the Interface provided and whenever the newly added
The proposed event driven dynamic CEP engine is rules get matched alerts are generated.
implemented in Java. Java based JBoss Drools CEP engine is
taken as the core CEP engine and the existing APIs are VI. PERFORMANCE
extended to implement the event driven dynamic CEP engine.
The following modules have been introduced to support event Performance of the proposed dynamic rule engine can be
driven rule updates. analyzed from two angles.

1. Knowledge Update Listener: It is a new added interface Based on computational time:


and it is implemented by all the classes which will have Any rule engine which uses polling technique for rule
Knowledge Base. additions and updates runs a thread which polls the resources
at regular intervals of time to check if any updates are
2. Knowledge Event: This is a new added class. The required. During the polling process Knowledge update takes
knowledge event object contains precompiled rules which place if rule updates are requested by the user. Proposed push

192
2013 International Conference on Recent Trends in Information Technology (ICRTIT)

based or event driven based approach does not require regular


polling and knowledge update takes place only when there is a Push based system:
rule update request. Let ‘n’ be no of times the system polls the It is assumed that time taken to update knowledge base=0 sec
resources in a given time T. Let t1be the time taken for each i.e. as new rules are written it gets added instantaneously to
polling process and t2 be time taken to update the knowledge. the system.
Suppose that update requests exist only ‘m’ times in the total
time T. Time taken for the total rule updates incase of polling Therefore,
based rule engine and proposed push based rule engine can be WT1 = (3-3) =0 sec
computed as follows. WT2= (10-10) =0 sec
WT3= (18-18) =0 sec
Polling based rule engine: WT4= (20-20) =0 sec
WT5= (23-23) =0 sec
Total time taken = (n-m)*t1 + m*(t1+t2) (1) WT6 = (27-27) =0 sec
So Average Waiting time = (0+0+0+0+0+0)/6 = 0 sec
Proposed event driven based rule engine:
From the above it can be concluded that push based or event
Total time taken = m*t2 (2) driven system gives better performance when compared
against polling based system.
Therefore the difference in total time for rule updates is given
by
Time Difference =n*t1 (3) VII. CONCLUSION
This paper proposes a push based or event driven approach
So, Push based techniques is n*t1 times efficient than Pull for incorporating the dynamism in CEP engines. The proposed
based technique. method allows the user to add or modify the rules dynamically
at runtime. The proposed system is implemented to extend the
Based on knowledge update waiting time: open software Drools Complex Event Processing engine. It is
observed that the proposed dynamic CEP engine performs
In polling based system if the polling interval is too large well when compared with engines that allow addition of rules
then the knowledge updates happen very late and the impact based on regular polling approach.
of the rule updates can be seen very late. This problem can be
overcome by making the polling interval small. But, this
causes more polling overhead as seen above. Consider a
Acknowledgment
simple scenario shown in Table 1. Knowledge event
Occurrence column indicates the time instance at which the This research project is supported by NRDMS, Department
knowledge update events are generated. of Science and Technology, New Delhi. The authors would
like to extend their sincere thanks to NRDMS, DST, New
Sl No Knowledge Event Delhi for the support.
Occurrence (sec)
1 3 REFERENCES
2 10 [1] Drools Expert User Guide, Version 5.4.0 CR1, JBoss Drools Team,
3 18 2012, pp.31-33.
[2] Esper Reference, Version 4.9.0, Esper Team and EsperTech Inc, 2012,
4 20 pp.441-443
5 23 [3] Miro Samek (2009, March).”State machine for event based systems”.
6 27 [Online]
Table 1 [4] Available:http://www.barrgroup.com/Embedded-Systems/How-
As the knowledge base update time is the same in both the To/State-Machines-Event-Driven-Systems
[5] Kendal SL,Creen M, “Developing Rules based System,” in An
cases i.e. polling based and Push based only the waiting time introduction to knowledge engineering, London, Springer,2007,pp 126-
is considered for analysis. Average waiting time for 140
knowledge base update in a Polling based system with a [6] Hasan Suleiman,Sean O’Reianin and Edward Curry “Approximate
polling interval of 5 seconds can be computed as follows: Semantic Matching of Heterogeneous Events ,”in 6th ACM International
Conference on Distributed Event-Based Systems (DEBS 2012) Berlin,
Germany, pp- 252–263
[7] Hinze, A., Sachs, K., and Buchmann, “A. Event-based applications and
WT1 = (5-3) =2 sec enabling technologies”, in Proceedings of the 3rd ACM International
WT2 = (10-10) = 0sec Conference on Distributed Event Based Systems, ACM (2009),pp1-15.
[8] Luckham, D.C. “The power of events: an introduction to complex event
WT3 = (20-18) = 2sec processing in distributed enterprise systems”. Addison-Wesley Longman
WT4 = (20-20) = 0 sec Publishing Co., Inc., Boston, MA, USA, 2002.
WT5 = (25-23) = 2 sec [9] A. Paschke, Alexander Kozlenkov, and Harold Boley, “A homogenous
WT6 = (30-27) =3 sec reaction rule language for complex event processing”, In In Proc. 2nd
International Workshop on Event Drive Architecture and Event
Average waiting time: = 2+0+2+0+2+3/6= 1.5sec Processing Systems (EDA-PS), 2007.

193
2013 International Conference on Recent Trends in Information Technology (ICRTIT)

[10] Y. Turchin, A. Gal, and S. Wasserkrug, “Tuning Complex Event


Processing Rules Using the Prediction-Correction Paradigm”, Proc.
Third ACM Int’l Conf. Distributed Event-Based Systems (DEBS’09),
pp. 1 – 12, 2009.
[11] V. Gulisano, R. Jimenez-Peris, M. Patino-Martinez and P. Valduriez.
StreamCloud: a large scale data streaming system. In ICDCS, pp. 126 -
137, 2010.
[12] K. Patroumpas and T. Sellis. Event processing and real-time monitoring
over streaming traffic data. In W2GIS, pp. 116 – 133, 2012.
[13] N. Schultz-M_ller, M. Migliavacca and P. Pietzuch. Distributed complex
event processing with query rewriting. In DEBS, pages 1 - 12, July
2009.
[14] K. Teymourian, M. Rohde and A. Paschke. Knowledge-based
processing of complex stock market events. In EDBT, pages 594 - 597,
2012.
[15] Bastian Hoßbach and Bernhard Seeger. 2013. Anomaly management
using complex event processing: extending data base technology paper.
In Proceedings of the 16th International Conference on Extending
Database Technology (EDBT '13). ACM, New York, NY, USA, pp.
149-154, 2013.
[16] http://esper.codehaus.org/
[17] http://www.jboss.org/drools/
[18] Lindsay, Robert K., Bruce G. Buchanan, E. A. Feigenbaum, and Joshua
Lederberg. DENDRAL: A Case Study of the First Expert System for
Scientific Hypothesis Formation. Artificial Intelligence 61, 2 (1993):
209-261.
[19] Buchanan, B.G.; Shortliffe, E.H. (1984). Rule Based Expert Systems:
The MYCIN Experiments of the Stanford Heuristic Programming
Project. Reading, MA: Addison-Wesley. ISBN 978-0-201-10172-0.
[20] Drools Guvnor User Guide, Version 5.4.0 CR1, JBoss Drools Team,
2012, pp.1-2.
[21] http://www.espertech.com/resources/sd_esperjmx.html

194

You might also like