SlideShare une entreprise Scribd logo
1  sur  40
Télécharger pour lire hors ligne
Introducing the WSO2 
Complex Event Processor 
Simplifying Complexities of Data Processing 
S. Suhothayan 
Software Engineer, 
Data Technologies Team.
Outline 
ƒ Introduction to CEP 
ƒ WSO2 CEP Server 
ƒ Siddhi Runtime 
ƒ HA & Scalability of WSO2 CEP 
ƒ WSO2 CEP server and WSO2 BAM 
ƒ Use Cases
Event Processing (Contd.) 
ƒ Event processing is about listening to events and 
detecting patterns in near real-time without storing 
all events. 
ƒ Three models 
o Simple Event Processing 
- Simple filters (e.g. Is this a gold or platinum customer?) 
o Event Stream Processing 
- Looking across multiple event streams and joining 
multiple event stream etc. 
o Complex Event Processing 
- Processing multiple event streams to identify meaningful 
patterns, using complex conditions & temporal windows 
- E.g. There has been a more than 10% increase in overall 
trading activity AND the average price of commodities 
has fallen 2% in the last 4 hours
Complex Event Processing 
ƒ We categorize events into different streams 
ƒ Process with minimal storage 
ƒ Use queries to evaluate the continuous event 
streams (Usually SQL like query language) 
ƒ Very fast results (in milliseconds range)
CEP Queries 
ƒ Types of queries are following 
o Filters and Projection 
o Windows – events are processed within temporal 
windows (e.g. for aggregation and joins). 
Time window vs. length window. 
o Ordering – identify event sequences and patterns 
(e.g. for a credit card new location followed by 
small and a large purchase might suggest a fraud) 
o Joins – join two streams
Example Query 
from p=PINChangeEvents#window.time(3600) join 
t=TransactionEvents[amount>10000]#window.time(3600) 
on p.custid==t.custid 
return t.custid, t.amount;
Opensource CEP Runtimes 
ƒ Siddhi 
o Apache License, a java library, Tuple based event 
model 
o Supports distributed processing 
o Supports multiple query models 
- Based on a SQL-like language 
- Filters, Windows, Joins, Ordering and others 
ƒ Esper, http://esper.codehaus.org 
o GPLv2 License, a Java library, Events can be XML, Map, 
Object 
o Supports multiple query models 
- Based on a SQL-like language 
- Filters, Windows, Joins, Ordering and others 
ƒ Drools Fusion 
o Apache License, a java library 
o Support for temporal reasoning + windows
WSO2 CEP Server 
ƒ Enterprise grade server for CEP runtimes 
ƒ Provides support for several transports 
(network access) and data formats 
o SOAP/WS-Eventing – XML messages 
o REST/JSON – JSON messages 
o JMS – map messages, XML messages 
o Thrift – WSO2 data bridge format 
- High Performant Event Capturing & Delivery Framework 
supports Java/C/C++/C# via Thrift language bindings. 
ƒ Support multiple CEP runtimes 
o Siddhi – WSO2, new, very fast, distributed 
o Esper - well known CEP runtime 
o Drools Fusion – rule based, but much slower 
ƒ Easy plugin new brokers, new CEP engines
WSO2 CEP Server(Contd.) 
File System
CEP Buckets 
ƒ CEP Bucket is a 
logical execution 
unit 
ƒ Each CEP bucket has 
set of queries, 
event sources and 
input, output event 
mappings. 
ƒ It is one-one with a 
CEP engine
Management UI 
ƒ To define 
buckets 
ƒ Update running 
queries without 
resetting 
current 
execution 
states 
ƒ Manage brokers 
(Data adopters)
Developer Studio UI 
ƒ Eclipse based 
tool to define 
buckets 
ƒ Can manage 
the 
configurations 
through the 
production 
lifecycle
Siddhi Complex 
Event Processing 
Engine
Big Picture 
ƒ Users provide query/queries 
ƒ Map event streams to queries 
ƒ Siddhi keep the queries running and invoke 
callbacks registered against one or more 
queries/streams 
ƒ Example Query 
from cseEventStream[ symbol == ‘IBM’]#win.time(50000) 
insert into IBMStockQuote symbol, avg(price) as avgPrice
Siddhi High Level Architecture
Siddhi Queries: Filters 
from <stream-name> [<conditions>]* 
insert into <stream-name> 
ƒ Filters the events by conditions 
ƒ Conditions 
o >, <, = , <=, <=, != 
o contains 
o and, or, not 
ƒ Example 
from cseEventStream[price >= 20 and symbol==’IBM’] 
insert into StockQuote symbol, volume
Window 
from <stream-name> [<conditions>]#window.<window-name>(<parameters>) 
Insert [<output-type>] into <stream-name 
ƒ Types of Windows 
o (Time | Length) (Sliding| Batch) windows 
o Unique window, First unique (not supported in 1.0) 
ƒ Type of aggregate functions 
o sum, avg, max, min 
ƒ Example 
from cseEventStream[price >= 20]#window.lengthBatch(50) 
insert expired-events into StockQuote 
symbol, avg(price) as avgPrice 
group by symbol 
having avgPrice>50
Join 
from <stream>#<window> [unidirectional] join <stream>#<window> 
on <condition> within <time> 
insert into <stream> 
ƒ Join two streams based on a condition and window 
ƒ Join can be in multiple forms ((left|right|full outer) | 
inner) join - only inner is supported in 1.0 
ƒ Unidirectional – event arriving only to the 
unidirectional stream triggers the join 
ƒ Example 
from TickEvent[symbol==’IBM’]#win.length(2000) 
join NewsEvent#win.time(500) 
insert into JoinStream *
Pattern 
from [every] <condition> Æ [every] <condition> … <condition> 
within <time> 
insert into StockQuote (<attribute-name>* | * ) 
ƒ Check condition A happen before/after condition B 
ƒ Can do iterative checks via “every” keyword. 
ƒ Here with “within <time>”, SIddhi emits only events 
that are within that time of each other 
ƒ Example 
from every (a1 = purchase[price < 10] ) 
Æa2 = purchase [price >10000 and a1.cardNo==a2.cardNo] 
within 300000 
insert into potentialFraud 
a2. cardNo as cardNo, a2. price as price, a2.place as place
Sequence 
from <event-regular-expression> within <time> insert into <stream> 
ƒ Regular Expressions supported 
o * - Zero or more matches (reluctant). 
o + - One or more matches (reluctant). 
o ? - Zero or one match (reluctant). 
o or – either event 
ƒ Here we have to refer events returned by * , + using 
square brackets to access a specific occurrence of 
that event 
From a1 = requestOrder[action == "buy"], 
b1 = cseEventStream[price > a1.price and symbol==a1.symbol]+, 
b2 = cseEventStream[price <b1.price] 
insert into purchaseOrder 
a1. symbol as symbol, b1[0].price as firstPrice, b2.price as orderPrice
Performance Results 
ƒ We compared Siddhi with Esper, the widely used 
opensource CEP engine 
ƒ For evaluation, we did setup different queries using both 
systems, push events in to the system, and measure the 
time till all of them are processed. 
ƒ We used Intel(R) Xeon(R) X3440 @2.53GHz , 4 cores 8M 
cache 8GB RAM running Debian 2.6.32-5-amd64 Kernel
Performance Comparison With ESPER 
Simple filter without window 
from StockTick[prize >6] return symbol, prize
Performance Comparison With ESPER 
State machine query for pattern matching 
From f=FraudWarningEvent -> 
p=PINChangeEvent(accountNumber=f.accountNumber) 
return accountNumber;
Siddhi Features 
ƒ Supports State Persistence 
o Enabling Queries to span lifetimes much greater 
than server uptime. 
o By taking periodic snapshots and storing all state 
information and windows to a scalable persistence 
store (Apache Cassandra). 
o Pluggable persistent stores. 
ƒ Support Highly Available Deployment 
o Using Hazelcast distributed cache as a shared 
working memory.
HA/ Persistence 
ƒ This is ability to recover 
runtime state in the 
case of a failure 
ƒ CEP server can support 
if CEP engine supports 
persistence (OK with 
Siddhi, Esper)
Scaling 
ƒ CEP pipeline can be distributed,But queries like 
windows, patterns, and Join are hard to distribute 
ƒ WSO2 CEP with Siddhi uses distributed cache 
(Hazelcast) as shared memory and selective 
processing approach to achieve massive scalability in 
distributed processing
Event Recording 
ƒ Ability to record all/some of the events for 
future processing 
ƒ Few options 
o Publish them to Cassandra cluster using WSO2 data 
bridge API or BAM (can process data in Cassandra 
with Hadoop using WSO2 BAM). 
o Write them to distributed cache 
o Custom thrift based event recorder
WSO2 BAM
CEP Role within WSO2 Platform
DEMO
Scenario 
ƒ Monitoring stock exchange for game changing 
moments 
ƒ Two input event streams. 
o Event stream of Stock Quotes from a stock 
exchange 
o Event stream of word count on various company 
names from twitter pages 
ƒ Check whether the last traded price of the 
stock has changed significantly(by 2%) within 
last minute, and people are twitting about that 
company (> 10) within last minute
Example Scenario 
JMS Event 
Publisher 
JMS Event 
Receiver
Input events 
ƒ Input events are JMS Maps 
o Stock Exchange Stream 
Map<String, Object> map1 = new HashMap<String, Object>(); 
map1.put("symbol", "MSFT"); 
map1.put("price", 26.36); 
publisher.publish("AllStockQuotes", map1); 
o Twitter Stream 
Map<String, Object> map1 = new HashMap<String, Object>(); 
map1.put("company", "MSFT"); 
map1.put("wordCount", 8); 
publisher.publish("TwitterFeed", map1);
Queries
Queries 
from allStockQuotes[win.time(60000)] 
insert into fastMovingStockQuotes 
symbol,price, avg(price) as averagePrice 
group by symbol 
having ((price > averagePrice*1.02) or (averagePrice*0.98 > price )) 
from twitterFeed[win.time(60000)] 
insert into highFrequentTweets 
company as company, sum(wordCount) as words 
group by company 
having (words > 10) 
from fastMovingStockQuotes[win.time(60000)] as fastMovingStockQuotes 
join highFrequentTweets[win.time(60000)] as highFrequentTweets 
on fastMovingStockQuotes.symbol==highFrequentTweets.company 
insert into predictedStockQuotes 
fastMovingStockQuotes.symbol as company, 
fastMovingStockQuotes.averagePrice as amount, 
highFrequentTweets.words as words
Alert 
ƒ As a XML 
<quotedata:StockQuoteDataEvent 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
xmlns:quotedata="http://ws.cdyne.com/"> 
<quotedata:StockSymbol>{company}</quotedata:StockSymbol> 
<quotedata:LastTradeAmount>{amount}</quotedata:LastTradeAmount> 
<quotedata:WordCount>{words}</quotedata:WordCount> 
</quotedata:StockQuoteDataEvent>
Useful links 
ƒ WSO2 CEP 2.0.0 Milestone 2 
https://svn.wso2.org/repos/wso2/people/suho/packs/cep/wso2cep-2.0.0- 
M2.zip 
ƒ Distributed Processing Sample With Siddhi CEP 
and ActiveMQ JMS Broker. 
http://suhothayan.blogspot.com/2012/08/distributed-processing-sample-for-wso2. 
html
Questions?
Thank you.

