Deployment Components with Parametric Concurrency Einar Broch - - PowerPoint PPT Presentation

deployment components with parametric concurrency
SMART_READER_LITE
LIVE PREVIEW

Deployment Components with Parametric Concurrency Einar Broch - - PowerPoint PPT Presentation

Deployment Components with Parametric Concurrency Einar Broch Johnsen Olaf Owe Rudolf Schlatte S. Lizeth Tapia Tarifa University of Oslo 10 March 2011, Tallinn http://www.hats-project.eu Rudolf Schlatte Deployment Components 10.3.2011,


slide-1
SLIDE 1

Deployment Components with Parametric Concurrency

Einar Broch Johnsen Olaf Owe Rudolf Schlatte

  • S. Lizeth Tapia Tarifa

University of Oslo 10 March 2011, Tallinn http://www.hats-project.eu

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 1 / 43

slide-2
SLIDE 2

Outline

1 Motivation and aim 2 The Abs language 3 Time model 4 Deployment components 5 Resource reallocation 6 Conclusions and future work Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 2 / 43

slide-3
SLIDE 3

Motivation

Software systems tend to be released for a range of different architectures

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 3 / 43

slide-4
SLIDE 4

Motivation

Software systems tend to be released for a range of different architectures

Examples

◮ Software Product Lines ◮ Embedded Systems ◮ Sensors ◮ Web Services ◮ Operating Systems

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 3 / 43

slide-5
SLIDE 5

Motivation

Software systems tend to be released for a range of different architectures

Examples

◮ Software Product Lines ◮ Embedded Systems ◮ Sensors ◮ Web Services ◮ Operating Systems

Need to model software which ranges over deployment scenarios

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 3 / 43

slide-6
SLIDE 6

Motivation

Abstraction levels in modeling Implementation-oriented Spec#, Java+JML

? ?

Design-oriented Graphical notations Specification level Modeling formalisms

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 4 / 43

slide-7
SLIDE 7

Motivation

Abstraction levels in modeling Implementation-oriented Spec#, Java+JML

? ?

Design-oriented Graphical notations Specification level Modeling formalisms Abstract behavioral Abs

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 4 / 43

slide-8
SLIDE 8

Abs Modeling Language

Abstract behavioral modeling language for distributed active objects

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 5 / 43

slide-9
SLIDE 9

Abs Modeling Language

Abstract behavioral modeling language for distributed active objects

Syntactic categories. C, I, m in Names g in Guard s in Stmt x in Var e in Expr b in BoolExpr Definitions. IF ::= interface I { [Sg] } CL ::= class C [(I x)] [implements I] { [I x; ] M} Sg ::= I m ([I x]) M ::= Sg == [I x; ] { s } g ::= b | x? | g ∧ g s ::= s; s | x := rhs | release | await g | return e | if b then { s } [ else { s }] | while b { s } | skip e ::= x | b | this || null rhs ::= e | new C (e) | [e]!m(e) | [e.]m(e) | x.get

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 5 / 43

slide-10
SLIDE 10

Abs Modeling Language

Abstract behavioral modeling language for distributed active objects

Syntactic categories. C, I, m in Names g in Guard s in Stmt x in Var e in Expr b in BoolExpr Definitions. IF ::= interface I { [Sg] } CL ::= class C [(I x)] [implements I] { [I x; ] M} Sg ::= I m ([I x]) M ::= Sg == [I x; ] { s } g ::= b | x? | g ∧ g s ::= s; s | x := rhs | release | await g | return e | if b then { s } [ else { s }] | while b { s } | skip e ::= x | b | this || null rhs ::= e | new C (e) | [e]!m(e) | [e.]m(e) | x.get ◮ Abs has a model of parallelism based on concurrent objects, where the

communications is through asynchronous method calls.

◮ Every object has a set of processes to be executed ◮ At most one process per object is active, the others are suspended

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 5 / 43

slide-11
SLIDE 11

Abs Modeling Language

Abstract behavioral modeling language for distributed active objects

Syntactic categories. C, I, m in Names g in Guard s in Stmt x in Var e in Expr b in BoolExpr Definitions. IF ::= interface I { [Sg] } CL ::= class C [(I x)] [implements I] { [I x; ] M} Sg ::= I m ([I x]) M ::= Sg == [I x; ] { s } g ::= b | x? | g ∧ g s ::= s; s | x := rhs | release | await g | return e | if b then { s } [ else { s }] | while b { s } | skip e ::= x | b | this || null rhs ::= e | new C (e) | [e]!m(e) | [e.]m(e) | x.get ◮ Abs has a model of parallelism based on concurrent objects, where the

communications is through asynchronous method calls.

◮ Every object has a set of processes to be executed ◮ At most one process per object is active, the others are suspended ◮ Scheduling is controlled by await statements ◮ Compositional proof theory, implemented in KeY

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 5 / 43

