Optimization for Atlas Reactive Engine

homelybrrrInternet και Εφαρμογές Web

4 Δεκ 2013 (πριν από 3 χρόνια και 9 μήνες)

88 εμφανίσεις

Optimization for Atlas
Reactive Engine

Dunam

Kim,
Hokyu

Kang,
Yangbae

Park


Introduction


How to Improve


Evaluation Shortcut


Cache System

Table of Contents


The problems of the basic RE


PUSH only


Too much energy consumption



Our objectives


To reduce accessing sensors


To fix minor bugs of the basic RE

Introduction


Evaluation Shortcut


To find the optimal sequence of evaluation


Based on probability



Cache System


To reuse creditable values from stable sensors

How to Improve?


Finding optimized execution plan of pulling
events


Steps


Enumerate all possible query
-
evaluation plans


All possible sequences of evaluation of atomic
events(terminal events)


Equivalent Rules


Compute the cost for the plans



Probability of each events


Pick up the plan having the minimum cost

Evaluation Shortcut


Probability Model


P(event1) = # Occurrence / # Observation


P(~event1) = 1
-

P(event1)


P(event1


event2) = P(event1) * P(event2)


Example


P(S1(0,100)) * 1 + P(~S1(0,100)) * P(~S2(0,50)) *
2 +

P(~S1(0,100)) * P(S2(0,50)) * 3


[S1,S2,S3], [S1,S2,S3]


[S2,S1,S3],[S2,S3,S1]


[S3,S1,S2],[S3,S2,S1]




Evaluation Shortcut (cont’d)


Formal Representation of Cost Calculation


n


size of atomic events in forms of S(Number) or


S[Number, Number]. n is 3
in the previous example.


Integer x


truth value for each sensing event


x = 011 for [S1(0,100) = FALSE, S2(0,50) = TRUE, S3(0,50) = TRUE]


M(x)


minimum number of evaluation for the case x,

x = 100 for [S1(0,100) =
TRUE, S2(0,50) = FALSE, S3(0,50) = FALSE]


Pi


probability that
ith

sensing event is true.


For [S1(0,100), S2(0,50), S3(0,50)], P2 = P(S2(0,50))


B(x,
i
)


ith

bit value of integer x

B(x,
i
) = (x >> (n
-
i
)) bitwise & 1


Expected number of evaluation of sensing event is



Evaluation Shortcut (cont’d)

Cache System

Atlas Client (Reactive Engine)

History Manager

Cache Manager

Database


Data History Manager


Stores all received data on the database


MySQL

+ JDBC Driver



Provides statistical functions


The number of reports in certain period


Average time interval


Range


Standard Deviation


Probability of event

Cache System (cont’d)


Cache Manager


Tracks each sensor’s stability


Timestamps


Values



Controls PUSH/PULL mode of a sensor


Additive Increase Multiplicative Decrease
algorithm



Updates out
-
of
-
date caches

Cache System (cont’d)

Cache System (cont’d)

0
20
40
60
80
100
120
1
2
3
4
5
6
7
8
9
10
11
12
13

Value

Time

Traditional PUSH mode

value
Cache System (cont’d)

0
20
40
60
80
100
120
0
5
10
15
20
25
30
35
40
Value

Time

Dynamic PULL mode

(Additive Increase)

value
Cache System (cont’d)

0
20
40
60
80
100
120
100
120
140
160
180
200
220
Value

Time

Transition from PULL to PUSH

value (pull)
value (push)

Evaluation Metrics


The number of access to sensors with and without
optimization strategies when there are
continuous constant values from the sensors.



Test case


While running the Atlas Reactive Engine, change
the sensing mode to constants to verify the
dynamic push/pull transition strategy


Measure the number of sensor accesses

Evaluation


Test rule set


The rule set below is used to verify the
evaluation shortcut strategy

Evaluation (cont’d)

// E58 is a humidity sensor, and K47 is a temperature sensor

DEFINE event e1=E58[10,11]

DEFINE event e2=K47[10,90]

DEFINE event e3=e1*e2

DEFINE condition c1=true

DEFINE action a1=servo_G88(120)

DEFINE rule r1=e3,c1,a1


The number of sensor access when the
evaluation shortcut strategy is used







The number of sensor access (
read_sensor
) is
only one even though there is one more event
to be evaluated

Evaluation (cont’d)

Contents of
shortcut_result

table


The number of sensor access when the
dynamic push/pull transition strategy is
used

Evaluation (cont’d)

Contents of history
table


The optimization was enabled between
03:09:11 and 03:09:13 and the number of
sensor access decreases to 10

Evaluation (cont’d)

Contents of history
table

Thank You for Listening!