82
A Formal Framework for Component Deployment Y. David Liu Scott F. Smith Johns Hopkins University OOPSLA'06, Portland, Oregon

A Formal Framework for Component Deployment

  • Upload
    others

  • View
    5

  • Download
    0

Embed Size (px)

Citation preview

Page 1: A Formal Framework for Component Deployment

A Formal Framework for

Component Deployment

Y. David Liu

Scott F. SmithJohns Hopkins University

OOPSLA'06, Portland, Oregon

Page 2: A Formal Framework for Component Deployment

A Menagerie of Deployment Systems

OSGi

InstallShield

EJB Manifests

Bazaar

RubyGems

CPANCTAN

CORBA D&C

Portage

Dpkg

RPM

JSR 277

CLI Assemblies

Page 3: A Formal Framework for Component Deployment

Foundations?

OSGi

InstallShield

EJB Manifests

Bazaar

RubyGems

CPANCTAN

CORBA D&C

Portage

Dpkg

RPM

JSR 277

CLI Assemblies

?

Page 4: A Formal Framework for Component Deployment

An Analogy: Programming Languages

Java

Pascal

C++

C#

C

MLHaskel

Scheme

Scala

Perl

Lisp

Smalltalk

Fortran

Page 5: A Formal Framework for Component Deployment

An Analogy: Foundations of Languages

Java

Pascal

C++

C#

C

MLHaskel

Scheme

Scala

Perl

Lisp

Smalltalk

Fortran

λ CalculusObject Calculi

etc.

Page 6: A Formal Framework for Component Deployment

This Work

OSGi

InstallShield

EJB Manifests

Bazaar

RubyGems

CPANCTAN

CORBA D&C

Portage

Dpkg

RPM

JSR 277

CLI Assemblies

Application Buildbox

Page 7: A Formal Framework for Component Deployment

This Work

An abstract, platform-independent, vendor-independent study of component deployment

● Designing components as deployment units● Formalizing the entire deployment lifecycle● Proving deployment invariants

Design objectives: simple (capturing recurring themes) and expressive

Page 8: A Formal Framework for Component Deployment

This Work

An abstract, platform-independent, vendor-independent study of component deployment

● Designing components as deployment units● Formalizing the entire deployment lifecycle● Proving deployment invariants

Design objectives: simple (capturing recurring themes) and expressive

Page 9: A Formal Framework for Component Deployment

This Work

An abstract, platform-independent, vendor-independent study of component deployment

● Designing components as deployment units● Formalizing the entire deployment lifecycle● Proving deployment invariants

Design objectives: simple (capturing recurring themes) and expressive

Page 10: A Formal Framework for Component Deployment

NetLib

1690

NetLib

5429

Browser

5233

BrowserNetLib

1690 5233

NetLib

5429

Browser

NetLib

1690

5233

NetLib

5429

Browser

5233

NetLib

5429

Browser

5233

NetLib

5429

Flash

3265

Browser

5233

NetLib

5429

Flash

3265

Browser

5233

NetLib

5429Flash

3265

Flash

4423

install

update

remove

execute

hot deploy

hot update

Page 11: A Formal Framework for Component Deployment

NetLib

1690

Browser

Browser

5233

NetLib

5429

Browser

5233

NetLib

5429

Browser

5233

build ship

execute(testing)

Page 12: A Formal Framework for Component Deployment

This Work

An abstract, platform-independent, vendor-independent study of component deployment

● Designing components as deployment units● Formalizing the entire deployment lifecycle● Proving deployment invariants

● Deployment ''never goes wrong''● Version compatibility

Design objectives: simple (capturing recurring themes) and expressive

Page 13: A Formal Framework for Component Deployment

This Work

An abstract, platform-independent, vendor-independent study of component deployment

● Designing components as deployment units● Formalizing the entire deployment lifecycle● Proving deployment invariants

Design objectives: simple (capturing recurring themes) and expressive

Page 14: A Formal Framework for Component Deployment

Why Foundations?

● Fosters next-generation deployment systems– Elucidates subtle issues– More features proposed from academic

research community– Deployment systems with provably

correct properties● Complements modularity research

– when and where of linking

Page 15: A Formal Framework for Component Deployment

Why Foundations?