slide-12
SLIDE 12

A Time Model for Abs

◮ A time interval captures the execution between two observable

points in time

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 6 / 43

slide-13
SLIDE 13

A Time Model for Abs

◮ A time interval captures the execution between two observable

points in time

◮ Comparable to a system clock which updates every n milliseconds

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 6 / 43

slide-14
SLIDE 14

A Time Model for Abs

◮ A time interval captures the execution between two observable

points in time

◮ Comparable to a system clock which updates every n milliseconds ◮ The expression now returns the present time

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 6 / 43

slide-15
SLIDE 15

A Time Model for Abs

◮ A time interval captures the execution between two observable

points in time

◮ Comparable to a system clock which updates every n milliseconds ◮ The expression now returns the present time ◮ Suitable for guards in await statements.

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 6 / 43

slide-16
SLIDE 16

A Time Model for Abs

◮ A time interval captures the execution between two observable

points in time

◮ Comparable to a system clock which updates every n milliseconds ◮ The expression now returns the present time ◮ Suitable for guards in await statements.

  • Example:

Time t:=now; await now ≥ t + c;

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 6 / 43

slide-17
SLIDE 17

A Time Model for Abs

◮ A time interval captures the execution between two observable

points in time

◮ Comparable to a system clock which updates every n milliseconds ◮ The expression now returns the present time ◮ Suitable for guards in await statements.

  • Example:

Time t:=now; await now ≥ t + c; ◮ From the local perspective time advances by

  • awaiting the passage of time, or
  • when no other activity may occur

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 6 / 43

slide-18
SLIDE 18

A Time Model for Abs

◮ A time interval captures the execution between two observable

points in time

◮ Comparable to a system clock which updates every n milliseconds ◮ The expression now returns the present time ◮ Suitable for guards in await statements.

  • Example:

Time t:=now; await now ≥ t + c; ◮ From the local perspective time advances by

  • awaiting the passage of time, or
  • when no other activity may occur

Paper: Lightweight Time Modeling in Timed Creol

  • Proc. 1st Int. Workshop on Rewriting Techniques for Real-Time Systems (RTRTS 2010), ENTCS 36:67–81, 2010

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 6 / 43

slide-19
SLIDE 19

Aim

Apply performance analysis to OO models which range over deployment scenarios

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 7 / 43

slide-20
SLIDE 20

Aim

Apply performance analysis to OO models which range over deployment scenarios Modeling of deployment scenarios

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 7 / 43

slide-21
SLIDE 21

Aim

Apply performance analysis to OO models which range over deployment scenarios Modeling of deployment scenarios

◮ Deployment components with a set of (physical) processors ◮ Every component is parametric in the amount of concurrent

processing resources

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 7 / 43

slide-22
SLIDE 22

Aim

Apply performance analysis to OO models which range over deployment scenarios Modeling of deployment scenarios

◮ Deployment components with a set of (physical) processors ◮ Every component is parametric in the amount of concurrent

processing resources Processing resources are:

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 7 / 43

slide-23
SLIDE 23

Aim

Apply performance analysis to OO models which range over deployment scenarios Modeling of deployment scenarios

◮ Deployment components with a set of (physical) processors ◮ Every component is parametric in the amount of concurrent

processing resources Processing resources are:

◮ Shared between the concurrent objects of a deployment component ◮ Updated for every time interval

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 7 / 43

slide-24
SLIDE 24

Approach

◮ Propose an abstract model of

deployment components

  • Concurrent object groups
  • Parametric amount of resources per time

interval

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 8 / 43

slide-25
SLIDE 25

Approach

◮ Propose an abstract model of

deployment components

  • Concurrent object groups
  • Parametric amount of resources per time

interval

◮ Extend the Abs modeling language

  • Time model
  • Deployment components
  • Resource reallocation

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 8 / 43

slide-26
SLIDE 26

Approach

◮ Propose an abstract model of

deployment components

  • Concurrent object groups
  • Parametric amount of resources per time

interval

◮ Extend the Abs modeling language

  • Time model
  • Deployment components
  • Resource reallocation

◮ Operational semantics in rewriting logic

  • Executable prototype using Maude
  • Language interpreter
  • Simulation of model behavior
  • Test suites

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 8 / 43

slide-27
SLIDE 27

Model

Object1 ObjectN method1() result methodN() result ObjectA ObjectC ObjectB methodA() methodB()

Deployment Component

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 9 / 43

slide-28
SLIDE 28

Model with DC

Object1 ObjectN method1() result methodN() result ObjectA ObjectC ObjectB DC methodA() methodB()

Global clock Deployment Component Resources

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 10 / 43

slide-29
SLIDE 29

Deployment Components (1)

A deployment component has a number of concurrent resources

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 11 / 43

