Learning from Failures: a Lightweight Approach to Run-Time Behavioural Adaptation

44
14 of September, 2011 Oslo, Norway Learning from Failures: a Lightweight Approach to Run-Time Behavioural Adaptation J. Antonio Martín, Antonio Borgi and Ernesto Pimentel University of Málaga - University of Pisa FACS'11

description

These are the slides I presented in FACS'11 regarding this accepted paper (http://goo.gl/SKPga).Normally, when designing a distributed system, you have to develop a choreograpy or orchestration able to coordinate the different services. This process is called synthesis and it is usually done at design time and it entails an exponential complexity. In this work, we developed dynamic learning adaptors that don't require the synthesis, it is a lightweight algorithm and is able to adapt to sporadic errors and changes in the system

Transcript of Learning from Failures: a Lightweight Approach to Run-Time Behavioural Adaptation

Page 1: Learning from Failures: a Lightweight Approach to Run-Time Behavioural Adaptation

14 of September, 2011 Oslo, Norway

Learning from Failures:a Lightweight Approach to

Run-Time Behavioural Adaptation

J. Antonio Martín, Antonio Borgi and Ernesto PimentelUniversity of Málaga - University of Pisa

FACS'11

Page 2: Learning from Failures: a Lightweight Approach to Run-Time Behavioural Adaptation

Motivation

In pervasive computing scenarios, we have thousands of interacting entities with limited resources which may move,

change and degrade over time

Page 3: Learning from Failures: a Lightweight Approach to Run-Time Behavioural Adaptation

Motivation

Existing WSAN could benefit from other networks by collaborating in communications and functionality

Page 4: Learning from Failures: a Lightweight Approach to Run-Time Behavioural Adaptation

Motivation

Flaky communication channels or low battery could disable part of the functionality of a node. Therefore, other nodes should avoid

wasting battery requesting such functionality

Page 5: Learning from Failures: a Lightweight Approach to Run-Time Behavioural Adaptation

Motivation

Changes such as node replacement, hardware malfunctions and environment interferences should also be adapted

Failures occur, but they must be mitigated or solved altogether

Page 6: Learning from Failures: a Lightweight Approach to Run-Time Behavioural Adaptation

Assumptions

• We do not know the actual behaviour of the serviceso New unforeseen services might come upo Service behaviour may change unexpectedly due to

hardware issueso This causes incompatibilities in signature and behaviour

• The nodes have limited resourceso Computation, memory and battery are scarceo Communications quickly deplete the batteryo Bounded services

• We have an adaptation contracto This is based on the signature of the serviceso And (optionally) a declarative representation of the goal of

the adapted sessiono Alternatively, we could use zero-knowledge adaptation

Page 7: Learning from Failures: a Lightweight Approach to Run-Time Behavioural Adaptation

Behavioural adaptation

Different operation names or operations which are require in a different order than expected cause deadlock situations and

impede the correct interaction among services

Page 8: Learning from Failures: a Lightweight Approach to Run-Time Behavioural Adaptation

Behavioural adaptation

An adaptor intermediates between two parts of the system while solving their incompatibilities in signature and behaviour

For instance, an adaptor can wrap an incompatible service

Page 9: Learning from Failures: a Lightweight Approach to Run-Time Behavioural Adaptation

Behavioural adaptation

An adaptor is specified in a declarative manerby an adaptation contract

Traditionally, adaptors are synthesised knowing the contract and the behaviour of the services

Page 10: Learning from Failures: a Lightweight Approach to Run-Time Behavioural Adaptation

Learning adaptors

In this work, however, because of the ever-changing nature of pervasive computing scenarios, we don't know the behaviour

of the services, we cannot synthesise the adaptor and, therefore, we have to learn their incompatibilities dynamically

Page 11: Learning from Failures: a Lightweight Approach to Run-Time Behavioural Adaptation

Learning adaptors

Basically, the adaptor will offer every interaction allowed by the contract and, when deadlock situations arise, the adaptor learns

to avoid that failed trace henceforth. Therefore, failed traces might occur but the adaptor eventually learns to avoid them

