SlideShare a Scribd company logo
Complex Event Processing
      with Esper
Real-time Event Stream & Complex Event Processing



                    Ted Won
                                        2011. 11. 12.
                http://tedwon.com
Complex Event Processing with Esper
Complex Event Processing
Complex Event Processing with Esper
Nanosecond

● CEP 세계의 측정 단위는 nanosecond



● A nanosecond (ns) is one billionth of a second
Nanosecond


 1 second is...

   1,000 ms

  1,000,000 us

1,000,000,000 ns
Concept of CEP

● 교회에서... 

● 벨이 울린다.

● 턱시도를 입은 남자와 꽃을 든 여자가 함께 걷는다.

● 두 사람 위로 꽃 잎이 날리고 푹죽이 터진다.
Concept of CEP




CEP 기술은 이러한 Complex한 Event를 참조하여


     결혼식이라는 것을 알아 차린다.
Imagination Beyond Reality
● Imaginary CEP Use Cases
Imagination Beyond Reality

● E-mart에서...

● 고객들이 카트를 끌고 매장을 돌아 다닌다.

● 카트의 이동 경로와 패턴을 알 수 없을까?

● 계산대에서 대기하는 고객들 상태 파악 후 실시간 조치

● 카트 + 멤버십 카드라면 카트에 달린 모니터를 통해 
  개인화된 실시간 추천/쿠폰 발행

● 카트에 물건을 담으면 자동으로 계산
Imagination Beyond Reality

● 전국의 이마트 매장이 130개...

● 엄청난 양의 데이터를 어찌 실시간으로 처리한단 말인가??

● Starbucks 매장에서...

● 파주 프리미엄 아웃렛 매장에서...

● 교통 관리에서
  실시간으로 교통 상태/패턴을 인지하고 적절한 조치
Imagination Beyond Reality


● Algorithmic Stock-Trading




● Applying CEP to the RHQ alert feature
  as a Operational Intelligence (OI) solution
What is CEP?
What is CEP

● Complex Event Processing

● CEP는 Event 중심의 실시간 대용량 데이터 처리 기술

● CEP는 실시간 대용량 Event 처리 기술

● CEP는 EDA(Event-driven architecture) 기반 시스템

● Mutliple event stream에서 발생하는 패턴 감지 기술
What is CEP

● Identifying the most meaningful events from event cloud

● Real-time computation and pattern detection over event streams

● Response가 아닌 Reaction을 하는 시스템

● http://en.wikipedia.org/wiki/Complex_Event_Processing
What is CEP

● Real-time Processing

● Intelligence System

● Real-time Business Intelligence

● Event Stream Intelligence
What is CEP

● Extreme Transaction Processing

● Publish/Subscribe Model

● Loosley-coupled

● Asynchronous Style




                              Source: Event Processing in Action
Open Source CEP

● EsperTech Esper (Stream-oriented)


● JBoss Drools Fusion (Rule-oriented)
CEP Language Style


● Strem-oriented
    ○ EsperTech Esper
    ○ MS StreamInsight


● Rule-oriented
   ○ JBoss Drools Fusion
   ○ TIBCO TIBCO BusinessEvents
What is EDA?
What is EDA
● Event Driven Architecture
● EDA는 event의 production, detection, consumption과
  reaction 하기위한 구조를 정의한 software architecture




                                Source: Event Processing in Action
What is EDA

● More Loosely-coupled than SOA

● Event 표준 스펙 논의가 OASIS에서 
  Common Base Events라는 이름으로 진행 중

● Response가 아닌 Reaction을 하는 시스템

● 선처리 후저장 패러다임

● http://en.wikipedia.org/wiki/Event-driven_architecture
Classical Request-response Architecture

● Synchronous interactions

● Request에 대한 Response를 하는 구조

● 선저장 후처리 패러다임
Event Processing Styles

● SEP - Simple Event Processing
   ○ Single event based
   ○ 상태가 없는 Event를 처리하는 케이스
   ○ JMS(Java Message Service)가 대표적인 예
   ○ ESB(Enterprise Service Bus)

● ESP - Event Stream Processing

● CEP - Complex Event Processing
Event Processing Application




                  Source: Event Processing in Action
ESP vs. CEP

● ESP - Event Stream Processing
   ○ Monitor streams of event data, analyse those events, and act
     upon opportunities
   ○ Volume weighted average of Google stock over the last
     (moving) 30min

● CEP - Complex Event Processing
   ○ Detecting patterns among events
   ○ If this Google VWAP increased more than 5% two times
     followed by Yahoo! VWAP decreased more than 10% then…
SOA vs. EDA

● SOA
   ○ RPC calls
   ○ Point-to-Point communication
   ○ Request and reply
   ○ Vertical interaction

● EDA
   ○ Message based
   ○ Less coupled than SOA
   ○ Publish and subscribe
   ○ Horizontal communication between tiers in process chain
Point-To-Point
Publish-and-Subscribe
What is an Event?
What is an Event

● Event란 무엇인가?

● 무엇을 Event로 정의 할 수 있는가?
What is an Event

● Something that happens

● 실제로 발생한 사건, 일, 메세지

● 상태의 변경
What is an Event


● An event is an immutable record of a past occurrence
  of an action or state change.


● Event properties capture the useful information for an event.
What is an Event




