47
Integrating Adaptation Mechanisms Using Control Theory Centric Architecture Models Grenoble, 27.5.2014 Philippe Collet Robert B. France Colorado State University Computer Science Department USA Université Nice Sophia Antipolis I3S - CNRS UMR 7271 France University Lille 1 / LIFL INRIA Lille France Filip Křikava, Romain Rouvoy, Lionel Seinturier

Integrating Adaptation Mechanisms Using Control Theory ...stephane.mocanu/slides_staars/krikva.pdf · • Web-based N-tier client-server • Objective • “To serve the content

  • Upload
    others

  • View
    4

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Integrating Adaptation Mechanisms Using Control Theory ...stephane.mocanu/slides_staars/krikva.pdf · • Web-based N-tier client-server • Objective • “To serve the content

Integrating Adaptation Mechanisms Using Control Theory Centric Architecture Models

Grenoble, 27.5.2014

Philippe Collet Robert B. FranceColorado State University

Computer Science Department USA

Université Nice Sophia Antipolis I3S - CNRS UMR 7271

FranceUniversity Lille 1 / LIFL

INRIA LilleFrance

Filip Křikava, Romain Rouvoy, Lionel Seinturier

Page 2: Integrating Adaptation Mechanisms Using Control Theory ...stephane.mocanu/slides_staars/krikva.pdf · • Web-based N-tier client-server • Objective • “To serve the content

Grenoble, 27.5.2014Integrating Adaptation Mechanisms Using Control Theory Centric Architecture Models

CONTEXT

Jeff Kephart - Autonomic Computing: The First Decade, ICAC’11 keynote

Electronic Retailer - Application Diagram

• Ever growing complexity of computing systems • Taming this complexity by skilled IT professionals does not scale • New operation modes are needed

Page 3: Integrating Adaptation Mechanisms Using Control Theory ...stephane.mocanu/slides_staars/krikva.pdf · • Web-based N-tier client-server • Objective • “To serve the content

Grenoble, 27.5.2014Integrating Adaptation Mechanisms Using Control Theory Centric Architecture Models

TOWARDS SELF-ADAPTIVE SOFTWARE SYSTEMS

• Systems adjusting themselves in accordance with higher-level goals. • Feedback control as a primary mean to enable adaptation.

Feedback Control Loop (FCL)

Monitoring Reconfiguration

Decision Making

sensors effectors

Target System

events actions

measures decisions

system outputs (response time, utilization, throughput)

system control inputs (queue size, scheduling policy, concurrency level)

achieve externally specified goals

Page 4: Integrating Adaptation Mechanisms Using Control Theory ...stephane.mocanu/slides_staars/krikva.pdf · • Web-based N-tier client-server • Objective • “To serve the content

Grenoble, 27.5.2014Integrating Adaptation Mechanisms Using Control Theory Centric Architecture Models

• Engineering self-adaptive software systems is challenging. • Example: web server adaptation - overload control

CHALLENGES

FCL design challenges • System identification • System modeling • Controller design

Controller Target System

Transducer

+ -

� =mX

i=1

1

d=

m

d

⇥(N) = �µ =

md

µ

d =m

�(N)µ

FCL integration challenges • Consistent monitoring • Coordinated

reconfiguration • Architecture connection

!

API

LOGS

CONFIG FILES

COMMANDSAOP

PROFILER

control engineers software engineers

Page 5: Integrating Adaptation Mechanisms Using Control Theory ...stephane.mocanu/slides_staars/krikva.pdf · • Web-based N-tier client-server • Objective • “To serve the content

Grenoble, 27.5.2014Integrating Adaptation Mechanisms Using Control Theory Centric Architecture Models

INTEGRATING ADAPTATION MECHANISMS

• Adhoc Implementations • Extensive handcrafting of non-trivial code • Low level of FCL abstraction • Low FCL visibility • Limited verification and reasoning • Giving raise to accidental complexities

API

LOGS

CONFIGURATIONS

COMMANDS

AOP

PROFILER

Page 6: Integrating Adaptation Mechanisms Using Control Theory ...stephane.mocanu/slides_staars/krikva.pdf · • Web-based N-tier client-server • Objective • “To serve the content

Grenoble, 27.5.2014Integrating Adaptation Mechanisms Using Control Theory Centric Architecture Models

INTEGRATING ADAPTATION MECHANISMS

• Adhoc Implementations • Extensive handcrafting of non-trivial code • Low level of FCL abstraction • Low FCL visibility • Limited verification and reasoning • Giving raise to accidental complexities

• Existing Approaches • Limited support for control theory based controllers

API

LOGS

CONFIGURATIONS

COMMANDS

AOP

PROFILER

Page 7: Integrating Adaptation Mechanisms Using Control Theory ...stephane.mocanu/slides_staars/krikva.pdf · • Web-based N-tier client-server • Objective • “To serve the content

Grenoble, 27.5.2014Integrating Adaptation Mechanisms Using Control Theory Centric Architecture Models

