cloud parte: elastic complex event processing based on mobile actors

22
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

Upload: stefan-marr

Post on 10-May-2015

1.252 views

Category:

Technology


0 download

DESCRIPTION

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.

TRANSCRIPT

Page 1: Cloud PARTE: Elastic Complex Event Processing based on Mobile Actors

Cloud PARTEElastic Complex Event Processing

based on Mobile ActorsJ. Swalens, T. Renaux, L. Hoste, S. Marr, W. De Meuter

Software Languages LabAGERE Workshop, 2013-10-27

Page 2: Cloud PARTE: Elastic Complex Event Processing based on Mobile Actors

2

Use Case

TrafficManagement ©Filip Bogdan

http://photo.net/photodb/photo?photo_id=5953570

Page 3: Cloud PARTE: Elastic Complex Event Processing based on Mobile Actors

Traffic Management at City Scale?©Jupiter Systems,

Beijing TrafficManagement Bureau

Source: City-Scale Traffic Estimation from a Roving Sensor Network, Javed Aslam, Sejoon Lim, Xinghao Pan, and Daniela Rus. Proceedings of the 10th ACM Conference on Embedded Network Sensor Systems. ACM, (2012)

Singapore: GPS coord. of 16000 taxis = 200 coord./sec = 12KB/sec

Page 4: Cloud PARTE: Elastic Complex Event Processing based on Mobile Actors

4©Jupiter Systems, Beijing Traffic Management Bureau

Personal Onboard Units Pedestrian Sensing

Vehicle Sensing

Challenges:Large Variety of Input Sources

Page 5: Cloud PARTE: Elastic Complex Event Processing based on Mobile Actors

5

Challenges:Combining the Data

int gru_tapping(struct grail *ge, const struct utouch_frame *frame) { struct gesture_recognizer *gru = ge->gru; struct tapping_model *state = &gru->tapping; struct move_model *move = &gru->move; state->tap = 0; if (frame->num_active && !frame->prev->num_active) { state->mintouch = 0; state->maxtouch = 0; } if (move->ntouch > state->maxtouch) { if (state->active) { gin_gid_discard(ge, state->gid); state->active = 0; } state->start = move->time; state->maxtouch = move->ntouch; set_props(ge->gin, state, move, frame); if (state->maxtouch <= 5) { int type = GRAIL_TYPE_TAP1 + state->maxtouch - 1; state->gid = gin_gid_begin(ge, type, PRIO_TAP, frame); state->active = 1; } return 0; } if (!state->active) { state->mintouch = move->ntouch; state->maxtouch = move->ntouch; return 0; } if (move->ntouch <= state->mintouch) { int x = state->prop[GRAIL_PROP_TAP_X]; int y = state->prop[GRAIL_PROP_TAP_Y]; int t = move->time - state->start; if (t > move->fm[FM_X].bar_ms) { gin_gid_discard(ge, state->gid); state->mintouch = move->ntouch; state->maxtouch = move->ntouch; state->active = 0; return 0; } state->tap = state->maxtouch; state->prop[GRAIL_PROP_TAP_DT] = t; gin_gid_event(ge, state->gid, x, y, state->maxtouch, state->prop, state->nprop, 1); state->mintouch = move->ntouch; state->maxtouch = move->ntouch; state->active = 0; return 1; } if (!move->ntouch) return 0; state->prop[GRAIL_PROP_TAP_DT] = move->time - state->start; if ((move->active & fm_mask) || move->time - state->start > move->fm[FM_X].bar_ms) { gin_gid_discard(ge, state->gid); state->mintouch = move->ntouch; state->maxtouch = move->ntouch; state->active = 0; } return 0;}

Imperative Declarative

(defrule detectTap (Press (x ?x) (y ?y) (finger "index") (timestamp ?t1)) (Release (x ?x) (y ?y) (finger "index") (timestamp ?t2)) (test (< ?t1 ?t2)) => (tapDetected ?x ?y)))

a simple tap

Page 6: Cloud PARTE: Elastic Complex Event Processing based on Mobile Actors

6

Challenges:Combining the Data

(defrule StolenCarInTraffic (StolenCar (plate ?pl)) (Car (plate ?pl) (camera ?c)) (Camera (id ?c) (highway ?hw) (direction ?d) (position ?p))=> (printout "Sloten car " ?pl " seen on highway " ?hw " at " ?p " in direction " ?d))

(defrule CarTooFast (Car (camera ?c1) (plate ?pl) (time ?t1)) (Car (camera ?c2) (plate ?pl) (time ?t2)) (test (> ?t2 ?t1)) (Camera (id ?c1) (highway ?hw) (direction ?d) (position ?p1)) (Camera (id ?c2) (highway ?hw) (direction ?d) (position ?p2)) (test (> (speed ?t1 ?p1 ?t2 ?p2) *speed-limit*))=> (printout "Car too fast: " ?pl " at " (speed ?t1 ?p1 ?t2 ?p2) " km/h."))

Page 7: Cloud PARTE: Elastic Complex Event Processing based on Mobile Actors

7

Challenges:Combining the Data