Contenu connexe

Tendances

Event Driven Architecture with a RESTful Microservices Architecture (Kyle Ben...
Event Driven Architecture with a RESTful Microservices Architecture (Kyle Ben...Event Driven Architecture with a RESTful Microservices Architecture (Kyle Ben...
Event Driven Architecture with a RESTful Microservices Architecture (Kyle Ben...
confluent
 
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
 

Tendances (20)

Event Driven Architecture with a RESTful Microservices Architecture (Kyle Ben...
Event Driven Architecture with a RESTful Microservices Architecture (Kyle Ben...Event Driven Architecture with a RESTful Microservices Architecture (Kyle Ben...
Event Driven Architecture with a RESTful Microservices Architecture (Kyle Ben...
 
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...
 
Kafka as an Event Store (Guido Schmutz, Trivadis) Kafka Summit NYC 2019
Kafka as an Event Store (Guido Schmutz, Trivadis) Kafka Summit NYC 2019Kafka as an Event Store (Guido Schmutz, Trivadis) Kafka Summit NYC 2019
Kafka as an Event Store (Guido Schmutz, Trivadis) Kafka Summit NYC 2019
 
Big Data Redis Mongodb Dynamodb Sharding
Big Data Redis Mongodb Dynamodb ShardingBig Data Redis Mongodb Dynamodb Sharding
Big Data Redis Mongodb Dynamodb Sharding
 
Streaming data for real time analysis
Streaming data for real time analysisStreaming data for real time analysis
Streaming data for real time analysis
 
A guide through the Azure Messaging services - Update Conference
A guide through the Azure Messaging services - Update ConferenceA guide through the Azure Messaging services - Update Conference
A guide through the Azure Messaging services - Update Conference
 
AWS Webcast - Introduction to Amazon Kinesis
AWS Webcast - Introduction to Amazon KinesisAWS Webcast - Introduction to Amazon Kinesis
AWS Webcast - Introduction to Amazon Kinesis
 
(BDT403) Best Practices for Building Real-time Streaming Applications with Am...
(BDT403) Best Practices for Building Real-time Streaming Applications with Am...(BDT403) Best Practices for Building Real-time Streaming Applications with Am...
(BDT403) Best Practices for Building Real-time Streaming Applications with Am...
 
Battery Ventures: Simulating and Visualizing Large Scale Cassandra Deployments
Battery Ventures: Simulating and Visualizing Large Scale Cassandra DeploymentsBattery Ventures: Simulating and Visualizing Large Scale Cassandra Deployments
Battery Ventures: Simulating and Visualizing Large Scale Cassandra Deployments
 
Bank of China (HK) Tech Talk 1: Dive Into Apache Kafka
Bank of China (HK) Tech Talk 1: Dive Into Apache KafkaBank of China (HK) Tech Talk 1: Dive Into Apache Kafka
Bank of China (HK) Tech Talk 1: Dive Into Apache Kafka
 
KSQL: Open Source Streaming for Apache Kafka
KSQL: Open Source Streaming for Apache KafkaKSQL: Open Source Streaming for Apache Kafka
KSQL: Open Source Streaming for Apache Kafka
 
APAC ksqlDB Workshop
APAC ksqlDB WorkshopAPAC ksqlDB Workshop
APAC ksqlDB Workshop
 
Event Sourcing in less than 20 minutes - With Akka and Java 8
Event Sourcing in less than 20 minutes - With Akka and Java 8Event Sourcing in less than 20 minutes - With Akka and Java 8
Event Sourcing in less than 20 minutes - With Akka and Java 8
 
A Tour of Apache Kafka
A Tour of Apache KafkaA Tour of Apache Kafka
A Tour of Apache Kafka
 
Introduction to the Processor API
Introduction to the Processor APIIntroduction to the Processor API
Introduction to the Processor API
 
(SDD405) Amazon Kinesis Deep Dive | AWS re:Invent 2014
(SDD405) Amazon Kinesis Deep Dive | AWS re:Invent 2014(SDD405) Amazon Kinesis Deep Dive | AWS re:Invent 2014
(SDD405) Amazon Kinesis Deep Dive | AWS re:Invent 2014
 
Kafka as an Event Store - is it Good Enough?
Kafka as an Event Store - is it Good Enough?Kafka as an Event Store - is it Good Enough?
Kafka as an Event Store - is it Good Enough?
 
Building a Real-time Streaming ETL Framework Using ksqlDB and NoSQL
Building a Real-time Streaming ETL Framework Using ksqlDB and NoSQLBuilding a Real-time Streaming ETL Framework Using ksqlDB and NoSQL
Building a Real-time Streaming ETL Framework Using ksqlDB and NoSQL
 
AWS Kinesis Streams
AWS Kinesis StreamsAWS Kinesis Streams
AWS Kinesis Streams
 
AWS compute Services
AWS compute ServicesAWS compute Services
AWS compute Services
 

Similaire à Introducing the WSO2 Complex Event Processor

WSO2 Product Release Webinar - Introducing the WSO2 Complex Event Processor
WSO2 Product Release Webinar - Introducing the WSO2 Complex Event Processor WSO2 Product Release Webinar - Introducing the WSO2 Complex Event Processor
WSO2 Product Release Webinar - Introducing the WSO2 Complex Event Processor
WSO2
 
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
 
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
 
Streamsheets and Apache Kafka – Interactively build real-time Dashboards and ...
Streamsheets and Apache Kafka – Interactively build real-time Dashboards and ...Streamsheets and Apache Kafka – Interactively build real-time Dashboards and ...
Streamsheets and Apache Kafka – Interactively build real-time Dashboards and ...
confluent
 
Microsoft SQL Server - StreamInsight Overview Presentation
Microsoft SQL Server - StreamInsight Overview PresentationMicrosoft SQL Server - StreamInsight Overview Presentation
Microsoft SQL Server - StreamInsight Overview Presentation
Microsoft Private Cloud
 
Developing your first application using FIWARE
Developing your first application using FIWAREDeveloping your first application using FIWARE
Developing your first application using FIWARE
FIWARE
 

Similaire à Introducing the WSO2 Complex Event Processor (20)

WSO2 Product Release Webinar - Introducing the WSO2 Complex Event Processor
WSO2 Product Release Webinar - Introducing the WSO2 Complex Event Processor WSO2 Product Release Webinar - Introducing the WSO2 Complex Event Processor
WSO2 Product Release Webinar - Introducing the 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 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 Product Release Webinar: WSO2 Complex Event Processor 4.0
WSO2 Product Release Webinar: WSO2 Complex Event Processor 4.0WSO2 Product Release Webinar: WSO2 Complex Event Processor 4.0
WSO2 Product Release Webinar: WSO2 Complex Event Processor 4.0
 
Introduction to WSO2 Data Analytics Platform
Introduction to  WSO2 Data Analytics PlatformIntroduction to  WSO2 Data Analytics Platform
Introduction to WSO2 Data Analytics Platform
 
Andrii Dembitskyi "Events in our applications Event bus and distributed systems"
Andrii Dembitskyi "Events in our applications Event bus and distributed systems"Andrii Dembitskyi "Events in our applications Event bus and distributed systems"
Andrii Dembitskyi "Events in our applications Event bus and distributed systems"
 
Streamsheets and Apache Kafka – Interactively build real-time Dashboards and ...
Streamsheets and Apache Kafka – Interactively build real-time Dashboards and ...Streamsheets and Apache Kafka – Interactively build real-time Dashboards and ...
Streamsheets and Apache Kafka – Interactively build real-time Dashboards and ...
 
WSO2Con USA 2015: WSO2 Analytics Platform - The One Stop Shop for All Your Da...
WSO2Con USA 2015: WSO2 Analytics Platform - The One Stop Shop for All Your Da...WSO2Con USA 2015: WSO2 Analytics Platform - The One Stop Shop for All Your Da...
WSO2Con USA 2015: WSO2 Analytics Platform - The One Stop Shop for All Your Da...
 
Building Streaming Applications with Streaming SQL
Building Streaming Applications with Streaming SQLBuilding Streaming Applications with Streaming SQL
Building Streaming Applications with Streaming SQL
 
GDG Jakarta Meetup - Streaming Analytics With Apache Beam
GDG Jakarta Meetup - Streaming Analytics With Apache BeamGDG Jakarta Meetup - Streaming Analytics With Apache Beam
GDG Jakarta Meetup - Streaming Analytics With Apache Beam
 
Stream Processing with Ballerina
Stream Processing with BallerinaStream Processing with Ballerina
Stream Processing with Ballerina
 
Reactive programming every day
Reactive programming every dayReactive programming every day
Reactive programming every day
 
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...
 
Api Statistics- The Scalable Way
Api Statistics- The Scalable WayApi Statistics- The Scalable Way
Api Statistics- The Scalable Way
 
Apache Spark Streaming: Architecture and Fault Tolerance
Apache Spark Streaming: Architecture and Fault ToleranceApache Spark Streaming: Architecture and Fault Tolerance
Apache Spark Streaming: Architecture and Fault Tolerance
 
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
 
Microsoft SQL Server - StreamInsight Overview Presentation
Microsoft SQL Server - StreamInsight Overview PresentationMicrosoft SQL Server - StreamInsight Overview Presentation
Microsoft SQL Server - StreamInsight Overview Presentation
 
Developing your first application using FIWARE
Developing your first application using FIWAREDeveloping your first application using FIWARE
Developing your first application using FIWARE
 
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
 
Fabric - Realtime stream processing framework
Fabric - Realtime stream processing frameworkFabric - Realtime stream processing framework
Fabric - Realtime stream processing framework
 

Plus de WSO2

Plus de WSO2 (20)

Driving Innovation: Scania's API Revolution with WSO2
Driving Innovation: Scania's API Revolution with WSO2Driving Innovation: Scania's API Revolution with WSO2
Driving Innovation: Scania's API Revolution with WSO2
 
Less Is More: Utilizing Ballerina to Architect a Cloud Data Platform
Less Is More: Utilizing Ballerina to Architect a Cloud Data PlatformLess Is More: Utilizing Ballerina to Architect a Cloud Data Platform
Less Is More: Utilizing Ballerina to Architect a Cloud Data Platform
 
Modernizing Legacy Systems Using Ballerina
Modernizing Legacy Systems Using BallerinaModernizing Legacy Systems Using Ballerina
Modernizing Legacy Systems Using Ballerina
 
WSO2CON 2024 - Unlocking the Identity: Embracing CIAM 2.0 for a Competitive A...
WSO2CON 2024 - Unlocking the Identity: Embracing CIAM 2.0 for a Competitive A...WSO2CON 2024 - Unlocking the Identity: Embracing CIAM 2.0 for a Competitive A...
WSO2CON 2024 - Unlocking the Identity: Embracing CIAM 2.0 for a Competitive A...
 
WSO2CON 2024 Slides - Unlocking Value with AI
WSO2CON 2024 Slides - Unlocking Value with AIWSO2CON 2024 Slides - Unlocking Value with AI
WSO2CON 2024 Slides - Unlocking Value with AI
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Quantum Leap in Next-Generation Computing
Quantum Leap in Next-Generation ComputingQuantum Leap in Next-Generation Computing
Quantum Leap in Next-Generation Computing
 
WSO2CON 2024 - Elevating the Integration Game to the Cloud
WSO2CON 2024 - Elevating the Integration Game to the CloudWSO2CON 2024 - Elevating the Integration Game to the Cloud
WSO2CON 2024 - Elevating the Integration Game to the Cloud
 
WSO2CON 2024 - OSU & WSO2: A Decade Journey in Integration & Innovation
WSO2CON 2024 - OSU & WSO2: A Decade Journey in Integration & InnovationWSO2CON 2024 - OSU & WSO2: A Decade Journey in Integration & Innovation
WSO2CON 2024 - OSU & WSO2: A Decade Journey in Integration & Innovation
 
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open SourceWSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
 
WSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaSWSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaS
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 
WSO2CON 2024 - IoT Needs CIAM: The Importance of Centralized IAM in a Growing...
WSO2CON 2024 - IoT Needs CIAM: The Importance of Centralized IAM in a Growing...WSO2CON 2024 - IoT Needs CIAM: The Importance of Centralized IAM in a Growing...
WSO2CON 2024 - IoT Needs CIAM: The Importance of Centralized IAM in a Growing...
 
WSO2CON 2024 - Architecting AI in the Enterprise: APIs and Applications
WSO2CON 2024 - Architecting AI in the Enterprise: APIs and ApplicationsWSO2CON 2024 - Architecting AI in the Enterprise: APIs and Applications
WSO2CON 2024 - Architecting AI in the Enterprise: APIs and Applications
 
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
 
WSO2CON 2024 - Software Engineering for Digital Businesses
WSO2CON 2024 - Software Engineering for Digital BusinessesWSO2CON 2024 - Software Engineering for Digital Businesses
WSO2CON 2024 - Software Engineering for Digital Businesses
 
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
 
WSO2CON 2024 - Designing Event-Driven Enterprises: Stories of Transformation
WSO2CON 2024 - Designing Event-Driven Enterprises: Stories of TransformationWSO2CON 2024 - Designing Event-Driven Enterprises: Stories of Transformation
WSO2CON 2024 - Designing Event-Driven Enterprises: Stories of Transformation
 
WSO2CON 2024 - Not Just Microservices: Rightsize Your Services!
WSO2CON 2024 - Not Just Microservices: Rightsize Your Services!WSO2CON 2024 - Not Just Microservices: Rightsize Your Services!
WSO2CON 2024 - Not Just Microservices: Rightsize Your Services!
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 

Dernier

Dernier (20)

Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 

Introducing the WSO2 Complex Event Processor

  • 1. Introducing the WSO2 Complex Event Processor Simplifying Complexities of Data Processing S. Suhothayan Software Engineer, Data Technologies Team.
  • 2. Outline ƒ Introduction to CEP ƒ WSO2 CEP Server ƒ Siddhi Runtime ƒ HA & Scalability of WSO2 CEP ƒ WSO2 CEP server and WSO2 BAM ƒ Use Cases
  • 3. Event Processing (Contd.) ƒ Event processing is about listening to events and detecting patterns in near real-time without storing all events. ƒ Three models o Simple Event Processing - Simple filters (e.g. Is this a gold or platinum customer?) o Event Stream Processing - Looking across multiple event streams and joining multiple event stream etc. o Complex Event Processing - Processing multiple event streams to identify meaningful patterns, using complex conditions & temporal windows - E.g. There has been a more than 10% increase in overall trading activity AND the average price of commodities has fallen 2% in the last 4 hours
  • 4. Complex Event Processing ƒ We categorize events into different streams ƒ Process with minimal storage ƒ Use queries to evaluate the continuous event streams (Usually SQL like query language) ƒ Very fast results (in milliseconds range)
  • 5. CEP Queries ƒ Types of queries are following o Filters and Projection o Windows – events are processed within temporal windows (e.g. for aggregation and joins). Time window vs. length window. o Ordering – identify event sequences and patterns (e.g. for a credit card new location followed by small and a large purchase might suggest a fraud) o Joins – join two streams
  • 6. Example Query from p=PINChangeEvents#window.time(3600) join t=TransactionEvents[amount>10000]#window.time(3600) on p.custid==t.custid return t.custid, t.amount;
  • 7. Opensource CEP Runtimes ƒ Siddhi o Apache License, a java library, Tuple based event model o Supports distributed processing o Supports multiple query models - Based on a SQL-like language - Filters, Windows, Joins, Ordering and others ƒ Esper, http://esper.codehaus.org o GPLv2 License, a Java library, Events can be XML, Map, Object o Supports multiple query models - Based on a SQL-like language - Filters, Windows, Joins, Ordering and others ƒ Drools Fusion o Apache License, a java library o Support for temporal reasoning + windows
  • 8. WSO2 CEP Server ƒ Enterprise grade server for CEP runtimes ƒ Provides support for several transports (network access) and data formats o SOAP/WS-Eventing – XML messages o REST/JSON – JSON messages o JMS – map messages, XML messages o Thrift – WSO2 data bridge format - High Performant Event Capturing & Delivery Framework supports Java/C/C++/C# via Thrift language bindings. ƒ Support multiple CEP runtimes o Siddhi – WSO2, new, very fast, distributed o Esper - well known CEP runtime o Drools Fusion – rule based, but much slower ƒ Easy plugin new brokers, new CEP engines
  • 10. CEP Buckets ƒ CEP Bucket is a logical execution unit ƒ Each CEP bucket has set of queries, event sources and input, output event mappings. ƒ It is one-one with a CEP engine
  • 11. Management UI ƒ To define buckets ƒ Update running queries without resetting current execution states ƒ Manage brokers (Data adopters)
  • 12. Developer Studio UI ƒ Eclipse based tool to define buckets ƒ Can manage the configurations through the production lifecycle
  • 13. Siddhi Complex Event Processing Engine
  • 14. Big Picture ƒ Users provide query/queries ƒ Map event streams to queries ƒ Siddhi keep the queries running and invoke callbacks registered against one or more queries/streams ƒ Example Query from cseEventStream[ symbol == ‘IBM’]#win.time(50000) insert into IBMStockQuote symbol, avg(price) as avgPrice
  • 15. Siddhi High Level Architecture
  • 16. Siddhi Queries: Filters from <stream-name> [<conditions>]* insert into <stream-name> ƒ Filters the events by conditions ƒ Conditions o >, <, = , <=, <=, != o contains o and, or, not ƒ Example from cseEventStream[price >= 20 and symbol==’IBM’] insert into StockQuote symbol, volume
  • 17. Window from <stream-name> [<conditions>]#window.<window-name>(<parameters>) Insert [<output-type>] into <stream-name ƒ Types of Windows o (Time | Length) (Sliding| Batch) windows o Unique window, First unique (not supported in 1.0) ƒ Type of aggregate functions o sum, avg, max, min ƒ Example from cseEventStream[price >= 20]#window.lengthBatch(50) insert expired-events into StockQuote symbol, avg(price) as avgPrice group by symbol having avgPrice>50
  • 18. Join from <stream>#<window> [unidirectional] join <stream>#<window> on <condition> within <time> insert into <stream> ƒ Join two streams based on a condition and window ƒ Join can be in multiple forms ((left|right|full outer) | inner) join - only inner is supported in 1.0 ƒ Unidirectional – event arriving only to the unidirectional stream triggers the join ƒ Example from TickEvent[symbol==’IBM’]#win.length(2000) join NewsEvent#win.time(500) insert into JoinStream *
  • 19. Pattern from [every] <condition> Æ [every] <condition> … <condition> within <time> insert into StockQuote (<attribute-name>* | * ) ƒ Check condition A happen before/after condition B ƒ Can do iterative checks via “every” keyword. ƒ Here with “within <time>”, SIddhi emits only events that are within that time of each other ƒ Example from every (a1 = purchase[price < 10] ) Æa2 = purchase [price >10000 and a1.cardNo==a2.cardNo] within 300000 insert into potentialFraud a2. cardNo as cardNo, a2. price as price, a2.place as place
  • 20. Sequence from <event-regular-expression> within <time> insert into <stream> ƒ Regular Expressions supported o * - Zero or more matches (reluctant). o + - One or more matches (reluctant). o ? - Zero or one match (reluctant). o or – either event ƒ Here we have to refer events returned by * , + using square brackets to access a specific occurrence of that event From a1 = requestOrder[action == "buy"], b1 = cseEventStream[price > a1.price and symbol==a1.symbol]+, b2 = cseEventStream[price <b1.price] insert into purchaseOrder a1. symbol as symbol, b1[0].price as firstPrice, b2.price as orderPrice
  • 21. Performance Results ƒ We compared Siddhi with Esper, the widely used opensource CEP engine ƒ For evaluation, we did setup different queries using both systems, push events in to the system, and measure the time till all of them are processed. ƒ We used Intel(R) Xeon(R) X3440 @2.53GHz , 4 cores 8M cache 8GB RAM running Debian 2.6.32-5-amd64 Kernel
  • 22. Performance Comparison With ESPER Simple filter without window from StockTick[prize >6] return symbol, prize
  • 23. Performance Comparison With ESPER State machine query for pattern matching From f=FraudWarningEvent -> p=PINChangeEvent(accountNumber=f.accountNumber) return accountNumber;
  • 24. Siddhi Features ƒ Supports State Persistence o Enabling Queries to span lifetimes much greater than server uptime. o By taking periodic snapshots and storing all state information and windows to a scalable persistence store (Apache Cassandra). o Pluggable persistent stores. ƒ Support Highly Available Deployment o Using Hazelcast distributed cache as a shared working memory.
  • 25. HA/ Persistence ƒ This is ability to recover runtime state in the case of a failure ƒ CEP server can support if CEP engine supports persistence (OK with Siddhi, Esper)
  • 26. Scaling ƒ CEP pipeline can be distributed,But queries like windows, patterns, and Join are hard to distribute ƒ WSO2 CEP with Siddhi uses distributed cache (Hazelcast) as shared memory and selective processing approach to achieve massive scalability in distributed processing
  • 27. Event Recording ƒ Ability to record all/some of the events for future processing ƒ Few options o Publish them to Cassandra cluster using WSO2 data bridge API or BAM (can process data in Cassandra with Hadoop using WSO2 BAM). o Write them to distributed cache o Custom thrift based event recorder
  • 29. CEP Role within WSO2 Platform
  • 30. DEMO
  • 31. Scenario ƒ Monitoring stock exchange for game changing moments ƒ Two input event streams. o Event stream of Stock Quotes from a stock exchange o Event stream of word count on various company names from twitter pages ƒ Check whether the last traded price of the stock has changed significantly(by 2%) within last minute, and people are twitting about that company (> 10) within last minute
  • 32.
  • 33. Example Scenario JMS Event Publisher JMS Event Receiver
  • 34. Input events ƒ Input events are JMS Maps o Stock Exchange Stream Map<String, Object> map1 = new HashMap<String, Object>(); map1.put("symbol", "MSFT"); map1.put("price", 26.36); publisher.publish("AllStockQuotes", map1); o Twitter Stream Map<String, Object> map1 = new HashMap<String, Object>(); map1.put("company", "MSFT"); map1.put("wordCount", 8); publisher.publish("TwitterFeed", map1);
  • 36. Queries from allStockQuotes[win.time(60000)] insert into fastMovingStockQuotes symbol,price, avg(price) as averagePrice group by symbol having ((price > averagePrice*1.02) or (averagePrice*0.98 > price )) from twitterFeed[win.time(60000)] insert into highFrequentTweets company as company, sum(wordCount) as words group by company having (words > 10) from fastMovingStockQuotes[win.time(60000)] as fastMovingStockQuotes join highFrequentTweets[win.time(60000)] as highFrequentTweets on fastMovingStockQuotes.symbol==highFrequentTweets.company insert into predictedStockQuotes fastMovingStockQuotes.symbol as company, fastMovingStockQuotes.averagePrice as amount, highFrequentTweets.words as words
  • 37. Alert ƒ As a XML <quotedata:StockQuoteDataEvent xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:quotedata="http://ws.cdyne.com/"> <quotedata:StockSymbol>{company}</quotedata:StockSymbol> <quotedata:LastTradeAmount>{amount}</quotedata:LastTradeAmount> <quotedata:WordCount>{words}</quotedata:WordCount> </quotedata:StockQuoteDataEvent>
  • 38. Useful links ƒ WSO2 CEP 2.0.0 Milestone 2 https://svn.wso2.org/repos/wso2/people/suho/packs/cep/wso2cep-2.0.0- M2.zip ƒ Distributed Processing Sample With Siddhi CEP and ActiveMQ JMS Broker. http://suhothayan.blogspot.com/2012/08/distributed-processing-sample-for-wso2. html