INTEGRATING ADAPTATION MECHANISMS

• Adhoc Implementations • Extensive handcrafting of non-trivial code • Low level of FCL abstraction • Low FCL visibility • Limited verification and reasoning • Giving raise to accidental complexities

• Existing Approaches • Limited support for control theory based controllers

• shared by many framework/middleware approaches targeting legacy software systems

API

LOGS

CONFIGURATIONS

COMMANDS

AOP

PROFILER

Rainbow example - tactics

Cheng et al., Rainbow: Cost-Effective Software

Page 8: Integrating Adaptation Mechanisms Using Control Theory ...stephane.mocanu/slides_staars/krikva.pdf · • Web-based N-tier client-server • Objective • “To serve the content

Grenoble, 27.5.2014Integrating Adaptation Mechanisms Using Control Theory Centric Architecture Models

INTEGRATING ADAPTATION MECHANISMS

• Adhoc Implementations • Extensive handcrafting of non-trivial code • Low level of FCL abstraction • Low FCL visibility • Limited verification and reasoning • Giving raise to accidental complexities

• Existing Approaches • Limited support for control theory based controllers • Target specific types of adaptation problems

• Cyber-physical systems [DiaSuite] • Embedded, real-time systems [Ptolemy, Simulink, Sysweaver]

• Require the use of certain adaptation policy • Utility theory [Rainbow]

• Applicable to single domain or technology • Mobile systems [Music] • Java-based applications [StarMX,AMT,AST]

• Do not support remoting or complex control schemes [Rainbow, AMT, AST, Genie, Zanshin]

• Too low-level abstraction [StarMX, AMT, AST] • Too high-level abstraction [Runtime MegaModels, Zanshin] • Limiting their applicability

API

LOGS

CONFIGURATIONS

COMMANDS

AOP

PROFILER

Page 9: Integrating Adaptation Mechanisms Using Control Theory ...stephane.mocanu/slides_staars/krikva.pdf · • Web-based N-tier client-server • Objective • “To serve the content

Grenoble, 27.5.2014Integrating Adaptation Mechanisms Using Control Theory Centric Architecture Models

Derived requirements for integrating self-adaptation into software systems.

Generality

• Domain-agnostic • Technology-agnostic

• Explicit FCLs, their process and interactions • Verification support

Visibility

• Reusable FCL parts across adaptation scenarios

Reusability

• Remote distribution of FCL

Distribution

• Composition • Reflection

Complex control

• Prototyping • Automating

Tooling

REQUIREMENTS

Page 10: Integrating Adaptation Mechanisms Using Control Theory ...stephane.mocanu/slides_staars/krikva.pdf · • Web-based N-tier client-server • Objective • “To serve the content

Grenoble, 27.5.2014Integrating Adaptation Mechanisms Using Control Theory Centric Architecture Models

Controller Target System

Transducer

+ -

� =mX

i=1

1

d=

m

d

⇥(N) = �µ =

md

µ

d =m

�(N)µ

API

LOGS

CONFIGURATIONS

COMMANDS

AOP

PROFILER

Generality Visibility Reusability Distribution Complex control Tooling

APPROACH

Integrating adaptation mechanisms into target systems

using control theory centric architecture models

Monitoring Reconfiguration

Decision Making

sensors effectors

Target System

events actions

measures decisions

Page 11: Integrating Adaptation Mechanisms Using Control Theory ...stephane.mocanu/slides_staars/krikva.pdf · • Web-based N-tier client-server • Objective • “To serve the content

Grenoble, 27.5.2014Integrating Adaptation Mechanisms Using Control Theory Centric Architecture Models

OUTLINE

Feedback Control Definition Language1

Application to ZNN.COM2

Controller Target System

Transducer

+ -

� =mX

i=1

1

d=

m

d

⇥(N) = �µ =

md

µ

d =m

�(N)µ

API

LOGS

CONFIGURATIONS

COMMANDS

AOP

PROFILERMonitoring Reconfiguration

Decision Making

sensors effectors

Target System

events actions

measures decisions

The ACTRESS Modeling Environment3

Page 12: Integrating Adaptation Mechanisms Using Control Theory ...stephane.mocanu/slides_staars/krikva.pdf · • Web-based N-tier client-server • Objective • “To serve the content

Grenoble, 27.5.2014Integrating Adaptation Mechanisms Using Control Theory Centric Architecture Models

1Feedback Control Definition Language

Page 13: Integrating Adaptation Mechanisms Using Control Theory ...stephane.mocanu/slides_staars/krikva.pdf · • Web-based N-tier client-server • Objective • “To serve the content

Grenoble, 27.5.2014Integrating Adaptation Mechanisms Using Control Theory Centric Architecture Models

FEEDBACK CONTROL DEFINITION LANGUAGE

1. Raise the level of abstraction

2. Fine-grained decomposition of FCL elements

3. Explicit interactions

4. Provide reflection and composition capabilities

5. Embed remoting

Monitoring Decision Making Reconfiguration

measures

events

