Discovering Exis7ng Systems: T-Rex G. Cugola E. - - PowerPoint PPT Presentation

discovering exis7ng systems t rex
SMART_READER_LITE
LIVE PREVIEW

Discovering Exis7ng Systems: T-Rex G. Cugola E. - - PowerPoint PPT Presentation

Stream and Complex Event Processing Discovering Exis7ng Systems: T-Rex G. Cugola E. Della Valle A. Margara Politecnico


slide-1
SLIDE 1

Stream ¡and ¡Complex ¡Event ¡Processing ¡

Discovering ¡Exis7ng ¡Systems: ¡T-­‑Rex ¡

  • G. ¡Cugola ¡ ¡ ¡ ¡E. ¡Della ¡Valle ¡

¡ ¡ ¡A. ¡Margara ¡ ¡

¡ ¡ ¡ ¡ ¡ ¡Politecnico ¡di ¡Milano ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡Vrije ¡Universiteit ¡Amsterdam ¡

cugola@elet.polimi.it a.margara@vu.nl dellavalle@elet.polimi.it

slide-2
SLIDE 2

T-­‑Rex: ¡an ¡Engine ¡for ¡TESLA ¡ ¡

Define ¡ ¡CE(AI1 ¡: ¡Type1, ¡…, ¡AIn ¡: ¡Typen) ¡ From ¡ ¡ ¡PaIern ¡ Where ¡ ¡AI1 ¡= ¡f1(..), ¡…, ¡AIn ¡= ¡fn(..) ¡ Consuming ¡e1, ¡…, ¡em ¡ ¡

Stream ¡& ¡Complex ¡Event ¡Processing ¡-­‑ ¡Discovering ¡Exis7ng ¡Systems: ¡T-­‑Rex ¡ 2 ¡

slide-3
SLIDE 3

The ¡Ingredients: ¡Selec7on ¡… ¡

  • Selec7on ¡of ¡a ¡single ¡

event ¡

  • A(x>10)
  • Timer()

A ¡(X=15) ¡ B ¡ B ¡ CE ¡

3 ¡ Stream ¡& ¡Complex ¡Event ¡Processing ¡-­‑ ¡Discovering ¡Exis7ng ¡Systems: ¡T-­‑Rex ¡

slide-4
SLIDE 4

B ¡ CE ¡ CE ¡

The ¡Ingredients: ¡… ¡Sequences ¡… ¡

  • Selec7on ¡of ¡sequences ¡
  • A(x>10) and each

B within 5 min from A

  • A(x>10) and last

B within 5 min from A

  • A(x>10) and first

B within 5 min from A

  • Generaliza7on ¡
  • n-­‑first ¡/ ¡n-­‑last ¡

A ¡(X=15) ¡ B ¡ A ¡(X=15) ¡ B ¡ B ¡ A ¡(X=15) ¡ B ¡ B ¡ CE ¡ CE ¡ 5 ¡min ¡

4 ¡ Stream ¡& ¡Complex ¡Event ¡Processing ¡-­‑ ¡Discovering ¡Exis7ng ¡Systems: ¡T-­‑Rex ¡

slide-5
SLIDE 5

The ¡Ingredients: ¡… ¡Sequences ¡… ¡

  • TESLA ¡allows ¡*-­‑within ¡operators ¡to ¡be ¡

composed ¡with ¡each ¡other: ¡

  • In ¡chains ¡of ¡events ¡
  • A and each B

within 3 min from A and last C within 2 min from B

  • In ¡parallel ¡
  • A and each B

within 3 min from A and last C within 4 min from A

¡ A ¡ B ¡ C ¡ B ¡ A ¡ C ¡

Stream ¡& ¡Complex ¡Event ¡Processing ¡-­‑ ¡Discovering ¡Exis7ng ¡Systems: ¡T-­‑Rex ¡ 5 ¡

slide-6
SLIDE 6

The ¡Ingredients: ¡… ¡Parameters ¡… ¡

  • Parameters ¡can ¡be ¡added ¡between ¡events ¡in ¡a ¡

paIern ¡

  • A(a=$x) and each B(a=$x)

within 3 min from A and last C(a=$x) within 4 min from A

¡

Stream ¡& ¡Complex ¡Event ¡Processing ¡-­‑ ¡Discovering ¡Exis7ng ¡Systems: ¡T-­‑Rex ¡ 6 ¡

slide-7
SLIDE 7

SELECTION ¡

