43
Beanbag: Operation-based Synchronization with Intra- Relation Support Yingfei Xiong Ph.D. Student University of Tokyo

Beanbag: Operation-based Synchronization with Intra-Relation Support Yingfei Xiong Ph.D. Student University of Tokyo

Embed Size (px)

Citation preview

Page 1: Beanbag: Operation-based Synchronization with Intra-Relation Support Yingfei Xiong Ph.D. Student University of Tokyo

Beanbag: Operation-based Synchronization with Intra-Relation Support

Yingfei XiongPh.D. Student

University of Tokyo

Page 2: Beanbag: Operation-based Synchronization with Intra-Relation Support Yingfei Xiong Ph.D. Student University of Tokyo

Example: An EJB Modeling Application(Enterprise JavaBeans)

Page 3: Beanbag: Operation-based Synchronization with Intra-Relation Support Yingfei Xiong Ph.D. Student University of Tokyo

Inter-Relations on Data

Equal

Equal

Page 4: Beanbag: Operation-based Synchronization with Intra-Relation Support Yingfei Xiong Ph.D. Student University of Tokyo

Inter-Relations on Data

User

User

Page 5: Beanbag: Operation-based Synchronization with Intra-Relation Support Yingfei Xiong Ph.D. Student University of Tokyo

Intra-relations on data

Dependent Equal

Page 6: Beanbag: Operation-based Synchronization with Intra-Relation Support Yingfei Xiong Ph.D. Student University of Tokyo

Intra-relations on data

SignModule

SignModule

Page 7: Beanbag: Operation-based Synchronization with Intra-Relation Support Yingfei Xiong Ph.D. Student University of Tokyo

Intra-relation and bidirectional transformation

A X

Y

Related

Containtment

bidirectional transformation

MOF

B Related

How many roundtrips are needed is unknown.

Page 8: Beanbag: Operation-based Synchronization with Intra-Relation Support Yingfei Xiong Ph.D. Student University of Tokyo

Intra-Relations Call for Operation-based Synchronization

SignOn

SignModule?

Page 9: Beanbag: Operation-based Synchronization with Intra-Relation Support Yingfei Xiong Ph.D. Student University of Tokyo

Intra-Relations Call for Operation-based Synchronization

SignModule

Page 10: Beanbag: Operation-based Synchronization with Intra-Relation Support Yingfei Xiong Ph.D. Student University of Tokyo

Intra-Relations Have Mutual Effect with Inter-Relations

Page 11: Beanbag: Operation-based Synchronization with Intra-Relation Support Yingfei Xiong Ph.D. Student University of Tokyo

Intra-Relations Has Mutual Effect with Inter-Relations

SignModule

SignModule

SignModule

Page 12: Beanbag: Operation-based Synchronization with Intra-Relation Support Yingfei Xiong Ph.D. Student University of Tokyo

Intra-Relations Has Mutual Effect with Inter-Relations

Equal

Equal

Equal

Page 13: Beanbag: Operation-based Synchronization with Intra-Relation Support Yingfei Xiong Ph.D. Student University of Tokyo

Intra-Relations often Lead to Multiple Choices

Page 14: Beanbag: Operation-based Synchronization with Intra-Relation Support Yingfei Xiong Ph.D. Student University of Tokyo

Intra-Relations often Lead to Multiple Choices

Page 15: Beanbag: Operation-based Synchronization with Intra-Relation Support Yingfei Xiong Ph.D. Student University of Tokyo

Intra-Relations often Lead to Multiple Choices

Page 16: Beanbag: Operation-based Synchronization with Intra-Relation Support Yingfei Xiong Ph.D. Student University of Tokyo

Intra-Relations often Lead to Multiple Choices

false

Page 17: Beanbag: Operation-based Synchronization with Intra-Relation Support Yingfei Xiong Ph.D. Student University of Tokyo

Our Contribution: Beanbag

• Beanbag(お手玉,沙包 ) is also a traditional Asian game for keeping several beanbags consistent

The picture is obtained from www.city.kodaira.tokyo.jp

• Beanbag is a new language for operation-based synchronization with intra-relations.

Page 18: Beanbag: Operation-based Synchronization with Intra-Relation Support Yingfei Xiong Ph.D. Student University of Tokyo

An Overview of Beanbag

Application Data

Synchronizer

Updates

Updates

Users

------------------------------------------------

Beanbag Program

Compile

Page 19: Beanbag: Operation-based Synchronization with Intra-Relation Support Yingfei Xiong Ph.D. Student University of Tokyo

Features of Beanbag