decisions

actions

General Purpose Language (GPL)Generality

Visibility

Reusability

Distribution

Complex control

Page 14: Integrating Adaptation Mechanisms Using Control Theory ...stephane.mocanu/slides_staars/krikva.pdf · • Web-based N-tier client-server • Objective • “To serve the content

Grenoble, 27.5.2014Integrating Adaptation Mechanisms Using Control Theory Centric Architecture Models

1. Raise the level of abstraction 2. Fine-grained decomposition of FCL elements 3. Explicit interactions 4. Provide reflection capabilities 5. Embed remoting

Domain-Specific Modeling

• Feedback Control Loop • Sequence of interconnected processes • Inputs x State -> Output • Reactive • Concurrent • Dynamic

Monitoring Reconfiguration

Decision Making

sensors effectorsevents actions

measures decisions

• The Actor Model • Message passing actor networks • Message x State -> Message(s) • Reactive • Concurrent • Dynamic • Scalable • Remoting through location

transparency

actor

actor

actor

FEEDBACK CONTROL DEFINITION LANGUAGE

Page 15: Integrating Adaptation Mechanisms Using Control Theory ...stephane.mocanu/slides_staars/krikva.pdf · • Web-based N-tier client-server • Objective • “To serve the content

Grenoble, 27.5.2014Integrating Adaptation Mechanisms Using Control Theory Centric Architecture Models

FEEDBACK CONTROL DEFINITION LANGUAGE - IN A NUTSHELL

ControllerApache

Web Server

MEMMCMEM⇤

Apache adaptation example - adjusts the maximum number of connections to be processed simultaneously (MC) based on the difference between reference (MEM*) and measured memory usage (MEM) [Hellerstain’04].

Page 16: Integrating Adaptation Mechanisms Using Control Theory ...stephane.mocanu/slides_staars/krikva.pdf · • Web-based N-tier client-server • Objective • “To serve the content

Grenoble, 27.5.2014Integrating Adaptation Mechanisms Using Control Theory Centric Architecture Models

FEEDBACK CONTROL DEFINITION LANGUAGE - IN A NUTSHELL

ControllerApache

Web Server

MEMMCMEM⇤

mem: SysMem

controller: IController

mcConf: SetApacheConf

out output

in input

out output

scheduler: PeriodTrigger

out output

in input

in input

MEM

MEM

MC

-refMem-kI

ps -o pmem= $(cat /var/run/httpd.pid) /etc/apache2/httpd.conf/etc/init.d/apachectl

Apache adaptation example - adjusts the maximum number of connections to be processed simultaneously (MC) based on the difference between reference (MEM*) and measured memory usage (MEM) [Hellerstain’04].

Page 17: Integrating Adaptation Mechanisms Using Control Theory ...stephane.mocanu/slides_staars/krikva.pdf · • Web-based N-tier client-server • Objective • “To serve the content

Grenoble, 27.5.2014Integrating Adaptation Mechanisms Using Control Theory Centric Architecture Models

FEEDBACK CONTROL DEFINITION LANGUAGE - IN A NUTSHELL

ControllerApache

Web Server

MEMMCMEM⇤

mem: SysMem

controller: IController

mcConf: SetApacheConf

out output

in input

out output

scheduler: PeriodTrigger

out output

in input

in input

MEM

MEM

MC

-refMem-kI

ps -o pmem= $(cat /var/run/httpd.pid) /etc/apache2/httpd.conf/etc/init.d/apachectl

in input

setRefMemrefMem

out output

MEM⇤ MEM⇤

Apache adaptation example - adjusts the maximum number of connections to be processed simultaneously (MC) based on the difference between reference (MEM*) and measured memory usage (MEM) [Hellerstain’04].

Page 18: Integrating Adaptation Mechanisms Using Control Theory ...stephane.mocanu/slides_staars/krikva.pdf · • Web-based N-tier client-server • Objective • “To serve the content

Grenoble, 27.5.2014Integrating Adaptation Mechanisms Using Control Theory Centric Architecture Models

FCDL - MODEL OF COMPUTATION AND INTERACTION CONTRACTS

in input

: Accumulator

out sum

• Activated on input push request • Activated on sum pull request

• Semantics is based on the Ptolemy Push/Pull model of computation • Communication originates at ports • Ports can be in push/pull/agnostic • Ports are statically typed • Multi-ports • Multiple activation methods

Page 19: Integrating Adaptation Mechanisms Using Control Theory ...stephane.mocanu/slides_staars/krikva.pdf · • Web-based N-tier client-server • Objective • “To serve the content

Grenoble, 27.5.2014Integrating Adaptation Mechanisms Using Control Theory Centric Architecture Models

INTERACTION CONTRACTS

in input

: Accumulator

out sumin reset

out output

• Activated on input push request • Activated on reset push request • Activated on input / reset request • Activated on sum pull request • Activated on input push request always pushing data on output • Activated on reset push request always pushing data on output • ....