Stream ¡& ¡Complex ¡Event ¡Processing ¡-­‑ ¡Discovering ¡Exis7ng ¡Systems: ¡T-­‑Rex ¡ 7 ¡

slide-8
SLIDE 8

Selec7on ¡

  • Generic ¡problem ¡of ¡matching ¡events ¡against ¡

constraints ¡on ¡their ¡content ¡

  • Used ¡twice ¡in ¡CEP ¡
  • To ¡select ¡the ¡set ¡of ¡rules ¡a ¡primi7ve ¡event ¡is ¡

relevant ¡for ¡

  • To ¡select ¡the ¡set ¡of ¡sinks ¡a ¡(composite) ¡event ¡

needs ¡to ¡be ¡delivered ¡to ¡

  • Classical ¡Publish ¡/ ¡Subscribe ¡Content-­‑Based ¡Matching ¡

Stream ¡& ¡Complex ¡Event ¡Processing ¡-­‑ ¡Discovering ¡Exis7ng ¡Systems: ¡T-­‑Rex ¡ 8 ¡

slide-9
SLIDE 9

Content-­‑Based ¡Matching ¡

Events ¡ Sinks ¡ ¡

Content-­‑Based ¡Matching ¡ (Smoke=true and Room = “Kitchen”) or (Light>30 and Room=“Bedroom”)

Light=50, Room=Bedroom, Sender=“Sensor1”

Filter ¡ Constraint ¡ Predicate ¡ A;ribute ¡

Stream ¡& ¡Complex ¡Event ¡Processing ¡-­‑ ¡Discovering ¡Exis7ng ¡Systems: ¡T-­‑Rex ¡ 9 ¡

slide-10
SLIDE 10

Related ¡Work ¡

  • Two ¡kinds ¡of ¡algorithms ¡
  • Tree-­‑Based ¡
  • Coun7ng ¡

Stream ¡& ¡Complex ¡Event ¡Processing ¡-­‑ ¡Discovering ¡Exis7ng ¡Systems: ¡T-­‑Rex ¡ 10 ¡

slide-11
SLIDE 11

Tree-­‑Based ¡Algorithms ¡

  • Build ¡a ¡decision ¡tree ¡
  • Inner ¡nodes: ¡condi7onal ¡

statements ¡

  • Leaves: ¡sinks ¡

A>0 ¡ B>8 ¡ B≤2 4 ¡ C>2 ¡ S1, ¡S2, ¡S4 ¡ S1, ¡S3 ¡

Stream ¡& ¡Complex ¡Event ¡Processing ¡-­‑ ¡Discovering ¡Exis7ng ¡Systems: ¡T-­‑Rex ¡ 11 ¡

Yes ¡ Yes ¡ Yes ¡ No ¡ Yes ¡

slide-12
SLIDE 12

Coun7ng ¡Algorithms ¡

  • For ¡each ¡filter ¡… ¡
  • … ¡count ¡how ¡many ¡constraints ¡have ¡been ¡

sa7sfied ¡so ¡far ¡

Stream ¡& ¡Complex ¡Event ¡Processing ¡-­‑ ¡Discovering ¡Exis7ng ¡Systems: ¡T-­‑Rex ¡ 12 ¡

slide-13
SLIDE 13

Coun7ng ¡Algorithms ¡

F1: A>10 and B=20 F2: B>15 and C<30

Constraint ¡ Filter ¡ A>10 ¡ F1 ¡ B=20 ¡ F1 ¡ B>15 ¡ F2 ¡ C<30 ¡ F2 ¡ D=20 ¡ F3 ¡

S1 ¡ S2 ¡

F3: D=20

Filter ¡ Size ¡ Count ¡ Predicate ¡ F1 ¡ 2 ¡ S1 ¡ F2 ¡ 2 ¡ S1 ¡ F3 ¡ 1 ¡ S2 ¡ 0 ¡ 0 ¡ 0 ¡ 1 ¡ 1 ¡ 2 ¡ A=12 B=20 A=12 B=20

Stream ¡& ¡Complex ¡Event ¡Processing ¡-­‑ ¡Discovering ¡Exis7ng ¡Systems: ¡T-­‑Rex ¡ 13 ¡

slide-14
SLIDE 14

Idea: ¡Exploit ¡Parallel ¡Hardware ¡

  • PCM: ¡Parallel ¡Content-­‑Based ¡Matching ¡
  • Both ¡mul7 ¡core ¡CPUs ¡… ¡
  • OCM ¡– ¡OpenMP ¡
  • … ¡and ¡Nvidia, ¡CUDA ¡GPUs ¡
  • CCM ¡