Event란 어떤 것이 변화한 것이다!
What is an Event

● 변화한다는 것은 어떠한 상태를 가지고 있다는 의미

● 상태를 가지고 변화하는 모든 것이 Event로 정의될 수 있다.

● 이 세상의 모든 것은 변화한다.

● 변화량을 정량적으로 측정가능하도록 정의해야함

● Event를 추상화하여 표현한 것을 Event type이라함
What is an Event

● 상태가 없는 Event를 처리하는 경우도 존재

● SEP(Simple Event Processing)의 경우 존재

● JMS가 하나의 예
Event Examples

● Stock tick

● 비밀번호 변경

● 10초마다 실내 온도 측정

● 서비스 응답 시간

● 고객이 들고 다가오는 Starbucks membership cards with RFID

● 고객이 끌고 다니는 E-mart carts with RFID
Events vs. Messages

● Event는 때로는 Message로 표현됨

● Message는 단순히 Event의 다른 표현이라는 측면도 존재

● Event의 상태라는 속성이 Message에서는 어떤 내용(contents)이
  라는 차이

● EDA에 속한 개념으로써 SEP(Simple Event Processing)의 한 종류
  인 JMS와 같은 기술에서 사용하는 전문 용어라는 측면
What is Event Type?
What is Event Type

● Event Representation Schema

● 개념적인 Event를 실제 프로그래밍적으로 표현하는 방법

● Event의 개념적 표현을 Event Schema라 할 수 있는데

● Event Schema의 표현을 Event Type 으로 한다.

● DBMS의 테이블 스키마와 유사한 개념

● 대표적인 Data Format을 이용하여 정의 할 수 있다.
Event Type Data Format

● POJO
● Map
● XML
● JSON
● CSV
What is Event Stream?
What is Event Stream


● 시간의 순서대로 연속되는 Event



● 시작과 끝이 없는 Event의 연속된 흐름
What is Real-time?
What is Real-time

Real-time system은 다음의 조건들을 충족해야 합니다

● Low latency

● Regularities in Response time

● Providing predictable performance
CEP Usages
● Algorithmic Stock-Trading
● Operational Intelligence(OI) solutions
● Real-time analytics
● Predictive analytics
● Event-driven business process management
● BAM - Business Activity Monitoring
● BI - Business intelligence
● BRMSs - Business rule management systems
● Network and System Management
● MOM- Message-oriented middleware
● Stream computing
● ETL(Extract, Transform, Load)
CEP Products
Esper
EsperTech Esper

● Event Stream and Complex Event Processing platform

● Convergence of ESP and CEP

● Open Source ESP/CEP Engine

● Event Processing Language (EPL)

● Java and .Net
EsperTech Esper

● High Throughput, Low Latency

● Highly Available (EsperHA)

● Rich Multi-Window GUI (Enterprise Edition)

● Real-time Displays (Enterprise Edition)

● Enterprise *ilities (Enterprise Edition)
EsperTech Esper

● Usability
● Maintainability
● Scalability
● Availability and Reliability
● Extensibility
● Security
● Portability
EsperTech Esper

● Technical Support (Enterprise Edition)

● Lightweight & Embeddable

● No Runtime Support

● GNU GPL(General Public License) v2
Runtime: Esper + Java EE platform
Runtime: Esper + OSGi
Esper Documentation

● Esper Documentation Home
   ○ http://goo.gl/isNb6

● Esper 4.4.0 Reference documentation
   ○ http://goo.gl/5TXel

● EsperIO 4.4.0 Reference documentation
   ○ http://goo.gl/76uOe
Esper Architecture
Esper EDAS
CEP Architecture
CEP Architecture
CEP Architecture
Sample CEP Architecture
Real-time Log Aggregator & CEP
Input / Output Adapters

● Binary File Reader Input
● Binary File Writer Output
● CSV File Reader Input
● CSV File Writer Output
● CSV Socket Reader Input
● CSV Socket Writer Output
● Email (IMAP) Reader Input
● Email Sender
● HA Heartbeat Input
● IP Packet Capture /HTTP
● IP Packet Capture /IRC
Input / Output Adapters

● IP Packet Capture /POP3
● IP Packet Capture /SMTP
● IRC Output adapter
● Jabber Output Adapter
● JDBC
● JMS Publish/Subscribe*
● Log Output
● Microsoft Excel RTD*
● Multicast UDP Input and Output*
● Quartz Enterprise Scheduler Input*
Input / Output Adapters

● Regular Expression File Reader Input
● Regular Expression Socket Reader Input
● RSS
● Twitter
● Unicast UDP Input Adapter
● XML File Writer Output
● XML over HTTP Writer Output
● Hadoop HDFS Input Adapter
● Hadoop HDFS Output Adapter
Esper EPL
Event Processing Language




select symbol, symbolDesc from OrderEvent.win:time(30 min)
Event Processing Language

● No standard
● SQL-like language
● Data windows
● Pattern matching
● Continuous query
Event Processing Language
Event Processing Model
Event Processing Model
Event Processing Model
Event Processing Model
Event Processing Language

● Event filtering
● Sliding windows and aggregation
● Grouped windows and output rate limiting
● Joins and Outer Joins
● Historical or reference data
● Subquery
Event Example: The RFID Domain