Page 20: Integrating Adaptation Mechanisms Using Control Theory ...stephane.mocanu/slides_staars/krikva.pdf · • Web-based N-tier client-server • Objective • “To serve the content

Grenoble, 27.5.2014Integrating Adaptation Mechanisms Using Control Theory Centric Architecture Models

INTERACTION CONTRACTS

in input

: Accumulator

out sumin reset

out output

• Describe allowed interactions among components

Visibility

• Originally developed by Cassou et al. for SCC systems • Our extensions • Elements with multiple output ports • Multiple port connections • Composites • Composite interaction contract inference algorithm • Optional contracts • Completion verification algorithm

processor Accumulator { push in port reset: int push in port input: long pull out port sum: long push out port output: long ! act onInput(input; ; output) act onSum(sum; ; ) act onReset(reset; ; ) }

Page 21: Integrating Adaptation Mechanisms Using Control Theory ...stephane.mocanu/slides_staars/krikva.pdf · • Web-based N-tier client-server • Objective • “To serve the content

Grenoble, 27.5.2014Integrating Adaptation Mechanisms Using Control Theory Centric Architecture Models

APPLICATION TO ZNN.COM2

Page 22: Integrating Adaptation Mechanisms Using Control Theory ...stephane.mocanu/slides_staars/krikva.pdf · • Web-based N-tier client-server • Objective • “To serve the content

Grenoble, 27.5.2014Integrating Adaptation Mechanisms Using Control Theory Centric Architecture Models

THE ZNN.COM CASE STUDY

• Originally used for Rainbow evaluation [Cheng’09] • Acknowledged SEAMS case-study • Partially used by others (e.g., DYNAMICO, Zenshin, AdaptCases)

http://www.hpi.uni-potsdam.de/giese/public/selfadapt/exemplars/model-problem-znn-com/

• A news service model • Web-based N-tier client-server • Objective

• “To serve the content within reasonable response time and quality in the event of traffic spikes caused by highly popular news.“

• Challenges • content adaptation (e.g. serving reduced content quality), • service differentiation (e.g. prioritizing premium customers), • infrastructure adaptation (e.g. adapting the size of the server pool)

Page 23: Integrating Adaptation Mechanisms Using Control Theory ...stephane.mocanu/slides_staars/krikva.pdf · • Web-based N-tier client-server • Objective • “To serve the content

Grenoble, 27.5.2014Integrating Adaptation Mechanisms Using Control Theory Centric Architecture Models

Idea: service time = fixed overhead + data-size dependent overhead

Abdelzaher et al., 1999, 2002

QoS management control of web servers by content delivery adaptation

...

serve fromtree #2

serve fromtree #1

Rejection Level

Minimum Content Full Content

Goal: maintain server load around some pre-set value

/1/photo.jpg

/2/photo.jpg

/photo.jpgfull quality

degraded quality

normal load

overload

Prerequisite: preprocessed content (different quality and size)

ZNN.COM - LOCAL CONTENT DELIVERY ADAPTATION

Distribution Complex control

Generality Visibility Reusability

Using FCDL

Page 24: Integrating Adaptation Mechanisms Using Control Theory ...stephane.mocanu/slides_staars/krikva.pdf · • Web-based N-tier client-server • Objective • “To serve the content

Grenoble, 27.5.2014Integrating Adaptation Mechanisms Using Control Theory Centric Architecture Models

Compute severity of adaptation (G)

Compute the requests rate (R), bandwidth (W) and utilization (U)

Compute the number of requests (r) and size of responses (w)12

3

ZNN.COM - LOCAL CONTENT DELIVERY ADAPTATION

Page 25: Integrating Adaptation Mechanisms Using Control Theory ...stephane.mocanu/slides_staars/krikva.pdf · • Web-based N-tier client-server • Objective • “To serve the content

Grenoble, 27.5.2014Integrating Adaptation Mechanisms Using Control Theory Centric Architecture Models

Compute the number of requests (r) and size of responses (w)1

accessLog: FileTailer

out lines

file=/var/log/apache2/access.log

access_log

active sensor FileTailer { push out port lines: String ! property file: String }

processor Accumulator { push in port input: long pull out port sum: long }

processor AccessLogParser { push in port lines: String push out port size: int push out port requests: int }

Generality

Visibility

Reusability

requestCounter: Accumulator

responseSizeCounter: Accumulator

in input

out sum out sum

in lines

out sizeout requests

accessLogParser: AccessLogParser

ZNN.COM - LOCAL CONTENT DELIVERY ADAPTATION

Page 26: Integrating Adaptation Mechanisms Using Control Theory ...stephane.mocanu/slides_staars/krikva.pdf · • Web-based N-tier client-server • Objective • “To serve the content

Grenoble, 27.5.2014Integrating Adaptation Mechanisms Using Control Theory Centric Architecture Models

Generality

Visibility

Reusabilityaccess_log

active processor PeriodTrigger<T> { pull in port input: T push out port output: T ! property initialPeriod = 10.seconds }

requestCounter: Accumulator