Page 12: Learning from Failures: a Lightweight Approach to Run-Time Behavioural Adaptation

Adaptation contract

1. !user(U) <>2. !pass(P) <> ?login(U,P) ...8. <> !quit()9. !quit() <>

Adaptation ContractServices Services

!user(usr)!pass(psw)

...!quit()

?login(usr, psw)

...!quit()

Page 13: Learning from Failures: a Lightweight Approach to Run-Time Behavioural Adaptation

Adaptation contract

1. !user(U) <>2. !pass(P) <> ?login(U,P) ...8. <> !quit()9. !quit() <>

Adaptation ContractServices Services

!user(usr)!pass(psw)

...!quit()

?login(usr, psw)

...!quit()

Page 14: Learning from Failures: a Lightweight Approach to Run-Time Behavioural Adaptation

Learning adaptor

Learning Adaptor1. !user(U) <>2. !pass(P) <> ?login(U,P) ...8. <> !quit()9. !quit() <>

1. Adaptation contract2. Current state3. Current trace4. Inhibited traces

{}

Services

!user(usr)!pass(psw)

...!quit()

Services

?login(usr, psw)

...!quit()

Page 15: Learning from Failures: a Lightweight Approach to Run-Time Behavioural Adaptation

Learning adaptor

Learning Adaptor1. !user(U) <>2. !pass(P) <> ?login(U,P) ...8. <> !quit()9. !quit() <>

1. Adaptation contract2. Current state3. Inhibited traces

{}

Services

!user(usr)!pass(psw)

...!quit()

Services

?login(usr, psw)

...!quit()

Page 16: Learning from Failures: a Lightweight Approach to Run-Time Behavioural Adaptation

Learning adaptor

Learning Adaptor1. !user(U) <>2. !pass(P) <> ?login(U,P) ...8. <> !quit()9. !quit() <>

1. Adaptation contract2. Current state3. Inhibited traces

{}

Services

!user(usr)!pass(psw)

...!quit()

Services

?login(usr, psw)

...!quit()

Page 17: Learning from Failures: a Lightweight Approach to Run-Time Behavioural Adaptation

Learning adaptor

Learning Adaptor1. !user(U) <>2. !pass(P) <> ?login(U,P) ...8. <> !quit()9. !quit() <>

1. Adaptation contract2. Current state3. Current trace4. Inhibited traces

{}

Services

!user(usr)!pass(psw)

...!quit()

Services

?login(usr, psw)

...!quit()

Page 18: Learning from Failures: a Lightweight Approach to Run-Time Behavioural Adaptation

Learning adaptor

Learning Adaptor1. !user(U) <>2. !pass(P) <> ?login(U,P) ...8. <> !quit()9. !quit() <>

1. Adaptation contract2. Current state3. Current trace4. Inhibited traces

{}

Services

!user(usr)!pass(psw)

...!quit()

Services

?login(usr, psw)

...!quit()

Page 19: Learning from Failures: a Lightweight Approach to Run-Time Behavioural Adaptation

Learning adaptor

Learning Adaptor1. !user(U) <>2. !pass(P) <> ?login(U,P) ...8. <> !quit()9. !quit() <>

1. Adaptation contract2. Current state3. Inhibited traces

{}

Services

!user(usr)!pass(psw)

...!quit()

Services

?login(usr, psw)

...!quit()

Page 20: Learning from Failures: a Lightweight Approach to Run-Time Behavioural Adaptation

Learning adaptor

Learning Adaptor1. !user(U) <>2. !pass(P) <> ?login(U,P) ...8. <> !quit()9. !quit() <>

1. Adaptation contract2. Current state3. Current trace4. Inhibited traces

{}

Services

!user(usr)!pass(psw)

...!quit()

Services

?login(usr, psw)

...!quit()

Page 21: Learning from Failures: a Lightweight Approach to Run-Time Behavioural Adaptation

Learning adaptor

Learning Adaptor1. !user(U) <>2. !pass(P) <> ?login(U,P) ...8. <> !quit()9. !quit() <>