slide-30
SLIDE 30

Deployment Components (1)

A deployment component has a number of concurrent resources

◮ These resources are shared between the component’s objects

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 11 / 43

slide-31
SLIDE 31

Deployment Components (1)

A deployment component has a number of concurrent resources

◮ These resources are shared between the component’s objects ◮ Resources abstract from the number and speed of the physical

processors available to the component

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 11 / 43

slide-32
SLIDE 32

Deployment Components (1)

A deployment component has a number of concurrent resources

◮ These resources are shared between the component’s objects ◮ Resources abstract from the number and speed of the physical

processors available to the component

◮ Resources reflect the execution capacity of

the deployment component in a time interval

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 11 / 43

slide-33
SLIDE 33

Deployment Components (2)

Consider a deployment component D with r units of processing resources and G objects

Object1 ObjectN method1() result methodN() result ObjectA ObjectC ObjectB DC methodA() methodB()

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 12 / 43

slide-34
SLIDE 34

Deployment Components (2)

Consider a deployment component D with r units of processing resources and G objects

Object1 ObjectN method1() result methodN() result ObjectA ObjectC ObjectB DC methodA() methodB()

◮ Any number n of objects in G can execute concurrently (n ≤ r)

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 12 / 43

slide-35
SLIDE 35

Deployment Components (2)

Consider a deployment component D with r units of processing resources and G objects

Object1 ObjectN method1() result methodN() result ObjectA ObjectC ObjectB DC methodA() methodB()

◮ Any number n of objects in G can execute concurrently (n ≤ r) ◮ Let A ⊆ G such that n = |A|

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 12 / 43

slide-36
SLIDE 36

Deployment Components (2)

Consider a deployment component D with r units of processing resources and G objects

Object1 ObjectN method1() result methodN() result ObjectA ObjectC ObjectB DC methodA() methodB()

◮ Any number n of objects in G can execute concurrently (n ≤ r) ◮ Let A ⊆ G such that n = |A| ◮ After one concurrent execution step,

D has r1 = r − n available units of resources.

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 12 / 43

slide-37
SLIDE 37

Deployment Components (2)

Consider a deployment component D with r units of processing resources and G objects

Object1 ObjectN method1() result methodN() result ObjectA ObjectC ObjectB DC methodA() methodB()

◮ Any number n of objects in G can execute concurrently (n ≤ r) ◮ Let A ⊆ G such that n = |A| ◮ After one concurrent execution step,

D has r1 = r − n available units of resources.

◮ If r1 > 0, another execution step can be done

(leaving r2 remaining units of resources available)

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 12 / 43

slide-38
SLIDE 38

Deployment Components (2)

Consider a deployment component D with r units of processing resources and G objects

Object1 ObjectN method1() result methodN() result ObjectA ObjectC ObjectB DC methodA() methodB()

◮ Any number n of objects in G can execute concurrently (n ≤ r) ◮ Let A ⊆ G such that n = |A| ◮ After one concurrent execution step,

D has r1 = r − n available units of resources.

◮ If r1 > 0, another execution step can be done

(leaving r2 remaining units of resources available) Execution inside the time interval stops when no units of resources are available or the objects are blocked

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 12 / 43

slide-39
SLIDE 39

Abs Syntax Extension

Object1 ObjectN method1() result methodN() result ObjectA ObjectC ObjectB DC methodA() methodB()

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 13 / 43

slide-40
SLIDE 40

Abs Syntax Extension

Object1 ObjectN method1() result methodN() result ObjectA ObjectC ObjectB DC methodA() methodB()

Extension of the Syntax of Abs:

◮ now() returns the current time

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 13 / 43

slide-41
SLIDE 41

Abs Syntax Extension

Object1 ObjectN method1() result methodN() result ObjectA ObjectC ObjectB DC methodA() methodB()

Extension of the Syntax of Abs:

◮ now() returns the current time ◮ component(r) creates a new deployment component dc:=component(r);

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 13 / 43

slide-42
SLIDE 42

Abs Syntax Extension

Object1 ObjectN method1() result methodN() result ObjectA ObjectC ObjectB DC methodA() methodB()

Extension of the Syntax of Abs:

◮ now() returns the current time ◮ component(r) creates a new deployment component dc:=component(r); ◮ An optional clause in the object creation new C(e) in dc;

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 13 / 43

slide-43
SLIDE 43

Operational Semantics - Extension

The operational semantics of Abs is formalized in rewriting logic and is executable on the Maude tool

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 14 / 43

slide-44
SLIDE 44

Operational Semantics - Extension

The operational semantics of Abs is formalized in rewriting logic and is executable on the Maude tool A Abs configuration (system state) consists of:

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 14 / 43

slide-45
SLIDE 45

Operational Semantics - Extension

