RMI and CORBA Why both are valuable tools

40
Brian Gilstrap 1 RMI and CORBA Why both are valuable tools by Brian Gilstrap with thanks to Mark Volkmann

description

 

Transcript of RMI and CORBA Why both are valuable tools

Page 1: RMI and CORBA Why both are valuable tools

Brian Gilstrap 1

RMI and CORBA

Why both are valuable tools

byBrian Gilstrap

with thanks to Mark Volkmann

Page 2: RMI and CORBA Why both are valuable tools

Brian Gilstrap 2

Introduction• This talk is about RMI and CORBA, not

“RMI vs CORBA”• It’s about using the right tool for the job• RMI and CORBA have different “design

centers”; as a result, they are good forsolving different (but overlapping) sets ofproblems

• This talk centers around Java

Page 3: RMI and CORBA Why both are valuable tools

Brian Gilstrap 3

RMI & CORBA Characteristics

• Pure Java• Free• Simple to use• Integrated into platform• Object-oriented communication• Dynamic codebase• Performance is not as good

(depending on application)• Less mature (but learned from

CORBA issues/mistakes)

• Maturing quickly

• Multi-language• $$$• Harder to use• Add-on• Structured

communication• Static codebase• Performance is better

(depending on application)• More mature (but 1st of its kind

in the industry)• Maturing slowly

RMI CORBA

Page 4: RMI and CORBA Why both are valuable tools

Brian Gilstrap 4

These characteristics result inDesign Centers

distributed

Pure Java

Free

o-o communication

dynamic codebase

$$$$

multi-language

add-on to Java

structuredcommunication

static codebase

integrated into Java

object-oriented

Page 5: RMI and CORBA Why both are valuable tools

Brian Gilstrap 5

RMI features/limitations• Pure Java

– RMI is pure Java (no other languages), but itsupports distributed OO computing in Java verywell

– Can still mix in socket communication andnative code (JNI) to access non-Java (e.g.legacy) systems

• this may be easier or harder than using CORBA,depending on the problem

Page 6: RMI and CORBA Why both are valuable tools

Brian Gilstrap 6

RMI features/limitations (cont)• Free

– comes as part of the Java Development Kit(JDK) and is part of the Java RuntimeEnvironment (JRE)

– no runtime costs, developer costs, etc.

Page 7: RMI and CORBA Why both are valuable tools

Brian Gilstrap 7

RMI Features/Limitations (Cont)• Simple to use - providing remote access

– extend “Remote” interface & handle exceptions– use the “rmic” utility to generate stubs &

skeletons (produces ‘.class’ files)– registry provides bootstrap for finding remote

objects• must know host

Page 8: RMI and CORBA Why both are valuable tools

Brian Gilstrap 8

RMI Features/Limitations (Cont)• Simple to use - sending objects

– implement “Serializable” interface– optionally specify codebase– automatic version mismatch detection

Page 9: RMI and CORBA Why both are valuable tools

Brian Gilstrap 9

• Integrated into platform– standard way of using RMI– source code is the same for any platform– bytecode is cross-platform just like other Java– remote method calls are nearly identical to

normal method calls– distributed garbage collection preserves

automatic memory management

RMI Features/Limitations (Cont)

Page 10: RMI and CORBA Why both are valuable tools

Brian Gilstrap 10

RMI Features/Limitations (Cont)

• Object-oriented communication– can easily send references to remotely

accessible objects to other VMs• using the “Remote” interface

– can easily send copies of objects to other VMs• using “Serializable” interface

– can get more sophisticated• overriding “read/writeObject”• using “Externalizable”

Page 11: RMI and CORBA Why both are valuable tools

Brian Gilstrap 11

RMI Features/Limitations (Cont)• Object-oriented communication (continued)

– distributed garbage collection• allows server VMs to garbage collect unused

objects/resources when those objects/resources areno longer needed

Page 12: RMI and CORBA Why both are valuable tools

Brian Gilstrap 12

RMI Features/Limitations (Cont)• Dynamic codebase

– can send not only the state information (fieldvalues) but also the implementation (bytecode)of objects across the network

– very powerful• send code to be executed by the server as part of

performing work– example: a search object for searching a datastore

• send an agent to a remote site to do work• send an object to a server to be stored persistently• etc.

Page 13: RMI and CORBA Why both are valuable tools

Brian Gilstrap 13

RMI Features: Dynamic Codebase

Foo.class

aFoo1

VM 1 VM 2

codebase codebase

2“I need class ‘Foo’”

3

Foo.class

method call passing“aFoo”

here’s implementationfor class ‘Foo’

Page 14: RMI and CORBA Why both are valuable tools

Brian Gilstrap 14

RMI Features: Dynamic Codebase (cont)

Foo.class

codebase codebase

extends codebase to include remote sources of classes

aFoo1

VM 1 VM 2

2“I need class ‘Foo’”

3

Foo.class

method call passing“aFoo”

here’s implementationfor class ‘Foo’