1. Adaptation contract2. Current state3. Current trace4. Inhibited traces

{a?user(U):b?quit()}

Services Services

?login(usr, psw)

...!quit()

Page 22: Learning from Failures: a Lightweight Approach to Run-Time Behavioural Adaptation

Learning adaptor

Learning Adaptor1. !user(U) <>2. !pass(P) <> ?login(U,P) ...8. <> !quit()9. !quit() <>

1. Adaptation contract2. Current state3. Current trace4. Inhibited traces

{a?user(U):b?quit(),b?quit()}

Services Services

?login(usr, psw)

...!quit()

Page 23: Learning from Failures: a Lightweight Approach to Run-Time Behavioural Adaptation

Properties

Learning Adaptor

• Convergence• Correctness• Well-definedness• Complexity (general case)

o O(SAd)• Complexity (particular case)

o Time: O(max(A,d))o Space: O(SA+Ad)

S - Number of contract statesA - Number of contract vectorsd - Maximum length of a trace

Page 24: Learning from Failures: a Lightweight Approach to Run-Time Behavioural Adaptation

Evaluation

Page 25: Learning from Failures: a Lightweight Approach to Run-Time Behavioural Adaptation

Evaluation

data

Page 26: Learning from Failures: a Lightweight Approach to Run-Time Behavioural Adaptation

Evaluation

data

Page 27: Learning from Failures: a Lightweight Approach to Run-Time Behavioural Adaptation

Evaluation

Sample standard deviation with 10 samples

Page 28: Learning from Failures: a Lightweight Approach to Run-Time Behavioural Adaptation

Evaluation

Sample standard deviation with 10 samples

55 inhibited traces vs 7123 transitions allowing a total of 5466 different successful sessions

Page 29: Learning from Failures: a Lightweight Approach to Run-Time Behavioural Adaptation

Sporadic errors

• Communications are unstable due to hardware failures (e.g., low battery) or environmental interferences (e.g., shadow fading)

• We model this situation with a transition error rate (TER) which is the probability of a certain synchronisation to forcibly fail due to these sporadic errors

• The learning adaptors presented so far inhibit every failed trace, therefore they converge to empty adaptors when sporadic errors occur...

• ... therefore we have to forget those inhibited traces that we cannot trust

Page 30: Learning from Failures: a Lightweight Approach to Run-Time Behavioural Adaptation

Learning to forget

• Bounded learning: learn up to X traces and, when the threshold is met, then forget the oldest/longest/least-used/...

• Reset on empty adaptors: if we inhibit the empty trace, then the adaptor is emptyo Then we can forget some (or all) traces in I

• Recognise sporadic errors: traces are inhibited transition-by-transition. If some transitions are skipped, it may be caused by a sporadic error

Page 31: Learning from Failures: a Lightweight Approach to Run-Time Behavioural Adaptation

Learning to forget

• Bounded learning: learn up to X traces and, when the threshold is met, then forget the oldest/longest/least-used/...

• Reset on empty adaptors: if we inhibit the empty trace, then the adaptor is emptyo Then we can forget some (or all) traces in I

• Recognise sporadic errors: traces are inhibited transition-by-transition. If some transitions are skipped, it may be caused by a sporadic error

Page 32: Learning from Failures: a Lightweight Approach to Run-Time Behavioural Adaptation

Learning to forget

• Bounded learning: learn up to X traces and, when the threshold is met, then forget the oldest/longest/least-used/...

• Reset on empty adaptors: if we inhibit the empty trace, then the adaptor is emptyo Then we can forget some (or all) traces in I

• Recognise sporadic errors: traces are inhibited transition-by-transition. If some transitions are skipped, it may be caused by a sporadic error

Page 33: Learning from Failures: a Lightweight Approach to Run-Time Behavioural Adaptation

Learning to forget

• Bounded learning: learn up to X traces and, when the threshold is met, then forget the oldest/longest/least-used/...

• Reset on empty adaptors: if we inhibit the empty trace, then the adaptor is emptyo Then we can forget some (or all) traces in I

