SlideShare a Scribd company logo
1 of 67
Download to read offline
WSO2 Complex Event Processor 
Sriskandarajah Suhothayan (Suho) 
Srinath Perera 
WSO2 Inc.
Outline 
• BigData 
• Complex Event Processing 
• Basic Constructs of Query Language 
• CEP Solution Patterns 
• Scale, HA and Performance 
• Demo
Why Big Data is hard? 
• How store? Assuming 1TB bytes it takes 1000 
computers to store a 1PB 
• How to move? Assuming 10Gb network, it 
takes 2 hours to copy 1TB, or 83 days to copy 
a 1PB 
• How to search? Assuming each record is 1KB 
and one machine can process 1000 records 
per sec, it needs 277CPU days to process a 
1TB and 785 CPU years to process a 1 PB 
• How to process? 
– How to convert algorithms to work in large size 
– How to create new algorithms 
http://www.susanica.com/photo/9
Why it is hard (Contd.)? 
• System build of many computers 
• That handles lots of data 
• Running complex logic 
• This pushes us to frontier of 
Distributed Systems and Databases 
• More data does not mean there is a 
simple model 
• Some models can be complex as 
the system 
http://www.flickr.com/photos/mariachily/5250487136, 
Licensed CC
Big data Processing Technologies 
Landscape
WSO2 Bigdata Offerings
CEP Is & Is NOT! 
• Is NOT! 
• Simple filters 
• Simple Event Processing 
• E.g. Is this a gold or platinum customer? 
• Joining multiple event streams 
• Event Stream Processing 
• Is ! 
• Processing multiple event streams 
• Identify meaningful patterns among streams 
• Using temporal windows 
• E.g. Notify if there is a 10% increase in overall trading activity AND the 
average price of commodities has fallen 2% in the last 4 hours
What is ?
Query Functions of CEP 
• Filter 
• Transformation 
• Window + { Aggregation, group by } 
• Join 
• Event Sequence 
• Event Table
CEP Architecture
Event Streams 
• Event stream is a sequence of events 
• Event streams are defined by Stream Definitions 
• Events streams have in-flows and out-flows 
• Inflows can be from 
• Event builders 
Converts incoming XML, JSON, etc events to event 
stream 
• Execution plans 
• Outflows are to 
• Event formatters 
Converts to event stream to XML, JSON, etc events 
• Execution plans
Stream Definition 
{ 
'name':'phone.retail.shop', 'version':'1.0.0', 
'nickName': 'Phone_Retail_Shop', 'description': 'Phone Sales', 
'metaData':[ 
{'name':'clientType','type':'STRING'} 
], 
'correlaitonData':[ 
{'name':’transactionID’,'type':'STRING'} 
], 
'payloadData':[ 
{'name':'brand','type':'STRING'}, {'name':'quantity','type':'INT'}, 
{'name':'total','type':'INT'}, {'name':'user','type':'STRING'} 
] 
}
Event Format 
• Standard event formats are available for 
• XML 
• JSON 
• Text 
• Map 
• WSO2 Event 
• If events adhere to the standard format 
they do not need data mapping. 
• If events do not adhere 
custom event mapping should be configured in 
Event builder & Event Formatter 
appropriately.
Event Format 
Standard XML event format 
<events> 
<event> 
<metaData> 
<tenant_id>2</tenant_id> 
</metaData> 
<correlationData> 
<activity_id>ID5</activity_id> 
</correlationData> 
<payloadData> 
<clientPhoneNo>0771117673</clientPhoneNo> 
<clientName>Mohanadarshan</clientName> 
<clientResidenceAddress>15, Alexendra road, 
California</clientResidenceAddress> 
<clientAccountNo>ACT5673</clientAccountNo> 
</payloadData> 
</event> 
<events>
CEP Execution Plan 
● Is an isolated logical execution unit 
● Each execution plan imports some of the event streams 
available in CEP and defines the execution logic using queries 
and exports the results as output event streams. 
● Has one-to-one relationship with CEP Backend Runtime. 
● Has many-to-many relationship with Event Streams. 
● Each execution plan spawns a Siddhi Engine Instance.
CEP Solution patterns 
1. Transformation - project, translate, enrich, split 
2. Filter 
3. Composition / Aggregation / Analytics 
● basic stats, group by, moving averages 
4. Join multiple streams 
5. Detect patterns 
● Coordinating events over time 
● Trends - increasing, decreasing, stable, non-increasing, non-decreasing, 
mixed 
6. Blacklisting 
7. Building a profile
Siddhi Query Structure 
define stream <event stream> 
(<attribute> <type>,<attribute> <type>, ...); 
from <event stream> 
select <attribute>,<attribute>, ... 
insert into <event stream> ;
Siddhi Query : Projection 
define stream TempStream 
(deviceID long, roomNo int, temp double); 
from TempStream 
select roomNo, temp 
insert into OutputStream ;
Siddhi Query : Inferred Streams 
from TempStream 
select roomNo, temp 
insert into OutputStream ; 
define stream OutputStream 
(roomNo int, temp double);
Siddhi Query : Enrich 
from TempStream 
select roomNo, temp,‘C’ as scale 
insert into OutputStream 
define stream OutputStream 
(roomNo int, temp double, scale string);
Siddhi Query : Enrich 
from TempStream 
select deviceID, roomNo, avg(temp) as avgTemp 
insert into OutputStream ;
Siddhi Query : Transformation 
from TempStream 
select concat(deviceID, ‘-’, roomNo) as uid, 
toFahrenheit(temp) as tempInF, 
‘F’ as scale 
insert into OutputStream ;
Siddhi Query : Split 
from TempStream 
select roomNo, temp 
insert into RoomTempStream ; 
from TempStream 
select deviceID, temp 
insert into DeviceTempStream ;
Siddhi Query : Filter 
from TempStream [temp > 30.0 and roomNo != 2043] 
select roomNo, temp 
insert into HotRoomsStream ;
Siddhi Query : Window 
from TempStream 
select roomNo, avg(temp) as avgTemp 
insert into HotRoomsStream ;
Siddhi Query : Window 
from TempStream#window.time(1 min) 
select roomNo, avg(temp) as avgTemp 
insert into HotRoomsStream ;
Siddhi Query : Window 
from TempStream#window.time(1 min) 
select roomNo, avg(temp) as avgTemp 
group by roomNo 
insert into HotRoomsStream ;
Siddhi Query : Batch Window 
from TempStream#window.timeBatch(5 min) 
select roomNo, avg(temp) as avgTemp 
group by roomNo 
insert into HotRoomsStream ;
Siddhi Query : Join 
define stream TempStream 
(deviceID long, roomNo int, temp double); 
define stream RegulatorStream 
(deviceID long, roomNo int, isOn bool);
Siddhi Query : Join 
define stream TempStream 
(deviceID long, roomNo int, temp double); 
define stream RegulatorStream 
(deviceID long, roomNo int, isOn bool); 
from TempStream[temp > 30.0]#window.time(1 min) as T 
join RegulatorStream[isOn == false]#window.lenght(1) as R 
on T.roomNo == R.roomNo 
select T.roomNo, R.deviceID, ‘start’ as action 
insert into RegulatorActionStream ;
Siddhi Query : Detect Trend 
from t1=TempStream, 
t2=TempStream [t1.temp < t2.temp and 
t1.deviceID == t2.deviceID]+ 
within 5 min 
select t1.temp as initialTemp, 
t2.temp as finalTemp, 
t1.deviceID, 
t1.roomNo 
insert into IncreaingHotRoomsStream ;
Siddhi Query : Partition 
define partition Device by TempStream.deviceID ; 
define partition Temp by 
range TempStream.temp <= 0 as ‘ICE’, 
range TempStream.temp > 0 and 
TempStream.temp < 100 as ‘WATER’, 
range TempStream.temp > 100 as ‘VAPOUR’ ;
Siddhi Query : Detect Trend per Partition 
define partition Device by TempStream.deviceID ; 
from t1=TempStream, 
t2=TempStream [t1.temp < t2.temp and 
t1.deviceID == t2.deviceID]+ 
within 5 min 
select t1.temp as initialTemp, 
t2.temp as finalTemp, 
t1.deviceID, 
t1.roomNo 
insert into IncreaingHotRoomsStream 
partition by Device ;
Siddhi Query : Detect Pattern 
define stream Purchase (price double, cardNo long,place string); 
from every (a1 = Purchase[price < 10] -> a3= ..) -> 
a2 = Purchase[price >10000 and a1.cardNo == a2.cardNo] 
within 1 day 
select a1.cardNo as cardNo, a2.price as price, a2.place as place 
insert into PotentialFraud ;
Siddhi Query : Define Event Table 
define table CardUserTable (name string, cardNum long) ; 
define table CardUserTable (name string, cardNum long) 
from (‘datasource.name’=‘CardDataSource’, ‘table.name’= 
‘UserTable’, ‘caching.algorithm’=‘LRU’) ; 
Cache types supported 
● Basic: A size-based algorithm based on FIFO. 
● LRU (Least Recently Used): The least recently used event is dropped 
when cache is full. 
● LFU (Least Frequently Used): The least frequently used event is dropped 
when cache is full.
Siddhi Query : Query Event Table 
define stream Purchase (price double, cardNo long, place string); 
define table CardUserTable (name string, cardNum long) ; 
from Purchase#window.length(1) join CardUserTable 
on Purchase.cardNo == CardUserTable.cardNum 
select Purchase.cardNo as cardNo, 
CardUserTable.name as name, 
Purchase.price as price 
insert into PurchaseUserStream ;
Siddhi Query : Insert into Event Table 
define stream FraudStream (price double, cardNo long, userName 
string); 
define table BlacklistedUserTable (name string, cardNum long) ; 
from FraudStream 
select userName as name, cardNo as cardNum 
insert into BlacklistedUserTable ;
Siddhi Query : Update into Event Table 
define stream LoginStream (userID string, 
islogin bool, loginTime long); 
define table LastLoginTable (userID string, time long) ; 
from LoginStream 
select userID, loginTime as time 
update LastLoginTable 
on LoginStream.userID == LastLoginTable.userID ;
Siddhi Extensions 
● Function extension 
● Aggregator extension 
● Window extension 
● Transform extension
Siddhi Query : Function Extension 
from TempStream 
select deviceID, roomNo, 
custom:toKelvin(temp) as tempInKelvin, 
‘K’ as scale 
insert into OutputStream ;
Siddhi Query : Aggregator Extension 
from TempStream 
select deviceID, roomNo, temp 
custom:stdev(temp) as stdevTemp, 
‘C’ as scale 
insert into OutputStream ;
Siddhi Query : Window Extension 
from TempStream 
#window.custom:lastUnique(roomNo,2 min) 
select * 
insert into OutputStream ;
Siddhi Query : Transform Extension 
from XYZSpeedStream 
#transform.custom:getVelocityVector(v,vx,vy,vz) 
select velocity, direction 
insert into SpeedStream ;
CEP Event Adaptors 
● For receiving and publishing events 
● Has the configurations to connect to external endpoints 
● Has many-to-one relationship with Event Streams
CEP Event Adaptors 
Support for several transports (network access) 
● SOAP 
● HTTP 
● JMS 
● SMTP 
● SMS 
● Thrift 
● Kafka 
Supporting data formats 
● XML 
● JSON 
● Map 
● Text 
● WSO2Event - WSO2 data format over Thrift for High Performant Event transfer 
supporting Java/C/C++/C# via Thrift language bindings
CEP Event Adaptors 
Supports database writes using Map messages 
● Cassandra 
● MYSQL 
● H2 
Supports custom event adaptors 
via its pluggable architecture!
Monitoring & Debugging : Event Flow 
● Visualization of the Event Stream flow in CEP 
● Helps to get the big picture 
● Good for debugging
Monitoring & Debugging : Event Tracer 
• Dump message traces in a textual format 
• Before and after processing each stage of event flow
Monitoring & Debugging : Event Statistics 
• Real-time statistics 
• via visual illustrations & JMX 
• Time based request & response counts 
• Stats on all components of CEP server
Real Time Dashboard 
• Provides tools to configure gadgets 
• Currently supports RDBMS only 
• Powered by WSO2 User Engagement Server ( WSO2UES)
Performance Results 
• Same JVM Performance (Siddhi with Esper, M means a Million) 
4 core machine 
• Filters 8M Events/Sec vs Esper 2M 
• Window 2.5M Events/Sec vs. Esper 1M 
• Patterns 1.4M Events/Sec about 10X faster than Esper 
• Over the Network Performance (Using thrift based WSO2 event 
format) - 8 core machine 
• Filter 0.25M (or 250K) Event/Sec
CEP High Availability 
Execution plan in “RedundantNode” based distributed processing mode 
<executionPlan name="RedundantNodeExecutionPlan" statistics="enable" 
trace="enable" xmlns="http://wso2.org/carbon/eventprocessor"> 
... 
<siddhiConfiguration> 
<property name="siddhi.enable.distributed.processing">RedundantNode</property> 
<property name="siddhi.persistence.snapshot.time.interval.minutes">0</property> 
</siddhiConfiguration> 
... 
</executionPlan>
HA / Persistence 
• Option 1: Side by side 
• Recommended 
• Takes 2X hardware 
• Gives zero down time 
• Option 2: Snapshot and restore 
• Uses less HW 
• Will lose events between snapshots 
• Downtime while recovery 
• ** Some scenarios you can use event tables to keep 
intermediate state
Scaling 
• Vertically scaling 
• Can be distributed as a pipeline 
• Horizontally scaling 
• Queries like windows, patterns, and Join have shared states 
• Hard to distribute!
Scaling (Contd.) 
• Currently users have to setup the pipeline manually (WSO2 team 
can help) 
• Work is underway to support above pipeline and distributer 
operators out of the box
Lambda Architecture
Demo
Scenario 
MyPizzaShop – On time delivery or free Pizza Offer !!!
Order Event 
{ 
"event": { 
"correlationData": { 
"orderNo": "0023" 
}, 
"payloadData": { 
"orderInfo": "2 L PEPPERONI", 
"amount": "25.70", 
"name": "James Mark", 
"address": "29BX Finchwood Ave, Clovis, CA 93611", 
"tpNo": "(626)446-4601" 
} 
} 
}
Delivered to customer event 
correlation_orderNo:23, 
isDelivered:true
Email Notification 
Hi Alis Miranda 
Your order for 1 L CHICKEN pizza will be delivered in 30 mins to 
779 Burl Ave, Clovis, CA 93611. 
The total cost of the order is $14.5. 
If you didn't get the pizza within 30 min you will be eligible to have those pizzas for 
free..!! 
MyPizzaShop
Final Payment Notification 
<event xmlns="http://wso2.org/carbon/event"> 
<correlationData> 
<orderNo>3</orderNo> 
</correlationData> 
<payloadData> 
<name>James Clark</name> 
<amount>54.0</amount> 
</payloadData> 
</event>
Thank You