● RFID: Radio Frequency Identification
● LocationReport
    ○ asset id - a unique identifier of the tagged asset
    ○ x - the x location value
    ○ y - the y location value
    ○ zone - derived from x and y
● Use cases
    ○ “When a given group of assets are not moving together from
      zone to zone, then...”
    ○ “When a given asset stays too long in the same zone, then...”
EPL Statement Sample

● If a given set of assets are not moving together from zone to zone,
● then alert



    insert into CountZone
    select zone, count(*) as cnt
    from LocationReport.std:unique('assetId')
    where assetId in (1, 2, 3)
    group by zone
EPL Statement Sample


select Part.zone from pattern [
    every Part=CountZone(cnt in (1, 2)) ->
    ( timer:interval(1 min) and not
     CountZone(zone=Part.zone, cnt in (0, 3))
    )
]
Listener and Engine

// Get engine instance and register statement
EPServiceProvider engine = EPServiceProviderManager.getDefaultProvider();
EPStatement statement = engine.getEPAdministrator().createEQL("...");


// Attach a listener
statement.addListener(new UpdateListener() {
public void update(EventBean[] newEvents, EventBean[] oldEvents) {
      // Handle complex event
      ...
}
});
Sending events

// Get the same engine instance
EPServiceProvider engine = EPServiceProviderManager.
getDefaultProvider();
EPRuntime runtimeEngine = engine.getRuntime();


...


LocationReport event = new LocationReport(assetId,x,y,zone);
runtimeEngine.sendEvent(event);
Event filtering




// Filter for location report by location rectangle
select * from LR(x in [4:10], y in [6:12])
Sliding windows and aggregation



// Count all assets reporting zone 10 in last 30 sec
select count(*) from LR(zone=10).win:time(30 sec)
Grouped windows and output rate limiting



// Get X location range of the last 100 events per zone
// every 1 minute
select zone, min(x), max(x)
from LR.std:groupby('zone').win:length(100 events)
output every 1 min
Continuous joins


// Fire when any asset enters zone 2 before zone 1
select Zone2.assetId
from
  LR(zone=2).win:time(1 day) Zone2
left outer join
  LR(zone=1).win:time(1 day) Zone1
on Zone1.assetId = Zone2.assetId
where Zone1.assetId is null
Historical or reference data



// Alert when we hit the minimum inventory
// for a given zone
select zone, count(*)
from LR.std:unique(assetId) as lr,
sql:db[select mini from Minimum where zone=${lr.zone}]
having mini < count(*)
Subquery



// Notify when the asset id is not known
select * from LR
where assetId not in
(select assetId
from KnownAsset.std:unique('assetId'))
Data window views

● win:length
● win:length_batch
● win:time
● win:time_batch
● win:time_length_batch
● win:time_accum
● win:ext_timed
● ext:sort_window
● ext:time_order
Data window views

● std:unique
● std:groupwin
● std:lastevent
● std:firstevent
● std:firstunique
● win:firstlength
● win:firsttime
Statistics views

● std:size
● stat:uni
● stat:linest
● stat:correl
● stat:weighted_avg
CEP Application Development Steps

● Define Event
● Define Event Type
● Define EPL Statements
● Publish EPL Statements
● Subscribe Output Adapter
● Attache Input Adapter
CEP Application Development Points

● Runtime 환경 결정
● Resilience를 지원 여부
● Zero-downtime event processing
● Support dynamic EPL Statement updates
● Input/Output Adapter에서 bottleneck이 발생
● 그러므로 Adapter의 성능이 중요
● Event의 타입과 용량에 따라서 성능에 영향
● Input Adapter의 통신 protocol 결정 중요
● CEP Engine Performance Tuning
CEP Application Key Considerations

● Low Latency

● High Throughput

● High Availability - Failover

● Zero-downtime
Performance

● Throughput
   ○ events/sec

● Latency
    ○ us/event


● 성능 측정은 throughput을 고정하고 latency statistics로 측정

● http://docs.codehaus.org/display/ESPER/Esper+performance
Latency statistics

● Throughput 995900 (active 0 pending 0)

 ---Stats - engine (unit: ns)

  Avg: 2656 #9936457

        0<    5000: 99.78% 99.78% #9914178

     5000 < 10000: 0.20% 99.98% #20120

   10000 < 15000: 0.01% 99.98% #646

   15000 < 20000: 0.00% 99.99% #69

   20000 < 25000: 0.00% 99.99% #36

   25000 < 50000: 0.00% 99.99% #56

   50000 < 100000: 0.00% 99.99% #26

   100000 < 500000: 0.00% 99.99% #189

   500000 < 1000000: 0.00% 99.99% #2

  1000000 < 2500000: 0.00% 99.99% #68
Thanks
 Q&A
Thanks
 Q&A