(defrule StationaryCar (Car (camera ?c) (plate ?pl) (time ?t1)) (Car (camera ?c) (plate ?pl) (time ?t2)) (test (> (- ?t2 ?t1) 30)) (Camera (id ?c) (highway ?hw) (direction ?d) (position ?p))=> (assert (StationaryCar (camera ?c) (plate ?pl) (time ?t1))))

(defrule StationaryCars (Camera (id ?c) (highway ?hw) (direction ?d) (position ?p)) (StationaryCar (camera ?c) (plate ?pl1) (time ?t1)) (StationaryCar (camera ?c) (plate ?pl2) (time ?t2)) (StationaryCar (camera ?c) (plate ?pl3) (time ?t3))

(test (!= ?pl1 ?pl2 ?pl3)) (test (< 0 (- ?t2 ?t1) 1)) (test (< 0 (- ?t3 ?t2) 1))=> (assert (StationaryCars (camera ?c) (time ?t1))))

Page 8: Cloud PARTE: Elastic Complex Event Processing based on Mobile Actors

8

How to approach such scenarios?

• Declarative rules!• Online processing of real-time events!

ElasticityLoad balancing1 set of rules1 set of facts

(transparent distribution)

Page 9: Cloud PARTE: Elastic Complex Event Processing based on Mobile Actors

9

Our Approach

Parallel + Soft Real-Time Distributed for “Big Data”

• Declarative rules• Mobile actors• Central managing interface• Simple heuristics for load balancing

Page 10: Cloud PARTE: Elastic Complex Event Processing based on Mobile Actors

10

PARTE: A Parallel, Actor-based Rete Engine

[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.

(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)))

Events

e=Car e=Cam

Unification1.cam=2.cam

1.plate=2.plate

Type Tests

Testtime-diff > 30

Unificationcam=id

assert

• Each node an actor• Unification memory

intensive• Tests computationally

intensive

1

3

4

2

Page 11: Cloud PARTE: Elastic Complex Event Processing based on Mobile Actors

11

Cloud PARTEFrom Parallel to Distributed

Even

ts

master

App

• Transparent Distribution

(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)))

1

3

4

2

worker

Cloud PARTE builds on Theron (C++ actor library, http://www.theron-library.com/)

Page 12: Cloud PARTE: Elastic Complex Event Processing based on Mobile Actors

12

Cloud PARTEFrom Parallel to Distributed

Even

ts

master

App

• Automatic Load Balancing• Mobile actors• Heuristic– Length of message queue

(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)))

1

3

4

2

worker

Cloud PARTE builds on Theron (C++ actor library, http://www.theron-library.com/)

Load Balancer

Page 13: Cloud PARTE: Elastic Complex Event Processing based on Mobile Actors

13

Cloud PARTEFrom Parallel to Distributed

Even

ts

master

App

1

3

4

2

worker

Load Balancer

• Elasticity– Adding/removing

of workers

• Coordination required (currently)

Page 14: Cloud PARTE: Elastic Complex Event Processing based on Mobile Actors

14

Cloud PARTEFrom Parallel to Distributed

• Elasticity– Adding/removing

of workers

• Coordination required (currently)

Even

ts

master

App

1

3

4

2

worker

Load Balancer

Page 15: Cloud PARTE: Elastic Complex Event Processing based on Mobile Actors

EVALUATIONPerformance

04/11/2023

15

Page 16: Cloud PARTE: Elastic Complex Event Processing based on Mobile Actors

16

Microbenchmarks

Performance Evaluation: Comparison with non-distributed PARTE

Cloud PARTE Scalability PARTE vs. CloudPARTE

Slowdown

101 simple tests 18x501 simple tests 29x101 complex tests 5x… with variables 5x10x101 simple tests 60x10x8 heavy tests 2x16 heavy tests 4x32 heavy tests 4x64 heavy tests 4x128 heavy tests 3xJoining tree 6xSearch 2x

16 heavy tests

Communication

overhead

Single machine

Page 17: Cloud PARTE: Elastic Complex Event Processing based on Mobile Actors

17

Performance: Traffic Scenario

Simulating events from variety of sources

Page 18: Cloud PARTE: Elastic Complex Event Processing based on Mobile Actors

18

11% speedup 17% speedup

2 machinesStatic Actor Distribution

2 machinesStatic Actor Distribution +Dynamic Load Balancing

3 machinesStatic Actor Distribution +Dynamic Load Balancing +

Empty Machine

Page 19: Cloud PARTE: Elastic Complex Event Processing based on Mobile Actors

19

CONCLUSION

Page 20: Cloud PARTE: Elastic Complex Event Processing based on Mobile Actors

20Cloud PARTE: Elastic Complex Event Processing based on Mobile Actors

Traffic Management

Load balancing1 set of rules1 set of facts

(transparent distribution)

Elasticity

Page 21: Cloud PARTE: Elastic Complex Event Processing based on Mobile Actors

21

BACKUP

Page 22: Cloud PARTE: Elastic Complex Event Processing based on Mobile Actors

22

Mobile Actors: Movement Protocol