Page 15: RMI and CORBA Why both are valuable tools

Brian Gilstrap 15

RMI Features/Limitations (Cont)• Performance

– for designs which pass data only (no objects), and forwhich version mismatch detection is not needed, RMIperforms more slowly that CORBA

• exact numbers depend upon many things– platform– Java JIT/no-JIT– ORB vendor– problem domain– etc.

– for designs which pass objects, RMI is currently theonly ticket in town (CORBA can’t pass objects)

Page 16: RMI and CORBA Why both are valuable tools

Brian Gilstrap 16

RMI Features/Limitations (Cont)• Performance (continued)

– performance can be improved by custom serializationcode

• allows default implementation with targeted tuningfor the 80/20 rule

– BUT• using RMI features to solve problems produces a

different design and can reduce or eliminateperformance differences

• passing objects, version mismatch, and distributedgarbage collection are important issues whenbuilding distributed systems

Page 17: RMI and CORBA Why both are valuable tools

Brian Gilstrap 17

RMI Features/Limitations (Cont)

• RMI is Maturing quickly1/97 6/97 1/98 6/98

JDK 1.1;RMI

JDK 1.2b2;RMI v2 beta

JDK 1.2;RMI v2(expected)

Page 18: RMI and CORBA Why both are valuable tools

Brian Gilstrap 18

CORBA Features/Limitations

• Multi-language– C (requires layering object-oriented concepts on top)

– C++– Smalltalk– Java - not yet standardized– COBOL– Ada

Page 19: RMI and CORBA Why both are valuable tools

Brian Gilstrap 19

CORBA Features/Limitations (cont)

• Not free– costs can be substantial

• developer licenses (­$800+ per developer)• runtime licenses (cost varies with vendor)

– standardized extensions (“Object services” inOMG-speak) add more costs

Page 20: RMI and CORBA Why both are valuable tools

Brian Gilstrap 20

• Harder to use– must

• write IDL to provide interfaces and define datastructures for passing information

• transform IDL to Java stub & skeleton source code• compile stub/skeleton code to bytecode

– different vendor’s stub/skeleton bytecodes(‘.class’ files) are not compatible

– details of using CORBA are different for eachvendor: changing ORB vendors requireschanging source code (eek!)

CORBA Features/Limitations (cont)

Page 21: RMI and CORBA Why both are valuable tools

Brian Gilstrap 21

CORBA Features/Limitations (cont)• Harder to use (continued)

– more source code required to perform sametasks (vs. RMI)

– no standard way to bootstrap communication• some vendor-specific options exist, but nothing

standard across different vendors

– no support for detecting software versionmismatches

• wing it or hand build it• most often, this isn’t handled and problems arise at

runtime, sometimes resulting in silent errors

Page 22: RMI and CORBA Why both are valuable tools

Brian Gilstrap 22

CORBA features/limitations (cont)• Add-on to the language

– does not dovetail with standard Java features• breaks the object-oriented model when doing

distributed communication• no built-in support for flattening objects onto/off of

the wire– must use pseudo-objects or do the flattening/inflating by

hand

• no distributed garbage collection– e.g. don’t know when server objects & resources are no

longer needed

Page 23: RMI and CORBA Why both are valuable tools

Brian Gilstrap 23

CORBA features/limitations (cont)• Add-on to the language (continued)

– BUT: Allows implementing in multiplelanguages

• good for accessing legacy systems– especially if Java is not supported on the legacy platform

• good for extending existing CORBA-based systemswith Java

• good for leveraging expertise in other languages– as long as there is a CORBA binding for that language

Page 24: RMI and CORBA Why both are valuable tools

Brian Gilstrap 24

• Structured communication– must define pseudo-objects using IDL and

translated to data structures– can’t send objects

CORBA features/limitations (cont)

Page 25: RMI and CORBA Why both are valuable tools

Brian Gilstrap 25

• Structured communication (continued)– there is substantial hand-coding to flatten/inflate a

group of objects when sending their state information toa remote location

CORBA features/limitations (cont)

A

B C

D

pAstuff state

pB

pD

pC

pA

pB

pD

pC

A’

B’ C’

D’

inflate state

IIOP

IDL-definedstructures

Page 26: RMI and CORBA Why both are valuable tools

Brian Gilstrap 26

• Structured communication (continued)– lack of support for sending objects hampers design

options and results in more remote calls across the wire

CORBA features/limitations (cont)

IIOP

RMIBook Order

Book 1 ... Book n

Book Order

Book 1 ... Book n

“create BookOrder”

“add Book 1 to order bo1”

“add Book n to order bo1”

...

1 remote call

• (n + 2) remote calls

“submit order bo1”

Book Order

Book 1 ... Book n

bo1

“submit( aBookOrder )”

Page 27: RMI and CORBA Why both are valuable tools

Brian Gilstrap 27

