learning from failures: a lightweight approach to run-time behavioural adaptation
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 systemTRANSCRIPT
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
Motivation
In pervasive computing scenarios, we have thousands of interacting entities with limited resources which may move,
change and degrade over time
Motivation
Existing WSAN could benefit from other networks by collaborating in communications and functionality
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
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
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
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
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
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
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
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
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()
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()
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()
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()
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()
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()
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()
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()
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()
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()
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()
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
Evaluation
Evaluation
data
Evaluation
data
Evaluation
Sample standard deviation with 10 samples
Evaluation
Sample standard deviation with 10 samples
55 inhibited traces vs 7123 transitions allowing a total of 5466 different successful sessions
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
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
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
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
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
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
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
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
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]
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]
Zero-knowledge adaptation
{}
Zero-knowledgeAdaptation Contract
Zero-knowledge adaptation
1. !a <>2. <> ?a
Zero-knowledgeAdaptation Contract
!a
Zero-knowledge adaptation
1. !a <>2. <> ?a
Zero-knowledgeAdaptation Contract
!a
Zero-knowledge adaptation
1. !a <>2. <> ?a3. <> !b4. ?b <>5. !c <> ...
Zero-knowledgeAdaptation Contract
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/
Thank you!