dist-computing1 - EECS People Web Server

advertisement
Distributed Computing
& Object Oriented
Middleware: Part 1
Presented By
Shawn Mulkey
May 2, 2006
Shawn Mulkey - EECS 816
1
Agenda
Introduction
 Supporting Technologies
 Remote Procedure Calls
 CORBA
 J2EE & RMI
 Conclusion

May 2, 2006
Shawn Mulkey - EECS 816
2
Demonstration Interlude 1
May 2, 2006
Shawn Mulkey - EECS 816
3
Agenda

Introduction
 Definitions
 Usage
 CORBA,
J2EE/RMI, .Net
Supporting Technologies
 Remote Procedure Calls
 CORBA
 J2EE & RMI
 Conclusion

May 2, 2006
Shawn Mulkey - EECS 816
4
Definitions

Distributed Computing :
A set of programs executing on
one or more computers which
coordinate actions by exchanging
messages.
Concurrent Execution
 Independent Failure

May 2, 2006
Shawn Mulkey - EECS 816
5
Definitions

Middleware :
Software components which promote
extensibility and maintainability by
employing abstraction between
standardized interfaces.
Behavior Semantics
 Data Representation

May 2, 2006
Shawn Mulkey - EECS 816
6
Middleware Diagrams
Local System Middleware
Distributed System Middleware
Server
Application
Process
Middleware
Middleware
Network Comm
System Resources
Operating System
Network Comm
Middleware
Application
Hardware Resources
Client
May 2, 2006
Shawn Mulkey - EECS 816
7
Definitions

Remote Procedure Call:
A protocol used by a program to
request a service from another program
without having to understand network
or inter-process details.
Client/Server based
 Local procedure call semantics

May 2, 2006
Shawn Mulkey - EECS 816
8
Distributed Computing Usage

Distributed file systems

Mobile systems

Remote database access

Web based applications

Real-Time content distribution
May 2, 2006
Shawn Mulkey - EECS 816
9
Distributed Computing Middleware

Object oriented middleware
 Extends
RPC paradigm
 Uses OO design principles

Event based middleware
 Publish-Subscribe

systems
Message oriented middleware
 General
May 2, 2006
queuing model
Shawn Mulkey - EECS 816
10
Distributed OO Middleware
Platforms

Common Object Request Broker Architecture
(CORBA)
 Canonical
standard
 Extremely robust architecture
 Variable vendor implementation

Java RMI/J2EE
 RMI
is object based RPC
 J2EE is a distributed object computing framework
May 2, 2006
Shawn Mulkey - EECS 816
11
Distributed OO Middleware
Platforms

Microsoft DCOM/.Net
 Proprietary
distributed object technology
 Strong tool support
 .Net intends complete integration

Web Services
 Based
on open interoperable standards
 Strong industry and academic support
 Extensibility based on standardized semantics
May 2, 2006
Shawn Mulkey - EECS 816
12
Agenda
Introduction
 Supporting Technologies

 Application
Stack
 Transport Protocols
Remote Procedure Calls
 CORBA
 J2EE & RMI
 Conclusion

May 2, 2006
Shawn Mulkey - EECS 816
13
Application Protocol Stack

Creates layered architecture

Between layers
 Standardized
interfaces
 Standardized protocol
 Message encapsulation

Minimizes dependencies
May 2, 2006
Shawn Mulkey - EECS 816
14
Application Protocol Stack
Message Exit
Message Enter
Application
Session
Transport
Network
Data Link
Physical
Sender
May 2, 2006
Router 1
Router 2
Shawn Mulkey - EECS 816
Recipient
15
Network Transport Protocols

Socket based

Communication protocols
 Packet sequencing
 Error recovery

TCP or UDP most common
 Connection

oriented vs. connectionless
Addressing and routing
 Typically
May 2, 2006
IP based
Shawn Mulkey - EECS 816
16
Agenda



Introduction
Supporting Technologies
Remote Procedure Calls









RPC Introduction
Architecture
Protocol
Error Handling
Marshalling
Asynchronous RPC
CORBA
J2EE & RMI
Conclusion
May 2, 2006
Shawn Mulkey - EECS 816
17
RPC Introduction

Application partitioned into ‘service’ and
‘client’ processes
 Either
may be anonymous
 Service may be implemented as federation of
processes

Difference between RPC and general
client/server model
?
RPC Follows semantics of local
procedure call (LPC)
May 2, 2006
Shawn Mulkey - EECS 816
18
RPC Introduction

Requires naming and binding
 Service
lookup
 E.g. DNS, NIS, NFS

RPC service may or may not persist
information
 Data
replication
 Caching
May 2, 2006
Shawn Mulkey - EECS 816
19
RPC Architecture