The operational semantics of Abs is formalized in rewriting logic and is executable on the Maude tool A Abs configuration (system state) consists of: Classes, Objects, Futures and Invocation messages

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 14 / 43

slide-46
SLIDE 46

Operational Semantics - Extension

The operational semantics of Abs is formalized in rewriting logic and is executable on the Maude tool A Abs configuration (system state) consists of: Classes, Objects, Futures and Invocation messages Extend the configurations with:

◮ Global clock t:Clock | Limit:l ◮ Deployment components dc:Comp|Free:r, Limit:l ◮ Object attribute mycomp

Object1 ObjectN method1() result methodN() result ObjectA ObjectC ObjectB DC methodA() methodB()

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 14 / 43

slide-47
SLIDE 47

Operational Semantics - Extension

Extend the rewriting rules with time, deployment components, and resource consumption

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 15 / 43

slide-48
SLIDE 48

Operational Semantics - Extension

Extend the rewriting rules with time, deployment components, and resource consumption Some of the statements consume resources when they execute.

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 15 / 43

slide-49
SLIDE 49

Operational Semantics - Extension

Extend the rewriting rules with time, deployment components, and resource consumption Some of the statements consume resources when they execute. Simple example:

skip;

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 15 / 43

slide-50
SLIDE 50

Operational Semantics - Extension

Extend the rewriting rules with time, deployment components, and resource consumption Some of the statements consume resources when they execute. Simple example:

skip;

Old rule:

rl [skip]:

  • : C | Pr: {l | skip; s}

− →

  • : C | Pr: {l | s} .

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 15 / 43

slide-51
SLIDE 51

Operational Semantics - Extension

Extend the rewriting rules with time, deployment components, and resource consumption Some of the statements consume resources when they execute. Simple example:

skip;

Old rule:

rl [skip]:

  • : C | Pr: {l | skip; s}

− →

  • : C | Pr: {l | s} .

New rule: skip consumes a resource

crl [skip]:

  • : C | Att:a, Pr: {l | skip; s} dc:Comp |Free:r

− →

  • : C | Att:a, Pr: {l | s}

dc:Comp |Free:r − 1 if dc = a[mycomp].

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 15 / 43

slide-52
SLIDE 52

Operational Semantics - Extension

Old rule:

crl [async-call]:

  • : C | Att: a, Pr: {l | x := e!m(e);s}, Lcnt: f

− → o : C | Att: a, Pr: {l [x → n] | s}, Lcnt: f + 1 invoc([ [e] ](a◦l),none, n, m, [ [e] ](a◦l),none) n:Fut |Done:false,Value:⊥ if n:=label(o, f )∧ o = [ [e] ](a◦l),none .

New rule consumes resources and evaluates expressions using time:

crl [async-call]:

  • : C | Att: a, Pr: {l | x := e!m(e);s}, Lcnt: f

t:Clock | dc:Comp |Free:r − → o : C | Att: a, Pr: {l [x → n] | s}, Lcnt: f + 1 t:Clock | dc:Comp |Free:r − 1 invoc([ [e] ]t

(a◦l),none, n, m, [

[e] ]t

(a◦l),none) n:Fut |Done:false,Value:⊥

if n:=label(o, f )∧ o = [ [e] ]t

(a◦l),none

∧ dc = a[mycomp] .

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 16 / 43

slide-53
SLIDE 53

Operational Semantics - Extension

crl [progress]: { cn t : Clock | limit: limit } − → {Adv(cn) t + 1: Clock | limit: limit } if canAdv(cn,t)∧ t < limit .

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 17 / 43

slide-54
SLIDE 54

Operational Semantics - Extension

crl [progress]: { cn t : Clock | limit: limit } − → {Adv(cn) t + 1: Clock | limit: limit } if canAdv(cn,t)∧ t < limit .

Adv(cn) resets the free resources of each deployment component to their specified limit.

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 17 / 43

slide-55
SLIDE 55

Operational Semantics - Extension

crl [progress]: { cn t : Clock | limit: limit } − → {Adv(cn) t + 1: Clock | limit: limit } if canAdv(cn,t)∧ t < limit .

Adv(cn) resets the free resources of each deployment component to their specified limit. canAdv(cn,t) is true if

◮ no object can do anything and no invocation messages to that object are in the

configuration.

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 17 / 43

slide-56
SLIDE 56

Operational Semantics - Extension

crl [progress]: { cn t : Clock | limit: limit } − → {Adv(cn) t + 1: Clock | limit: limit } if canAdv(cn,t)∧ t < limit .

Adv(cn) resets the free resources of each deployment component to their specified limit. canAdv(cn,t) is true if

◮ no object can do anything and no invocation messages to that object are in the

configuration. An object can not do anything if:

  • Its deployment component has run out of resources or
  • All its process are blocked