responseSizeCounter: Accumulator

scheduler: PeriodTrigger

loadMonitor: LoadMonitor

in input

out sum out sum

in requests in size

out utilization

in input

out output

initialPeriod=10s

accessLog: FileTailer

in lines

out lines

file=/var/log/apache2/access_log

out sizeout requests

accessLogParser: AccessLogParser

Compute the requests rate (R), bandwidth (W) and utilization (U)2ZNN.COM - LOCAL CONTENT DELIVERY ADAPTATION

Page 27: Integrating Adaptation Mechanisms Using Control Theory ...stephane.mocanu/slides_staars/krikva.pdf · • Web-based N-tier client-server • Objective • “To serve the content

Grenoble, 27.5.2014Integrating Adaptation Mechanisms Using Control Theory Centric Architecture Models

Generality

Visibility

Reusability content_treeaccess_log

Compute severity of adaptation (G)3

controller IController { in push port input: double out push port output: double! property KI: double property reference: double property loBnd: double property upBnd: double }

ZNN.COM - LOCAL CONTENT DELIVERY ADAPTATION

utilController: IController

in input

requestCounter: Accumulator

responseSizeCounter: Accumulator

scheduler: PeriodTrigger

loadMonitor: LoadMonitor

in input

out sum out sum

in requests in size

out utilization

in input

out output

in input

out outputinitialPeriod=10s

adaptor: ContentAdaptor

in contentTree

accessLog: FileTailer

in lines

out lines

file=/var/log/apache2/access_log

out sizeout requests

accessLogParser: AccessLogParser

KI=?reference=?

Page 28: Integrating Adaptation Mechanisms Using Control Theory ...stephane.mocanu/slides_staars/krikva.pdf · • Web-based N-tier client-server • Objective • “To serve the content

Grenoble, 27.5.2014Integrating Adaptation Mechanisms Using Control Theory Centric Architecture Models

GeneralityVisibilityReusability

composite ApacheQOS { ! feature accessLog = new FileTailer { file = “/var/log/apache2/access_log” } ! feature accessLogParser = new AccessLogParser feature requestCounter = new Accumulator feature responseSizeCounter = new Accumulator feature loadMonitor = new LoadMonitor feature scheduler = new PeriodTrigger<Double> feature utilController = new IController { reference = 0.8 } feature adaptor = new ContentAdaptor ! connect accessLog.lines to accessLogParser.lines connect accessLogParser.size to responseSizeCounter.input connect accessLogParser.requests to requestsCounter.input connect requestCounter.output to loadMonitor.requests connect responseSizeCounter.output to loadMonitor.size connect loadMonitor.utilization to scheduler.input connect scheduler.output to utilController.utilization connect utilController.contentTree to adaptor.contentTree }

Complete modelZNN.COM - LOCAL CONTENT DELIVERY ADAPTATION

ApacheQOSutilController: IController

in input

requestCounter: Accumulator

responseSizeCounter: Accumulator

scheduler: PeriodTrigger

loadMonitor: LoadMonitor

in input

out sum out sum

in requests in size

out utilization

in input

out output

in input

out output

syst

em

laye

rco

ntro

l la

yer

initialPeriod=10s

adaptor: ContentAdaptor

in contentTree

accessLog: FileTailer

in lines

out lines

file=/var/log/apache2/access_log

out sizeout requests

accessLogParser: AccessLogParser

KI=?reference=?

Page 29: Integrating Adaptation Mechanisms Using Control Theory ...stephane.mocanu/slides_staars/krikva.pdf · • Web-based N-tier client-server • Objective • “To serve the content

Grenoble, 27.5.2014Integrating Adaptation Mechanisms Using Control Theory Centric Architecture Models

Generality

Visibility

Reusability

Hierarchical organization of Adaptive Elements using composites

composite ApacheWebServer { ! property accessLogFile: String feature accessLog = new FileTailer { file = accessLogFile } ! feature accessLogParser = new AccessLogParser feature adaptor = new ContentAdaptor connect accessLog.lines to accessLogParser.lines ! promote accessLogParser.size promote accessLogParser.requests promote adaptor.contentTree !}

ZNN.COM - LOCAL CONTENT DELIVERY ADAPTATION

ApacheQOS utilController: IController

in input

requestCounter: Accumulator

responseSizeCounter: Accumulator

scheduler: PeriodTrigger

loadMonitor: LoadMonitor

in input

out sum out sum

in requests in size

out utilization

in input

out output

in input

out output

out requests

out size

syst

em

laye

rco

ntro

l la

yer

initialPeriod=10s

adaptor: ContentAdaptor

out

size

in contentTree

out size

out

requ

ests

out requests in contentTree

in contentTree

ApacheWebServer

server: ApacheWebServer

accessLog: FileTailer

accessLogParser: AccessLogParser

in lines

out lines

file=/var/log/apache2/access_log

KI=?reference=?

Page 30: Integrating Adaptation Mechanisms Using Control Theory ...stephane.mocanu/slides_staars/krikva.pdf · • Web-based N-tier client-server • Objective • “To serve the content