Practice!!
http://goo.gl/5ijAu
JBoss Community (http://www.jboss.org)
Korea JBoss User Group (http://cafe.naver.com/jbossug)

More Related Content

What's hot (9)

PDF
Next generation alerting and fault detection, SRECon Europe 2016
Dieter Plaetinck
 
PDF
Bosun Monitoring Talk at LISA14
Kyle Brandt
 
PDF
Distributed real time stream processing- why and how
Petr Zapletal
 
PDF
QCon London: Low latency Java in the real world - LMAX Exchange and the Zing JVM
Azul Systems, Inc.
 
PDF
Deep Learning in Spark with BigDL by Petar Zecevic at Big Data Spain 2017
Big Data Spain
 
PDF
[245] presto 내부구조 파헤치기
NAVER D2
 
PDF
Reactive Software Systems
Behrad Zari
 
PDF
Building a Database for the End of the World
jhugg
 
PDF
Important Factors that bring down the trading systems projects
NexSoftsys
 
Next generation alerting and fault detection, SRECon Europe 2016
Dieter Plaetinck
 
Bosun Monitoring Talk at LISA14
Kyle Brandt
 
Distributed real time stream processing- why and how
Petr Zapletal
 
QCon London: Low latency Java in the real world - LMAX Exchange and the Zing JVM
Azul Systems, Inc.
 
Deep Learning in Spark with BigDL by Petar Zecevic at Big Data Spain 2017
Big Data Spain
 
[245] presto 내부구조 파헤치기
NAVER D2
 
Reactive Software Systems
Behrad Zari
 
Building a Database for the End of the World
jhugg
 
Important Factors that bring down the trading systems projects
NexSoftsys
 

Similar to Complex Event Processing with Esper (20)

PPT
Complex Event Processing
John Plummer
 
PDF
Complex Event Processor 3.0.0 - An overview of upcoming features
WSO2
 
PPT
Open Source Event Processing for Sensor Fusion Applications
guestc4ce526
 
PDF
Complex Event Processing with Esper
Ted Won
 
PDF
WSO2 Product Release Webinar - WSO2 Complex Event Processor
WSO2
 
PDF
Real Time Event Processing and In-­memory analysis of Big Data - StampedeCon ...
StampedeCon
 
PDF
EDA With Glassfish ESB Jfall IEP Intelligent Event Processing
Eugene Bogaart
 
PDF
[Hands-on] CQRS(Command Query Responsibility Segregation) 와 Event Sourcing 패턴 실습
Oracle Korea
 
PPTX
CQRS and Event Sourcing
Inho Kang
 
PDF
Decision CAMP 2014 - Mariano de Maio
Decision CAMP
 
PPT
FIWARE CEP GE introduction, ICT 2015
ishkin
 
PDF
Applying complex event processing (2010-10-11)
Geoffrey De Smet
 
PPT
Processing Patterns for Predictive Business
Tim Bass
 
PDF
Introducing the WSO2 Complex Event Processor
WSO2
 
PDF
Semantic Complex Event Processing at Sem Tech 2010
Adrian Paschke
 
PPT
Processing Patterns for PredictiveBusiness
Tim Bass
 
PPTX
Why and how to engage a Complex Event Processor from a Java Web Application
Lucas Jellema
 
PPT
Combating Fraud and Intrusion Threats with Event Processing
Tim Bass
 
PPTX
eBiz#3: CEP
Yulian Slobodyan
 
PDF
Reaction RuleML 1.0
Adrian Paschke
 
Complex Event Processing
John Plummer
 
Complex Event Processor 3.0.0 - An overview of upcoming features
WSO2
 
Open Source Event Processing for Sensor Fusion Applications
guestc4ce526
 
Complex Event Processing with Esper
Ted Won
 
WSO2 Product Release Webinar - WSO2 Complex Event Processor
WSO2
 
Real Time Event Processing and In-­memory analysis of Big Data - StampedeCon ...
StampedeCon
 
EDA With Glassfish ESB Jfall IEP Intelligent Event Processing
Eugene Bogaart
 
[Hands-on] CQRS(Command Query Responsibility Segregation) 와 Event Sourcing 패턴 실습
Oracle Korea
 
CQRS and Event Sourcing
Inho Kang
 
Decision CAMP 2014 - Mariano de Maio
Decision CAMP
 
FIWARE CEP GE introduction, ICT 2015
ishkin
 
Applying complex event processing (2010-10-11)
Geoffrey De Smet
 
Processing Patterns for Predictive Business
Tim Bass
 
Introducing the WSO2 Complex Event Processor
WSO2
 
Semantic Complex Event Processing at Sem Tech 2010
Adrian Paschke
 
Processing Patterns for PredictiveBusiness
Tim Bass
 
Why and how to engage a Complex Event Processor from a Java Web Application
Lucas Jellema
 
Combating Fraud and Intrusion Threats with Event Processing
Tim Bass
 
eBiz#3: CEP
Yulian Slobodyan
 
Reaction RuleML 1.0
Adrian Paschke
 
Ad

More from Ted Won (17)

PDF
Undertow RequestBufferingHandler 소개
Ted Won
 
PDF
JBoss EAP 7 & JDG 7 최신 기술 소개
Ted Won
 
PDF
JBoss Modules Internal
Ted Won
 
PDF
오픈 소스 컨트리뷰션 가이드
Ted Won
 
PDF
Jenkins X Hands-on - automated CI/CD solution for cloud native applications o...
Ted Won
 
PDF
Jenkins X - automated CI/CD solution for cloud native applications on Kubernetes
Ted Won
 
PDF
Hawkular overview
Ted Won
 
PDF
JDG 7 & Spark Integration
Ted Won
 
PDF
지금 핫한 Real-time In-memory Stream Processing 이야기
Ted Won
 
PDF
Nara - Personalized Web Recommendation Service Quick Review
Ted Won
 
PDF
JBoss Community's Application Monitoring Platform
Ted Won
 
PDF
Real-time Big Data Analytics Practice with Unstructured Data
Ted Won
 
PDF
Red Hat Forum 2012 - JBoss RHQ - Java Application Monitoring & Management Pla...
Ted Won
 
PDF
Building Real-time CEP Application with Open Source Projects
Ted Won
 
PDF
JCO 11th 클라우드 환경에서 Java EE 운영 환경 구축하기
Ted Won
 
PDF
JBoss RHQ와 Byteman을 이용한 오픈소스 자바 애플리케이션 모니터링
Ted Won
 
PPT
RHQ 공감 Seminar 6th
Ted Won
 
Undertow RequestBufferingHandler 소개
Ted Won
 
JBoss EAP 7 & JDG 7 최신 기술 소개
Ted Won
 
JBoss Modules Internal
Ted Won
 
오픈 소스 컨트리뷰션 가이드
Ted Won
 
Jenkins X Hands-on - automated CI/CD solution for cloud native applications o...
Ted Won
 
Jenkins X - automated CI/CD solution for cloud native applications on Kubernetes
Ted Won
 
Hawkular overview
Ted Won
 
JDG 7 & Spark Integration
Ted Won
 
지금 핫한 Real-time In-memory Stream Processing 이야기
Ted Won
 
Nara - Personalized Web Recommendation Service Quick Review
Ted Won
 
JBoss Community's Application Monitoring Platform
Ted Won
 
Real-time Big Data Analytics Practice with Unstructured Data
Ted Won
 
Red Hat Forum 2012 - JBoss RHQ - Java Application Monitoring & Management Pla...
Ted Won
 
Building Real-time CEP Application with Open Source Projects
Ted Won
 
JCO 11th 클라우드 환경에서 Java EE 운영 환경 구축하기
Ted Won
 
JBoss RHQ와 Byteman을 이용한 오픈소스 자바 애플리케이션 모니터링
Ted Won
 
RHQ 공감 Seminar 6th
Ted Won
 
Ad

Recently uploaded (20)

PDF
Researching The Best Chat SDK Providers in 2025
Ray Fields
 
PDF
A Strategic Analysis of the MVNO Wave in Emerging Markets.pdf
IPLOOK Networks
 
PDF
AI Unleashed - Shaping the Future -Starting Today - AIOUG Yatra 2025 - For Co...
Sandesh Rao
 
PDF
Responsible AI and AI Ethics - By Sylvester Ebhonu
Sylvester Ebhonu
 
PPTX
IT Runs Better with ThousandEyes AI-driven Assurance
ThousandEyes
 
PDF
Peak of Data & AI Encore - Real-Time Insights & Scalable Editing with ArcGIS
Safe Software
 
PDF
The Future of Artificial Intelligence (AI)
Mukul
 
PDF
OFFOFFBOX™ – A New Era for African Film | Startup Presentation
ambaicciwalkerbrian
 
PPTX
What-is-the-World-Wide-Web -- Introduction
tonifi9488
 
PPTX
The Future of AI & Machine Learning.pptx
pritsen4700
 
PPTX
Introduction to Flutter by Ayush Desai.pptx
ayushdesai204
 
PPTX
Farrell_Programming Logic and Design slides_10e_ch02_PowerPoint.pptx
bashnahara11
 
PPTX
Applied-Statistics-Mastering-Data-Driven-Decisions.pptx
parmaryashparmaryash
 
PDF
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
 
PPTX
Agentic AI in Healthcare Driving the Next Wave of Digital Transformation
danielle hunter
 
PPTX
Agile Chennai 18-19 July 2025 | Emerging patterns in Agentic AI by Bharani Su...
AgileNetwork
 
PDF
Economic Impact of Data Centres to the Malaysian Economy
flintglobalapac
 
PDF
introduction to computer hardware and sofeware
chauhanshraddha2007
 
PDF
CIFDAQ's Market Wrap : Bears Back in Control?
CIFDAQ
 
PPTX
Agile Chennai 18-19 July 2025 Ideathon | AI Powered Microfinance Literacy Gui...
AgileNetwork
 
Researching The Best Chat SDK Providers in 2025
Ray Fields
 
A Strategic Analysis of the MVNO Wave in Emerging Markets.pdf
IPLOOK Networks
 
AI Unleashed - Shaping the Future -Starting Today - AIOUG Yatra 2025 - For Co...
Sandesh Rao
 
Responsible AI and AI Ethics - By Sylvester Ebhonu
Sylvester Ebhonu
 
IT Runs Better with ThousandEyes AI-driven Assurance
ThousandEyes
 
Peak of Data & AI Encore - Real-Time Insights & Scalable Editing with ArcGIS
Safe Software
 
The Future of Artificial Intelligence (AI)
Mukul
 
OFFOFFBOX™ – A New Era for African Film | Startup Presentation
ambaicciwalkerbrian
 
What-is-the-World-Wide-Web -- Introduction
tonifi9488
 
The Future of AI & Machine Learning.pptx
pritsen4700
 
Introduction to Flutter by Ayush Desai.pptx
ayushdesai204
 
Farrell_Programming Logic and Design slides_10e_ch02_PowerPoint.pptx
bashnahara11
 
Applied-Statistics-Mastering-Data-Driven-Decisions.pptx
parmaryashparmaryash
 
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
 
Agentic AI in Healthcare Driving the Next Wave of Digital Transformation
danielle hunter
 
Agile Chennai 18-19 July 2025 | Emerging patterns in Agentic AI by Bharani Su...
AgileNetwork
 
Economic Impact of Data Centres to the Malaysian Economy
flintglobalapac
 
introduction to computer hardware and sofeware
chauhanshraddha2007
 
CIFDAQ's Market Wrap : Bears Back in Control?
CIFDAQ
 
Agile Chennai 18-19 July 2025 Ideathon | AI Powered Microfinance Literacy Gui...
AgileNetwork
 

Complex Event Processing with Esper

  • 1. Complex Event Processing with Esper Real-time Event Stream & Complex Event Processing Ted Won 2011. 11. 12. http://tedwon.com
  • 5. Nanosecond ● CEP 세계의 측정 단위는 nanosecond ● A nanosecond (ns) is one billionth of a second
  • 6. Nanosecond 1 second is... 1,000 ms 1,000,000 us 1,000,000,000 ns
  • 7. Concept of CEP ● 교회에서...  ● 벨이 울린다. ● 턱시도를 입은 남자와 꽃을 든 여자가 함께 걷는다. ● 두 사람 위로 꽃 잎이 날리고 푹죽이 터진다.
  • 8. Concept of CEP CEP 기술은 이러한 Complex한 Event를 참조하여 결혼식이라는 것을 알아 차린다.
  • 9. Imagination Beyond Reality ● Imaginary CEP Use Cases
  • 10. Imagination Beyond Reality ● E-mart에서... ● 고객들이 카트를 끌고 매장을 돌아 다닌다. ● 카트의 이동 경로와 패턴을 알 수 없을까? ● 계산대에서 대기하는 고객들 상태 파악 후 실시간 조치 ● 카트 + 멤버십 카드라면 카트에 달린 모니터를 통해  개인화된 실시간 추천/쿠폰 발행 ● 카트에 물건을 담으면 자동으로 계산
  • 11. Imagination Beyond Reality ● 전국의 이마트 매장이 130개... ● 엄청난 양의 데이터를 어찌 실시간으로 처리한단 말인가?? ● Starbucks 매장에서... ● 파주 프리미엄 아웃렛 매장에서... ● 교통 관리에서 실시간으로 교통 상태/패턴을 인지하고 적절한 조치
  • 12. Imagination Beyond Reality ● Algorithmic Stock-Trading ● Applying CEP to the RHQ alert feature as a Operational Intelligence (OI) solution
  • 14. What is CEP ● Complex Event Processing ● CEP는 Event 중심의 실시간 대용량 데이터 처리 기술 ● CEP는 실시간 대용량 Event 처리 기술 ● CEP는 EDA(Event-driven architecture) 기반 시스템 ● Mutliple event stream에서 발생하는 패턴 감지 기술
  • 15. What is CEP ● Identifying the most meaningful events from event cloud ● Real-time computation and pattern detection over event streams ● Response가 아닌 Reaction을 하는 시스템 ● http://en.wikipedia.org/wiki/Complex_Event_Processing
  • 16. What is CEP ● Real-time Processing ● Intelligence System ● Real-time Business Intelligence ● Event Stream Intelligence
  • 17. What is CEP ● Extreme Transaction Processing ● Publish/Subscribe Model ● Loosley-coupled ● Asynchronous Style Source: Event Processing in Action
  • 18. Open Source CEP ● EsperTech Esper (Stream-oriented) ● JBoss Drools Fusion (Rule-oriented)
  • 19. CEP Language Style ● Strem-oriented ○ EsperTech Esper ○ MS StreamInsight ● Rule-oriented ○ JBoss Drools Fusion ○ TIBCO TIBCO BusinessEvents
  • 21. What is EDA ● Event Driven Architecture ● EDA는 event의 production, detection, consumption과 reaction 하기위한 구조를 정의한 software architecture Source: Event Processing in Action
  • 22. What is EDA ● More Loosely-coupled than SOA ● Event 표준 스펙 논의가 OASIS에서  Common Base Events라는 이름으로 진행 중 ● Response가 아닌 Reaction을 하는 시스템 ● 선처리 후저장 패러다임 ● http://en.wikipedia.org/wiki/Event-driven_architecture
  • 23. Classical Request-response Architecture ● Synchronous interactions ● Request에 대한 Response를 하는 구조 ● 선저장 후처리 패러다임
  • 24. Event Processing Styles ● SEP - Simple Event Processing ○ Single event based ○ 상태가 없는 Event를 처리하는 케이스 ○ JMS(Java Message Service)가 대표적인 예 ○ ESB(Enterprise Service Bus) ● ESP - Event Stream Processing ● CEP - Complex Event Processing
  • 25. Event Processing Application Source: Event Processing in Action
  • 26. ESP vs. CEP ● ESP - Event Stream Processing ○ Monitor streams of event data, analyse those events, and act upon opportunities ○ Volume weighted average of Google stock over the last (moving) 30min ● CEP - Complex Event Processing ○ Detecting patterns among events ○ If this Google VWAP increased more than 5% two times followed by Yahoo! VWAP decreased more than 10% then…
  • 27. SOA vs. EDA ● SOA ○ RPC calls ○ Point-to-Point communication ○ Request and reply ○ Vertical interaction ● EDA ○ Message based ○ Less coupled than SOA ○ Publish and subscribe ○ Horizontal communication between tiers in process chain
  • 30. What is an Event?
  • 31. What is an Event ● Event란 무엇인가? ● 무엇을 Event로 정의 할 수 있는가?
  • 32. What is an Event ● Something that happens ● 실제로 발생한 사건, 일, 메세지 ● 상태의 변경
  • 33. What is an Event ● An event is an immutable record of a past occurrence of an action or state change. ● Event properties capture the useful information for an event.
  • 34. What is an Event Event란 어떤 것이 변화한 것이다!
  • 35. What is an Event ● 변화한다는 것은 어떠한 상태를 가지고 있다는 의미 ● 상태를 가지고 변화하는 모든 것이 Event로 정의될 수 있다. ● 이 세상의 모든 것은 변화한다. ● 변화량을 정량적으로 측정가능하도록 정의해야함 ● Event를 추상화하여 표현한 것을 Event type이라함
  • 36. What is an Event ● 상태가 없는 Event를 처리하는 경우도 존재 ● SEP(Simple Event Processing)의 경우 존재 ● JMS가 하나의 예
  • 37. Event Examples ● Stock tick ● 비밀번호 변경 ● 10초마다 실내 온도 측정 ● 서비스 응답 시간 ● 고객이 들고 다가오는 Starbucks membership cards with RFID ● 고객이 끌고 다니는 E-mart carts with RFID
  • 38. Events vs. Messages ● Event는 때로는 Message로 표현됨 ● Message는 단순히 Event의 다른 표현이라는 측면도 존재 ● Event의 상태라는 속성이 Message에서는 어떤 내용(contents)이 라는 차이 ● EDA에 속한 개념으로써 SEP(Simple Event Processing)의 한 종류 인 JMS와 같은 기술에서 사용하는 전문 용어라는 측면
  • 39. What is Event Type?
  • 40. What is Event Type ● Event Representation Schema ● 개념적인 Event를 실제 프로그래밍적으로 표현하는 방법 ● Event의 개념적 표현을 Event Schema라 할 수 있는데 ● Event Schema의 표현을 Event Type 으로 한다. ● DBMS의 테이블 스키마와 유사한 개념 ● 대표적인 Data Format을 이용하여 정의 할 수 있다.
  • 41. Event Type Data Format ● POJO ● Map ● XML ● JSON ● CSV
  • 42. What is Event Stream?
  • 43. What is Event Stream ● 시간의 순서대로 연속되는 Event ● 시작과 끝이 없는 Event의 연속된 흐름
  • 45. What is Real-time Real-time system은 다음의 조건들을 충족해야 합니다 ● Low latency ● Regularities in Response time ● Providing predictable performance
  • 46. CEP Usages ● Algorithmic Stock-Trading ● Operational Intelligence(OI) solutions ● Real-time analytics ● Predictive analytics ● Event-driven business process management ● BAM - Business Activity Monitoring ● BI - Business intelligence ● BRMSs - Business rule management systems ● Network and System Management ● MOM- Message-oriented middleware ● Stream computing ● ETL(Extract, Transform, Load)
  • 48. Esper
  • 49. EsperTech Esper ● Event Stream and Complex Event Processing platform ● Convergence of ESP and CEP ● Open Source ESP/CEP Engine ● Event Processing Language (EPL) ● Java and .Net
  • 50. EsperTech Esper ● High Throughput, Low Latency ● Highly Available (EsperHA) ● Rich Multi-Window GUI (Enterprise Edition) ● Real-time Displays (Enterprise Edition) ● Enterprise *ilities (Enterprise Edition)
  • 51. EsperTech Esper ● Usability ● Maintainability ● Scalability ● Availability and Reliability ● Extensibility ● Security ● Portability
  • 52. EsperTech Esper ● Technical Support (Enterprise Edition) ● Lightweight & Embeddable ● No Runtime Support ● GNU GPL(General Public License) v2
  • 53. Runtime: Esper + Java EE platform
  • 55. Esper Documentation ● Esper Documentation Home ○ http://goo.gl/isNb6 ● Esper 4.4.0 Reference documentation ○ http://goo.gl/5TXel ● EsperIO 4.4.0 Reference documentation ○ http://goo.gl/76uOe
  • 63. Input / Output Adapters ● Binary File Reader Input ● Binary File Writer Output ● CSV File Reader Input ● CSV File Writer Output ● CSV Socket Reader Input ● CSV Socket Writer Output ● Email (IMAP) Reader Input ● Email Sender ● HA Heartbeat Input ● IP Packet Capture /HTTP ● IP Packet Capture /IRC
  • 64. Input / Output Adapters ● IP Packet Capture /POP3 ● IP Packet Capture /SMTP ● IRC Output adapter ● Jabber Output Adapter ● JDBC ● JMS Publish/Subscribe* ● Log Output ● Microsoft Excel RTD* ● Multicast UDP Input and Output* ● Quartz Enterprise Scheduler Input*
  • 65. Input / Output Adapters ● Regular Expression File Reader Input ● Regular Expression Socket Reader Input ● RSS ● Twitter ● Unicast UDP Input Adapter ● XML File Writer Output ● XML over HTTP Writer Output ● Hadoop HDFS Input Adapter ● Hadoop HDFS Output Adapter
  • 67. Event Processing Language select symbol, symbolDesc from OrderEvent.win:time(30 min)
  • 68. Event Processing Language ● No standard ● SQL-like language ● Data windows ● Pattern matching ● Continuous query
  • 74. Event Processing Language ● Event filtering ● Sliding windows and aggregation ● Grouped windows and output rate limiting ● Joins and Outer Joins ● Historical or reference data ● Subquery
  • 75. Event Example: The RFID Domain ● RFID: Radio Frequency Identification ● LocationReport ○ asset id - a unique identifier of the tagged asset ○ x - the x location value ○ y - the y location value ○ zone - derived from x and y ● Use cases ○ “When a given group of assets are not moving together from zone to zone, then...” ○ “When a given asset stays too long in the same zone, then...”
  • 76. EPL Statement Sample ● If a given set of assets are not moving together from zone to zone, ● then alert insert into CountZone select zone, count(*) as cnt from LocationReport.std:unique('assetId') where assetId in (1, 2, 3) group by zone
  • 77. EPL Statement Sample select Part.zone from pattern [ every Part=CountZone(cnt in (1, 2)) -> ( timer:interval(1 min) and not CountZone(zone=Part.zone, cnt in (0, 3)) ) ]
  • 78. Listener and Engine // Get engine instance and register statement EPServiceProvider engine = EPServiceProviderManager.getDefaultProvider(); EPStatement statement = engine.getEPAdministrator().createEQL("..."); // Attach a listener statement.addListener(new UpdateListener() { public void update(EventBean[] newEvents, EventBean[] oldEvents) { // Handle complex event ... } });
  • 79. Sending events // Get the same engine instance EPServiceProvider engine = EPServiceProviderManager. getDefaultProvider(); EPRuntime runtimeEngine = engine.getRuntime(); ... LocationReport event = new LocationReport(assetId,x,y,zone); runtimeEngine.sendEvent(event);
  • 80. Event filtering // Filter for location report by location rectangle select * from LR(x in [4:10], y in [6:12])
  • 81. Sliding windows and aggregation // Count all assets reporting zone 10 in last 30 sec select count(*) from LR(zone=10).win:time(30 sec)
  • 82. Grouped windows and output rate limiting // Get X location range of the last 100 events per zone // every 1 minute select zone, min(x), max(x) from LR.std:groupby('zone').win:length(100 events) output every 1 min
  • 83. Continuous joins // Fire when any asset enters zone 2 before zone 1 select Zone2.assetId from LR(zone=2).win:time(1 day) Zone2 left outer join LR(zone=1).win:time(1 day) Zone1 on Zone1.assetId = Zone2.assetId where Zone1.assetId is null
  • 84. Historical or reference data // Alert when we hit the minimum inventory // for a given zone select zone, count(*) from LR.std:unique(assetId) as lr, sql:db[select mini from Minimum where zone=${lr.zone}] having mini < count(*)
  • 85. Subquery // Notify when the asset id is not known select * from LR where assetId not in (select assetId from KnownAsset.std:unique('assetId'))
  • 86. Data window views ● win:length ● win:length_batch ● win:time ● win:time_batch ● win:time_length_batch ● win:time_accum ● win:ext_timed ● ext:sort_window ● ext:time_order
  • 87. Data window views ● std:unique ● std:groupwin ● std:lastevent ● std:firstevent ● std:firstunique ● win:firstlength ● win:firsttime
  • 88. Statistics views ● std:size ● stat:uni ● stat:linest ● stat:correl ● stat:weighted_avg
  • 89. CEP Application Development Steps ● Define Event ● Define Event Type ● Define EPL Statements ● Publish EPL Statements ● Subscribe Output Adapter ● Attache Input Adapter
  • 90. CEP Application Development Points ● Runtime 환경 결정 ● Resilience를 지원 여부 ● Zero-downtime event processing ● Support dynamic EPL Statement updates ● Input/Output Adapter에서 bottleneck이 발생 ● 그러므로 Adapter의 성능이 중요 ● Event의 타입과 용량에 따라서 성능에 영향 ● Input Adapter의 통신 protocol 결정 중요 ● CEP Engine Performance Tuning
  • 91. CEP Application Key Considerations ● Low Latency ● High Throughput ● High Availability - Failover ● Zero-downtime
  • 92. Performance ● Throughput ○ events/sec ● Latency ○ us/event ● 성능 측정은 throughput을 고정하고 latency statistics로 측정 ● http://docs.codehaus.org/display/ESPER/Esper+performance
  • 93. Latency statistics ● Throughput 995900 (active 0 pending 0) ---Stats - engine (unit: ns) Avg: 2656 #9936457 0< 5000: 99.78% 99.78% #9914178 5000 < 10000: 0.20% 99.98% #20120 10000 < 15000: 0.01% 99.98% #646 15000 < 20000: 0.00% 99.99% #69 20000 < 25000: 0.00% 99.99% #36 25000 < 50000: 0.00% 99.99% #56 50000 < 100000: 0.00% 99.99% #26 100000 < 500000: 0.00% 99.99% #189 500000 < 1000000: 0.00% 99.99% #2 1000000 < 2500000: 0.00% 99.99% #68
  • 97. JBoss Community (http://www.jboss.org) Korea JBoss User Group (http://cafe.naver.com/jbossug)