• Structured communication (continued)– assume an order for 3 books– we include marshalling/unmarshalling time– if 1 RMI call takes an average of 35 milliseconds (ms)– if 1 CORBA call takes

• 21 ms => CORBA is •105 ms & RMI is 35 ms• 10 ms => CORBA is •50 ms & RMI is 35 ms• 6 ms => CORBA is •35 ms & RMI is 35 ms

CORBA features/limitations (cont)

(numbers are illustrative only)

Page 28: RMI and CORBA Why both are valuable tools

Brian Gilstrap 28

• Static codebase– can’t send implementations across the wire,

therefore• can’t send previously unknown types of objects

where they are needed to make computation moreefficient

• can’t dynamically extend the behavior of runningVM

– using DII only allows discovering new remote types andmaking remote method calls upon them

CORBA features/limitations (cont)

Page 29: RMI and CORBA Why both are valuable tools

Brian Gilstrap 29

• Performance– performance of CORBA IIOP is not as good as custom

protocols provided by ORB vendors• this talk only discusses IIOP because inter-vendor

support is important– traditional client/server speed is better in ORB

implementations than in RMI/JDK 1.1.x.• how much better varies, depending on how the

application is structured, what OS you are running,etc.

CORBA features/limitations (cont)

Page 30: RMI and CORBA Why both are valuable tools

Brian Gilstrap 30

• Performance (continued)– Compared to RMI, CORBA limits possible designs and

removes at least some of the performance gain whenincluding time for

• marshalling/unmarshalling of objects into/out ofIDL structures

• more calls across the wire, which are substantiallymore costly than local calls

• code to perform version mismatch detection• distributed garbage collection issues

CORBA features/limitations (cont)

Page 31: RMI and CORBA Why both are valuable tools

Brian Gilstrap 31

• CORBA is Maturing slowly

1992 1994 1996 1998

CORBA 1.1 CORBA 2.0(IIOP)

IIOP supportappears}

CORBA1.1 supported}

CORBA features/limitations (cont)

CORBA 3.0?(pass by-value)

Page 32: RMI and CORBA Why both are valuable tools

Brian Gilstrap 32

The Future of RMI (JDK 1.2)• Support for mixing different reference types

– secure, multi-cast, etc.• Performance improvements

– RMI-specific improvements– JDK improvements: HotSpot + VM/library tuning

• Better control over (de)serialization of objects andability to unexport a “Remote” object in your VM

• Activation of server objects– launching a VM to run a server object

Page 33: RMI and CORBA Why both are valuable tools

Brian Gilstrap 33

The Future of RMI (2.0?)• RMI over IIOP

– there is an initiative by the OMG and Javasoftto extend CORBA’s IIOP to support featuresneeded to run RMI over IIOP

– no known availability date– requires OMG’s “pass by-value” (see next

slide)

Page 34: RMI and CORBA Why both are valuable tools

Brian Gilstrap 34

The Future of CORBA• (3.0?) OMG is looking into supporting

pass by-value– first response to first RFP was completed end

of January– no known availability date

• (???) Other proposed features which havevarying degrees of vendor support– see http://www.omg.org

Page 35: RMI and CORBA Why both are valuable tools

Brian Gilstrap 35

The Future of CORBA (Cont)• There are hard problems to be solved in

order to support pass by-value in aheterogeneous environment– different languages at each end (e.g. C++ vs. COBOL)

• Might only allow passing state, not implementation– introduces new failure modes– appears to be current OMG direction (except for Java)

• If only passing state, might fail if appropriateimplementation not available at receiving end

– introduces new failure modes

– what about security?• no security “sandbox” except in Java

Page 36: RMI and CORBA Why both are valuable tools

Brian Gilstrap 36

The Future of CORBA (Cont)• Supporting pass by-value (continued)

– almost all languages don’t support dynamic codeinclusion in a running program (e.g. C, COBOL, C++)

• introduces new failure modes– version mismatch problem must be solved for a multi-

language environment. If not implemented• systems development becomes much more error

prone• can result in “silent” errors (bad computation)• would introduce new failure modes

Page 37: RMI and CORBA Why both are valuable tools

Brian Gilstrap 37

The Future - CORBA continued

• Therefore: don’t expect pass by-value tobecome standardized and supported on top ofIIOP very soon

(my guess: not before 1Q’99, more likely3Q’99 or later)

Page 38: RMI and CORBA Why both are valuable tools

Brian Gilstrap 38

Useful URL’s

• RMI pages at Javasoft– www.javasoft.com/products/jdk/rmi

• Object Management Group (OMG)– www.omg.org

• CORBA FAQ– www.cerfnet.com/~mpcline/corba-faq

Page 39: RMI and CORBA Why both are valuable tools

Brian Gilstrap 39

Useful Newsgroups/email lists

[email protected]• comp.lang.java.*• comp.object• comp.object.corba• general CORBA mailing list?

Page 40: RMI and CORBA Why both are valuable tools

Brian Gilstrap 40

Questions/Comments

• Now• Later: [email protected]