• Recognise sporadic errors: traces are inhibited transition-by-transition. If some transitions are skipped, it may be caused by a sporadic error

Page 34: Learning from Failures: a Lightweight Approach to Run-Time Behavioural Adaptation

Learning to forget

• Bounded learning: learn up to X traces and, when the threshold is met, then forget the oldest/longest/least-used/...

• Reset on empty adaptors: if we inhibit the empty trace, then the adaptor is emptyo Then we can forget some (or all) traces in I

• Recognise sporadic errors: traces are inhibited transition-by-transition. If some transitions are skipped, it may be caused by a sporadic error

Page 35: Learning from Failures: a Lightweight Approach to Run-Time Behavioural Adaptation

Learning to forget

• Bounded learning: learn up to X traces and, when the threshold is met, then forget the oldest/longest/least-used/...

• Reset on empty adaptors: if we inhibit the empty trace, then the adaptor is emptyo Then we can forget some (or all) traces in I

• Recognise sporadic errors: traces are inhibited transition-by-transition. If some transitions are skipped, it may be caused by a sporadic error

Page 36: Learning from Failures: a Lightweight Approach to Run-Time Behavioural Adaptation

Learning to forget

• Bounded learning: learn up to X traces and, when the threshold is met, then forget the oldest/longest/least-used/...

• Reset on empty adaptors: if we inhibit the empty trace, then the adaptor is emptyo Then we can forget some (or all) traces in I

• Recognise sporadic errors: traces are inhibited transition-by-transition. If some transitions are skipped, it may be caused by a sporadic error

Page 37: Learning from Failures: a Lightweight Approach to Run-Time Behavioural Adaptation

Evaluation with sporadic errors

TER = 0 in (0, 4000]; 10E−4 in (4000, 6000]; 10E−3 in (6000, 10000]; 0.01 in (10000, 12000];0.1 in (12000, 14000]; 10E−3 in (14000, 16000]; 10E−4 in (16000, 18000]; and 0 in (18000, 20000]

Page 38: Learning from Failures: a Lightweight Approach to Run-Time Behavioural Adaptation

Evaluation: close-up on athr

TER = 0 in (0, 4000]; 10E−4 in (4000, 6000]; 10E−3 in (6000, 10000]; 0.01 in (10000, 12000];0.1 in (12000, 14000]; 10E−3 in (14000, 16000]; 10E−4 in (16000, 18000]; and 0 in (18000, 20000]

Page 39: Learning from Failures: a Lightweight Approach to Run-Time Behavioural Adaptation

Zero-knowledge adaptation

{}

Zero-knowledgeAdaptation Contract

Page 40: Learning from Failures: a Lightweight Approach to Run-Time Behavioural Adaptation

Zero-knowledge adaptation

1. !a <>2. <> ?a

Zero-knowledgeAdaptation Contract

!a

Page 41: Learning from Failures: a Lightweight Approach to Run-Time Behavioural Adaptation

Zero-knowledge adaptation

1. !a <>2. <> ?a

Zero-knowledgeAdaptation Contract

!a

Page 42: Learning from Failures: a Lightweight Approach to Run-Time Behavioural Adaptation

Zero-knowledge adaptation

1. !a <>2. <> ?a3. <> !b4. ?b <>5. !c <> ...

Zero-knowledgeAdaptation Contract

Page 43: Learning from Failures: a Lightweight Approach to Run-Time Behavioural Adaptation

Conclusions

• Contributiono Learning adaptors are not synthesisedo They do not need to know the behaviour/protocol of the

services, they learn ito Failed interactions are learnt and avoidedo The learning process is completely formalised and it

converges to the same solutions as traditional adaptorso Simulation implemented in the ITACA toolbox*

• Future worko Evaluate the feasibility of zero-knowledge adaptationo Explore other techniques for contract generationo Deploy and test on a real network

* http://itaca.gisum.uma.es/

Page 44: Learning from Failures: a Lightweight Approach to Run-Time Behavioural Adaptation

Thank you!