Grenoble, 27.5.2014Integrating Adaptation Mechanisms Using Control Theory Centric Architecture Models

Generality

Visibility

Reusability

ZNN.COM - LOCAL CONTENT DELIVERY ADAPTATION

ApacheQOS

control: QOSControl

in contentTree

apache: ApacheWebServer

in requests

in size

out requests

out size

out contentTreeco

ntro

l la

yer

syst

em

laye

r

QOSControl utilController: IController

utilization: UtilizationMonitor

out contentTree

scheduler: PeriodTrigger

out utilizationin input out output

in input

out outputin requests in size

in requests in size

Page 31: Integrating Adaptation Mechanisms Using Control Theory ...stephane.mocanu/slides_staars/krikva.pdf · • Web-based N-tier client-server • Objective • “To serve the content

Grenoble, 27.5.2014Integrating Adaptation Mechanisms Using Control Theory Centric Architecture Models

Remote distribution of Adaptive Elements

remote-main remote-apache

network

ApacheQOS

in contentTree

in requests

in size

out requests

out size

out contentTree

Apache.apacheendpoint= akka.tcp://actress@remote-apache/user/Apache/apache

referenced feature

Apache

in contentTree

in requests

in size

out requests

out size

out contentTree

ApacheQOS.control

endpoint=akka.tcp://actress@remote-main/user/ApacheQOS/control

apache: ApacheWebServer

control: QOSControl

composite feature

// deployed at remote-apache composite Apache { feature apache = new ApacheWebServer { ... } feature control = ref ApacheQOS.control @ "akka://remote-main/user/ApacheQOS/control" } !// deployed at host remote-main composite ApacheQOS { feature control = new QOSControl { ... } feature apache = ref Apache.apache @ "akka://remote-apache/user/Apache/apache" // ... }

Distribution

Visibility

ZNN.COM - REMOTE CONTENT DELIVERY ADAPTATION

Page 32: Integrating Adaptation Mechanisms Using Control Theory ...stephane.mocanu/slides_staars/krikva.pdf · • Web-based N-tier client-server • Objective • “To serve the content

Grenoble, 27.5.2014Integrating Adaptation Mechanisms Using Control Theory Centric Architecture Models

ILLUSTRATION - DISTRIBUTED CONTENT DELIVERY ADAPTATION• QoS management control of a pool of web servers using content

delivery adaptation. • Load balancer schedules requests to a server with highest QoS.

Znn.com

Client 1

Client 2

Client N

Forwardsrequests to s

Server cluster

...

Load Balancer

...

S

G1

G2

Gn

s 2 S such that Gs = max (G1, . . . , Gn)

Page 33: Integrating Adaptation Mechanisms Using Control Theory ...stephane.mocanu/slides_staars/krikva.pdf · • Web-based N-tier client-server • Objective • “To serve the content

Grenoble, 27.5.2014Integrating Adaptation Mechanisms Using Control Theory Centric Architecture Models

LocalApacheQOS

out contentTree

contentTreeWithHost: Tuple2

hostname: Hostname

Siout output

out hostname

in input2

in input1

in inputGi

contentTreePub: EventBusPublisher

server: ApacheQOS

(Si, Gi)

scheduler: PeriodTrigger

in input

out output

(Si, Gi)

contentTree: Queue

in input

out output

Gi

out

cont

entT

ree

ApacheQOS

in contentTree

in requests

in size

out requests

out size

out contentTree

server: ApacheWebServer

control: QOSControl

LoadBalancerControlcontentTree: MapStore

ctrl: LoadBalancerController

contentTreeMin: MapMaxKey

lbForwardHost: FileWriter

out output out outputin input

in input

Siout output in value

in hostname

out hostname

8><

>:

S1 : G1...

Sn : Gn

9>=

>;

contentTreeSub: EventBusSubscriber

scheduler: PeriodTrigger

in inputout output

Si Si

(Si, Gi)

Load Balancer

si

Distribution

Visibility

Reusability

ILLUSTRATION - DISTRIBUTED CONTENT DELIVERY ADAPTATION

Page 34: Integrating Adaptation Mechanisms Using Control Theory ...stephane.mocanu/slides_staars/krikva.pdf · • Web-based N-tier client-server • Objective • “To serve the content

Grenoble, 27.5.2014Integrating Adaptation Mechanisms Using Control Theory Centric Architecture Models

Visibility

Reusability

ILLUSTRATION - RESOURCE MANAGEMENT

ServerPoolControlcontentTree: MapStore

serverPoolController: IController

contentTreeAvg: MapAvgValue

clusterManager: ClusterManager

out output out output

n

in input

in input

out output in numOfServers

in input

out output

8><

>:

S1 : G1...

Sn : Gn

9>=

>;

scheduler: PeriodTrigger

in inputout output

(Si, Gi)

G G

contentTreeSub: EventBusSubscriber

Load Balancer…

s1

sn

