COP 4991 Component Based Software Development Lecture #2 Distributed and Web Computing Onyeka Ezenwoye.

Slides:



Advertisements
Similar presentations
Message Passing Vs Distributed Objects
Advertisements

What is RMI? Remote Method Invocation –A true distributed computing application interface for Java, written to provide easy access to objects existing.
Remote Procedure Call (RPC)
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Emery Berger University of Massachusetts Amherst Operating Systems CMPSCI 377 Lecture.
Copyright © 2001 Qusay H. Mahmoud RMI – Remote Method Invocation Introduction What is RMI? RMI System Architecture How does RMI work? Distributed Garbage.
Advanced Programming Rabie A. Ramadan Lecture 4. A Simple Use of Java Remote Method Invocation (RMI) 2.
Reliability on Web Services Presented by Pat Chan 17/10/2005.
Java Remote Method Invocation (RMI) In Java we implement object systems: O1O2 O3 thread 1thread 2 execution scheme JVM 1JVM 2 distribution scheme.
Java Remote Object Invocation (RMI) Overview of RMI Java RMI allowed programmer to execute remote function class using the same semantics as local functions.
Remote Method Invocation
Distributed components
FONG CHAN SING (143334) WONG YEW JOON (143388). JAVA RMI is a distributive system programming interface introduced in JDK 1.1. A library that allows an.
Middleware Fatemeh Hendijanifard 1 آزمايشگاه سيستم هاي هوشمند (
Remote Method Invocation Chin-Chih Chang. Java Remote Object Invocation In Java, the object is serialized before being passed as a parameter to an RMI.
Advanced Java Class Network Programming. Network Protocols Overview Levels of Abstraction –HTTP protocol: spoken by Web Servers and Web Clients –TCP/IP:
Sockets  Defined as an “endpoint for communication.”  Concatenation of IP address + port.  Used for server-client communication.  Server waits for.
EEC-681/781 Distributed Computing Systems Lecture 5 Wenbing Zhao Department of Electrical and Computer Engineering Cleveland State University
Software Engineering and Middleware: a Roadmap by Wolfgang Emmerich Ebru Dincel Sahitya Gupta.
Introduction to Remote Method Invocation (RMI)
OCT 1 Master of Information System Management Organizational Communications and Distributed Object Technologies Lecture 5: Distributed Objects.
Java Remote Object Invocation (RMI) Overview of RMI Java RMI allowed programmer to execute remote function class using the same semantics as local functions.
Practical Issues of RPCCS-4513, D-Term Remote Procedure Call Practical Issues CS-4513 Distributed Computing Systems (Slides include materials from.
Software Engineering and Middleware A Roadmap Author: Wolfgang Emmerich Presented by: Sam Malek.
1 Java Programming II Java Network II (Distributed Objects in Java)
1 G52IWS: Distributed Computing Chris Greenhalgh.
Communication Tran, Van Hoai Department of Systems & Networking Faculty of Computer Science & Engineering HCMC University of Technology.
CS 390- Unix Programming Environment CS 390 Unix Programming Environment Topics to be covered: Distributed Computing Fundamentals.
Information Management NTU Interprocess Communication and Middleware.
Java RMI: Remote Method Invocation January 2000 Nancy McCracken Syracuse University.
Java Remote Method Invocation (RMI) ). Distributed Systems  a collection of independent computers that appears to its users as a single coherent system.
1 Java RMI G53ACC Chris Greenhalgh. 2 Contents l Java RMI overview l A Java RMI example –Overview –Walk-through l Implementation notes –Argument passing.
Spring/2002 Distributed Software Engineering C:\unocourses\4350\slides\DefiningThreads 1 RMI.
Silberschatz, Galvin, and Gagne  1999 Applied Operating System Concepts Chapter 15: Distributed Communication Sockets Remote Procedure Calls (RPCs) Remote.
Java Remote Method Invocation RMI. Idea If objects communicate with each other on one JVM why not do the same on several JVM’s? If objects communicate.
RMI remote method invocation. Traditional network programming The client program sends data to the server in some intermediary format and the server has.
RMI Remote Method Invocation Distributed Object-based System and RPC Together 2-Jun-16.
Java Remote Object Invocation (RMI) Overview of RMI Java RMI allowed programmer to execute remote function class using the same semantics as local functions.
 Remote Method Invocation  A true distributed computing application interface for Java, written to provide easy access to objects existing on remote.
Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved Chapter 43 Remote Method Invocation.
Hwajung Lee.  Interprocess Communication (IPC) is at the heart of distributed computing.  Processes and Threads  Process is the execution of a program.
CORBA Common Object Request Broker Architecture. Basic Architecture A distributed objects architecture. Logically, an object client makes method calls.
Chapter 5: Distributed objects and remote invocation Introduction Remote procedure call Events and notifications.
Java Remote Method Invocation (RMI) Overview of RMI Java RMI allowed programmer to execute remote function class using the same semantics as local functions.
 Java RMI Distributed Systems IT332. Outline  Introduction to RMI  RMI Architecture  RMI Programming and a Sample Example:  Server-Side RMI programming.
Remote Method Invocation A Client Server Approach.
UMBC Distributed Computing with Objects RMI/Corba CMSC 432 Shon Vick.
Computer Science Lecture 4, page 1 CS677: Distributed OS Last Class: RPCs RPCs make distributed computations look like local computations Issues: –Parameter.
Liang, Introduction to Java Programming, Fifth Edition, (c) 2005 Pearson Education, Inc. All rights reserved Chapter 29 Remote Method.
Distributed Web Systems Distributed Objects and Remote Method Invocation Lecturer Department University.
Java Distributed Computing
Chapter 4 Remote Method Invocation
Java Distributed Object System
Java Distributed Computing
Remote Method Invocation
What is RMI? Remote Method Invocation
Remote Method Invocation
#01 Client/Server Computing
Network and Distributed Programming in Java
Inventory of Distributed Computing Concepts and Web services
Lecture 4: RPC Remote Procedure Call Coulouris et al: Chapter 5
Inventory of Distributed Computing Concepts
Chapter 40 Remote Method Invocation
Lecture 4: RPC Remote Procedure Call CDK: Chapter 5
Creating a Distributed System with Remote Procedure Calls and Web Services Ch.5 B.Ramamurthy 2/17/2019 B.Ramamurthy.
Chapter 46 Remote Method Invocation
Chapter 46 Remote Method Invocation
Java Remote Method Invocation
CSE 451: Operating Systems Messaging and Remote Procedure Call (RPC)
#01 Client/Server Computing
Presentation transcript:

COP 4991 Component Based Software Development Lecture #2 Distributed and Web Computing Onyeka Ezenwoye

Acknowledgement Lou Somers Alex Chaffee

BASIC Beginners All-purpose Symbolic Instruction Code John Kemeny and Thomas Kurtz, 1963 General-purpose language Easy to use?

BASIC 10 REM a great BASIC program 20 PRINT “Hello There!” 30 INPUT “Please enter your age:” age 40 IF age > 1 AND age < 21 GOTO IF age > 29 GOTO PRINT “You are still a baby!” GOTO PRINT “You are ready for retirement!” 80 END

BASIC The GOTO problem What on earth does line 2970 do? Code in single continuous block Great for “K-LOCers” Unstructured Not reusable Not “easy to use”!

Structure in language Program structure composed of sub- structures Essentially functions and subroutines y = add(a,b) x = multiply(y, z) Single point of entry, multiple points of exit. Promote modularity

Object-oriented programming More sophisticated form of modularity The world is made of objects Think objects, not procedures y = Math.add(a,b) x = Math.multiply(y,z) Program is a collection of objects (class libraries)

Interface Communication boundary between two entities (software) Abstraction about software component Well defined entry point Enables interaction Method signatures int add(int, int) Math multiply add

Complexity Need for modularity

Multi-tier applications Split application logic Reduce cost, improve maintainability Improve scalability Use multiple partners three-tier application client app serverDB server

Client-server Enables separation between modules A request-response interaction style. Uniform interface: resources accessed with a generic interface (e.g., HTTP GET, POST). Named resources - the system is comprised of resources which are accessed using a URL. Easier to build, maintain and extend components Standardization Interoperability

HTTP (Hypertext Transfer Protocol) Request/response communication protocol between client and server. Est. TCP connection to port 80 on server HTTP GET –Requests a resource, identified by the URL HTTP POST –Sends data to be processed

RPC (remote procedure call) The act of invoking a method over a network Remote component integration Client-Server message passing Location transparent Tight coupling between client and remote applications Math add y=Math.add(a,b) Internet

RPC Client Call Client Stub Pack and send parameters Receive and unpack parameters Pack and send results Execute procedure Return Receive and unpack results Server StubServer Message

Client Java object Java RMI Remote Java object TCP Java Remote Method Invocation

Remote Objects –Live on server –Accessed as if they were local

Registries Name and look up remote objects Servers can register their objects Clients can find server objects and obtain a remote reference A registry is a running process on a host machine

Stubs and Skeletons Stub –lives on client –pretends to be remote object Skeleton –lives on server –receives requests from stub –talks to true remote object –delivers response to stub Skeleton Remote object Stub Client object

Remote Interfaces and Stubs Remote Interface Stub Remote Object (Server) ClientSkeleton implements

RMI System Architecture Client Virtual Machine Client Server Virtual Machine Stub Remote Object Skeleton Registry Virtual Machine “Fred” Server

RMI System Architecture Client Virtual Machine Client Server Virtual Machine Stub Remote Object Skeleton Registry Virtual Machine “Fred” Server Server Creates Remote Object 2. Server Registers Remote Object

RMI System Architecture Client Virtual Machine Client Server Virtual Machine Stub Remote Object Skeleton Registry Virtual Machine “Fred” Server 4 3. Client requests object from Registry 4. Registry returns remote reference (and stub gets created) 3

RMI System Architecture Client Virtual Machine Client Server Virtual Machine Stub Remote Object Skeleton Registry Virtual Machine “Fred” Server 6 5. Client invokes stub method 6. Stub talks to skeleton 7. Skeleton invokes remote object method 57

Creating Remote Objects Define a Remote Interface –extends java.rmi.Remote Define a class that implements the Remote Interface –extends java.rmi.RemoteObject –or java.rmi.UnicastRemoteObject

Remote Interface Example import java.rmi.*; public interface Adder extends Remote { public int add(int x, int y) throws RemoteException; }

Remote Class Example import java.rmi.*; import java.rmi.server.*; public class AdderImpl extends UnicastRemoteObject implements Adder { public AdderImpl() throws RemoteException { } public int add(int x, int y) throws RemoteException { return x + y; }

Compiling Remote Classes Compile the Java class –javac reads.java file produces.class file Compile the Stub and Skeleton –rmic reads.class file produces _Skel.class and _Stub.class

Compiling Remote Classes (Diagram) Adder.java (interface) Adder.class (interface classfile) javac AdderImpl.java (remote class) AdderImpl.class (classfile) javac rmic AdderImpl_Skel.class (skeleton classfile) AdderImpl_Stub.class (stub classfile)

Registering Remote Classes start the registry –running process Unix: rmiregistry & Windows: start /m rmiregistry

Create the server Creates a new instance of the remote object Registers it in the registry with a unique name That’s it

RMI Server Example try { AdderImpl adder = new AdderImpl(); Naming.rebind("adder", adder); System.out.println("Adder bound"); } catch (RemoteException re) { re.printStackTrace(); } catch (MalformedURLException me) { me.printStackTrace(); }

Launch the Server % java AdderServer & Adder bound

Server Logging invoke from command line java -Djava.rmi.server.logCalls=true YourServerImpl or enable inside program RemoteServer.setLog(System.err);

Creating an RMI Client Install a Security Manager –to protect from malicious stubs Find a registry –use java.rmi.Naming Lookup the name, returns a reference Cast the reference to the appropriate Remote Interface Just use it!

RMI URLs rmi://host[:port]/name default port is 1099 Specifies hostname of registry can also use relative URLs –name only –assumes registry is on local host

RMI Client Example Adder a = (Adder) Naming.lookup(“rmi://localhost/add er"); int sum = a.add(2,2); System.out.println("2+2=" + sum);

Object Serialization aka Persistence saves the state (data) of a particular instance of an object serialize - to save unserialize - to load

Java Serialization writes object as a sequence of bytes writes it to a Stream recreates it on the other end creates a brand new object with the old data

Not All Objects Are Serializable Any object that doesn’t implement Serializable Any object that would pose a security risk –e.g. FileInputStream Any object whose value depends on VM- specific information –e.g. Thread

Limitations of RMI Java-only

Middleware “The glue which connects objects which are distributed across multiple heterogeneous computer systems” “A software layer that serves to shield the application of the heterogeneity of the underlying computer platforms and networks” Distribution Middleware

Middleware goals Integrate existing components into a distributed system –Components may be off-the-shelf –Components may have incompatible requirements for hardware and OS platforms –Scalability requires distribution (not centralized or client server). Resolve heterogeneity –Facilitate communication and coordination of distributed components –Build systems distributed across a local area network, the internet – Future: adaptive, reconfigurable

Requirements of middleware / 1 Network communication –Need higher level primitives than network operating system primitives –Transport complex data structures over the network (marshalling / unmarshalling) Coordination –Three models: Synchronous: client waits for result Deferred synchronous: client asks for result (e.g. by polling) Asynchronous: server initiates result –Group requests –Component activation / deactivation –Concurrent requests

Requirements of middleware / 2 Reliability –Error detection and correction mechanisms on top of network protocols Scalability –Access to a component independent of whether it is local or remote –Migration transparency –Replication transparency Heterogeneity –Primitive data encoding –Different programming languages

Middleware categories Transactional middleware –Offers a tuple abstraction (SQL) –Distributed transaction processing (DTP protocol) Message oriented (MOM) –Offers a mailbox abstraction –Asynchronous messages Procedural (RPC) –Offers a procedure abstraction –Synchronous client / server interaction Object and component –Offers an object abstraction –(A)synchronous client / server interaction

Transactional middleware / 1 Transactions on distributed relational database –Two-phase commit protocol to implement distributed transactions Examples –IBM CICS –BEA Tuxedo –LDAP (simple protocol to access remote directories, no transactions)

Transactional middleware / 2 Network communication –Client and servers may reside on different hosts Coordination –Synchronous and asynchronous Reliability –DTP (Distributed Transaction Protocol): two phase commit –ACID properties: –Atomic: transaction is either complete or not –Consistent: system always in consistent state –Isolation: transaction is independent of other transactions –Durable: committed transaction survives system failures Scalability –Load balancing and replication of server components Heterogeneity –Different hardware and operating systems platforms –No data heterogeneity

Message oriented middleware / 1 Exchange messages between components –“Mailbox” Examples –Java Message Queue –IBM MQSeries

Message oriented middleware / 2 Network communication –Client sends message, server replies with result –Well suited for event notification and publish / subscribe Coordination –Asynchronous –Synchronous has to be coded by client Reliability –Message queues are stored on persistent memory –At-least-once semantics possible Scalability –Local / remote differs Heterogeneity –Marshalling code has to be written by hand

Procedural middleware / 1 Remote procedure calls (RPC) –Procedures can be called across the network Examples –Unix RPC’s –DCE RPC (Distributed Computing Environment) –Windows RPC’s –XML-RPC

Procedural middleware / 2 Network communication –Server exports parameterized procedures –Clients call these across the network –Marshalling and unmarshalling by client and server stubs (generated by the compiler) Coordination –Synchronous interaction between one client and one server –Startup on demand possible (daemon needs a table that maps RPC names to program locations in the file system) Reliability –At-most-once semantics (exception if RPC fails) No scalability Heterogeneity –Can be used between different programming languages –Across different hardware and OS platforms

Object middleware / 1 Objects are available across the network Examples –Corba –COM, DCOM –Java RMI, Enterprise Java Beans

Enterprise A Java RMI App 1App 2 Enterprise B COM App 1App 2 Enterprise C CORBA App 1App 2 COM/RMI bridge COM/CORBA bridge

Enterprise A Java RMI App 1App 2 Enterprise B COM App 1App 2 Enterprise C CORBA App 1App 2 COM/RMI bridge COM/CORBA bridge protocol change

Reading List Patricia Soares, “On Remote Procedure Call ” Birrell et. al., “Implementing Remote Procedure Calls” Eugster et. al., “The Many Faces of Publish/Subscribe” Talarian Corp., “Talarian: Everything You Need Know About Middleware” David B akken,”Middleware” Bertrand Meyer, “The Reusability Challenge” Ted Lewis, “Where is Client/Server Software Headed?” Scot Lewandowski,”Frameworks for Component-Based Client/Server Computing”