Application Data

Synchronizer

Updates

Updates

Users

------------------------------------------------

Beanbag Program

Compile

Intra-relations and inter-relations are captured in a

unified way

Allow fine control over synchronization behavior

Operation-based Synchronization with no propagation direction

imposed

Page 20: Beanbag: Operation-based Synchronization with Intra-Relation Support Yingfei Xiong Ph.D. Student University of Tokyo

Beanbag Program for the EJBmain(ejbs, modules, entitybeans) { containmentRefs<attr="Module">(ejbs, modules); for [ejb, entitybean] in [ejbs, entitybeans] { persistent(ejb, entitybean, modules) | nonPersistent(ejb, entitybean) | {ejb = null; entitybean = null} }}

Page 21: Beanbag: Operation-based Synchronization with Intra-Relation Support Yingfei Xiong Ph.D. Student University of Tokyo

Beanbag Program for the EJB persistent(ejb, entitybean, modules) { var moduleRef, moduleName, module; ejb."Persistent" = true; entitybean."EJBName" = ejb."Name"; moduleRef = ejb."Module"; !modules.moduleRef = module; entitybean."ModuleName" = module.”Name”;}nonPersistent(ejb, entitybean){ ejb."Persistent" = false; entitybean = null;}

Page 22: Beanbag: Operation-based Synchronization with Intra-Relation Support Yingfei Xiong Ph.D. Student University of Tokyo

Describing Updates

1

2

3

4 5

6

Assign a unique id for each object

Page 23: Beanbag: Operation-based Synchronization with Intra-Relation Support Yingfei Xiong Ph.D. Student University of Tokyo

Describing Updates

1

3

4 5

6

Describing attribute modification

User

2

ejbs: {2->{“Name”->!”User”}}modules: voidentityBeans: void

Page 24: Beanbag: Operation-based Synchronization with Intra-Relation Support Yingfei Xiong Ph.D. Student University of Tokyo

Describing Updates

1

3

4 5

6

Describing deletion

2

ejbs: voidmodules: {4->!null}entityBeans: void

Page 25: Beanbag: Operation-based Synchronization with Intra-Relation Support Yingfei Xiong Ph.D. Student University of Tokyo

Describing Updates

1

3

4 5

6

Describing Insertion

2

AccessRight : EJBPersistent = true

7

ejbs: {7->{“Name”->!”AccessRight”,“Persistent”->!true}}modules: voidentityBeans: void

Page 26: Beanbag: Operation-based Synchronization with Intra-Relation Support Yingfei Xiong Ph.D. Student University of Tokyo

An Update Propagation of EJB Tool

User Synchronizer

ejbs: {2->{“Name”->!”User”}}modules: voidentityBeans: void

ejbs: {2->{“Name”->!”User”}}modules: voidentityBeans: {5->{“Name”->!”User”}}

------------------------------------------------

EJB Program

CompileUser

1

3

4

2

5

6

Page 27: Beanbag: Operation-based Synchronization with Intra-Relation Support Yingfei Xiong Ph.D. Student University of Tokyo

Properties of Synchronization

• Adapted from our previous work on state-based synchronization [Xiong07]:– Stability– Preservation– Consistency

• Can be used in bidirectional situation and multidirectional situation

• sync : Updaten -> Updaten

Page 28: Beanbag: Operation-based Synchronization with Intra-Relation Support Yingfei Xiong Ph.D. Student University of Tokyo

Stability• sync(void,…,void)=(void,…,void)• If there is no update, the synchronizer produce no

update.

Page 29: Beanbag: Operation-based Synchronization with Intra-Relation Support Yingfei Xiong Ph.D. Student University of Tokyo

Preservation• sync(u1…un)=(u’1,…,u’n)=> i. u∀ i u’⊑ i

• We cannot overwrite user updates

PersonEJB

UserEJB

Page 30: Beanbag: Operation-based Synchronization with Intra-Relation Support Yingfei Xiong Ph.D. Student University of Tokyo

Consistency (Propagation)• sync(u1…un)=(u’1,…,u’n)=>consistent(u’1(d1), …,u’n(dn))• After updating, the data should satisfy the consistency relation

PersonEJB

PersonEJB

PersonEJB

PersonEJB

Equal

Page 31: Beanbag: Operation-based Synchronization with Intra-Relation Support Yingfei Xiong Ph.D. Student University of Tokyo

Review: Multiple Choices

Page 32: Beanbag: Operation-based Synchronization with Intra-Relation Support Yingfei Xiong Ph.D. Student University of Tokyo