Service provider advertises interface or
implements standardized interface
 Interface
often defined in standardized language (IDL)
 Service may (or may not) also employ LPC semantics

Development framework provides connection
and processing logic for services
 Framework
may also provide naming directory for
service binding
May 2, 2006
Shawn Mulkey - EECS 816
20
RPC Architecture

Client executes ‘stub’ code to invoke
remote service
 Stub
hides connection and processing details
 Similar to macro expansion

Stub generator may be explicit or implicit
 Service
provider may also execute against
stub programs
May 2, 2006
Shawn Mulkey - EECS 816
21
RPC Architecture Model
Service Process
Client Process
Service Program
Client Program
Stub Procedure
Stub Procedure
Request
Comm Manager
Dispatcher
Comm Manager
Response
May 2, 2006
Shawn Mulkey - EECS 816
22
RPC Protocol

Request – Acknowledge / Response –
Acknowledge
 Request
Client
May 2, 2006
must be processed exactly once
Server
Client
Shawn Mulkey - EECS 816
Server
23
Demonstration Interlude 2
May 2, 2006
Shawn Mulkey - EECS 816
24
RPC Error Handling

Unique error types
 Binding
error
 Server unavailable

Unknown failure origin
 Transparent

backup server use
Unknown server state on failure
 Transactional
May 2, 2006
semantics may be required
Shawn Mulkey - EECS 816
25
Data Marshalling

Canonical data representation
 eXternal
Data Representation (XDR)
 eXtensible Markup Language (XML)

Efficiency of processing vs. interoperability

Pointers complicate argument passing

Design tip: Use external types in application
May 2, 2006
Shawn Mulkey - EECS 816
26
Asynchronous RPC Features

Synchronous semantics difficult to
maintain
 Lack

of global clock
Explicit asynchronous features useful
 Request
only call
 Callbacks
 Event notification
May 2, 2006
Shawn Mulkey - EECS 816
27
Agenda




Introduction
Supporting Technologies
Remote Procedure Calls
CORBA






History & Introduction
Components & Architecture
Interface Definition Language
Services
J2EE & RMI
Conclusion
May 2, 2006
Shawn Mulkey - EECS 816
28
CORBA Introduction

Acronym:
Common Object Request Broker Architecture
?

Development system addressing common RPC
issues in an OO framework

Overtaken by newer technologies, but still
standard reference model
May 2, 2006
Shawn Mulkey - EECS 816
29
CORBA History

Advanced Network Systems Architecture
(ANSA) early attempt at distributed system
generalization
 Encouraged distributed objects design
 Applied as set of guidelines to design

approach
Object Management Group (OMG) formed by
vendors to promote interoperability between
object systems
 System developed became CORBA
 Concrete tools over abstract ANSA specifications
May 2, 2006
Shawn Mulkey - EECS 816
30
CORBA Features

Provides common distributed object architecture

Defines common syntax for data and interface definition

Primarily method of inter-system interoperability


Strong legacy system support
Implementations and support in common languages



C++
Java
Many others
May 2, 2006
Shawn Mulkey - EECS 816
31
CORBA Components

Entities
 Object
references
 Abstract interface
 Basic types
 Constructed Types

Requests
 Operations
on objects called by client on server
 May be one way
May 2, 2006
Shawn Mulkey - EECS 816
32
CORBA Components

Object Request Broker (ORB)
 Matches

client request with servicing object
Client stub
 Generated
calling code implementing connection and
marshaling logic

Server skeleton
 Generated
May 2, 2006
code extended by server object
Shawn Mulkey - EECS 816
33
Basic CORBA Architecture
Have a nice day!
Client Program
Server Object
Calling Stub
Interface Skeleton
Object Request Broker
May 2, 2006
Shawn Mulkey - EECS 816
34
Interface Definition Language

Interface defined for client calls and server
implementation

CORBA IDL not compiled
 Mapped
to individual language constructs
 Not every language directly supports every IDL
feature

Concrete implementations (stubs & skeletons)
generated automatically
May 2, 2006
Shawn Mulkey - EECS 816
35
Simple Interface Example
interface salestax {
float calculate_tax ( in float taxable_amount );
}

Note:
C
like syntax
 Typed identifiers
 Procedural declarations
May 2, 2006
Shawn Mulkey - EECS 816
36
IDL Syntax

Typed references and values
 Interfaces
 Constructed
(structs, arrays, etc.)
 Value
Types
 Built-in (int, float, etc.)

Scoped access
 ‘Module’
identifier
 Namespace semantics
May 2, 2006
Shawn Mulkey - EECS 816
37
IDL Syntax

Parameter accessibility
 in
 out
 inout