Otherwise, time cannot advance.

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 17 / 43

slide-57
SLIDE 57

Operational Semantics - Extension

crl [progress]: { cn t : Clock | limit: limit } − → {Adv(cn) t + 1: Clock | limit: limit } if canAdv(cn,t)∧ t < limit .

Adv(cn) resets the free resources of each deployment component to their specified limit. canAdv(cn,t) is true if

◮ no object can do anything and no invocation messages to that object are in the

configuration. An object can not do anything if:

  • Its deployment component has run out of resources or
  • All its process are blocked

Otherwise, time cannot advance.

Paper: Validating Timed Models of Deployment Components with Parametric Concurrency.

  • Proc. Int. Conference on Formal Verification of Object-Oriented Software (FoVeOOS) 2010. LNCS 6528, pg. 46–60.

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 17 / 43

slide-58
SLIDE 58

Example: A Shopping Service

Web Shop Model Client Client

  • rder()

success?

  • rder()

success?

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 18 / 43

slide-59
SLIDE 59

Example: A Shopping Service

Client Client

  • rder()

success?

  • rder()

success? Agent

Sessions

DB Session getsession() makeorder() result

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 19 / 43

slide-60
SLIDE 60

Example: A Shopping Service - Abs Model

Database

interface Database { Bool makeOrder(); } class Database(Nat min, Nat max) implements Database { Bool makeOrder () { Time t:=now; await now >= t + min; return now <= t + max; } }

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 20 / 43

slide-61
SLIDE 61

Example: A Shopping Service - Abs Model

interface Database { Bool makeOrder(); } class Database(Nat min, Nat max) implements Database { Bool makeOrder () { Time t:=now; await now >= t + min; return now <= t + max; } }

Session

interface Session { Bool order(); } class Session(Agent agent, Database db) implements Session { Bool order() {return db.makeorder(); agent.free(this); } }

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 20 / 43

slide-62
SLIDE 62

Example: A Shopping Service - Abs Model

interface Database { Bool makeOrder(); } class Database(Nat min, Nat max) implements Database { Bool makeOrder () { Time t:=now; await now >= t + min; return now <= t + max; } } interface Session { Bool order(); } class Session(Agent agent, Database db) implements Session { Bool order() {return db.makeorder(); agent.free(this); } }

Agent

interface Agent { Session getSession(); Void free(Session session); } class Agent(Database db, Set[Session] sessionPool) implements Agent { Session getSession() { if isempty(sessionPool) { return new Session(this, db); } else { session:=choose(sessionPool); sessionPool:=remove(session,sessionPool); return session; } } Void free(Session session) {sessionPool := add(sessionPool, session); }

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 20 / 43

slide-63
SLIDE 63

Example: Client Behavior

Periodic Client

  • rder()
  • rder()
  • rder()
  • rder()
  • rder()
  • rder()

time c c ...

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 21 / 43

slide-64
SLIDE 64

Example: Client Behavior

Periodic Client

  • rder()
  • rder()
  • rder()
  • rder()
  • rder()
  • rder()

time c c ... Sync Client

  • rder()
  • rder()

time c c success success

  • rder()
  • rder()

c success

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 21 / 43

slide-65
SLIDE 65

Example: Client Behavior - Abs Model

Synchronous client

class SyncClient(Agent a, Nat c) { Void run { Time t := now; Session s := a.getsession(); Bool result := s.order(); await now >= t + c; this!run(); } }

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 22 / 43

slide-66
SLIDE 66

Example: Client Behavior - Abs Model

class SyncClient(Agent a, Nat c) { Void run { Time t := now; Session s := a.getsession(); Bool result := s.order(); await now >= t + c; this!run(); } }

Periodic client

class PeriodicClient(Agent a, Nat c) { Void run { Time t := now; Session s := a.getsession(); Fut(Bool) rc := s!order(); await now >= t + c; this!run(); } }

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 22 / 43

slide-67
SLIDE 67

Example: Simulation

Client Client

  • rder()

success?

  • rder()

success? Agent

Sessions

DB Session getsession() makeorder() result Shop

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 23 / 43

slide-68
SLIDE 68

Example: Simulation and Testing - Abs Model

Different configurations:

Void main() { Component shop := component(10); Database db := new Database(5, 10) in shop; Agent a := new Agent(db, {}) in shop; SyncClient c := new SyncClient(a, 5); ... }

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 24 / 43

slide-69
SLIDE 69

Example: Simulation and Testing - Abs Model

Different configurations:

Void main() { Component shop := component(10); Database db := new Database(5, 10) in shop; Agent a := new Agent(db, {}) in shop; SyncClient c := new SyncClient(a, 5); ... }