More Related Content

What's hot

From Zero to Streaming Healthcare in Production (Alexander Kouznetsov, Invita...
From Zero to Streaming Healthcare in Production (Alexander Kouznetsov, Invita...From Zero to Streaming Healthcare in Production (Alexander Kouznetsov, Invita...
From Zero to Streaming Healthcare in Production (Alexander Kouznetsov, Invita...
confluent
 

What's hot (20)

Spark streaming: Best Practices
Spark streaming: Best PracticesSpark streaming: Best Practices
Spark streaming: Best Practices
 
Real-time driving score service using Flink
Real-time driving score service using FlinkReal-time driving score service using Flink
Real-time driving score service using Flink
 
Apache Kafka: New Features That You Might Not Know About
Apache Kafka: New Features That You Might Not Know AboutApache Kafka: New Features That You Might Not Know About
Apache Kafka: New Features That You Might Not Know About
 
A Practical Approach to Building a Streaming Processing Pipeline for an Onlin...
A Practical Approach to Building a Streaming Processing Pipeline for an Onlin...A Practical Approach to Building a Streaming Processing Pipeline for an Onlin...
A Practical Approach to Building a Streaming Processing Pipeline for an Onlin...
 
Distributed Stream Processing - Spark Summit East 2017
Distributed Stream Processing - Spark Summit East 2017Distributed Stream Processing - Spark Summit East 2017
Distributed Stream Processing - Spark Summit East 2017
 
Remote Log Analytics Using DDS, ELK, and RxJS
Remote Log Analytics Using DDS, ELK, and RxJSRemote Log Analytics Using DDS, ELK, and RxJS
Remote Log Analytics Using DDS, ELK, and RxJS
 
(DEV204) Building High-Performance Native Cloud Apps In C++
(DEV204) Building High-Performance Native Cloud Apps In C++(DEV204) Building High-Performance Native Cloud Apps In C++
(DEV204) Building High-Performance Native Cloud Apps In C++
 
Event Sourcing - what could possibly go wrong?
Event Sourcing - what could possibly go wrong?Event Sourcing - what could possibly go wrong?
Event Sourcing - what could possibly go wrong?
 
Andrzej Ludwikowski - Event Sourcing - what could possibly go wrong? - Codemo...
Andrzej Ludwikowski - Event Sourcing - what could possibly go wrong? - Codemo...Andrzej Ludwikowski - Event Sourcing - what could possibly go wrong? - Codemo...
Andrzej Ludwikowski - Event Sourcing - what could possibly go wrong? - Codemo...
 
Building Stateful Microservices With Akka
Building Stateful Microservices With AkkaBuilding Stateful Microservices With Akka
Building Stateful Microservices With Akka
 
Predictive Maintenance with Deep Learning and Apache Flink
Predictive Maintenance with Deep Learning and Apache FlinkPredictive Maintenance with Deep Learning and Apache Flink
Predictive Maintenance with Deep Learning and Apache Flink
 
Performance Analysis and Optimizations for Kafka Streams Applications
Performance Analysis and Optimizations for Kafka Streams ApplicationsPerformance Analysis and Optimizations for Kafka Streams Applications
Performance Analysis and Optimizations for Kafka Streams Applications
 
From Zero to Streaming Healthcare in Production (Alexander Kouznetsov, Invita...
From Zero to Streaming Healthcare in Production (Alexander Kouznetsov, Invita...From Zero to Streaming Healthcare in Production (Alexander Kouznetsov, Invita...
From Zero to Streaming Healthcare in Production (Alexander Kouznetsov, Invita...
 
Developing a Real-time Engine with Akka, Cassandra, and Spray
Developing a Real-time Engine with Akka, Cassandra, and SprayDeveloping a Real-time Engine with Akka, Cassandra, and Spray
Developing a Real-time Engine with Akka, Cassandra, and Spray
 
So you think you can stream.pptx
So you think you can stream.pptxSo you think you can stream.pptx
So you think you can stream.pptx
 
Lambda at Weather Scale - Cassandra Summit 2015
Lambda at Weather Scale - Cassandra Summit 2015Lambda at Weather Scale - Cassandra Summit 2015
Lambda at Weather Scale - Cassandra Summit 2015
 
Reactive Stream Processing Using DDS and Rx
Reactive Stream Processing Using DDS and RxReactive Stream Processing Using DDS and Rx
Reactive Stream Processing Using DDS and Rx
 
spChains: A Declarative Framework for Data Stream Processing in Pervasive App...
spChains: A Declarative Framework for Data Stream Processing in Pervasive App...spChains: A Declarative Framework for Data Stream Processing in Pervasive App...
spChains: A Declarative Framework for Data Stream Processing in Pervasive App...
 
Hadoop metric을 이용한 알람 개발
Hadoop metric을 이용한 알람 개발Hadoop metric을 이용한 알람 개발
Hadoop metric을 이용한 알람 개발
 
Kogito: cloud native business automation
Kogito: cloud native business automationKogito: cloud native business automation
Kogito: cloud native business automation
 

Viewers also liked

12 couplingand cohesion-student
12 couplingand cohesion-student12 couplingand cohesion-student
12 couplingand cohesion-student
randhirlpu
 
Data structure and algorithms in c++
Data structure and algorithms in c++Data structure and algorithms in c++
Data structure and algorithms in c++
Karmjeet Chahal
 
C++: inheritance, composition, polymorphism
C++: inheritance, composition, polymorphismC++: inheritance, composition, polymorphism
C++: inheritance, composition, polymorphism
Jussi Pohjolainen
 

Viewers also liked (20)

Iterator - a powerful but underappreciated design pattern
Iterator - a powerful but underappreciated design patternIterator - a powerful but underappreciated design pattern
Iterator - a powerful but underappreciated design pattern
 
Polymorphism
PolymorphismPolymorphism
Polymorphism
 
Polymorphism and Software Reuse
Polymorphism and Software ReusePolymorphism and Software Reuse
Polymorphism and Software Reuse
 
C++ Inheritance
C++ InheritanceC++ Inheritance
C++ Inheritance
 
The Physical Layer
The Physical LayerThe Physical Layer
The Physical Layer
 
Universal Declarative Services
Universal Declarative ServicesUniversal Declarative Services
Universal Declarative Services
 
Classes And Methods
Classes And MethodsClasses And Methods
Classes And Methods
 
12 couplingand cohesion-student
12 couplingand cohesion-student12 couplingand cohesion-student
12 couplingand cohesion-student
 
Syntax part 6
Syntax part 6Syntax part 6
Syntax part 6
 
XKE - Programming Paradigms & Constructs
XKE - Programming Paradigms & ConstructsXKE - Programming Paradigms & Constructs
XKE - Programming Paradigms & Constructs
 
The Data Link Layer
The Data Link LayerThe Data Link Layer
The Data Link Layer
 
Hashing and Hash Tables
Hashing and Hash TablesHashing and Hash Tables
Hashing and Hash Tables
 
Association agggregation and composition
Association agggregation and compositionAssociation agggregation and composition
Association agggregation and composition
 
04 design concepts_n_principles
04 design concepts_n_principles04 design concepts_n_principles
04 design concepts_n_principles
 
Inheritance in c++ ppt (Powerpoint) | inheritance in c++ ppt presentation | i...
Inheritance in c++ ppt (Powerpoint) | inheritance in c++ ppt presentation | i...Inheritance in c++ ppt (Powerpoint) | inheritance in c++ ppt presentation | i...
Inheritance in c++ ppt (Powerpoint) | inheritance in c++ ppt presentation | i...
 
Data structure and algorithms in c++
Data structure and algorithms in c++Data structure and algorithms in c++
Data structure and algorithms in c++
 
C++: inheritance, composition, polymorphism
C++: inheritance, composition, polymorphismC++: inheritance, composition, polymorphism
C++: inheritance, composition, polymorphism
 
Cohesion & Coupling
Cohesion & Coupling Cohesion & Coupling
Cohesion & Coupling
 
Cohesion and coherence
Cohesion and coherenceCohesion and coherence
Cohesion and coherence
 
The Network Layer
The Network LayerThe Network Layer
The Network Layer
 

Similar to WSO2 Complex Event Processor

Complex Event Processor 3.0.0 - An overview of upcoming features
Complex Event Processor 3.0.0 - An overview of upcoming features Complex Event Processor 3.0.0 - An overview of upcoming features
Complex Event Processor 3.0.0 - An overview of upcoming features
WSO2
 
5-minute Practical Streaming Techniques that can Save You Millions
5-minute Practical Streaming Techniques that can Save You Millions5-minute Practical Streaming Techniques that can Save You Millions
5-minute Practical Streaming Techniques that can Save You Millions
HostedbyConfluent
 
WSO2 Product Release Webinar - WSO2 Complex Event Processor
WSO2 Product Release Webinar - WSO2 Complex Event ProcessorWSO2 Product Release Webinar - WSO2 Complex Event Processor
WSO2 Product Release Webinar - WSO2 Complex Event Processor
WSO2
 
Flink Forward San Francisco 2018: David Reniz & Dahyr Vergara - "Real-time m...
Flink Forward San Francisco 2018:  David Reniz & Dahyr Vergara - "Real-time m...Flink Forward San Francisco 2018:  David Reniz & Dahyr Vergara - "Real-time m...
Flink Forward San Francisco 2018: David Reniz & Dahyr Vergara - "Real-time m...
Flink Forward
 
Reactive & Realtime Web Applications with TurboGears2
Reactive & Realtime Web Applications with TurboGears2Reactive & Realtime Web Applications with TurboGears2
Reactive & Realtime Web Applications with TurboGears2
Alessandro Molina
 

Similar to WSO2 Complex Event Processor (20)

[WSO2Con EU 2018] Patterns for Building Streaming Apps
[WSO2Con EU 2018] Patterns for Building Streaming Apps[WSO2Con EU 2018] Patterns for Building Streaming Apps
[WSO2Con EU 2018] Patterns for Building Streaming Apps
 
Monitoring und Metriken im Wunderland
Monitoring und Metriken im WunderlandMonitoring und Metriken im Wunderland
Monitoring und Metriken im Wunderland
 
Complex Event Processor 3.0.0 - An overview of upcoming features
Complex Event Processor 3.0.0 - An overview of upcoming features Complex Event Processor 3.0.0 - An overview of upcoming features
Complex Event Processor 3.0.0 - An overview of upcoming features
 
[WSO2Con USA 2018] Patterns for Building Streaming Apps
[WSO2Con USA 2018] Patterns for Building Streaming Apps[WSO2Con USA 2018] Patterns for Building Streaming Apps
[WSO2Con USA 2018] Patterns for Building Streaming Apps
 
Api Statistics- The Scalable Way
Api Statistics- The Scalable WayApi Statistics- The Scalable Way
Api Statistics- The Scalable Way
 
Patterns for Building Streaming Apps
Patterns for Building Streaming AppsPatterns for Building Streaming Apps
Patterns for Building Streaming Apps
 
Discover Data That Matters- Deep dive into WSO2 Analytics
Discover Data That Matters- Deep dive into WSO2 AnalyticsDiscover Data That Matters- Deep dive into WSO2 Analytics
Discover Data That Matters- Deep dive into WSO2 Analytics
 
A head start on cloud native event driven applications - bigdatadays
A head start on cloud native event driven applications - bigdatadaysA head start on cloud native event driven applications - bigdatadays
A head start on cloud native event driven applications - bigdatadays
 
5-minute Practical Streaming Techniques that can Save You Millions
5-minute Practical Streaming Techniques that can Save You Millions5-minute Practical Streaming Techniques that can Save You Millions
5-minute Practical Streaming Techniques that can Save You Millions
 
Fabian Hueske_Till Rohrmann - Declarative stream processing with StreamSQL an...
Fabian Hueske_Till Rohrmann - Declarative stream processing with StreamSQL an...Fabian Hueske_Till Rohrmann - Declarative stream processing with StreamSQL an...
Fabian Hueske_Till Rohrmann - Declarative stream processing with StreamSQL an...
 
INTEGRATE 2022 - Data Mapping in the Microsoft Cloud
INTEGRATE 2022 - Data Mapping in the Microsoft CloudINTEGRATE 2022 - Data Mapping in the Microsoft Cloud
INTEGRATE 2022 - Data Mapping in the Microsoft Cloud
 
Building Streaming Applications with Streaming SQL
Building Streaming Applications with Streaming SQLBuilding Streaming Applications with Streaming SQL
Building Streaming Applications with Streaming SQL
 
InfluxDB 101 – Concepts and Architecture by Michael DeSa, Software Engineer |...
InfluxDB 101 – Concepts and Architecture by Michael DeSa, Software Engineer |...InfluxDB 101 – Concepts and Architecture by Michael DeSa, Software Engineer |...
InfluxDB 101 – Concepts and Architecture by Michael DeSa, Software Engineer |...
 
WSO2 Product Release Webinar - WSO2 Complex Event Processor
WSO2 Product Release Webinar - WSO2 Complex Event ProcessorWSO2 Product Release Webinar - WSO2 Complex Event Processor
WSO2 Product Release Webinar - WSO2 Complex Event Processor
 
Flink Forward San Francisco 2018: David Reniz & Dahyr Vergara - "Real-time m...
Flink Forward San Francisco 2018:  David Reniz & Dahyr Vergara - "Real-time m...Flink Forward San Francisco 2018:  David Reniz & Dahyr Vergara - "Real-time m...
Flink Forward San Francisco 2018: David Reniz & Dahyr Vergara - "Real-time m...
 
Stream Processing with Ballerina
Stream Processing with BallerinaStream Processing with Ballerina
Stream Processing with Ballerina
 
Reactive & Realtime Web Applications with TurboGears2
Reactive & Realtime Web Applications with TurboGears2Reactive & Realtime Web Applications with TurboGears2
Reactive & Realtime Web Applications with TurboGears2
 
Cloud Dataflow - A Unified Model for Batch and Streaming Data Processing
Cloud Dataflow - A Unified Model for Batch and Streaming Data ProcessingCloud Dataflow - A Unified Model for Batch and Streaming Data Processing
Cloud Dataflow - A Unified Model for Batch and Streaming Data Processing
 
Comprehensive container based service monitoring with kubernetes and istio
Comprehensive container based service monitoring with kubernetes and istioComprehensive container based service monitoring with kubernetes and istio
Comprehensive container based service monitoring with kubernetes and istio
 
Data to Insight in a Flash: Introduction to Real-Time Analytics with WSO2 Com...
Data to Insight in a Flash: Introduction to Real-Time Analytics with WSO2 Com...Data to Insight in a Flash: Introduction to Real-Time Analytics with WSO2 Com...
Data to Insight in a Flash: Introduction to Real-Time Analytics with WSO2 Com...
 

More from Sriskandarajah Suhothayan

More from Sriskandarajah Suhothayan (11)

Patterns for Deploying Analytics in the Real World
Patterns for Deploying Analytics in the Real WorldPatterns for Deploying Analytics in the Real World
Patterns for Deploying Analytics in the Real World
 
WSO2 Analytics Platform - The one stop shop for all your data needs
WSO2 Analytics Platform - The one stop shop for all your data needsWSO2 Analytics Platform - The one stop shop for all your data needs
WSO2 Analytics Platform - The one stop shop for all your data needs
 
Sensing the world with Data of Things
Sensing the world with Data of ThingsSensing the world with Data of Things
Sensing the world with Data of Things
 
Sensing the world with data of things
Sensing the world with  data of thingsSensing the world with  data of things
Sensing the world with data of things
 
WSO2 Analytics Platform: The one stop shop for all your data needs
WSO2 Analytics Platform: The one stop shop for all your data needsWSO2 Analytics Platform: The one stop shop for all your data needs
WSO2 Analytics Platform: The one stop shop for all your data needs
 
An introduction to the WSO2 Analytics Platform
An introduction to the WSO2 Analytics Platform   An introduction to the WSO2 Analytics Platform
An introduction to the WSO2 Analytics Platform
 
DEBS 2015 Tutorial : Patterns for Realtime Streaming Analytics
DEBS 2015 Tutorial : Patterns for Realtime Streaming AnalyticsDEBS 2015 Tutorial : Patterns for Realtime Streaming Analytics
DEBS 2015 Tutorial : Patterns for Realtime Streaming Analytics
 
Make it fast for everyone - performance and middleware design
Make it fast for everyone - performance and middleware designMake it fast for everyone - performance and middleware design
Make it fast for everyone - performance and middleware design
 
Gather those events : Instrumenting everything for analysis
Gather those events : Instrumenting everything for analysisGather those events : Instrumenting everything for analysis
Gather those events : Instrumenting everything for analysis
 
Intelligent integration with WSO2 ESB & WSO2 CEP
Intelligent integration with WSO2 ESB & WSO2 CEP Intelligent integration with WSO2 ESB & WSO2 CEP
Intelligent integration with WSO2 ESB & WSO2 CEP
 
Manen Ant SVN
Manen Ant SVNManen Ant SVN
Manen Ant SVN
 

Recently uploaded

一比一原版(UCD毕业证书)加州大学戴维斯分校毕业证成绩单原件一模一样
一比一原版(UCD毕业证书)加州大学戴维斯分校毕业证成绩单原件一模一样一比一原版(UCD毕业证书)加州大学戴维斯分校毕业证成绩单原件一模一样
一比一原版(UCD毕业证书)加州大学戴维斯分校毕业证成绩单原件一模一样
wsppdmt
 
Cytotec in Jeddah+966572737505) get unwanted pregnancy kit Riyadh
Cytotec in Jeddah+966572737505) get unwanted pregnancy kit RiyadhCytotec in Jeddah+966572737505) get unwanted pregnancy kit Riyadh
Cytotec in Jeddah+966572737505) get unwanted pregnancy kit Riyadh
Abortion pills in Riyadh +966572737505 get cytotec
 
Gartner's Data Analytics Maturity Model.pptx
Gartner's Data Analytics Maturity Model.pptxGartner's Data Analytics Maturity Model.pptx
Gartner's Data Analytics Maturity Model.pptx
chadhar227
 
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
 
Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...
nirzagarg
 
Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...
Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...
Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...
Klinik kandungan
 
Top profile Call Girls In Hapur [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In Hapur [ 7014168258 ] Call Me For Genuine Models We ...Top profile Call Girls In Hapur [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In Hapur [ 7014168258 ] Call Me For Genuine Models We ...
nirzagarg
 
PLE-statistics document for primary schs
PLE-statistics document for primary schsPLE-statistics document for primary schs
PLE-statistics document for primary schs
cnajjemba
 
Abortion pills in Doha Qatar (+966572737505 ! Get Cytotec
Abortion pills in Doha Qatar (+966572737505 ! Get CytotecAbortion pills in Doha Qatar (+966572737505 ! Get Cytotec
Abortion pills in Doha Qatar (+966572737505 ! Get Cytotec
Abortion pills in Riyadh +966572737505 get cytotec
 
Reconciling Conflicting Data Curation Actions: Transparency Through Argument...
Reconciling Conflicting Data Curation Actions:  Transparency Through Argument...Reconciling Conflicting Data Curation Actions:  Transparency Through Argument...
Reconciling Conflicting Data Curation Actions: Transparency Through Argument...
Bertram Ludäscher
 
Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...
nirzagarg
 
+97470301568>>weed for sale in qatar ,weed for sale in dubai,weed for sale in...
+97470301568>>weed for sale in qatar ,weed for sale in dubai,weed for sale in...+97470301568>>weed for sale in qatar ,weed for sale in dubai,weed for sale in...
+97470301568>>weed for sale in qatar ,weed for sale in dubai,weed for sale in...
Health
 

Recently uploaded (20)

一比一原版(UCD毕业证书)加州大学戴维斯分校毕业证成绩单原件一模一样
一比一原版(UCD毕业证书)加州大学戴维斯分校毕业证成绩单原件一模一样一比一原版(UCD毕业证书)加州大学戴维斯分校毕业证成绩单原件一模一样
一比一原版(UCD毕业证书)加州大学戴维斯分校毕业证成绩单原件一模一样
 
Cytotec in Jeddah+966572737505) get unwanted pregnancy kit Riyadh
Cytotec in Jeddah+966572737505) get unwanted pregnancy kit RiyadhCytotec in Jeddah+966572737505) get unwanted pregnancy kit Riyadh
Cytotec in Jeddah+966572737505) get unwanted pregnancy kit Riyadh
 
Sequential and reinforcement learning for demand side management by Margaux B...
Sequential and reinforcement learning for demand side management by Margaux B...Sequential and reinforcement learning for demand side management by Margaux B...
Sequential and reinforcement learning for demand side management by Margaux B...
 
Gartner's Data Analytics Maturity Model.pptx
Gartner's Data Analytics Maturity Model.pptxGartner's Data Analytics Maturity Model.pptx
Gartner's Data Analytics Maturity Model.pptx
 
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Ranking and Scoring Exercises for Research
Ranking and Scoring Exercises for ResearchRanking and Scoring Exercises for Research
Ranking and Scoring Exercises for Research
 
Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...
 
Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...
Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...
Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...
 
Switzerland Constitution 2002.pdf.........
Switzerland Constitution 2002.pdf.........Switzerland Constitution 2002.pdf.........
Switzerland Constitution 2002.pdf.........
 
The-boAt-Story-Navigating-the-Waves-of-Innovation.pptx
The-boAt-Story-Navigating-the-Waves-of-Innovation.pptxThe-boAt-Story-Navigating-the-Waves-of-Innovation.pptx
The-boAt-Story-Navigating-the-Waves-of-Innovation.pptx
 
Dubai Call Girls Peeing O525547819 Call Girls Dubai
Dubai Call Girls Peeing O525547819 Call Girls DubaiDubai Call Girls Peeing O525547819 Call Girls Dubai
Dubai Call Girls Peeing O525547819 Call Girls Dubai
 
Top profile Call Girls In Hapur [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In Hapur [ 7014168258 ] Call Me For Genuine Models We ...Top profile Call Girls In Hapur [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In Hapur [ 7014168258 ] Call Me For Genuine Models We ...
 
Harnessing the Power of GenAI for BI and Reporting.pptx
Harnessing the Power of GenAI for BI and Reporting.pptxHarnessing the Power of GenAI for BI and Reporting.pptx
Harnessing the Power of GenAI for BI and Reporting.pptx
 
PLE-statistics document for primary schs
PLE-statistics document for primary schsPLE-statistics document for primary schs
PLE-statistics document for primary schs
 
Abortion pills in Doha Qatar (+966572737505 ! Get Cytotec
Abortion pills in Doha Qatar (+966572737505 ! Get CytotecAbortion pills in Doha Qatar (+966572737505 ! Get Cytotec
Abortion pills in Doha Qatar (+966572737505 ! Get Cytotec
 
Predicting HDB Resale Prices - Conducting Linear Regression Analysis With Orange
Predicting HDB Resale Prices - Conducting Linear Regression Analysis With OrangePredicting HDB Resale Prices - Conducting Linear Regression Analysis With Orange
Predicting HDB Resale Prices - Conducting Linear Regression Analysis With Orange
 
Reconciling Conflicting Data Curation Actions: Transparency Through Argument...
Reconciling Conflicting Data Curation Actions:  Transparency Through Argument...Reconciling Conflicting Data Curation Actions:  Transparency Through Argument...
Reconciling Conflicting Data Curation Actions: Transparency Through Argument...
 
Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...
 
Capstone in Interprofessional Informatic // IMPACT OF COVID 19 ON EDUCATION
Capstone in Interprofessional Informatic  // IMPACT OF COVID 19 ON EDUCATIONCapstone in Interprofessional Informatic  // IMPACT OF COVID 19 ON EDUCATION
Capstone in Interprofessional Informatic // IMPACT OF COVID 19 ON EDUCATION
 
+97470301568>>weed for sale in qatar ,weed for sale in dubai,weed for sale in...
+97470301568>>weed for sale in qatar ,weed for sale in dubai,weed for sale in...+97470301568>>weed for sale in qatar ,weed for sale in dubai,weed for sale in...
+97470301568>>weed for sale in qatar ,weed for sale in dubai,weed for sale in...
 

WSO2 Complex Event Processor

  • 1. WSO2 Complex Event Processor Sriskandarajah Suhothayan (Suho) Srinath Perera WSO2 Inc.
  • 2. Outline • BigData • Complex Event Processing • Basic Constructs of Query Language • CEP Solution Patterns • Scale, HA and Performance • Demo
  • 3.
  • 4.
  • 5.
  • 6. Why Big Data is hard? • How store? Assuming 1TB bytes it takes 1000 computers to store a 1PB • How to move? Assuming 10Gb network, it takes 2 hours to copy 1TB, or 83 days to copy a 1PB • How to search? Assuming each record is 1KB and one machine can process 1000 records per sec, it needs 277CPU days to process a 1TB and 785 CPU years to process a 1 PB • How to process? – How to convert algorithms to work in large size – How to create new algorithms http://www.susanica.com/photo/9
  • 7. Why it is hard (Contd.)? • System build of many computers • That handles lots of data • Running complex logic • This pushes us to frontier of Distributed Systems and Databases • More data does not mean there is a simple model • Some models can be complex as the system http://www.flickr.com/photos/mariachily/5250487136, Licensed CC
  • 8. Big data Processing Technologies Landscape
  • 10. CEP Is & Is NOT! • Is NOT! • Simple filters • Simple Event Processing • E.g. Is this a gold or platinum customer? • Joining multiple event streams • Event Stream Processing • Is ! • Processing multiple event streams • Identify meaningful patterns among streams • Using temporal windows • E.g. Notify if there is a 10% increase in overall trading activity AND the average price of commodities has fallen 2% in the last 4 hours
  • 12. Query Functions of CEP • Filter • Transformation • Window + { Aggregation, group by } • Join • Event Sequence • Event Table
  • 14. Event Streams • Event stream is a sequence of events • Event streams are defined by Stream Definitions • Events streams have in-flows and out-flows • Inflows can be from • Event builders Converts incoming XML, JSON, etc events to event stream • Execution plans • Outflows are to • Event formatters Converts to event stream to XML, JSON, etc events • Execution plans
  • 15. Stream Definition { 'name':'phone.retail.shop', 'version':'1.0.0', 'nickName': 'Phone_Retail_Shop', 'description': 'Phone Sales', 'metaData':[ {'name':'clientType','type':'STRING'} ], 'correlaitonData':[ {'name':’transactionID’,'type':'STRING'} ], 'payloadData':[ {'name':'brand','type':'STRING'}, {'name':'quantity','type':'INT'}, {'name':'total','type':'INT'}, {'name':'user','type':'STRING'} ] }
  • 16. Event Format • Standard event formats are available for • XML • JSON • Text • Map • WSO2 Event • If events adhere to the standard format they do not need data mapping. • If events do not adhere custom event mapping should be configured in Event builder & Event Formatter appropriately.
  • 17. Event Format Standard XML event format <events> <event> <metaData> <tenant_id>2</tenant_id> </metaData> <correlationData> <activity_id>ID5</activity_id> </correlationData> <payloadData> <clientPhoneNo>0771117673</clientPhoneNo> <clientName>Mohanadarshan</clientName> <clientResidenceAddress>15, Alexendra road, California</clientResidenceAddress> <clientAccountNo>ACT5673</clientAccountNo> </payloadData> </event> <events>
  • 18. CEP Execution Plan ● Is an isolated logical execution unit ● Each execution plan imports some of the event streams available in CEP and defines the execution logic using queries and exports the results as output event streams. ● Has one-to-one relationship with CEP Backend Runtime. ● Has many-to-many relationship with Event Streams. ● Each execution plan spawns a Siddhi Engine Instance.
  • 19. CEP Solution patterns 1. Transformation - project, translate, enrich, split 2. Filter 3. Composition / Aggregation / Analytics ● basic stats, group by, moving averages 4. Join multiple streams 5. Detect patterns ● Coordinating events over time ● Trends - increasing, decreasing, stable, non-increasing, non-decreasing, mixed 6. Blacklisting 7. Building a profile
  • 20. Siddhi Query Structure define stream <event stream> (<attribute> <type>,<attribute> <type>, ...); from <event stream> select <attribute>,<attribute>, ... insert into <event stream> ;
  • 21. Siddhi Query : Projection define stream TempStream (deviceID long, roomNo int, temp double); from TempStream select roomNo, temp insert into OutputStream ;
  • 22. Siddhi Query : Inferred Streams from TempStream select roomNo, temp insert into OutputStream ; define stream OutputStream (roomNo int, temp double);
  • 23. Siddhi Query : Enrich from TempStream select roomNo, temp,‘C’ as scale insert into OutputStream define stream OutputStream (roomNo int, temp double, scale string);
  • 24. Siddhi Query : Enrich from TempStream select deviceID, roomNo, avg(temp) as avgTemp insert into OutputStream ;
  • 25. Siddhi Query : Transformation from TempStream select concat(deviceID, ‘-’, roomNo) as uid, toFahrenheit(temp) as tempInF, ‘F’ as scale insert into OutputStream ;
  • 26. Siddhi Query : Split from TempStream select roomNo, temp insert into RoomTempStream ; from TempStream select deviceID, temp insert into DeviceTempStream ;
  • 27. Siddhi Query : Filter from TempStream [temp > 30.0 and roomNo != 2043] select roomNo, temp insert into HotRoomsStream ;
  • 28. Siddhi Query : Window from TempStream select roomNo, avg(temp) as avgTemp insert into HotRoomsStream ;
  • 29. Siddhi Query : Window from TempStream#window.time(1 min) select roomNo, avg(temp) as avgTemp insert into HotRoomsStream ;
  • 30. Siddhi Query : Window from TempStream#window.time(1 min) select roomNo, avg(temp) as avgTemp group by roomNo insert into HotRoomsStream ;
  • 31. Siddhi Query : Batch Window from TempStream#window.timeBatch(5 min) select roomNo, avg(temp) as avgTemp group by roomNo insert into HotRoomsStream ;
  • 32. Siddhi Query : Join define stream TempStream (deviceID long, roomNo int, temp double); define stream RegulatorStream (deviceID long, roomNo int, isOn bool);
  • 33. Siddhi Query : Join define stream TempStream (deviceID long, roomNo int, temp double); define stream RegulatorStream (deviceID long, roomNo int, isOn bool); from TempStream[temp > 30.0]#window.time(1 min) as T join RegulatorStream[isOn == false]#window.lenght(1) as R on T.roomNo == R.roomNo select T.roomNo, R.deviceID, ‘start’ as action insert into RegulatorActionStream ;
  • 34. Siddhi Query : Detect Trend from t1=TempStream, t2=TempStream [t1.temp < t2.temp and t1.deviceID == t2.deviceID]+ within 5 min select t1.temp as initialTemp, t2.temp as finalTemp, t1.deviceID, t1.roomNo insert into IncreaingHotRoomsStream ;
  • 35. Siddhi Query : Partition define partition Device by TempStream.deviceID ; define partition Temp by range TempStream.temp <= 0 as ‘ICE’, range TempStream.temp > 0 and TempStream.temp < 100 as ‘WATER’, range TempStream.temp > 100 as ‘VAPOUR’ ;
  • 36. Siddhi Query : Detect Trend per Partition define partition Device by TempStream.deviceID ; from t1=TempStream, t2=TempStream [t1.temp < t2.temp and t1.deviceID == t2.deviceID]+ within 5 min select t1.temp as initialTemp, t2.temp as finalTemp, t1.deviceID, t1.roomNo insert into IncreaingHotRoomsStream partition by Device ;
  • 37. Siddhi Query : Detect Pattern define stream Purchase (price double, cardNo long,place string); from every (a1 = Purchase[price < 10] -> a3= ..) -> a2 = Purchase[price >10000 and a1.cardNo == a2.cardNo] within 1 day select a1.cardNo as cardNo, a2.price as price, a2.place as place insert into PotentialFraud ;
  • 38. Siddhi Query : Define Event Table define table CardUserTable (name string, cardNum long) ; define table CardUserTable (name string, cardNum long) from (‘datasource.name’=‘CardDataSource’, ‘table.name’= ‘UserTable’, ‘caching.algorithm’=‘LRU’) ; Cache types supported ● Basic: A size-based algorithm based on FIFO. ● LRU (Least Recently Used): The least recently used event is dropped when cache is full. ● LFU (Least Frequently Used): The least frequently used event is dropped when cache is full.
  • 39. Siddhi Query : Query Event Table define stream Purchase (price double, cardNo long, place string); define table CardUserTable (name string, cardNum long) ; from Purchase#window.length(1) join CardUserTable on Purchase.cardNo == CardUserTable.cardNum select Purchase.cardNo as cardNo, CardUserTable.name as name, Purchase.price as price insert into PurchaseUserStream ;
  • 40. Siddhi Query : Insert into Event Table define stream FraudStream (price double, cardNo long, userName string); define table BlacklistedUserTable (name string, cardNum long) ; from FraudStream select userName as name, cardNo as cardNum insert into BlacklistedUserTable ;
  • 41. Siddhi Query : Update into Event Table define stream LoginStream (userID string, islogin bool, loginTime long); define table LastLoginTable (userID string, time long) ; from LoginStream select userID, loginTime as time update LastLoginTable on LoginStream.userID == LastLoginTable.userID ;
  • 42. Siddhi Extensions ● Function extension ● Aggregator extension ● Window extension ● Transform extension
  • 43. Siddhi Query : Function Extension from TempStream select deviceID, roomNo, custom:toKelvin(temp) as tempInKelvin, ‘K’ as scale insert into OutputStream ;
  • 44. Siddhi Query : Aggregator Extension from TempStream select deviceID, roomNo, temp custom:stdev(temp) as stdevTemp, ‘C’ as scale insert into OutputStream ;
  • 45. Siddhi Query : Window Extension from TempStream #window.custom:lastUnique(roomNo,2 min) select * insert into OutputStream ;
  • 46. Siddhi Query : Transform Extension from XYZSpeedStream #transform.custom:getVelocityVector(v,vx,vy,vz) select velocity, direction insert into SpeedStream ;
  • 47. CEP Event Adaptors ● For receiving and publishing events ● Has the configurations to connect to external endpoints ● Has many-to-one relationship with Event Streams
  • 48. CEP Event Adaptors Support for several transports (network access) ● SOAP ● HTTP ● JMS ● SMTP ● SMS ● Thrift ● Kafka Supporting data formats ● XML ● JSON ● Map ● Text ● WSO2Event - WSO2 data format over Thrift for High Performant Event transfer supporting Java/C/C++/C# via Thrift language bindings
  • 49. CEP Event Adaptors Supports database writes using Map messages ● Cassandra ● MYSQL ● H2 Supports custom event adaptors via its pluggable architecture!
  • 50. Monitoring & Debugging : Event Flow ● Visualization of the Event Stream flow in CEP ● Helps to get the big picture ● Good for debugging
  • 51. Monitoring & Debugging : Event Tracer • Dump message traces in a textual format • Before and after processing each stage of event flow
  • 52. Monitoring & Debugging : Event Statistics • Real-time statistics • via visual illustrations & JMX • Time based request & response counts • Stats on all components of CEP server
  • 53. Real Time Dashboard • Provides tools to configure gadgets • Currently supports RDBMS only • Powered by WSO2 User Engagement Server ( WSO2UES)
  • 54. Performance Results • Same JVM Performance (Siddhi with Esper, M means a Million) 4 core machine • Filters 8M Events/Sec vs Esper 2M • Window 2.5M Events/Sec vs. Esper 1M • Patterns 1.4M Events/Sec about 10X faster than Esper • Over the Network Performance (Using thrift based WSO2 event format) - 8 core machine • Filter 0.25M (or 250K) Event/Sec
  • 55. CEP High Availability Execution plan in “RedundantNode” based distributed processing mode <executionPlan name="RedundantNodeExecutionPlan" statistics="enable" trace="enable" xmlns="http://wso2.org/carbon/eventprocessor"> ... <siddhiConfiguration> <property name="siddhi.enable.distributed.processing">RedundantNode</property> <property name="siddhi.persistence.snapshot.time.interval.minutes">0</property> </siddhiConfiguration> ... </executionPlan>
  • 56. HA / Persistence • Option 1: Side by side • Recommended • Takes 2X hardware • Gives zero down time • Option 2: Snapshot and restore • Uses less HW • Will lose events between snapshots • Downtime while recovery • ** Some scenarios you can use event tables to keep intermediate state
  • 57. Scaling • Vertically scaling • Can be distributed as a pipeline • Horizontally scaling • Queries like windows, patterns, and Join have shared states • Hard to distribute!
  • 58. Scaling (Contd.) • Currently users have to setup the pipeline manually (WSO2 team can help) • Work is underway to support above pipeline and distributer operators out of the box
  • 60.
  • 61. Demo
  • 62. Scenario MyPizzaShop – On time delivery or free Pizza Offer !!!
  • 63. Order Event { "event": { "correlationData": { "orderNo": "0023" }, "payloadData": { "orderInfo": "2 L PEPPERONI", "amount": "25.70", "name": "James Mark", "address": "29BX Finchwood Ave, Clovis, CA 93611", "tpNo": "(626)446-4601" } } }
  • 64. Delivered to customer event correlation_orderNo:23, isDelivered:true
  • 65. Email Notification Hi Alis Miranda Your order for 1 L CHICKEN pizza will be delivered in 30 mins to 779 Burl Ave, Clovis, CA 93611. The total cost of the order is $14.5. If you didn't get the pizza within 30 min you will be eligible to have those pizzas for free..!! MyPizzaShop
  • 66. Final Payment Notification <event xmlns="http://wso2.org/carbon/event"> <correlationData> <orderNo>3</orderNo> </correlationData> <payloadData> <name>James Clark</name> <amount>54.0</amount> </payloadData> </event>