G1

Gn

n = n+KIE = n+KI(G⇤ �G)

n

Page 35: Integrating Adaptation Mechanisms Using Control Theory ...stephane.mocanu/slides_staars/krikva.pdf · • Web-based N-tier client-server • Objective • “To serve the content

Grenoble, 27.5.2014Integrating Adaptation Mechanisms Using Control Theory Centric Architecture Models

Visibility

Reusability

ZNN.COM - SYSTEM IDENTIFICATION

Generality

SystemIdentification

out output

log: FileWriter

in value

out utilization

in requests

in size scheduler: PeriodTrigger

in input out output

sample: Tuple2

in input2

in input1

contentTree: FileReader

out outputout requests

out size

in contentTree

contentTree: SineWaveserver: ApacheWebServer

(U,G) (U,G)

utilization: UtilizationMonitor

• Support for FCL design - black-box modeling • Open control loops for data collection

Page 36: Integrating Adaptation Mechanisms Using Control Theory ...stephane.mocanu/slides_staars/krikva.pdf · • Web-based N-tier client-server • Objective • “To serve the content

Grenoble, 27.5.2014Integrating Adaptation Mechanisms Using Control Theory Centric Architecture Models

VisibilityReusabilityZNN.COM - ADAPTIVE CONTROL

Generality

• Using the reflection support for adaptive control

AdaptiveApacheQOS

QOSControl

AdaptiveControl

utilizationController: IController

scheduler: PeriodTrigger

out output

in input

out output

setKI

loadMonitor: LoadMonitor

out utilization

in input

sample: Tuple2

in input2

in input1

out utilization

(U,G)

out output

(U,G) in input

scheduler: PeriodTrigger

in inputout output

cont

rol l

ayer

met

a-co

ntro

l la

yer

syst

em la

yer

in contentTree

in requests

in size

out requests

out size

out contentTree

provided in KI

contentTree: Queue

control: QOSControl

out KIin utilization

in contentTree

KI

adaptiveController: AdaptiveController

out

KI

out output

KI

prov

ided

in K

Iou

t co

nten

tTre

e

KI

...

in requests in size

......

out

utiliz

atio

n

in input out output

server: ApacheWebServer

in c

onte

ntTr

eein

utili

zatio

n

adaptiveControl: AdaptiveControl

Page 37: Integrating Adaptation Mechanisms Using Control Theory ...stephane.mocanu/slides_staars/krikva.pdf · • Web-based N-tier client-server • Objective • “To serve the content

Grenoble, 27.5.2014Integrating Adaptation Mechanisms Using Control Theory Centric Architecture Models

The ACTRESS Modeling Environment3

Page 38: Integrating Adaptation Mechanisms Using Control Theory ...stephane.mocanu/slides_staars/krikva.pdf · • Web-based N-tier client-server • Objective • “To serve the content

Grenoble, 27.5.2014Integrating Adaptation Mechanisms Using Control Theory Centric Architecture Models

Modeling

VerificationCode Generation

Tooling

• Reference implementation of FCDL based on Eclipse Modeling Framework • Eclipse IDE-based prototype to facilitate the use of FCDL

THE ACTRESS MODELING ENVIRONMENT

Page 39: Integrating Adaptation Mechanisms Using Control Theory ...stephane.mocanu/slides_staars/krikva.pdf · • Web-based N-tier client-server • Objective • “To serve the content

Grenoble, 27.5.2014Integrating Adaptation Mechanisms Using Control Theory Centric Architecture Models

ACTRESS - MODELING SUPPORT