Review: Multiple Choices

false

Page 33: Beanbag: Operation-based Synchronization with Intra-Relation Support Yingfei Xiong Ph.D. Student University of Tokyo

Beanbag Program for the EJBmain(ejbs, modules, entitybeans) { containmentRefs<attr="Module">(ejbs, modules); for [ejb, entitybean] in [ejbs, entitybeans] { persistent(ejb, entitybean, modules) | nonPersistent(ejb, entitybean) | {ejb = null; entitybean = null} }}

main(ejbs, modules, entitybeans) { containmentRefs<attr="Module">(ejbs, modules); for [ejb, entitybean] in [ejbs, entitybeans] { persistent(ejb, entitybean, modules) | {ejb = null; entitybean = null} | nonPersistent(ejb, entitybean) }}

Page 34: Beanbag: Operation-based Synchronization with Intra-Relation Support Yingfei Xiong Ph.D. Student University of Tokyo

How we compile a Beanbag program

Consider an example:{ var c; c=a.”Name”; c=b.”Name”;}

Basic relations (like a=b, a.”name”=b) Primitive synchronizers

Gluing constructs (like conjunction “;”)

gluing their inner synchronizers into a bigger synchronizer

Page 35: Beanbag: Operation-based Synchronization with Intra-Relation Support Yingfei Xiong Ph.D. Student University of Tokyo

c=a.“Name”

c=a.“Name”

a: {“Persistent”->!true}c: !”X”

a: {“Persistent”->!true, “Name”->!”X”}c: !”X”

Page 36: Beanbag: Operation-based Synchronization with Intra-Relation Support Yingfei Xiong Ph.D. Student University of Tokyo

c=a.“Name”

c=a.“Name”

a: {“Name”->!”Y”}c: !”X”

Failure!

Page 37: Beanbag: Operation-based Synchronization with Intra-Relation Support Yingfei Xiong Ph.D. Student University of Tokyo

Conjunction

{var c; c=a.”name”; c=b.”name”}

a: voidb: {“name”->!”x”}

a: {“name”->!”x”}b: {“name”->!”x”}

c=b.”name”

b: {“name”->!”x”}c: void

b: {“name”->!”x”}c: !”x”

c=a.”name”

a: voidc: !x

a: {“name”->!”x”}c: !”x”

Page 38: Beanbag: Operation-based Synchronization with Intra-Relation Support Yingfei Xiong Ph.D. Student University of Tokyo

Disjunction

{a=“x” | a=“y”}

a: !”y”

a: !”y”

a=“x”

a: !”y”

Failure!

a=“y”

a: !”y”

a: !”y”

Page 39: Beanbag: Operation-based Synchronization with Intra-Relation Support Yingfei Xiong Ph.D. Student University of Tokyo

The “for” Statement

for [a, b] in [dictA, dictB] {a = b}

dictA: {1->!”x”}dictB: {2->!”y”}

dictA: {1->!”x”, 2->!”y”}dictB: {1->!”x”, 2->!”y”}

a=b

a: !”x”b: void

a: !”x”b: !”x”

a=b

a: voidb: !”y”

a: !”y”b: !”y”

for key 1 for key 2

Page 40: Beanbag: Operation-based Synchronization with Intra-Relation Support Yingfei Xiong Ph.D. Student University of Tokyo

Implementation

• We have implemented Beanbag in Java

• We have appliedBeanbag to two case studies

• The implementation is published under MIT license

URL: http://www.ipl.t.u-tokyo.ac.jp/~xiong/beanbag.html

Page 41: Beanbag: Operation-based Synchronization with Intra-Relation Support Yingfei Xiong Ph.D. Student University of Tokyo

Experiments

Beanbag vs medini QVT

500 1000 1500 2000 2500 30000

500

1000

1500

2000

2500

3000

Number of EJB Objects

Tim

e(m

s)

Beanbag attribute changeBeanbag deletion

Beanbag insertion

QVT insertionQVT deletion

QVT attribute change

Page 42: Beanbag: Operation-based Synchronization with Intra-Relation Support Yingfei Xiong Ph.D. Student University of Tokyo

Conclusion

• We propose a new language, Beanbag, to support synchronization with intra-relations

• Beanbag captures inter-relations and intra-relations in a unified way

• Beanbag supports operation-based synchronization with no propagation direction imposed

• Beanbag allows fine control over synchronization behavior

Page 43: Beanbag: Operation-based Synchronization with Intra-Relation Support Yingfei Xiong Ph.D. Student University of Tokyo

Thank you for your attention!