Models and Languages for Service-Oriented and Cloud Computing - - PowerPoint PPT Presentation

models and languages for service oriented and
SMART_READER_LITE
LIVE PREVIEW

Models and Languages for Service-Oriented and Cloud Computing - - PowerPoint PPT Presentation

Models and Languages for Service-Oriented and Cloud Computing University of Bologna Gianluigi Zavattaro DISI - Department of Computer Science and Engineering INRIA research team FOCUS BISS 2016 Bertinoro 7-11 March 2016 A brief


slide-1
SLIDE 1

Gianluigi Zavattaro University of Bologna DISI - Department of Computer Science and Engineering INRIA research team FOCUS

Models and Languages for Service-Oriented and Cloud Computing

BISS 2016 – Bertinoro – 7-11 March 2016

slide-2
SLIDE 2

A brief introduction …

u Associate Professor at the University of

Bologna, DISI – Computer Science and Engineering Department

u My background:

n Foundational aspects of programming languages n Concurrency theory

u My recent interests (this course):

n Rigorous investigation of basic concepts in

emerging classes of languages for wide area programming

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

slide-3
SLIDE 3

The Programmable Web

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

The Web

  • ffers a

continuosly growing number of services available through dedicated APIs

slide-4
SLIDE 4

The Programmable Web

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Different kinds of APIs (with their corresponding protocols) exist …

slide-5
SLIDE 5

Service-Oriented Programming

u … but in general, independently from

the protocols/APIs, services call for:

n Specific programming paradigms:

w ORC: functional approach w Chor / Jolie: imperative approach

n Specific programming concepts:

w Behavioural interfaces, compliance, global

behavioural specifications, conformance, …

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

slide-6
SLIDE 6

ORC https://orc.csres.utexas.edu

u Basic idea:

n Apply the functional paradigm to

service-oriented programming

n Incorporate in the programming language

the concept of service (as a special form of function, called site) and …

n ... define composition operators to

program the so-called service orchestrations

Jayadev Misra, William R. Cook: Computation Orchestration. Software and System Modeling 6(1): 83-110 (2007)

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

slide-7
SLIDE 7

Formal definition of ORC syntax

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

slide-8
SLIDE 8

Formal definition of ORC syntax

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Publishes 1 or no value

slide-9
SLIDE 9

The site in ORC

u The basic ORC expression is site call

n A site is invoked, as a function, but it

nondeterministically publishes either one value or never return any value

w No value reflects, at the programming language

level, the unreliability of services

n Ex: BBC(d) either returns the BBC

newspage for date d, or never returns

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

slide-10
SLIDE 10

Formal definition of ORC syntax

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Three main composition

  • perators
slide-11
SLIDE 11

Composition operators in ORC

u ORC expression can be combined …

n … in parallel: CNN(d) | BBC(d)

this expression can publish 0, 1 or 2 values

n … in sequence:

(CNN(d) | BBC(d) ) >m> Email(“xxx@yyy”,m) each value published from the lhs activates the evaluation of the rhs (the published values are assigned to the variable m)

n … in asymmetric parallel (see next slide)

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

slide-12
SLIDE 12

Asymmetric parallel composition

u Email(“xxx@yyy”,m) where m:∈ (CNN(d) | BBC(d) )

sends the email only relative to the first newspage published by the rhs (not both!)

n The lhs and rhs start to be evaluated in

parallel …

n … but the evaluation of the subexpressions

  • f the lhs that needs m are deferred until the

first value is published, and assigned to m

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

slide-13
SLIDE 13

Formal definition of ORC syntax

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Expression definition Expression call

slide-14
SLIDE 14

Expression definition

u Email(“xxx@yyy”,m) where m:∈ (CNN(d) | BBC(d) )

This expression can be rewritten as follows: TwoNews(d) Δ CNN(d) | BBC(d) Email(“xxx@yyy”,m) where m:∈ TwoNews(d)

n The defined expression can be used inside

  • ther expressions (by indicating actual

parameters)

w it is replaced by its definition, where formal

parameters are replaced by the actual ones

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

slide-15
SLIDE 15

Formal definition of ORC semantics

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

slide-16
SLIDE 16

Formal definition of ORC semantics

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Asynchronous semantics: Call, Return, Publication are separated events (let is a special site that simply publishes its arguments)

slide-17
SLIDE 17

Formal definition of ORC semantics

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Parallel composition

slide-18
SLIDE 18

Formal definition of ORC semantics

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Sequential composition

slide-19
SLIDE 19

Formal definition of ORC semantics

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Asymmetric parallel composition

slide-20
SLIDE 20

Formal definition of ORC semantics

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Expression definition evaluation

slide-21
SLIDE 21

Example

Email(“xxx@yyy”,m) where m:∈ (CNN(d) | BBC(d) ) à Email(“xxx@yyy”,m) where m:∈ (?u | BBC(d) ) à Email(“xxx@yyy”,m) where m:∈ (?u | ?u’ ) à Email(“xxx@yyy”,m) where m:∈ (let(n) | ?u’ ) à Email(“xxx@yyy”,n) à ?u’’ à let(c) à 0

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

slide-22
SLIDE 22

Pros and Cons of the asynchronous semantics

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Email(“xxx@yyy”,m) where m:∈ let(n)|ComplexExpression

u In “real life” the Email will consider n

n instead of the first value published by a very complex expression

(e.g., including hundreds of external service invocations)

u For this reason ORC has been equipped also with a

synchronous semantics

u The idea is to postpone responses u?c (produced by

the SiteRet rule) thus giving priority to local actions

