Java Distributed Object System
Main Module of a Distributed System
• Global address space
– global identifier – registry/ name service ( central, distributed, replicated)
• Transportation system • Global Control flow (Invocation/Control flow Protocol)
– parameter passing across address space – method invocation semantic – entity activation
• Failure Behavior
– exception – consistency and persistency
1997.10.22
CS491 presented by Peng Wu
2
RMI Overview
RMI provides distributed computing ability on the specific system(JVM) for the specific language(Java)
– CORBA, RPC • System Heterogeneity • Language Heterogeneity – RMI based on homogeneity and strength it • Language Integration -- distributed object model – similar interface, preserve some behavior – exception • System Integration – garbage collection – mobile behavior – security
1997.10.22 CS491 presented by Peng Wu 3
Language Integration -- Distributed Object Model
Java Object model • Object • Interface
declare a set of methods for Java object without implementation
Distributed Object model • Remote object
object whose methods can be accessed from another address space
• Remote interface
an interface that declares the methods of a remote object
• Method Invocation
– primitive type passed by value – object passed by reference
• Remote Implementation • RMI
non-remote object passed by value remote object passed by reference
1997.10.22
CS491 presented by Peng Wu
4
RMI Interfaces and Classes
Interfaces
Remote
Object
classes
RemoteObject
IOException
RemoteServer Client stub
RemoteException
...
UnicastRemoteObject
...
extension
implementation
1997.10.22
CS491 presented by Peng Wu
5
System Integration
• Distributed Garbage Collection • Dynamic Stub loading
– specialized class loader – security manager – pickling system • When marshalling remote object, marshal stream embeds URL info of the stub code • On demarshalling, marshal stream loads stub code if it’s not available locally
1997.10.22
CS491 presented by Peng Wu
6
System Architecture
Application
Client Server
Stubs
Skeleton Transport
RMI System
Remote Reference layer
• Stub/Skeleton layer • Remote reference layer • Transport layer
1997.10.22 CS491 presented by Peng Wu
7
Distributed object Across Address Space
• Name Service
export
Remote Server
export registry Locate Reg naming binding
registry Locate Reg
Remote Server
client
naming binding
client
– URL based name lookup, no location transparency – Non-persistent database • java..rmi.registry.Registry • java.rmi.LocateRegistry • java.rmi.naming
1997.10.22 CS491 presented by Peng Wu 8
Distributed object Across Address Space
• Pickling -- Object transmission across address space
– Serialized representation of objects: • object type • object persistent state • relationships between objects within a stream • object implementation info – Pickling remote object • remote interface • remote object reference
1997.10.22
CS491 presented by Peng Wu
9
RMI Performance
• RMI vs. Local call(PPro 200Mhz, NT, JDK no JIT)
Null Long[256] RMI (cross process) 1.6 ms/call 6.5ms/call RMI (cross machine) 1.8ms/call 7.6ms/call local 700ns/call 800ns/call
• Call time (no configuration available)
– setup time: RMI 40% slower than CORBA – binding: RMI 200-1500ms slower than CORBA
• CORBA vs. RMI
– 1000 calls, one argument, JDK1.1.1
1997.10.22
CS491 presented by Peng Wu
10
CORBA and RMI Performance (1000 calls, one argument)
Time(sec)
80 70 60 50 40 30 20 10 0
0 int[24] int[240] struct[24] struct[240] parameter
IONA Orbix2.2(C++) OrbixWeb 2.0.2(Java) RMI(JD1.1.1)
1997.10.22
CS491 presented by Peng Wu
11
RMI Performance
• Scalability -- ability of handling multiple connections to one remote object
– HelloImpl.sayHello() JDK1.1, Win95, 133-Pentium • 150 threads in 2 sec interval, 200 threads in 5 sec interval(RMI) • 1000 threads(Java IDL)
• Serialization
– 100 times, default serialization, buffered stream, primitive type, small array, small object array(10) • RMI 64500ms (object) • CORBA 3485ms (IDL struct) – different serialization schemes Object[1000], each 3 attributes(String, Double,util.Data)
1997.10.22 CS491 presented by Peng Wu 12
Performance of different serialization scheme
(Solaris2.5 Ultra-1 with attributes String, Double,Data)
7
6
5
relative rate
4
3
default serialization partial serialization full serialization externalization
2
1
0 byte count create serialize deserialize
1997.10.22
CS491 presented by Peng Wu
13
Summary
Pros • Integrating distribute object model seamlessly into Java object model • Homogeneity • Communication with non-Java object may work through JNI and JDBC Cons • Make distributed computing in Java easily to approach, but not efficiently • Heterogeneity • A primitive implementation currently
1997.10.22 CS491 presented by Peng Wu 14
JavaSpace -- a new distributed computing paradigm
• JavaSpace -- A reliable distributed storage system • Goal -- facilitating cooperate distributed computing • Utilization
– Distributed algorithms as flow of object • establish connections between participants(Client/Server, RPC, RMI) – build interfaces and protocols between participants • establish connections with a broker(JavaSpace) – build interfaces and protocols with the broker – Distributed persistence
1997.10.22
CS491 presented by Peng Wu
15
Identities
Client write Write event
read
JavaSpace
Client
write
Event Dispatcher
notif y Transaction write JavaSpace take notify
JavaSpace
1997.10.22
CS491 presented by Peng Wu
16
JavaSpace model
• Entry basic unit of JavaSpace, a typed group of objects • Template a “partial” entry used to match entries with specific properties • Operation
– – – – read write take notify
1997.10.22
CS491 presented by Peng Wu
17
A reliable distributed storage system
• • • • Store and retrieve entries -- object Weak query ability Handle concurrent access Global control flow across multiple JavaSpaces
– asynchronous retrieval – distributed transaction mechanism
1997.10.22
CS491 presented by Peng Wu
18