  • r

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 24 / 43

slide-70
SLIDE 70

Example: Simulation and Testing - Abs Model

Different configurations:

Void main() { Component shop := component(10); Database db := new Database(5, 10) in shop; Agent a := new Agent(db, {}) in shop; SyncClient c := new SyncClient(a, 5); ... }

  • r

Void main() { Component shop := component(10); Database db := new Database(5, 10) in shop; Agent a := new Agent(db, {}) in shop; PeriodicClient c := new PeriodicClient(a, 5); ... }

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 24 / 43

slide-71
SLIDE 71

Example: Simulations in the Maude Interpreter

Use Maude as a language interpreter to simulate the different scenarios

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 25 / 43

slide-72
SLIDE 72

Example: Simulations in the Maude Interpreter - Results

The total and successful requests, depending on the number of clients and resources

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 26 / 43

slide-73
SLIDE 73

Example: Simulations in the Maude Interpreter - Results

The total and successful requests, depending on the number of clients and resources

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 26 / 43

slide-74
SLIDE 74

Example: Simulations in the Maude Interpreter - Results

The total and successful requests, depending on the number of clients and resources

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 26 / 43

slide-75
SLIDE 75

Example: Simulations in the Maude Interpreter - Results

The total and successful requests, depending on the number of clients and resources

For a larger number of periodic clients, the system becomes unresponsive

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 26 / 43

slide-76
SLIDE 76

Deployment Component

Object1 ObjectN method1() result methodN() result ObjectA ObjectC ObjectB DC methodA() methodB()

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 27 / 43

slide-77
SLIDE 77

Dynamic Resource Reallocation

Object1 ObjectN method1() result methodN() result ObjectA ObjectC DC1 methodA() methodB() Balancer1 ObjectB Balancer2 DC2 request()

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 28 / 43

slide-78
SLIDE 78

Dynamic Resource Reallocation

◮ Let components and resources be first-class citizens in the language

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 29 / 43

slide-79
SLIDE 79

Dynamic Resource Reallocation

◮ Let components and resources be first-class citizens in the language ◮ Now, we can store and pass on components and resource values

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 29 / 43

slide-80
SLIDE 80

Dynamic Resource Reallocation

◮ Let components and resources be first-class citizens in the language ◮ Now, we can store and pass on components and resource values

More new expressions and statements in Abs

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 29 / 43

slide-81
SLIDE 81

Dynamic Resource Reallocation

◮ Let components and resources be first-class citizens in the language ◮ Now, we can store and pass on components and resource values

More new expressions and statements in Abs Consider a variable dc of type Component and r of type Resource:

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 29 / 43

slide-82
SLIDE 82

Dynamic Resource Reallocation

◮ Let components and resources be first-class citizens in the language ◮ Now, we can store and pass on components and resource values

More new expressions and statements in Abs Consider a variable dc of type Component and r of type Resource:

◮ The expression mycomp returns dc of the object.

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 29 / 43

slide-83
SLIDE 83

Dynamic Resource Reallocation

◮ Let components and resources be first-class citizens in the language ◮ Now, we can store and pass on components and resource values

More new expressions and statements in Abs Consider a variable dc of type Component and r of type Resource:

◮ The expression mycomp returns dc of the object. ◮ The expression available returns the number of resources currently

allocated to mycomp

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 29 / 43

slide-84
SLIDE 84

Dynamic Resource Reallocation

◮ Let components and resources be first-class citizens in the language ◮ Now, we can store and pass on components and resource values

More new expressions and statements in Abs Consider a variable dc of type Component and r of type Resource:

◮ The expression mycomp returns dc of the object. ◮ The expression available returns the number of resources currently

allocated to mycomp

◮ The expression load(e) returns the average number of used resources in

mycomp during the last e time intervals

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 29 / 43

slide-85
SLIDE 85

Dynamic Resource Reallocation

◮ Let components and resources be first-class citizens in the language ◮ Now, we can store and pass on components and resource values

More new expressions and statements in Abs Consider a variable dc of type Component and r of type Resource:

◮ The expression mycomp returns dc of the object. ◮ The expression available returns the number of resources currently

allocated to mycomp

◮ The expression load(e) returns the average number of used resources in

mycomp during the last e time intervals

◮ The statement transfer(dc, r) reallocates r resources from mycomp to

another component dc

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 29 / 43

slide-86
SLIDE 86

Dynamic Resource Reallocation

◮ Let components and resources be first-class citizens in the language ◮ Now, we can store and pass on components and resource values

More new expressions and statements in Abs Consider a variable dc of type Component and r of type Resource:

◮ The expression mycomp returns dc of the object. ◮ The expression available returns the number of resources currently

allocated to mycomp

◮ The expression load(e) returns the average number of used resources in

mycomp during the last e time intervals

◮ The statement transfer(dc, r) reallocates r resources from mycomp to

another component dc

Paper: Dynamic Resource Reallocation Between Deployment Components.