n The semantics is now divided in alternative rounds:

local actions, one response, local actions, one response, ….

n In this way, if ComplexExpression requires at least one site call,

let(n) is guaranteed to publish first (during first round)

slide-23
SLIDE 23

ORC equivalences

u What about 0 and 0 >x> f ?

Are these expressions equivalent ?

u What about (g|h) >x > f and

(g >x > f ) | (h >x > f ) ?

u What about f >x > (g|h) and

(f >x >g) | (f >x > h) ?

u What about (f >y > g) where x :∈ h

and (f where x :∈ h) >y > g ?

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

slide-24
SLIDE 24

Bisimulation has been used to prove equivalence laws

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

slide-25
SLIDE 25

Bisimulation has been used to prove equivalence laws

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

slide-26
SLIDE 26

The ORC language

u What we have seen so far is named

ORC calculus

u A fully fledged language, called ORC,

has been developed starting from the calculus

u Few examples of programs follows

n An ORC interpreter is available at:

https://orc.csres.utexas.edu/tryorc.shtml

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

slide-27
SLIDE 27

Basic site calls

u Println is a built-in site that prints a string (and then

publishes a generic signal): Println ("Hello World")

u Prompt is a built-in site that prompt the user to

input a string, which is then published: Prompt("What is your name ?")

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

slide-28
SLIDE 28

Basic composition operators

u Parallel composition:

Prompt("Red or black ?") | Prompt("Odd or even ?")

u Sequential composition:

Prompt("What is your name?") > x > Println("Your name is " + x)

u Asymmetric parallel composition:

fruits < fruits < ( Prompt("Apples or oranges?") | Prompt("Grapes or mangos?") )

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

slide-29
SLIDE 29

Ask two questions and use both answers

( Prompt("Red or black ?") | Prompt("Odd or even ?") ) > x > Println("Your choice is " + x)

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

slide-30
SLIDE 30

Ask two questions and use both answers

( Prompt("Red or black ?") | Prompt("Odd or even ?") ) > x > Println("Your choice is " + x)

Modify it to use only the first answer

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

slide-31
SLIDE 31

Ask two questions and use both answers

Println("Your choice is " + x) < x < ( Prompt("Red or black ?") | Prompt("Odd or even ?") )

… here it is ... only the first answer!

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

slide-32
SLIDE 32

Similar ORC expressions

("Red" | "Blue") > x > Println("A nice color: " + x) ( Prompt("Write Red") | "Blue") > x > Println("A nice color: " + x) Println("A nice color: " + x) < x <
 ("Red" | "Blue") Println("A nice color: " + x) < x <
 (Prompt("Write Red") | "Blue")

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

slide-33
SLIDE 33

Timer

u Rwait is a special site

n When invoked with parameter t, it publishes

a signal after t milliseconds

"immediately" | Rwait(3000) >> "..three seconds later.." | Rwait(5000) >> "..five seconds later.."

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

slide-34
SLIDE 34

A metronome

def metronomeN(i) = i | Rwait(1000) >> metronomeN(i+1) metronomeN(0)

def is used for expression definitions

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

slide-35
SLIDE 35

Some real Web Service

u HTTP requests:

def randombytes(n) = val location = "https://www.fourmilab.ch/cgi-bin/Hotbits" val query = {. nbytes = n, fmt = "xml" .} val response = HTTP(location, query).get() val xml("hotbits", xml("random-data", data)) = ReadXML(response) data.replaceAll("\\s+"," ") randombytes(4)

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

slide-36
SLIDE 36

Some real Web Service

u Libraries are available that use

Web Services as ORC sites:

include "net.inc" GoogleGeocoder("Bertinoro") include "search.inc" Google("Sangiovese") > x > each(x)

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Publish a list of hits Publish the single elements in a list

slide-37
SLIDE 37

Some real Web Service

u Libraries are available that expose

Web Services as ORC sites:

include "net.inc" val BingSpell = BingSpellFactoryPropertyFile ("orc/orchard/orchard.properties") BingSpell("beutiful bertinoro!")

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

slide-38
SLIDE 38

Exercise

u Ask the user for a string and then .. u .. print the spell checked version of the

string, if this can be done in less than 250ms, or print the typed string

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

slide-39
SLIDE 39

Exercise

u Ask the user for a string and then .. u .. print the spell checked version of the

string, if this can be done in less than 250ms, or print the typed string

include "net.inc" val BingSpell = BingSpellFactoryPropertyFile ("orc/orchard/orchard.properties") Println(y) < y <
 ( Prompt("Input a string: ") > x > 
 ( BingSpell(x) | (Rwait(250) >> x) ) )

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

slide-40
SLIDE 40

ORC: conclusion

u ORC is an example of a language:

n Specifically designed for service-oriented

programming

n Developed starting from a formally

defined calculus

n Particularly tailored for service

  • rchestration

w The orchestrator is the unique point of

invocation for the other services

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

slide-41
SLIDE 41

WS-BPEL

http://docs.oasis-open.org/wsbpel/2.0/OS/wsbpel-v2.0-OS.html

u The most famous orchestration

language is WS-BPEL

n Web Service Business Process Execution

Language: result of the effort of industries like IBM, Microsoft, ORACLE, SAP, …

n XML based language, including many

different constructs, inherited from several predecessors of single companies in the consortium

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

slide-42
SLIDE 42

Difficult XML syntax ...

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

slide-43
SLIDE 43

… easier graphical notations

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

u WS-BPEL has a

complex XML syntax, but front- end graphic notations (similar to BPMN) have been designed