Stream ¡& ¡Complex ¡Event ¡Processing ¡-­‑ ¡Discovering ¡Exis7ng ¡Systems: ¡T-­‑Rex ¡ 14 ¡

slide-15
SLIDE 15
  • General ¡purpose ¡parallel ¡compu7ng ¡

architecture ¡by ¡Nvidia ¡

  • New ¡instruc7on ¡set ¡
  • New ¡programming ¡model ¡
  • Programmable ¡using ¡high-­‑level ¡languages ¡
  • Cuda ¡C ¡(a ¡C ¡dialect) ¡

Programming ¡GPUs: ¡CUDA ¡

Stream ¡& ¡Complex ¡Event ¡Processing ¡-­‑ ¡Discovering ¡Exis7ng ¡Systems: ¡T-­‑Rex ¡ 15 ¡

slide-16
SLIDE 16

Programming ¡Model: ¡Basics ¡

  • The ¡GPU ¡acts ¡as ¡a ¡coprocessor ¡with ¡its ¡own ¡

separate ¡memory ¡space ¡

  • Copy ¡data ¡to/from ¡the ¡GPU ¡memory ¡is ¡

expensive ¡

  • Communica7on ¡through ¡the ¡PCI-­‑Ex ¡bus ¡
  • Bandwidth ¡but ¡also ¡latency! ¡
  • Serializa7on ¡of ¡data ¡structures ¡
  • Keep ¡them ¡simple! ¡

Stream ¡& ¡Complex ¡Event ¡Processing ¡-­‑ ¡Discovering ¡Exis7ng ¡Systems: ¡T-­‑Rex ¡ 16 ¡

slide-17
SLIDE 17

Typical ¡Workflow ¡

Allocate memory on device Serialize and copy data to device Execute one or more kernels on the device Wait for the device to finish processing Copy results back

Stream ¡& ¡Complex ¡Event ¡Processing ¡-­‑ ¡Discovering ¡Exis7ng ¡Systems: ¡T-­‑Rex ¡ 17 ¡

slide-18
SLIDE 18

Programming ¡Model: ¡Fundamentals ¡

  • Single ¡Program ¡Mul>ple ¡Threads ¡

strategy ¡

  • A ¡single ¡kernel ¡is ¡executed ¡by ¡mul7ple ¡

threads ¡in ¡parallel ¡

  • Threads ¡are ¡organized ¡in ¡blocks ¡
  • The ¡run7me ¡provides ¡a ¡blockId ¡and ¡a ¡

threadId ¡variable, ¡to ¡uniquely ¡iden7fy ¡ each ¡running ¡thread ¡

  • Accessing ¡such ¡variables ¡is ¡the ¡only ¡way ¡

to ¡differen7ate ¡the ¡work ¡done ¡by ¡ different ¡threads ¡

Stream ¡& ¡Complex ¡Event ¡Processing ¡-­‑ ¡Discovering ¡Exis7ng ¡Systems: ¡T-­‑Rex ¡ 18 ¡

slide-19
SLIDE 19

Hardware ¡MaIers! ¡

  • Lots ¡(lots!) ¡of ¡cores ¡… ¡
  • … ¡but ¡specialized ¡for ¡data ¡parallelism ¡
  • Threads ¡organized ¡into ¡groups, ¡called ¡warps ¡
  • Maximum ¡performance ¡only ¡if ¡all ¡threads ¡in ¡a ¡

warp ¡agree ¡on ¡the ¡execu7on ¡path ¡

  • Condi7onal ¡statement ¡can ¡create ¡divergence! ¡

Stream ¡& ¡Complex ¡Event ¡Processing ¡-­‑ ¡Discovering ¡Exis7ng ¡Systems: ¡T-­‑Rex ¡ 19 ¡

slide-20
SLIDE 20

Hardware ¡MaIers! ¡

  • Lots ¡(lots!) ¡of ¡cores ¡… ¡
  • … ¡limited ¡space ¡for ¡cache ¡L ¡

Stream ¡& ¡Complex ¡Event ¡Processing ¡-­‑ ¡Discovering ¡Exis7ng ¡Systems: ¡T-­‑Rex ¡ 20 ¡

slide-21
SLIDE 21