Exceptions declared with ‘raises’ keyword

Not all semantics available through IDL
 Examples:
security, lifecycle
 Often implemented with standardized object behavior
May 2, 2006
Shawn Mulkey - EECS 816
38
Declaration Example
module CORBA {
interface Object {
InterfaceDef get_interface ();
boolean is_nil();
Object duplicate ();
void release ();
boolean is_a (in string logical_type_id);
boolean is_equivalent ( in Object other_object );
unsigned long hash( in unsigned long maximum);
void create_request (
in Context
ctx,
in Identifier
operation,
in NVList
arg_list,
inout NamedValue
result,
out Request
request,
in Flags
req_flag
);
…………
};
};
May 2, 2006
Shawn Mulkey - EECS 816
39
Standard CORBA Services

ORB
 Encapsulates all server behavior
 Load balancing
 Server initialization and termination
 Performance customization
 Extended features possible

Naming
 Hierarchical object reference map
 Used by ORBs to locate objects or
 Names
May 2, 2006
other ORBs
are symbol links to objects
Shawn Mulkey - EECS 816
40
Optional CORBA Services

Event Notification Service (ENS)
 Publish/subscribe


Register with topic – receive handle
Asynchronous event delivery
 Long

pattern
lived subscription requests
Life-Cycle Service
 Factory
for object creation
 Manages object copy, move & destruction
 Manages backups, repository organization etc.
May 2, 2006
Shawn Mulkey - EECS 816
41
Optional CORBA Services

Transaction Service
 Concurrency
control
 Synchronizes object actions
 Commit and abort semantics

Security Service
 Authentication
 Access
control
 Non-repudiation
May 2, 2006
Shawn Mulkey - EECS 816
42
CORBA Implementations

TAO / ACE
 Free
and product versions
 Dr. Douglas Schmidt

Orbix
 Steven

Vinoski
VisiBroker
 Borland
 Feature
rich
 Wide range of OS and language interopration
May 2, 2006
Shawn Mulkey - EECS 816
43
Agenda





Introduction
Supporting Technologies
Remote Procedure Calls
CORBA
J2EE & RMI

Introduction
 Java RMI
 J2EE

Conclusion
May 2, 2006
Shawn Mulkey - EECS 816
44
RMI Introduction

Remote Method Invocation
An explicit remote procedure call system
which leverages the Java development
framework to facilitate all aspects of RPC
such as binding, transport and marshalling.
May 2, 2006
Shawn Mulkey - EECS 816
45
RMI Implementation

Similar to CORBA semantics
 Requires
name lookup service
 Requests serviced by remote components
 Parameter data types must be marshaled
 Exception system defined in specification

Each component implemented with Java
technology
May 2, 2006
Shawn Mulkey - EECS 816
46
RMI Implementation tools

rmiregistry – Server naming service

rmic – stub compiler

java.io.Serialization – Marshalling system

java.rmi.Remote – Base remoting interface

java.rmi.RemoteException – Base Remoting
exception
May 2, 2006
Shawn Mulkey - EECS 816
47
RMI Interfaces

Server and client components implement java.io.Remote
interface



May be extended with other interfaces
Standard java interface and member declaration syntax as IDL
Example
public interface BankAccount extends java.rmi.Remote {
public void deposit(float amount) throws java.rmi.RemoteException;
public void withdraw(float amount)
throws OverdrawnException, java.rmi.RemoteException;
public float getBalance()
throws java.rmi.RemoteException;
}
May 2, 2006
Shawn Mulkey - EECS 816
48
RMI Protocol
1)
Server process begins
2)
Server process registers one or more objects
with the naming service
3)
Client makes remote call against stub code
4)
Stub code initiates TCP or HTTP stream
connection with server process
May 2, 2006
Shawn Mulkey - EECS 816
49
RMI Protocol
5)
Server accepts connection and
processes RPC
6)
Server sends returns value or exception
7)
Client stub marshals returned data to the
calling procedure
May 2, 2006
Shawn Mulkey - EECS 816
50
RMI Code Sample

RMI Interface
public interface ReceiveMessageInterface extends java.rmi.Remote
{
String transformMessage(String x) throws RemoteException;
}
May 2, 2006
Shawn Mulkey - EECS 816
51
public class RmiServer extends java.rmi.server.UnicastRemoteObject
implements ReceiveMessageInterface
{
public void RmiServer()
{
try{
// create the registry and bind the name and object.
java.rmi.Registry registry = LocateRegistry.createRegistry( 9999 );
registry.rebind("rmiServer", this);
}
catch(RemoteException e)
{
...
}
}
public String receiveMessage(String x) throws RemoteException
{
return x.toUpper();
}
}
May 2, 2006
Shawn Mulkey - EECS 816
52
public class RmiClient
{
static public void main(String args[]) {
try{
// get the “registry”
java.rmi.Registry registry = LocateRegistry.getRegistry(“somehost”, 9999);
// look up the remote object
ReceiveMessageInterface rmiServer =
(ReceiveMessageInterface)(registry.lookup("rmiServer"));
// call the remote method
String result = rmiServer.transformMessage(text);
System.out.println(result);
}
catch(RemoteException e){
…
}
catch(NotBoundException e){
…
}
}
}
May 2, 2006
Shawn Mulkey - EECS 816
53
RMI Summary

