Traffic monitoring or crowd management systems produce large amounts of data in the form of events that need to be processed to detect relevant incidents.
Rule-based pattern recognition is a promising approach for these applications, however, increasing amounts of data as well as large and complex rule sets demand for more and more processing power and memory. In order to scale such applications, a rule-based pattern detection system needs to be distributable over multiple machines. Today’s approaches are however focused on static distribution of rules or do not support reasoning over the full set of events.
We propose Cloud PARTE, a complex event detection system that implements the Rete algorithm on top of mobile actors. These actors can migrate between machines to respond to changes in the work load distribution. Cloud PARTE is an extension of PARTE and offers the first rule engine specifically tailored for continuous complex event detection that is able to benefit from elastic systems as provided by cloud computing platforms. It supports fully automatic load balancing and supports online rules with access to the entire event pool.
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Cloud PARTE: Elastic Complex Event Processing based on Mobile Actors
1. Cloud PARTE
Elastic Complex Event Processing
based on Mobile Actors
J. Swalens, T. Renaux, L. Hoste, S. Marr, W. De Meuter
Software Languages Lab
AGERE Workshop, 2013-10-27
8. How to approach such scenarios?
• Declarative rules!
• Online processing of real-time events!
1 set of rules
1 set of facts
Load balancing
Elasticity
(transparent distribution)
8
9. Our Approach
Parallel + Soft Real-Time
•
•
•
•
Distributed for “Big Data”
Declarative rules
Mobile actors
Central managing interface
Simple heuristics for load balancing
9
10. PARTE: A Parallel, Actor-based Rete Engine
(defrule StationaryCar
(Car (cam ?c) (plate ?plt) (time ?t1))
(Car (cam ?c) (plate ?plt) (time ?t2))
(test (> (- ?t2 ?t1) 30))
(Cam (id ?c) (position ?p))
Events
e=Car
• Each node an actor
• Unification memory
intensive
• Tests computationally
intensive
e=Cam
Unification
1.cam=2.cam
1.plate=2.plate
=>
(assert (StationaryCar (pos ?p)))
Type Tests
1
2
Test
time-diff > 30
Unification
cam=id
3
4
assert
[1] Rete: A Fast Algorithm for the Many Patterns/Many Objects Match Problem, Charles L. Forgy. Artif. Intell. 19(1):17–37 (1982)
[2] Parallel Gesture Recognition with Soft Real-Time Guarantees, T. Renaux, L. Hoste, S. Marr, and W. De Meuter. AGERE’12, 35–46.
10
11. Cloud PARTE
From Parallel to Distributed
1
Events
2
3
(defrule StationaryCar
(Car (cam ?c) (plate ?plt) (time
?t1))
(Car (cam ?c) (plate ?plt) (time
?t2))
(test (> (- ?t2 ?t1) 30))
(Cam (id ?c) (position ?p))
=>
(assert (StationaryCar (pos ?p)))
4
master
App
• Transparent Distribution
worker
Cloud PARTE builds on Theron (C++ actor library, http://www.theron-library.com/)
11
12. Cloud PARTE
From Parallel to Distributed
Events
1
Load
Balancer
2
(defrule StationaryCar
(Car (cam ?c) (plate ?plt) (time
?t1))
(Car (cam ?c) (plate ?plt) (time
?t2))
(test (> (- ?t2 ?t1) 30))
(Cam (id ?c) (position ?p))
=>
(assert (StationaryCar (pos ?p)))
4
master
App
3
worker
• Automatic Load Balancing
• Mobile actors
• Heuristic
– Length of message queue
Cloud PARTE builds on Theron (C++ actor library, http://www.theron-library.com/)
12
13. Cloud PARTE
From Parallel to Distributed
1
Load
Balancer
3
4
master
App
Events
2
worker
• Elasticity
– Adding/removing
of workers
• Coordination
required
(currently)
13
14. Cloud PARTE
From Parallel to Distributed
• Elasticity
2
Load
Balancer
3
4
master
App
Events
1
worker
– Adding/removing
of workers
• Coordination
required
(currently)
14
16. Microbenchmarks
16 heavy tests
Cloud PARTE Scalability
PARTE vs.
CloudPARTE
Slow
down
101 simple tests
501 simple tests
101 complex tests
… with variables
10x101 simple tests
10x8 heavy tests
16 heavy tests
32 heavy tests
64 heavy tests
128 heavy tests
Joining tree
Search
18x
29x
5x
5x
60x
2x
4x
4x
4x
3x
6x
2x
Single machine
Performance Evaluation: Comparison with non-distributed PARTE
16
20. 1 set of rules
1 set of facts
Load balancing
Elasticity
(transparent distribution)
Traffic Management
Cloud PARTE: Elastic Complex Event Processing based on Mobile Actors
20
First: all the good ideas are the ones of my colleagues, and the bad ones are all mine.Second: what I am going to talk about is a distributed Rete engineA forward chaining inference engine, for complex event detection, pattern matching
NYC area 8mio cars, and 18mio peopleBeijing 5mio cars, 20mio peopleImagine we want to manage the traffic based on realtime dataThe amount of data is not the real problem:Singapore: 5mio people.
State the conclusions, requirements, base to work fromMany to many matchingMany Rules and Many events
Declarative rules!Online processing of real-time eventsLoad-balancing (dynamic)Elastic (add more machines)Transparent distribution (single system image)
So, why would you care? Well, we believe that we do not only have a contribution in the field of Rete engines, but at the same time a relevant application of the actor modelInitial prototype with:Transparent DistributionMobile actorsCentral managing interface (managing actor)Simple load balancing heuristic
Make explicit: all nodes are actors, communicate via message passingPoint out the data intensive nodes, cross-product of cars, and cams and cars.Point out that tests can be all kind of things, complex expressions, but also compute intensive external functions, e.g., to calculate the spatial relationships between points
Mobility built on top of theronclassic code mobilitythe actor contains it’s code, for instance the test expressionGather load info per machineFind load imbalance node overloaded if > 50 messages machine overloaded if ≥ 5 overloaded nodesmachine underloaded if < 3 overloaded nodes 3. Select node to move and destination