Hardware ¡MaIers! ¡

  • Lots ¡(lots!) ¡of ¡cores ¡… ¡
  • … ¡limited ¡space ¡for ¡cache ¡L ¡
  • In ¡some ¡architecture ¡caching ¡is ¡controlled ¡by ¡the ¡

programmer ¡

  • Hierarchies ¡of ¡memories ¡
  • Global ¡(DRAM, ¡GB) ¡à ¡Shared ¡(SRAM, ¡block ¡level, ¡KB) ¡à ¡

Local ¡(Registers) ¡

  • Access ¡to ¡GPU ¡memory ¡oren ¡a ¡boIleneck ¡
  • Threads ¡with ¡con7guous ¡ids ¡should ¡access ¡con7guous ¡

memory ¡regions ¡

  • Hardware ¡combines ¡them ¡into ¡memory-­‑wide ¡accesses ¡

Stream ¡& ¡Complex ¡Event ¡Processing ¡-­‑ ¡Discovering ¡Exis7ng ¡Systems: ¡T-­‑Rex ¡ 21 ¡

slide-22
SLIDE 22

PCM ¡

  • Constraints ¡with ¡the ¡

same ¡name ¡are ¡stored ¡ in ¡an ¡array ¡

  • Con7guous ¡memory ¡

regions ¡

  • When ¡processing ¡an ¡

event ¡E, ¡the ¡CPU ¡selects ¡ all ¡relevant ¡constraint ¡ arrays ¡

  • Based ¡on ¡the ¡name ¡of ¡

the ¡aIributes ¡in ¡E ¡

Val Type Op

Names (CPU) Constraints

FilterId

SizeC

Stream ¡& ¡Complex ¡Event ¡Processing ¡-­‑ ¡Discovering ¡Exis7ng ¡Systems: ¡T-­‑Rex ¡ 22 ¡

slide-23
SLIDE 23

PCM ¡

  • Bi-­‑dimensional ¡
  • rganiza7on ¡of ¡threads ¡
  • On ¡GPU, ¡one ¡thread ¡for ¡

each ¡aIribute/ constraint ¡pair ¡

  • On ¡CPU, ¡different ¡rows ¡

are ¡processed ¡ sequen7ally ¡

  • On ¡GPU, ¡filters ¡count ¡

updated ¡with ¡an ¡atomic ¡

  • pera7on ¡

Count SizeF InterfaceId Filter0 Filter1 Filter2 ... Interfaces Filters Interface0 Interface1 Interface2 ...

Names (CPU) Constraints SizeC

B=32

Event ¡aIributes ¡

C=21 A=7

Stream ¡& ¡Complex ¡Event ¡Processing ¡-­‑ ¡Discovering ¡Exis7ng ¡Systems: ¡T-­‑Rex ¡ 23 ¡

slide-24
SLIDE 24

PCM ¡-­‑ ¡Results ¡

Stream ¡& ¡Complex ¡Event ¡Processing ¡-­‑ ¡Discovering ¡Exis7ng ¡Systems: ¡T-­‑Rex ¡ 24 ¡

slide-25
SLIDE 25

Performance: ¡Throughput ¡

25 ¡ Stream ¡& ¡Complex ¡Event ¡Processing ¡-­‑ ¡Discovering ¡Exis7ng ¡Systems: ¡T-­‑Rex ¡

Input ¡Connec7ons ¡Manager ¡ Input ¡Queue ¡ Engine ¡ Output ¡Queue ¡ Output ¡Connec7ons ¡Manager ¡

slide-26
SLIDE 26

Performance: ¡Throughput ¡

26 ¡ Stream ¡& ¡Complex ¡Event ¡Processing ¡-­‑ ¡Discovering ¡Exis7ng ¡Systems: ¡T-­‑Rex ¡

20 40 60 80 100 50 100 150 200 Processing Rate (k events/s) Input Rate (k events/s) CCM OCM SFF SFF ME

slide-27
SLIDE 27

Results ¡

  • What ¡is ¡the ¡7me ¡needed ¡

to ¡install ¡subscrip7ons? ¡

  • Need ¡to ¡serialize ¡data ¡

structures ¡

  • Need ¡to ¡copy ¡from ¡CPU ¡

memory ¡to ¡GPU ¡memory ¡

  • But ¡data ¡structures ¡are ¡

simple! ¡

  • Memory ¡requirements? ¡
  • Less ¡than ¡1GB ¡in ¡all ¡our ¡

tests ¡

  • Not ¡a ¡problem ¡for ¡a ¡

modern ¡GPU ¡

