DESIGNING DISTRIBUTED
APPLICATIONS WITH MOBILE
CODE PARADIGMS
Presented by: Andrea Gallidabino
Antonio Carzaniga, Gian Pietro Picco, GiovanniVigna
ICSE1997
1
2
Internet
INTERNET
3
Written in 1997 — Explosive growth
INTERNET
3
Biggest distributed system
Available to everyone
Written in 1997 — Explosive growth
INTERNET
3
Provision of services on large scale
Biggest distributed system
Available to everyone
Written in 1997 — Explosive growth
SCALING UP
4
Difficult
SCALING UP
4
Difficult
Ad-hoc solutions
PROGRAMMING LANGUAGES
5
For the Internet
Code mobility features
PROGRAMMING LANGUAGES
5
For the Internet
Code mobility features
Developers depended on the programming languages
CODE MOBILITY
6
Run-time reconfiguration
CODE MOBILITY
6
Run-time reconfiguration
CODE MOBILITY
6
Run-time reconfiguration
Apply code mobility to large scale systems
MOBILE CODE LANGUAGES
Telescript
7
TELESCRIPT
8
Site 1 Site 2
TELESCRIPT
8
Site 1 Site 2
TELESCRIPT
8
Site 1 Site 2
TELESCRIPT
8
Site 1 Site 2
SerializeSuspend Transmit Unserialize Resume
JAVA (1)
Dynamically load classes into the JavaVirtual Machine
9
public class ClassLoaderTest extends JavaClassLoader {
public static void main(String[] args) {
ClassLoader classLoader = this.getClass().getClassLoader();
Class loadedMyClass = classLoader.loadClass(“className”);
Constructor constructor = loadedMyClass.getConstructor();
Object myObject = constructor.newInstance();
Method method = loadedMyClass.getMethod(“methodName”);
Object[] args = {“arg1”, “arg2”, “arg3”}
method.invoke(myObject, args);
}
}
JAVA (2)
URLClassLoader classLoader =
new URLClassLoader(new URL(“myURL”));
10
MOBILE CODE LANGUAGES
Mobility for execution units (EU)
Run-time representation of a single flow of computation
MOBILE CODE LANGUAGES
Mobility for execution units (EU)
Run-time representation of a single flow of computation
Weak Mobility
Ability to allow EUs to be
dynamically bound to code
coming from other sites
1- From network
2- From other EUs
MOBILE CODE LANGUAGES
Mobility for execution units (EU)
Run-time representation of a single flow of computation
Strong Mobility
Ability to allow EUs to move
their code and execution state
to a different site
Weak Mobility
Ability to allow EUs to be
dynamically bound to code
coming from other sites
1- From network
2- From other EUs
StrongWeak
MOBILITY
12
Mobility
StrongWeak
MOBILITY
12
Mobility
Telescript
StrongWeak
MOBILITY
12
Mobility
TelescriptTycoon
AgentTcl
Emerald
StrongWeak
MOBILITY
12
Mobility
TelescriptTycoon
AgentTcl
Emerald
UNIX sh
REV
MOLE
TACOMA
FACILE
M0
13
TECHNOLOGY
VS
DESIGN
DISTRIBUTED APPLICATIONS
(1)
14
Interactions are independent of the location
Middleware
No distinction between local and remote interactions
DISTRIBUTED APPLICATIONS
(2)
15
What if location is important?
DISTRIBUTED APPLICATIONS
(2)
15
What if location is important?
Bindings
Resources
Migration
Latency
Partial failure
Concurrency
DISTRIBUTED APPLICATIONS
(2)
15
What if location is important?
Bindings
Resources
Migration
Latency
Partial failure
Concurrency
Performance and Reliability!
IDENTIFY DESIGN
PARADIGMS
MOBILE CODE PARADIGMS
TERMS
Components
Interactions
Sites
17
COMPONENTS
Resource Components Computational Components
Elements of an architecture
Code Components
18
SITES
19
Execution Environments
Support execution of computational components
Concept of location
1 Computational
1 Resource
1 Code
3 Computational
1 Resource
2 Code
INTERACTIONS
20
Events between two or more components
INTERACTIONS
20
Events between two or more components
Local
INTERACTIONS
20
Events between two or more components
Remote
Local
INTERACTIONS
20
Events between two or more components
Remote
Local
Local less expensive compared to remote
MOBILE CODE PARADIGMS (1)
21
Interaction pattern
Coordination and relocation of components
Site A
A
Site B
Delivers a service
MOBILE CODE PARADIGMS (1)
21
Interaction pattern
Coordination and relocation of components
Site A
A
Site B
Delivers a service
A starts interaction
MOBILE CODE PARADIGMS (1)
21
Interaction pattern
Coordination and relocation of components
Site A
A
Site B
Delivers a service
A starts interaction
B
B
B
MOBILE CODE PARADIGMS (2)
22
Extend the client-server paradigm
Remote evaluation, Code on demand, Mobile Agent
Site A
A
Site B
Delivers a service
A starts interaction
??
? ?
?
SCENARIO
23
Goal: bake a cake
SCENARIO
23
Goal: bake a cake
A
B
Me
You
SCENARIO
23
Goal: bake a cake
A
B
Me
You
Site A
Site B
Your house
My house
SCENARIO
23
Goal: bake a cake
A
B
Me
You
Recipe
Site A
Site B
Your house
My house
?
SCENARIO
23
Goal: bake a cake
A
B
Me
You
Recipe
Site A
Site B
Your house
My house
?
SCENARIO
23
Goal: bake a cake
A
B
Me
You
Recipe
Site A
Site B
Your house
My house
?
SCENARIO
23
Goal: bake a cake
A
B
Me
You
Recipe
Site A
Site B
Your house
My house
?
Ingredients?
Oven?
(easy to move)
(does not move)
CLIENT-SERVER (1)
24
Site A
A
Site B
B
B
B
B
Example: X Windows
CLIENT-SERVER (1)
24
Site A
A
Site B
B
B
B
B
Example: X Windows
CLIENT-SERVER (2)
25
Site A Site B
Computational Comp. (A)
—
—
Computational Comp. (B)
Code Comp.
Other Comp.
Site A Site B
Computational Comp. (A)
—
—
Computational Comp. (B)
Code Comp.
Other Comp.
Paradigm
Client-
Server
Before After
REMOTE EVALUATION (1)
26
Site A
A
Site B
B
B
B
A
Example: UNIX rsh / PostScript printing
REMOTE EVALUATION (1)
26
Site A
A
Site B
B
B
B
A
Example: UNIX rsh / PostScript printing
REMOTE EVALUATION (1)
26
Site A
A
Site B
B
B
B
A
Example: UNIX rsh / PostScript printing
REMOTE EVALUATION (2)
27
Site A Site B
Computational Comp. (A)
Code Comp.
—
Computational Comp. (B)
—
Other Comp.
Site A Site B
Computational Comp. (A)
—
—
Computational Comp. (B)
Code Comp.
Other Comp.
Paradigm
Remote
Evaluatio
n
Before After
CODE ON DEMAND (1)
28
Site A
A
Site B
A
A
B
B
Example: Internet applications (JavaScript) / Terminal
28
CODE ON DEMAND (1)
28
Site A
A
Site B
A
A
B
B
Example: Internet applications (JavaScript) / Terminal
28
CODE ON DEMAND (1)
28
Site A
A
Site B
A
A
B
B
Example: Internet applications (JavaScript) / Terminal
28
CODE ON DEMAND (2)
29
Site A Site B
Computational Comp. (A)
—
Other Comp.
Computational Comp. (B)
Code Comp.
—
Site A Site B
Computational Comp. (A)
Code Comp.
Other Comp.
Computational Comp. (B)
—
—
Paradigm
Remote
Evaluatio
n
Before After
29
MOBILE AGENT (1)
30
Site A
A
Site B
B
Example: network management
A
A
MOBILE AGENT (1)
30
Site A
A
Site B
B
Example: network management
A
A
MOBILE AGENT (1)
30
Site A
A
Site B
B
Example: network management
A
A
MOBILE AGENT (2)
31
Site A Site B
Computational Comp. (A)
Code Comp.
—
—
—
Other Comp.
Site A Site B
—
—
—
Computational Comp.
(A)
Code Comp.
Other Comp.
Paradigm
Remote
Evaluatio
n
Before After
31
SUMMARY
32
Site A Site B
Computational Comp. (A)
—
—
Computational Comp. (B)
Code Comp.
Other Comp.
Computational Comp. (A)
Code Comp.
—
Computational Comp. (B)
—
Other Comp.
Computational Comp. (A)
—
Other Comp.
Computational Comp. (B)
Code Comp.
—
Computational Comp. (A)
Code Comp.
—
—
—
Other Comp.
Site A Site B
Computational Comp. (A)
—
—
Computational Comp. (B)
Code Comp.
Other Comp.
Computational Comp. (A)
—
—
Computational Comp. (B)
Code Comp.
Other Comp.
Computational Comp. (A)
Code Comp.
Other Comp.
Computational Comp. (B)
—
—
—
—
—
Computational Comp.
(A)
Code Comp.
Other Comp.
Paradigm
Client-
Server
Remote
Evaluatio
n
Code on
Demand
Mobile
Agent
Before After
MOBILE CODE PARADIGMS (3)
33
Explicit model
Bindings between
components
Location Code
Reconfiguration
MOBILE CODE PARADIGMS (3)
33
Explicit model
Bindings between
components
Location Code
Reconfiguration
MOBILE CODE PARADIGMS (3)
33
Explicit model
Bindings between
components
Location Code
Reconfiguration
MOBILE CODE PARADIGMS (3)
33
Explicit model
Bindings between
components
Location Code
Reconfiguration
MOBILE CODE PARADIGMS (3)
33
Explicit model
Bindings between
components
Location Code
Reconfiguration
MOBILE CODE PARADIGMS (3)
33
Explicit model
Bindings between
components
Location Code
Reconfiguration
Independent of a language or system
COST
34
Location => Cost of interactions
Local interactions cost <<< Remote interactions cost
COST
34
Location => Cost of interactions
Local interactions cost <<< Remote interactions cost
Components may change location in order to
increase quality in the interactions, reducing the cost:
COST
34
Location => Cost of interactions
Local interactions cost <<< Remote interactions cost
Components may change location in order to
increase quality in the interactions, reducing the cost:
Remote Evaluation
Mobile Agent
Execution on remote sites,
local interactions with
components on new site
COST
34
Location => Cost of interactions
Local interactions cost <<< Remote interactions cost
Components may change location in order to
increase quality in the interactions, reducing the cost:
Remote Evaluation
Mobile Agent
Execution on remote sites,
local interactions with
components on new site
Code on Demand
Dynamically extend behaviour
BENEFITTING SCENARIOS
35
Deployment and upgrade of Distributed Systems
Customisation of services
Support for disconnected operations
Improve fault tolerance
DEPLOYMENT AND UPGRADE
OF DISTRIBUTED SYSTEMS
36
Without code mobility:
Local installation and rebuilt
DEPLOYMENT AND UPGRADE
OF DISTRIBUTED SYSTEMS
36
Without code mobility:
Local installation and rebuilt
Remote Evaluation
Mobile Agent
Installation process in the propagated
code in a set of network nodes.
DEPLOYMENT AND UPGRADE
OF DISTRIBUTED SYSTEMS
36
Without code mobility:
Local installation and rebuilt
Remote Evaluation
Mobile Agent
Installation process in the propagated
code in a set of network nodes.
Code Mobility
Add functionalities as soon as they
are needed only on user request
(react - Lazy installation).
CUSTOMISATION OF SERVICES
37
Without code mobility:
fixed set of services with statically defined interface
CUSTOMISATION OF SERVICES
37
Without code mobility:
fixed set of services with statically defined interface
Remote Evaluation
Mobile Agent
Increase flexibility, limited size and complexity.
Provide a unique service which
allows execution of remote code.
Client is responsible for the correctness
of the specification of the service.
SUPPORT FOR
DISCONNECTED OPERATIONS
38
Without code mobility:
different physical links
SUPPORT FOR
DISCONNECTED OPERATIONS
38
Without code mobility:
different physical links
Remote Evaluation
Mobile Agent
Complex computation move.
Communication across unreliable links
happens only once and can be injected
in a reliable network afterwards
IMPROVE FAULTTOLERANCE
39
Without code mobility:
difficult to identify where and how to react in faulty nodes
IMPROVE FAULTTOLERANCE
39
Without code mobility:
difficult to identify where and how to react in faulty nodes
Mobile Agent
(Remote Evaluation)
Simplify resolution of partial failures, because
interactions encapsulate the whole state of
a distributed application.
BEST PARADIGM?
40
No better paradigm than the others
Application specific
BEST PARADIGM?
40
No better paradigm than the others
Application specific
Decide which cost to minimise
# interactions CPU Usage Network traffic
EXAMPLE:
INFORMATION RETRIEVAL
41
EXAMPLE:
INFORMATION RETRIEVAL
41
EXAMPLE:
INFORMATION RETRIEVAL
41
EXAMPLE:
INFORMATION RETRIEVAL
41
?
EXAMPLE:
INFORMATION RETRIEVAL
41
?
Remote Evaluation performs better in this example
CLIENT-SERVER
42
Param Unit Description
N # nodes Number of Network nodes
D documents/ node Average dimension of database in nodes
i # density of relevant information (relevant/total)
h bits / document average dimension of document header
b bits / document average dimension of document body
r bits / document dimension of the request
REMOTE EVALUATION
43
Param Unit Description
N # nodes Number of Network nodes
D documents/ node Average dimension of database in nodes
i # density of relevant information (relevant/total)
h bits / document average dimension of document header
b bits / document average dimension of document body
r bits / document dimension of the request
MOBILE AGENT
44
Param Unit Description
N node Number of Network nodes
D documents / node Average dimension of database in nodes
i # density of relevant information (relevant/total)
h bits / documents average dimension of document header
b bits / documents average dimension of document body
r bits / documents dimension of the request
SA bits / nodes average dimension of “see also” list
s bits / nodes average dimension of internal data structure
ς bits / nodes ς = SA + s
TRAFFIC OVERHEAD (1)
45
Client-Server
Remote Evaluation
Mobile Agent
Overhead = Traffic - I
I = iDbN
Overhead = Traffic - I = (r + ir + h)DN
Overhead = Traffic - I = (r + CodeREV)N
Overhead = Traffic - I =
=(r + CodeMA + ς)(N+1) + I/2(N-1)
=(r + CodeMA + ς)(N+1) + 1/2iDbN(N-1)
TRAFFIC OVERHEAD (2)
46
CodeREV < (r + ir + h)D
Remote Evaluation is convenient:
Client-Server
Remote Evaluation
Overhead = Traffic - I = (r + ir + h)DN
Overhead = Traffic - I = (r + CodeREV)N
47
SIMPLIFIED MODEL
No security
No Memory usage
Uniform networks
48
AFTERWARDS?
Vigna, G. (1998). Cryptographic traces for mobile
agents. In Mobile agents and security. Springer
48
AFTERWARDS?
Vigna, G. (1998). Cryptographic traces for mobile
agents. In Mobile agents and security. Springer
Milojičić, D. S., Douglis, F., Paindaveine,Y.,Wheeler, R., & Zhou, S.
(2000). Process migration.ACM Computing Surveys
48
AFTERWARDS?
Fielding, R.T., &Taylor, R. N. (2002). Principled design of the
modern Web architecture.ACMTransactions on Internet
Technology
Vigna, G. (1998). Cryptographic traces for mobile
agents. In Mobile agents and security. Springer
Milojičić, D. S., Douglis, F., Paindaveine,Y.,Wheeler, R., & Zhou, S.
(2000). Process migration.ACM Computing Surveys
48
AFTERWARDS?
Fielding, R.T., &Taylor, R. N. (2002). Principled design of the
modern Web architecture.ACMTransactions on Internet
Technology
Vigna, G. (1998). Cryptographic traces for mobile
agents. In Mobile agents and security. Springer
Milojičić, D. S., Douglis, F., Paindaveine,Y.,Wheeler, R., & Zhou, S.
(2000). Process migration.ACM Computing Surveys
Miorandi, D., Sicari, S., De Pellegrini, F., Chlamtac, I. (2012).
Internet of things: Vision, applications and research
challenges.Ad Hoc Networks
49
MY RESEARCH
Liquid software
49
MY RESEARCH
Liquid software
Server
WebRTC
WebSockets
Liquid
Behaviour
Liquid
Behaviour
Signalling
Relay
3
2
43
2
4
1 2 3 1 2 3
(Database)
Browser
Memory
Browser
Memory
Local
Storage
Local
Storage
Session
Storage
Session
Storage
Liquid Component
Device2
Device1
Liquid Component
LiquidVariablesLiquidVariables

Designing Distributed Applications with Mobile Code Paradigms