● Fosters next-generation deployment systems– Elucidates subtle issues– More features proposed from academic

research community– Deployment systems with provably

correct properties● Complements modularity research

– when and where of linking

Page 16: A Formal Framework for Component Deployment

Basics

Page 17: A Formal Framework for Component Deployment

Application Buildbox

BrowserNetLib

1690 5233

NetLib

5429

An imaginary box where an application ''hatches'' throughout the deployment lifecycle

Page 18: A Formal Framework for Component Deployment

Deployment Unit: Assemblage

Browser

Net Plugins

send

timeout

readfile

start

● Real-world analogues: JAR, C .so library, DLL, CLI Assembly

● Assemblages were first developed in [Liu and Smith, ECOOP'04], but without deployment

5233

Page 19: A Formal Framework for Component Deployment

Version Identifiers

Browser

Net Plugins

send

timeout

readfile

start

● Globally Unique● Real-world analogues: COM+ GUID, CLI Assembly

strong names

5233

Page 20: A Formal Framework for Component Deployment

Side-by-Side Deployment

BrowserNetLib

1690 5233

NetLib

5429

Two versions of the NetLib are deployed in the same buildbox

Page 21: A Formal Framework for Component Deployment

Basic Construct: Assemblage Interfaces

Browser

Net Plugins

send

timeout

readfile

start

Real-world analogues: Manifest files, Deployment Descriptors

5233

Page 22: A Formal Framework for Component Deployment

Two Kinds of Assemblage Interfaces

Browser

Net Plugins

send

timeout

readfile

start

Mixers: regular dependency Pluggers: hot deployment dependency

5233

Page 23: A Formal Framework for Component Deployment

Interfaces are Bi-directional: Imports, Exports

Browser

Net Plugins

send

timeout

readfile

start

5233

Page 24: A Formal Framework for Component Deployment

Multiple Interfaces

readfile

start

Net Plugins

send

timeout

5233

Browser

GUI

initGraphics draw

● Name management is crucial for deployment.

● Avoid global name clashes

Page 25: A Formal Framework for Component Deployment

Interface: Unit of Versioning Dependencies

Net Plugins5233

Browser

GUIinitGraphics draw

GUILib

0872

initGraphics draw

Page 26: A Formal Framework for Component Deployment

What is NOT Possible...

Net Plugins5233

Browser

GUIinitGraphics draw

GUILib

5422

initGraphics draw

GUILib

0872

initGraphics draw

Page 27: A Formal Framework for Component Deployment

Assemblages in Shipped Form

Browser

Net Plugins

send

timeout

readfile

start

Net -> NetLib.1690.Socket

version constraint

5233

Page 28: A Formal Framework for Component Deployment

Component Wiring: Mixing

BrowserNetLib

1690 5233

Net -> NetLib.1690.Socket

Net PluginsSocket

send

timeout

● Between a pair of mixers● Matching of functionalities● Matching of version constraints

Page 29: A Formal Framework for Component Deployment

Component Wiring: Plugging

FlashBrowser

5233 3265

Main -> Browser.5233.Plugins

MainPlugins

readFile

start

● Wiring at hot deployment time● Between a plugger and a mixer● Matching of functionalities● Matching of version constraints

Page 30: A Formal Framework for Component Deployment

Compatibility Set

BrowserNetLib

1690 5233

Net -> NetLib.1690.Socket

Net PluginsSocket

● Subversioning: a partial order● We do not hardcode the strategy on how two versions

are semantically compatible

3370 < : 1690

Page 31: A Formal Framework for Component Deployment

Act 2:

Component Deployment Lifecycle

Page 32: A Formal Framework for Component Deployment

NetLib

1690

NetLib

5429

Browser

5233

BrowserNetLib

1690 5233

NetLib

5429

Browser

NetLib

1690

5233

NetLib

5429

Browser

5233

NetLib

5429

Browser

5233

NetLib

5429

Flash

3265

Browser

5233

NetLib

5429

Flash

3265

Browser

5233

NetLib

5429Flash

3265

Flash

4423

install

update

remove

execute

hot deploy

hot update

Deployment SiteTransitions

Page 33: A Formal Framework for Component Deployment

NetLib

1690

NetLib

5429

Browser

5233

BrowserNetLib

1690 5233

NetLib

5429

Browser

NetLib

1690

5233

NetLib

5429

Browser

5233

NetLib

5429

Browser

5233

NetLib

5429

Flash

3265

Browser

5233

NetLib

5429

Flash

3265

Browser

5233

NetLib

5429Flash

3265

Flash

4423

install

update

remove

execute

hot deploy

hot update

Page 34: A Formal Framework for Component Deployment

NetLib

1690

NetLib

5429

Browser

5233

BrowserNetLib

1690 5233

NetLib

5429

Browser

NetLib

1690

5233

NetLib

5429

Browser

5233

NetLib

5429

Browser

5233

NetLib

5429

Flash

3265

Browser

5233

NetLib

5429

Flash

3265

Browser

5233

NetLib

5429Flash

3265

Flash

4423

install

update

remove

execute

hot deploy

hot update

Page 35: A Formal Framework for Component Deployment

NetLib

1690

NetLib

5429

Browser

5233

BrowserNetLib

1690 5233

NetLib

5429

Browser

NetLib

1690

5233

NetLib

5429

Browser

5233

NetLib

5429

Browser

5233

NetLib

5429

Flash

3265

Browser

5233

NetLib

5429

Flash

3265

Browser

5233

NetLib

5429Flash

3265

Flash

4423

install

update

remove

execute

hot deploy

hot update

Page 36: A Formal Framework for Component Deployment

NetLib

1690

NetLib

5429

Browser

5233

BrowserNetLib

1690 5233

NetLib

5429

Browser

NetLib

1690

5233

NetLib

5429

Browser

5233

NetLib

5429

Browser

5233

NetLib

5429

Flash

3265

Browser

5233

NetLib

5429

Flash

3265

Browser

5233

NetLib

5429Flash

3265

Flash

4423

install

update

remove

execute

hot deploy

hot update

Page 37: A Formal Framework for Component Deployment

NetLib

1690

NetLib

5429

Browser

5233

BrowserNetLib

1690 5233

NetLib

5429

Browser

NetLib

1690

5233

NetLib

5429

Browser

5233

NetLib

5429

Browser

5233

NetLib

5429

Flash

3265

Browser

5233

NetLib

5429

Flash

3265

Browser

5233

NetLib

5429Flash

3265

Flash

4423

install

update

remove

execute

hot deploy

hot update

Page 38: A Formal Framework for Component Deployment

NetLib

1690

NetLib

5429

Browser

5233

BrowserNetLib

1690 5233

NetLib

5429

Browser

NetLib

1690

5233

NetLib

5429

Browser

5233

NetLib

5429

Browser

5233

NetLib

5429

Flash

3265

Browser

5233

NetLib

5429

Flash

3265

Browser

5233

NetLib

5429Flash

3265

Flash

4423

install

update

remove

execute

hot deploy

hot update

Page 39: A Formal Framework for Component Deployment

NetLib

1690

Browser

Browser

5233

NetLib

5429

Browser

5233

NetLib

5429

Browser

5233

build ship

execute(testing)

Development SiteTransitions

Page 40: A Formal Framework for Component Deployment

NetLib

1690

Browser

Browser

5233

NetLib

5429

Browser

5233

build ship

execute(testing)

Browser

5233

NetLib

5429

Page 41: A Formal Framework for Component Deployment

NetLib

1690

Browser

Browser

5233

NetLib

5429

Browser

5233

NetLib

5429

Browser

5233

build ship

execute(testing)

Page 42: A Formal Framework for Component Deployment

NetLib

1690

Browser

Browser

5233

NetLib

5429

Browser

5233

NetLib

5429

Browser

5233

build ship

execute(testing)

Page 43: A Formal Framework for Component Deployment

Formalism Choice

● Labelled Transition System (LTS) for deployment operations– Each transition step is an application buildbox

evolution step– Labels are ''commands'' which deployment

system users can trigger● Run-time behaviors captured via a minimalistic

programming language

Page 44: A Formal Framework for Component Deployment

BrowserNetLib

Socket Net Plugins

Shipping a Component

ship (Browser, 5233, {Net} )

1690 5233

Page 45: A Formal Framework for Component Deployment

BrowserNetLib

Socket Net Plugins

Shipping a Component

ship (Browser, 5233, {Net} )

1690 5233

Browser

Net Plugins5233

Shipped Assemblage

Net -> NetLib.1690.Socket

Page 46: A Formal Framework for Component Deployment

Why Not Always Ship the Entire Closure?

BrowserNetLib

Socket Net Plugins1690 5233

Page 47: A Formal Framework for Component Deployment

BrowserNetLib

Socket Net Plugins1690 5233

● Components are independently deployable units!● Off-the-shelf commercial components, libraries● Updates, patches

● Sometimes not realistic, such as native code

Why Not Always Ship the Entire Closure?

Page 48: A Formal Framework for Component Deployment

NetLib

Socket

Installing a Component

install (shippedbrowser)

3370

Browser

Net Plugins5233

shippedbrowser

Net -> NetLib.1690.Socket3370 < : 1690

Page 49: A Formal Framework for Component Deployment

BrowserNetLib

Socket Net Plugins

Installing a Component

3370 5233

Net -> NetLib.1690.Socket

3370 < : 1690

install (shippedbrowser)

Page 50: A Formal Framework for Component Deployment

Cyclic Dependencies

Example: System.dll and System.xml.dll in .NET

B

Q 0088

shippedB

Q -> A.7421.P

A

P 7421

shippedA

P -> B.0088.Q

Page 51: A Formal Framework for Component Deployment

Cyclic Dependencies

B

Q 0088

shippedB

Q -> A.7421.P

A

P7421

shippedA

P -> B.0088.Q

install (shippedA)

Page 52: A Formal Framework for Component Deployment

Cyclic Dependencies

B

Q 0088

shippedB

Q -> A.7421.P

7421

P -> B.0088.Q

install (shippedA)

A

P

Page 53: A Formal Framework for Component Deployment

Cyclic Dependencies

B

Q 0088

shippedB

Q -> A.7421.P

7421

P -> B.0088.Q

install (shippedB)

A

P

Page 54: A Formal Framework for Component Deployment

Cyclic Dependencies

B

Q 0088

Q -> A.7421.P

7421

P -> B.0088.Q

install (shippedB)

A

P

Page 55: A Formal Framework for Component Deployment

BrowserNetLib

Socket Net Plugins

Updating a Component

7622 5233

Net -> NetLib.1690.Socket

NetLib

Socket9985

9985 <: 1690, 7622 <: 1690

update (NetLib, 7622, 9985)

Page 56: A Formal Framework for Component Deployment

BrowserNetLib

Socket Net Plugins

Updating a Component

7622 5233

Net -> NetLib.1690.Socket

NetLib

Socket9985

9985 <: 1690, 7622 <: 1690

update (NetLib, 7622, 9985)

Page 57: A Formal Framework for Component Deployment

BrowserNetLib

Socket Net Plugins

Updating a Component

7622 5233

Net -> NetLib.1690.Socket

NetLib

Socket9985

9985 <: 1690, 7622 <: 1690

an update is not necessarily an upgrade

Page 58: A Formal Framework for Component Deployment

BrowserNetLib

Socket Net Plugins

Hot Deployment

send

timeout

readfile

start

7622 5233

Flash

Main3265

flash

Main -> Browser.5233.Plugins

h = plugin flash with Plugins >> Main;

Running application

Page 59: A Formal Framework for Component Deployment

BrowserNetLib

Socket Net Plugins

Hot Deployment

send

timeout

readfile

start

7622 5233

Flash

Main3265

h = plugin flash with Plugins >> Main;

Running application

Page 60: A Formal Framework for Component Deployment

BrowserNetLib

Socket Net Plugins

Hot Deployment

send

timeout

readfile

start

7622 5233

Flash

Main3265

h = plugin flash with Plugins >> Main;h..start();

Running application

Page 61: A Formal Framework for Component Deployment

BrowserNetLib

Socket Net Plugins

send

timeout

readfile

start

7622 5233

Flash

Main3265

h1 = plugin flash1 with Plugins >> Main;...h2 = plugin flash2 with Plugins >> Main;

Flash

Main3211

Multiple Plugins: Hot Update

Page 62: A Formal Framework for Component Deployment

Act 3:

Invariants, Invariants!

Page 63: A Formal Framework for Component Deployment

Theorems: Buildbox Well-formedness

● Theorem: no deployment operations can turn a well-formed buildbox into a non-well-formed one.

● Theorem: no reductions at run time can turn a well-formed buildbox into a non-well-formed one.

Page 64: A Formal Framework for Component Deployment

NetLib

1690

NetLib

5429

Browser

5233

BrowserNetLib

1690 5233

NetLib

5429

Browser

NetLib

1690

5233

NetLib

5429

Browser

5233

NetLib

5429

Browser

5233

NetLib

5429

Flash

3265

Browser

5233

NetLib

5429

Flash

3265

Browser

5233

NetLib

5429Flash

3265

Flash

4423

install

update

remove

execute

hot deploy

hot update

Page 65: A Formal Framework for Component Deployment

NetLib

1690

Browser

Browser

5233

NetLib

5429

Browser

5233

NetLib

5429

Browser

5233

build ship

execute(testing)

Page 66: A Formal Framework for Component Deployment

Specifying Version Compatibility

How do a deployment-site run and a pre-shipping test-run correspond?

Page 67: A Formal Framework for Component Deployment

Suppose we have a component X...

P

m

locating method m imported/exported from P

...int z = P::m(3);...

2700

n

method n

X

Page 68: A Formal Framework for Component Deployment

On The Development Site

X

2700Pm

Page 69: A Formal Framework for Component Deployment

On The Development Site

execute(testing)

X

2700Pm

X

2700Pm

Page 70: A Formal Framework for Component Deployment

On The Development Site

execute(testing)

X

2700Pm

X

2700Pm

at run timeP::m is bound to assemblage Y version v

Page 71: A Formal Framework for Component Deployment

On The Development Site

at run timeP::m is bound to assemblage Y version v

ship (X, 2700, {P})

Xexecute(testing)

X

2700Pm

X

2700Pm

2700Pm

Page 72: A Formal Framework for Component Deployment

On Any Deployment Site

X

2700Pm

install

Page 73: A Formal Framework for Component Deployment

On Any Deployment Site

X

2700Pm

install

2700

mP

X

Page 74: A Formal Framework for Component Deployment

On Any Deployment Site

X

2700Pm

install

2700

mP

X

..

2700

mP

X

anyLTS steps

Page 75: A Formal Framework for Component Deployment

On Any Deployment Site

X

2700Pm

install

2700

mP

X

..

2700

mP

X

any LTS steps

execute

2700

mP

X

Page 76: A Formal Framework for Component Deployment

On Any Deployment Site

X

2700Pm

install

2700

mP

X

..

2700

mP

X

any LTS steps

execute

2700

mP

X

at run timeP::m is bound to assemblage Y' version v'

Page 77: A Formal Framework for Component Deployment

● Y = Y'● v = v' or v' is a subversion of v

Theorem on Version Compatibility

Page 78: A Formal Framework for Component Deployment

Future Work

● Keep the platform-independent spirit, with more expressiveness gains– security in deployment– distributed deployment (e.g. sensor network

applications)● A closer look at Java deployment

– an effort to map back to the real world

Page 79: A Formal Framework for Component Deployment

Related Work

● Many real-world systems● Formal treatment is rare

– [Buckley, CD'05]: formalized name-binding of CLI Assemblies

● platform-specific● no modeling of deployment lifecycle● no invariant properties proved

Page 80: A Formal Framework for Component Deployment

Related Work: Real-world Systems

OSGi

InstallShield

EJB Manifests

Bazaar

RubyGems

CPANCTAN

CORBA D&C

Portage

Dpkg

RPM

JSR 277

CLI Assemblies

Application Buildbox

Page 81: A Formal Framework for Component Deployment

Related Work

● Many real-world systems● Formal treatment is rare

– [Buckley, CD'05]: formalized name-binding of CLI Assemblies

● platform-specific● no modeling of deployment lifecycle● no invariant properties proved

Page 82: A Formal Framework for Component Deployment

A Retrospective

● For deployment systems designers:– platform-independent communication– foster next-generation deployment systems

● For deployment system users:– tools with well-defined user interfaces– tools with provably correct properties

● For module system researchers:– a foundational study of when and where of

linking