27 ¡ High ¡Performance ¡Content-­‑Based ¡Matching ¡Using ¡GPUs ¡-­‑ ¡DEBS ¡2011 ¡

200 400 600 800 1000 1200 SFF CCM Install Time (ms)

slide-28
SLIDE 28

PCM ¡– ¡Lessons ¡Learned ¡

  • Algorithm ¡designed ¡for ¡GPUs ¡
  • Very ¡simple ¡data ¡structures ¡(matrix) ¡
  • No ¡pointers ¡
  • Benefits ¡on ¡CPU ¡as ¡well ¡
  • BeIer ¡use ¡of ¡data ¡locality ¡and ¡cache ¡
  • Even ¡beIer ¡performance ¡in ¡case ¡of ¡bursts ¡
  • Several ¡events ¡wai7ng ¡to ¡be ¡processed ¡
  • Can ¡be ¡processed ¡in ¡parallel ¡

Stream ¡& ¡Complex ¡Event ¡Processing ¡-­‑ ¡Discovering ¡Exis7ng ¡Systems: ¡T-­‑Rex ¡ 28 ¡

slide-29
SLIDE 29

SEQUENCES ¡

Stream ¡& ¡Complex ¡Event ¡Processing ¡-­‑ ¡Discovering ¡Exis7ng ¡Systems: ¡T-­‑Rex ¡ 29 ¡

slide-30
SLIDE 30

Related ¡Work ¡

  • Sequences ¡apparently ¡similar ¡to ¡regular ¡

expressions ¡

  • Detect ¡sequence ¡A ¡à ¡B ¡à ¡C ¡à ¡D ¡
  • Use ¡algorithms ¡based ¡on ¡automata ¡

A ¡ B ¡ C ¡ D

Stream ¡& ¡Complex ¡Event ¡Processing ¡-­‑ ¡Discovering ¡Exis7ng ¡Systems: ¡T-­‑Rex ¡ 30 ¡

slide-31
SLIDE 31

Problems ¡

  • Mul7ple ¡selec7on ¡
  • A

and each B within 5 min from A and each C within 5 min from B ¡

  • C1 ¡C2 ¡C3 ¡B1 ¡B2 ¡A1 ¡
  • We ¡need ¡one ¡automaton ¡(instance) ¡for ¡each ¡

possible ¡valid ¡sequence! ¡

  • C1 ¡B1 ¡A1 ¡
  • C2 ¡B1 ¡A1 ¡
  • … ¡

Stream ¡& ¡Complex ¡Event ¡Processing ¡-­‑ ¡Discovering ¡Exis7ng ¡Systems: ¡T-­‑Rex ¡ 31 ¡

slide-32
SLIDE 32

Problems ¡

  • Tradi7onal ¡approach ¡
  • Duplicate! ¡
  • C1 ¡C2 ¡C3 ¡B1 ¡B2 ¡A1 ¡
  • Lot ¡of ¡memory! ¡
  • Lots ¡of ¡copies! ¡

C1 ¡ C2 ¡ C3 ¡ C1 ¡ C2 ¡ C3 ¡ B1 ¡ B1 ¡ B1 ¡ C1 ¡ C2 ¡ C3 ¡ B2 ¡ B2 ¡ B2 ¡ C1 ¡ C2 ¡ C3 ¡ B1 ¡ B1 ¡ B1 ¡ A1 ¡ A1 ¡ A1 ¡ C1 ¡ C2 ¡ C3 ¡ B2 ¡ B2 ¡ B2 ¡ A1 ¡ A1 ¡ A1 ¡

Stream ¡& ¡Complex ¡Event ¡Processing ¡-­‑ ¡Discovering ¡Exis7ng ¡Systems: ¡T-­‑Rex ¡ 32 ¡

slide-33
SLIDE 33

Problems ¡

  • Parameters ¡
  • A(x=$a)

and last B within 5 min from A and last C(x=$a) within 5 min from B ¡

  • We ¡do ¡not ¡know ¡which ¡C ¡can ¡be ¡useful ¡
  • Un7l ¡we ¡receive ¡an ¡A ¡
  • We ¡have ¡to ¡save ¡all ¡of ¡them! ¡
  • We ¡create ¡a ¡lot ¡of ¡automata ¡that ¡are ¡later ¡

discarded ¡

  • Single ¡selec7on ¡becomes ¡expensive ¡as ¡mul7ple ¡

selec7on ¡