  • Proc. Int. Conference on Formal Engineering Methods (ICFEM) 2010. LNCS 6447, pg. 646–661.

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 29 / 43

slide-87
SLIDE 87

Example: Phone Services

Client Client sms() call(n) sms() call(n) tel sms Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 30 / 43

slide-88
SLIDE 88

Example: Phone Services

smscomp telcomp Client Client sms() call(n) sms() call(n) tel sms telb smsb request() Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 31 / 43

slide-89
SLIDE 89

Example: Phone Services - Abs Model

Telephone Service

interface TelephoneService { Void call(Int duration); } class TelephoneService implements TelephoneService { Void call(Int duration) { Time t; t := now; await now >= t + duration; } }

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 32 / 43

slide-90
SLIDE 90

Example: Phone Services - Abs Model

interface TelephoneService { Void call(Int duration); } class TelephoneService implements TelephoneService { Void call(Int duration) { Time t; t := now; await now >= t + duration; } }

SMS Service

interface SMSService { Void sendSMS(); } class SMSService implements SMSService { Void sendSMS() { skip; } }

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 32 / 43

slide-91
SLIDE 91

Example: Load Balancing Strategy - Abs Model

The proposed resource-related language-constructors available, load and transfer allow to express different load balancing schemes:

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 33 / 43

slide-92
SLIDE 92

Example: Load Balancing Strategy - Abs Model

The proposed resource-related language-constructors available, load and transfer allow to express different load balancing schemes: A simple balancer scheme

interface Balancer { Void setPartner(Balancer p); Void request(Component comp); } class Balancer { Balancer partner := null; Void setPartner(Balancer p) { partner := p; } Void request(Component comp) { if (load(1) < available−10) {transfer(comp,available/2);} } Void run () { Time t := now; await now > t; if (partner = null ∧ available<load(1)*0.9) { partner.request(mycomp);} this!run(); } }

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 33 / 43

slide-93
SLIDE 93

Example: The New Year’s Eve Client Behavior

50 70 Alternate sms and call Huge number of sms per time interval time Alternate sms and call Midnight Window

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 34 / 43

slide-94
SLIDE 94

Example: The New Year’s Eve Client Behavior

Normal behavior of client

class NYEbehavior (cycle: Int, ts: TelephoneService, smss: SMSService) { Time created := now; Bool call := false; Void normalBehavior() { Time t := now; if (now > created + 50 && now < created + 70) { !midnightWindow(); } else { if (call) ts.call(1;) else !smss.sendSMS() call := ˜ call; await now >= t + cycle; !normalBehavior(); } }

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 35 / 43

slide-95
SLIDE 95

Example: The New Year’s Eve Client Behavior

Midnight behavior of client

Void midnightWindow() { Time t := now; Int i := 0; if (now > created + 70) { !normalBehavior(); } else { while (i < 10) { !smss.sendSMS(); i := i+1; } await now > t; !midnightWindow(); } }

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 36 / 43

slide-96
SLIDE 96

Example: The New Year’s Eve Client Behavior

Void midnightWindow() { Time t := now; Int i := 0; if (now > created + 70) { !normalBehavior(); } else { while (i < 10) { !smss.sendSMS(); i := i+1; } await now > t; !midnightWindow(); } }

Run