Simple and efficient RPC system

Remote call semantics completely transparent to
client and server

Implemented entirely with Java technology

Limited service support
 Security,
May 2, 2006
life-cycle etc.
Shawn Mulkey - EECS 816
54
J2EE Introduction

Java 2 Platform Enterprise Edition
“A set of coordinated specifications and
practices that together enable solutions for
developing, deploying, and managing multitier server-centric applications.”
-Sun Microsystems, J2EE FAQ 2006
May 2, 2006
Shawn Mulkey - EECS 816
55
J2EE Muti-Tier Design

Client Tier



Web Tier



JSP
Servlets
Business Tier



Application process
HTML Pages
Domain Logic
Enterprise Java Beans
Enterprise Information System (EIS) Tier

Database server
May 2, 2006
Shawn Mulkey - EECS 816
56
J2EE Containers

Framework handling low-level details
 Connection
management
 Transaction and state management

Promotes reusable application components
 Usually

called ‘beans’
Container presents API and runtime protocol for
application beans
May 2, 2006
Shawn Mulkey - EECS 816
57
J2EE Container Types

J2EE Server



Enterprise JavaBeans (EJB) Container


Manages EJB components
Web Container



Running process
Container for other servers
HTTP server context
Servlet & JSP Management
Application/Applet Container


Manages client environment
Facilitates connections to the server components
May 2, 2006
Shawn Mulkey - EECS 816
58
J2EE Container Hierarchy
© Sun Microsystems, 2006
May 2, 2006
Shawn Mulkey - EECS 816
59
J2EE Services

Java Naming and Directory Interface (JNDI)

Enterprise ServiceBeans API

Java Servlet API

JavaServer Pages (JSP) API

Java Messaging Service (JMS)
May 2, 2006
Shawn Mulkey - EECS 816
60
J2EE Services

Java Transaction API

JDBC API

Java API for XML Processing & RPC

Java Authentication and Authorization
Service
May 2, 2006
Shawn Mulkey - EECS 816
61
Agenda






Introduction
Supporting Technologies
Remote Procedure Calls
CORBA
J2EE & RMI
Conclusion

Topic Summary
 Questions
 Looking Ahead
May 2, 2006
Shawn Mulkey - EECS 816
62
Topic Summary

Distributed applications consist of multiple
processes communicating via message passing

Remote Procedure Calls permit clients to
request services from remote servers
 Uses

same semantics as local procedures
Most RPC mechanisms have similar
characteristics
 Name
binding
 Data marshalling
 Exception handling
May 2, 2006
Shawn Mulkey - EECS 816
63
Topic Summary

CORBA was first widely excepted OO RPC
framework
 Established
common architecture used by future
distributed frameworks
 Created
Interface Definition Language (IDL) to
express service behavior and data descriptions
 Stubs
and skeletons generators on various platforms
to accommodate interoperability
May 2, 2006
Shawn Mulkey - EECS 816
64
Topic Summary

Sun’s Java RMI (Remote Method Invocation) is
Java specific PRC method
 Uses
Java constructs for RPC management (e.g.
naming, marshaling, etc.)
 Simple
and elegant architecture
 Generates
 Limited
May 2, 2006
Java stubs and skeletons
built-in services
Shawn Mulkey - EECS 816
65
Topic Summary

Java 2 Enterprise Edition (J2EE)
 Framework
 Provides
for distributed application development
containers to handle low-level details
 Applications
consist of relatively simple ‘beans’ which
perform application specific logic
 Host
of services available to facilitate distributed
behavior
May 2, 2006
Shawn Mulkey - EECS 816
66
Questions
?
?
Who, What, Where, Why, How?
?
May 2, 2006
?
Shawn Mulkey - EECS 816
?
67
Looking Ahead

Microsoft .Net Technologies

SOAP Web Services

Grid Computing
May 2, 2006
Shawn Mulkey - EECS 816
68
Distributed Computing & Object
Oriented Middleware: Part 1
Thanks !
Shawn Mulkey
May 2, 2006
Shawn Mulkey - EECS 816
69
Download