Stream ¡& ¡Complex ¡Event ¡Processing ¡-­‑ ¡Discovering ¡Exis7ng ¡Systems: ¡T-­‑Rex ¡ 33 ¡

slide-34
SLIDE 34

From ¡Automata ¡to ¡Columns ¡

  • Our ¡first ¡implementa7on ¡(T-­‑Rex ¡1.0) ¡was ¡

based ¡on ¡automata ¡

  • AIP ¡(Automata-­‑based ¡Incremental ¡Processing) ¡
  • We ¡developed ¡an ¡en7rely ¡new ¡algorithm ¡in ¡T-­‑

Rex ¡2.0 ¡

  • CDP ¡(Column-­‑based ¡Delayed ¡Processing) ¡
  • We ¡keep ¡all ¡the ¡events ¡
  • Stored ¡in ¡7me-­‑ordered ¡columns ¡
  • We ¡defer ¡the ¡processing ¡
  • Un7l ¡we ¡receive ¡a ¡poten7al ¡sequence ¡terminator ¡

Stream ¡& ¡Complex ¡Event ¡Processing ¡-­‑ ¡Discovering ¡Exis7ng ¡Systems: ¡T-­‑Rex ¡ 34 ¡

slide-35
SLIDE 35

CDP ¡-­‑ ¡Example ¡

  • A

and each B within 5 min from A and each C within 5 min from B

  • C1 ¡C2 ¡C3 ¡B1 ¡B2 ¡A1 ¡

¡

C1 ¡ C2 ¡ C3 ¡ B1 ¡ B2 ¡ A1 ¡

Stream ¡& ¡Complex ¡Event ¡Processing ¡-­‑ ¡Discovering ¡Exis7ng ¡Systems: ¡T-­‑Rex ¡ 35 ¡

slide-36
SLIDE 36

Evalua7on ¡-­‑ ¡CPU ¡

Processing ¡Time ¡(microsec) ¡ Mul@ple ¡Selec@on ¡Policy ¡

100 200 300 400 500 600 700 800 900 2 3 4 5 Number of Events in Sequences AIP CDP

¡

Processing ¡Time ¡(microsec) ¡ Single ¡Selec@on ¡Policy ¡

50 100 150 200 250 300 350 2 3 4 5 Number of Events in Sequences AIP CDP

36 ¡ Stream ¡& ¡Complex ¡Event ¡Processing ¡-­‑ ¡Discovering ¡Exis7ng ¡Systems: ¡T-­‑Rex ¡

slide-37
SLIDE 37

Evalua7on ¡– ¡CPU ¡& ¡GPU ¡

0.001 0.01 0.1 1 10 100 1000 1 10 100 Processing Time (ms) Size of Windows (thousands) AIP Multiple Selection CDP CPU Multiple Selection CDP GPU Multiple Selection AIP Single Selection CDP CPU Single Selection CDP GPU Single Selection

40x ¡

Stream ¡& ¡Complex ¡Event ¡Processing ¡-­‑ ¡Discovering ¡Exis7ng ¡Systems: ¡T-­‑Rex ¡ 37 ¡

slide-38
SLIDE 38

Performance ¡

38 ¡ Stream ¡& ¡Complex ¡Event ¡Processing ¡-­‑ ¡Discovering ¡Exis7ng ¡Systems: ¡T-­‑Rex ¡

0.001 0.01 0.1 1 10 100 1000 50 100 150 200 Processing Time (ms) Number of Rules AIP Multiple Selection CDP CPU Multiple Selection CDP GPU Multiple Selection AIP Single Selection CDP CPU Single Selection CDP GPU Single Selection

slide-39
SLIDE 39

Performance ¡

39 ¡ Stream ¡& ¡Complex ¡Event ¡Processing ¡-­‑ ¡Discovering ¡Exis7ng ¡Systems: ¡T-­‑Rex ¡

0.001 0.01 0.1 1 10 50 100 150 200 Processing Time (ms) Number of Rules AIP Multiple Selection CDP CPU Multiple Selection CDP GPU Multiple Selection AIP Single Selection CDP CPU Single Selection CDP GPU Single Selection

slide-40
SLIDE 40

CDP ¡– ¡Lessons ¡Learned ¡

  • Simple ¡memory ¡layout ¡
  • Arrays ¡
  • No ¡need ¡to ¡duplicate ¡
  • No ¡need ¡to ¡perform ¡useless ¡computa7on ¡
  • Invalid ¡sequences ¡are ¡immediately ¡discarded ¡
  • We ¡can ¡easily ¡maintain ¡mul7ple ¡indexes ¡over ¡the ¡