  • p run() { !normalBehavior(); } }

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 36 / 43

slide-97
SLIDE 97

Example: Simulating and Testing - Abs Model

Void main() { Component smscomp := component(50); Component telcomp := component(50);

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 37 / 43

slide-98
SLIDE 98

Example: Simulating and Testing - Abs Model

Void main() { Component smscomp := component(50); Component telcomp := component(50); SMSService sms := new SMSService() in smscomp; TelephoneService tel := new TelephoneService() in telcomp;

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 37 / 43

slide-99
SLIDE 99

Example: Simulating and Testing - Abs Model

Void main() { Component smscomp := component(50); Component telcomp := component(50); SMSService sms := new SMSService() in smscomp; TelephoneService tel := new TelephoneService() in telcomp; Balancer smsb := new Balancer in smscomp; Balancer telb := new Balancer in telcomp;

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 37 / 43

slide-100
SLIDE 100

Example: Simulating and Testing - Abs Model

Void main() { Component smscomp := component(50); Component telcomp := component(50); SMSService sms := new SMSService() in smscomp; TelephoneService tel := new TelephoneService() in telcomp; Balancer smsb := new Balancer in smscomp; Balancer telb := new Balancer in telcomp; smsb.setPartner(telb); telb.setPartner(smsb);

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 37 / 43

slide-101
SLIDE 101

Example: Simulating and Testing - Abs Model

Void main() { Component smscomp := component(50); Component telcomp := component(50); SMSService sms := new SMSService() in smscomp; TelephoneService tel := new TelephoneService() in telcomp; Balancer smsb := new Balancer in smscomp; Balancer telb := new Balancer in telcomp; smsb.setPartner(telb); telb.setPartner(smsb); Client c := new NYEbehavior(1,tel,sms); . . .}

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 37 / 43

slide-102
SLIDE 102

Example: Simulating and Testing - Abs Model

Void main() { Component smscomp := component(50); Component telcomp := component(50); SMSService sms := new SMSService() in smscomp; TelephoneService tel := new TelephoneService() in telcomp; //Balancer smsb := new Balancerinsmscomp; //Balancer telb := new Balancerintelcomp; //smsb.setPartner(telb); telb.setPartner(smsb); Client c := new NYEbehavior(1,tel,sms); . . .}

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 38 / 43

slide-103
SLIDE 103

Example: Simulation in the Maude Interpreter

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 39 / 43

slide-104
SLIDE 104

Example: Simulation in the Maude Interpreter

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 39 / 43

slide-105
SLIDE 105

Conclusions

◮ Modern software is designed to be

deployed in different architectures

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 40 / 43

slide-106
SLIDE 106

Conclusions

◮ Modern software is designed to be

deployed in different architectures

◮ Need analysis support which ranges

  • ver different deployment scenarios

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 40 / 43

slide-107
SLIDE 107

Conclusions

◮ Modern software is designed to be

deployed in different architectures

◮ Need analysis support which ranges

  • ver different deployment scenarios

◮ We proposed deployment components

with parametric concurrent resources

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 40 / 43

slide-108
SLIDE 108

Conclusions

◮ Modern software is designed to be

deployed in different architectures

◮ Need analysis support which ranges

  • ver different deployment scenarios

◮ We proposed deployment components

with parametric concurrent resources

◮ Abstract notion of resource, reflecting the execution capacity of a

component in a given time interval

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 40 / 43

slide-109
SLIDE 109

Conclusions

◮ Dynamic reallocation of resources

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 41 / 43

slide-110
SLIDE 110

Conclusions

◮ Dynamic reallocation of resources ◮ Software controlling allocation and

reallocation of resources can be completely separated from the rest of the code

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 41 / 43

slide-111
SLIDE 111

Conclusions

◮ Dynamic reallocation of resources ◮ Software controlling allocation and

reallocation of resources can be completely separated from the rest of the code

◮ Different reallocation strategies can be expressed in terms of

load(e), available and transfer(dc, r)

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 41 / 43

slide-112
SLIDE 112

Conclusions

◮ Dynamic reallocation of resources ◮ Software controlling allocation and

reallocation of resources can be completely separated from the rest of the code

◮ Different reallocation strategies can be expressed in terms of

load(e), available and transfer(dc, r)

◮ It is easy to replace different reallocation strategies for different

components

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 41 / 43

slide-113
SLIDE 113

Conclusions

◮ Dynamic reallocation of resources ◮ Software controlling allocation and

reallocation of resources can be completely separated from the rest of the code

◮ Different reallocation strategies can be expressed in terms of

load(e), available and transfer(dc, r)

◮ It is easy to replace different reallocation strategies for different

components

◮ Possible to express interesting non-functional system properties

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 41 / 43

slide-114
SLIDE 114

Ongoing/Future Work

◮ Reallocation between deployment components

(eg. load balancing) using object mobility

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 42 / 43

slide-115
SLIDE 115

Ongoing/Future Work

◮ Reallocation between deployment components

(eg. load balancing) using object mobility

◮ Resource adjustments frameworks using

hierarchical strategies

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 42 / 43

slide-116
SLIDE 116

Ongoing/Future Work

◮ Reallocation between deployment components

(eg. load balancing) using object mobility

◮ Resource adjustments frameworks using

hierarchical strategies

◮ Stronger analysis methods

  • Symbolic analysis
  • Static analysis

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 42 / 43

slide-117
SLIDE 117

Ongoing/Future Work

◮ Reallocation between deployment components

(eg. load balancing) using object mobility

◮ Resource adjustments frameworks using

hierarchical strategies

◮ Stronger analysis methods

  • Symbolic analysis
  • Static analysis

◮ Memory resources for deployment components

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 42 / 43

slide-118
SLIDE 118

Ongoing/Future Work

◮ Reallocation between deployment components

(eg. load balancing) using object mobility

◮ Resource adjustments frameworks using

hierarchical strategies

◮ Stronger analysis methods

  • Symbolic analysis
  • Static analysis

◮ Memory resources for deployment components ◮ Scheduling

  • Priority scheduling: Processes can dynamically increase
  • r decrease in priority according to their waiting time
  • Deadlines to method calls

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 42 / 43

slide-119
SLIDE 119

THANK YOU

Rudolf Schlatte Deployment Components 10.3.2011, Tallinn 43 / 43