controller IController { // ... ! // interaction contract act activate(input; ; output) // beginning of Xbase implementation implementation xbase { var U = reference ! // interaction contract act activate { // computes the error val E = reference - input // computes new extend of adaptation U = U + KI * E ! // correct bounds if (G < loBnd) U = loBnd if (G > upBnd) U = upBnd // returns the result U } }

• xFCDL (Extended FCDL) • Textual DSL for authoring FCDL models • Additionally supports

• Modularity • Java interoperability • Implementation specification

using Xbase • Eclipse IDE support

U = U +KIE = U +KI(U⇤ � U)

utilController: IController

in input

out output

Page 40: Integrating Adaptation Mechanisms Using Control Theory ...stephane.mocanu/slides_staars/krikva.pdf · • Web-based N-tier client-server • Objective • “To serve the content

Grenoble, 27.5.2014Integrating Adaptation Mechanisms Using Control Theory Centric Architecture Models

ACTRESS - CODE GENERATION SUPPORT

accessLogParser accessLog adaptor

apache control

requestCounter

responseSizeCounter

loadMonitor

utilization

scheduler utilController

ApacheQOS

ACTRESS Runtime

actor

actor with event listener

compositeactor

containment

messagepassing

Code generator

Model-to-Texttransformation

ACTRESS Domain

Framework

FCDL Model

Executable System

• Xbase compiled to Java • Skeleton implementation

ApacheQOS utilController: IController

in input

requestCounter: Accumulator

responseSizeCounter: Accumulator

scheduler: PeriodTrigger

loadMonitor: LoadMonitor

in input

out sum out sum

in requests in size

out utilization

in input

out output

in input

out output

out requests

out size

initialPeriod=10s

in contentTree

server: ApacheWebServer

KI=?reference=?

Visibility

Page 41: Integrating Adaptation Mechanisms Using Control Theory ...stephane.mocanu/slides_staars/krikva.pdf · • Web-based N-tier client-server • Objective • “To serve the content

Grenoble, 27.5.2014Integrating Adaptation Mechanisms Using Control Theory Centric Architecture Models

ACTRESS - CODE GENERATION SUPPORT - SKELETON IMPLEMENTATION

@SuppressWarnings("all") public class IControllerAct extends AdaptiveElementAct { ! // ... ! protected double activate(final double input) { // TODO: compute and output value for the output port } ! // ... !}

• Prescriptive • Restrictive

Visibility

utilController: IController

in input

out output

Page 42: Integrating Adaptation Mechanisms Using Control Theory ...stephane.mocanu/slides_staars/krikva.pdf · • Web-based N-tier client-server • Objective • “To serve the content

Grenoble, 27.5.2014Integrating Adaptation Mechanisms Using Control Theory Centric Architecture Models

ACTRESS - VERIFICATION SUPPORT • Architecture • Consistency • Determinacy • Completeness

• Interaction contracts verification

@OCL(invDifferentSource="self.ports->select(p | p.name = 'size' || p.name = 'requests') // select ports ->collect(p | p.connections) // select their connects->collect(p | p.parent) // select owning instances->asSet()->size() == 2 // there must be two different ones")processor LoadMonitor {

• User-defined structural constraints • xFCDL OCL annotations

• User temporal constraints • FCDL to PROMELA transformation

• SPIN model checker

⇤ ( accessLogParseractivate ! (⌃ utilControlleractivate))

FCDL Verification

• Model well-formedness • Data-type compatibility • Port connections • Required properties • and others

• Meta-model constraints

Page 43: Integrating Adaptation Mechanisms Using Control Theory ...stephane.mocanu/slides_staars/krikva.pdf · • Web-based N-tier client-server • Objective • “To serve the content

Grenoble, 27.5.2014Integrating Adaptation Mechanisms Using Control Theory Centric Architecture Models

Conclusions4

Page 44: Integrating Adaptation Mechanisms Using Control Theory ...stephane.mocanu/slides_staars/krikva.pdf · • Web-based N-tier client-server • Objective • “To serve the content

Grenoble, 27.5.2014Integrating Adaptation Mechanisms Using Control Theory Centric Architecture Models

ASSESSMENT

Generality Visibility

Reusability• Reused elements across scenarios

• Potentially any self-* property • Abstraction is close to block diagrams from

control theory • Control complex schemes through reflection • FCDL is technology agnostic • xFCDL with Xbase depends on Java • ACTRESS runtime depends on Java

Distribution

Complex control

• First-class support for remote AEs • Library support for event bus

• All case studies use hierarchical control • Eclipse based modeling environment • Model to code synthesis

Tooling

• Explicit FCLs • Explicit AE • Explicit AE interactions • Known concepts such as ports and composites • Higher-level of abstraction using control theory

concepts

• Performance1 • ACTRESS runtime accounts for ~1.5MB • AE accounts for 4 KB • 5000 messages accounts for 5% of CPU utilization

1MacBook Pro 2.53 Ghz Intel i5, 8GB RAM, Java 1.70_17, Akka 2.2.0

Page 45: Integrating Adaptation Mechanisms Using Control Theory ...stephane.mocanu/slides_staars/krikva.pdf · • Web-based N-tier client-server • Objective • “To serve the content

Grenoble, 27.5.2014Integrating Adaptation Mechanisms Using Control Theory Centric Architecture Models

SUMMARY

• Combining self-adaptive software systems with principles of MDE to provide systematic and tooled approach for integrating control mechanisms into software systems. !• A reference implementation and tools facilitating the language use including

modeling, code synthesis and verification support.

Page 46: Integrating Adaptation Mechanisms Using Control Theory ...stephane.mocanu/slides_staars/krikva.pdf · • Web-based N-tier client-server • Objective • “To serve the content

Grenoble, 27.5.2014Integrating Adaptation Mechanisms Using Control Theory Centric Architecture Models

FUTURE WORK

• Address ACTRESS limitations - a new MPS-based implementation •More robust FCDL - support data units, input output assertions • ZNN.COM challenge • From a case study to a benchmark • Easily reusable (docker packaging) • INRIA Lille Non-A team in charge of a new controller • Evaluation agains two base lines • Apache mod_proxy • Amazon elastic load balancer

Page 47: Integrating Adaptation Mechanisms Using Control Theory ...stephane.mocanu/slides_staars/krikva.pdf · • Web-based N-tier client-server • Objective • “To serve the content

Thank you

Filip Křikava [email protected]