elements ¡

  • E.g., ¡for ¡parameteriza7on ¡
  • Makes ¡parallel ¡processing ¡possible ¡
  • But ¡convenient ¡only ¡when ¡a ¡lot ¡of ¡data ¡is ¡available ¡
  • Can ¡we ¡automa7cally ¡and ¡dynamically ¡choose ¡the ¡best ¡

architecture? ¡

Stream ¡& ¡Complex ¡Event ¡Processing ¡-­‑ ¡Discovering ¡Exis7ng ¡Systems: ¡T-­‑Rex ¡ 40 ¡

slide-41
SLIDE 41

HANDS ¡ON ¡

Stream ¡& ¡Complex ¡Event ¡Processing ¡-­‑ ¡Discovering ¡Exis7ng ¡Systems: ¡T-­‑Rex ¡ 41 ¡

slide-42
SLIDE 42

Architecture ¡

Processing ¡Engine ¡ (CDP) ¡ TRex ¡Server ¡ TRex ¡Library ¡ TRex ¡Client ¡ (Library ¡+ ¡Example) ¡

Uses ¡ Virtual ¡Machine ¡

Stream ¡& ¡Complex ¡Event ¡Processing ¡-­‑ ¡Discovering ¡Exis7ng ¡Systems: ¡T-­‑Rex ¡ 42 ¡

slide-43
SLIDE 43

How ¡to ¡Get ¡T-­‑Rex? ¡

  • hIps://www.dropbox.com/sh/

8p3ahgaguhcuhp8/u3u0jZ66rM ¡

  • Includes ¡
  • T-­‑Rex ¡Library ¡
  • T-­‑Rex ¡Server ¡
  • Virtual ¡Machine ¡Image ¡
  • Server ¡already ¡configured ¡
  • T-­‑Rex ¡Client ¡Library ¡(Java) ¡
  • Command ¡line ¡client ¡

Stream ¡& ¡Complex ¡Event ¡Processing ¡-­‑ ¡Discovering ¡Exis7ng ¡Systems: ¡T-­‑Rex ¡ 43 ¡

slide-44
SLIDE 44

How ¡to ¡Define ¡a ¡Rule? ¡

  • We ¡want ¡to ¡create ¡a ¡new ¡rule ¡“Rule1” ¡
  • Create ¡a ¡new ¡Rule1 ¡class ¡
  • In ¡“Source/test/” ¡directory ¡
  • Both ¡.hpp ¡and ¡.cpp ¡files ¡
  • Include ¡the ¡Rule1.hpp ¡file ¡in ¡file ¡/Source/test.hpp ¡
  • Install ¡the ¡rule ¡to ¡the ¡engine ¡in ¡Main.cpp ¡
  • In ¡method ¡addBootstrapTestRules() ¡

¡Rule1 ¡rule; ¡ ¡engine.processRulePkt(rule.buildRule()); ¡

  • Invoke ¡engine.finalize() ¡arer ¡all ¡rules ¡have ¡been ¡

installed ¡

44 ¡ Stream ¡& ¡Complex ¡Event ¡Processing ¡-­‑ ¡Discovering ¡Exis7ng ¡Systems: ¡T-­‑Rex ¡

slide-45
SLIDE 45

Current ¡Limita7ons ¡

  • No ¡rule ¡parser ¡
  • Need ¡to ¡write ¡rules ¡in ¡the ¡server ¡
  • Tutorial ¡in ¡the ¡next ¡slides ¡
  • Examples ¡in ¡the ¡code ¡

Stream ¡& ¡Complex ¡Event ¡Processing ¡-­‑ ¡Discovering ¡Exis7ng ¡Systems: ¡T-­‑Rex ¡ 45 ¡

slide-46
SLIDE 46

Selec7on ¡

Stream ¡& ¡Complex ¡Event ¡Processing ¡-­‑ ¡Discovering ¡Exis7ng ¡Systems: ¡T-­‑Rex ¡ 46 ¡

slide-47
SLIDE 47

Sequences ¡

Stream ¡& ¡Complex ¡Event ¡Processing ¡-­‑ ¡Discovering ¡Exis7ng ¡Systems: ¡T-­‑Rex ¡ 47 ¡

slide-48
SLIDE 48

Sequences ¡

Stream ¡& ¡Complex ¡Event ¡Processing ¡-­‑ ¡Discovering ¡Exis7ng ¡Systems: ¡T-­‑Rex ¡ 48 ¡

slide-49
SLIDE 49

Parameters ¡

Stream ¡& ¡Complex ¡Event ¡Processing ¡-­‑ ¡Discovering ¡Exis7ng ¡Systems: ¡T-­‑Rex ¡ 49 ¡

slide-50
SLIDE 50

Nega7ons ¡

Stream ¡& ¡Complex ¡Event ¡Processing ¡-­‑ ¡Discovering ¡Exis7ng ¡Systems: ¡T-­‑Rex ¡ 50 ¡

slide-51
SLIDE 51

Nega7ons ¡

Stream ¡& ¡Complex ¡Event ¡Processing ¡-­‑ ¡Discovering ¡Exis7ng ¡Systems: ¡T-­‑Rex ¡ 51 ¡

slide-52
SLIDE 52

Nega7ons ¡and ¡Parameters ¡

Stream ¡& ¡Complex ¡Event ¡Processing ¡-­‑ ¡Discovering ¡Exis7ng ¡Systems: ¡T-­‑Rex ¡ 52 ¡

slide-53
SLIDE 53

Composite ¡Event ¡Defini7on ¡

Stream ¡& ¡Complex ¡Event ¡Processing ¡-­‑ ¡Discovering ¡Exis7ng ¡Systems: ¡T-­‑Rex ¡ 53 ¡

slide-54
SLIDE 54

Aggregates ¡

Stream ¡& ¡Complex ¡Event ¡Processing ¡-­‑ ¡Discovering ¡Exis7ng ¡Systems: ¡T-­‑Rex ¡ 54 ¡

slide-55
SLIDE 55

Recursion ¡

55 ¡ Stream ¡& ¡Complex ¡Event ¡Processing ¡-­‑ ¡Discovering ¡Exis7ng ¡Systems: ¡T-­‑Rex ¡

slide-56
SLIDE 56

Talking ¡with ¡T-­‑Rex ¡

  • How ¡to ¡communicate ¡with ¡T-­‑Rex ¡for ¡

publishing ¡and ¡subscribing ¡to ¡events? ¡

  • Using ¡the ¡command ¡line ¡example ¡
  • Wri7ng ¡your ¡own ¡Java ¡program ¡
  • Using ¡the ¡primi7ves ¡offered ¡by ¡the ¡T-­‑Rex ¡Client ¡Library ¡

56 ¡ Stream ¡& ¡Complex ¡Event ¡Processing ¡-­‑ ¡Discovering ¡Exis7ng ¡Systems: ¡T-­‑Rex ¡

slide-57
SLIDE 57

Using ¡the ¡T-­‑Rex ¡Client ¡Library ¡

57 ¡ Stream ¡& ¡Complex ¡Event ¡Processing ¡-­‑ ¡Discovering ¡Exis7ng ¡Systems: ¡T-­‑Rex ¡

  • Three ¡steps ¡
  • Create ¡a ¡connec7on ¡manager ¡
  • Send ¡a ¡subscrip7on ¡
  • Send ¡a ¡publica7on ¡
slide-58
SLIDE 58

Using ¡the ¡T-­‑Rex ¡Client ¡Library ¡

58 ¡ Stream ¡& ¡Complex ¡Event ¡Processing ¡-­‑ ¡Discovering ¡Exis7ng ¡Systems: ¡T-­‑Rex ¡

slide-59
SLIDE 59

Using ¡the ¡T-­‑Rex ¡Client ¡Library ¡

  • How ¡to ¡receive ¡events ¡for ¡my ¡

subscrip7ons? ¡

  • Implement ¡the ¡

PacketListerner ¡interface ¡

  • Implement ¡two ¡methods ¡
  • no7fyPktReceived(Packet ¡

pkt) ¡

  • no7fyConnec7onError() ¡

59 ¡ Stream ¡& ¡Complex ¡Event ¡Processing ¡-­‑ ¡Discovering ¡Exis7ng ¡Systems: ¡T-­‑Rex ¡

slide-60
SLIDE 60

Using ¡the ¡T-­‑Rex ¡Client ¡Library ¡

  • In ¡the ¡“main ¡class” ¡
  • Add ¡the ¡listener ¡to ¡the ¡TransportManager ¡
  • Start ¡the ¡TransportManager ¡

60 ¡ Stream ¡& ¡Complex ¡Event ¡Processing ¡-­‑ ¡Discovering ¡Exis7ng ¡Systems: ¡T-­‑Rex ¡