Last Class: Network Overview. Today: Distributed Systems

Similar documents
Course Snapshot. The Next Few Classes. Parallel versus Distributed Systems. Distributed Systems. We have covered all the fundamental OS components:

Course Snapshot. The Next Few Classes

Distributed Computing

Distributed Systems. Distributed Object Systems 2 Java RMI. Java RMI. Example. Applet continued. Applet. slides2.pdf Sep 9,

RMI (Remote Method Invocation) Over the year, there have been 3 different approaches to application development:

JAVA RMI. Remote Method Invocation

Object Interaction. Object Interaction. Introduction. Object Interaction vs. RPCs (2)

Remote Procedure Call

Remote Method Invocation

5.4. Events and notifications

Introduction & RMI Basics. CS3524 Distributed Systems Lecture 01

Written by: Dave Matuszek

Contents. Java RMI. Java RMI. Java RMI system elements. Example application processes/machines Client machine Process/Application A

RMI. Remote Method Invocation. 16-Dec-16

5 Distributed Objects: The Java Approach

COMP 6231: Distributed System Design

DISTRIBUTED OBJECTS AND REMOTE INVOCATION

Distributed Systems. 5. Remote Method Invocation

Communication Basics, RPC & RMI. CS403/534 Distributed Systems Erkay Savas Sabanci University

Remote Method Invocation

Component-Based Software Engineering

JAC444 - Lecture 11. Remote Method Invocation Segment 2 - Develop RMI Application. Jordan Anastasiade Java Programming Language Course

The UNIVERSITY of EDINBURGH. SCHOOL of INFORMATICS. CS4/MSc. Distributed Systems. Björn Franke. Room 2414

RPC flow. 4.3 Remote procedure calls IDL. RPC components. Procedure. Program. sum (j,k) int j,k; {return j+k;} i = sum (3,7); Local procedure call

Outline. EEC-681/781 Distributed Computing Systems. The OSI Network Architecture. Inter-Process Communications (IPC) Lecture 4

03 Remote invocation. Request-reply RPC. Coulouris 5 Birrel_Nelson_84.pdf RMI

CS193k, Stanford Handout #12. Threads 4 / RMI

Distributed Systems COMP 212. Lecture 10 Othon Michail

Distributed Software Systems

presentation DAD Distributed Applications Development Cristian Toma

RMI Case Study. A Typical RMI Application

RMI Example RMI. CmpE 473 Internet Programming RMI

JAVA RMI Java, summer semester

Remote Method Invocation in Java

Chapter 15: Distributed Communication. Sockets Remote Procedure Calls (RPCs) Remote Method Invocation (RMI) CORBA Object Registration

Generic architecture

Distributed Systems. 02r. Java RMI Programming Tutorial. Paul Krzyzanowski TA: Long Zhao Rutgers University Fall 2017

Message Passing vs. Distributed Objects. 5/15/2009 Distributed Computing, M. L. Liu 1

Questions and Answers. A. RMI allows us to invoke a method of java object that executes on another machine.

Activation of remote objects

Remote Objects and RMI

Verteilte Systeme (Distributed Systems)

Distributed Systems. 6. Remote Method Invocation. Werner Nutt

Chapter 4: Processes. Process Concept. Process State

Distributed object component middleware I - Java RMI

Distributed object component middleware I - Java RMI

Remote Method Invocation

Lab 2 : Java RMI. request sayhello() Hello interface remote object. local object. response "Hello world"

Bharati Vidyapeeth s Institute of Computer Applications and Management A-4, Paschim Vihar, New Delhi-63.

How are classes loaded into the Java Virtual Machine (JVM)? from the local file system (CLASSPATH). by an instance of ClassLoader

Applications. RMI, RPC and events. Request reply protocol External data representation. Operating System

Activation of remote objects

Reflection/RMI 4/28/2009

Distributed Systems. The main method of distributed object communication is with remote method invocation

Chapter 5 Distributed Objects and Remote Invocation

DISTRIBUTED COMPUTING

RMI. (Remote Method Invocation)

Agent and Object Technology Lab Dipartimento di Ingegneria dell Informazione Università degli Studi di Parma. Distributed and Agent Systems RMI

CS555: Distributed Systems [Fall 2017] Dept. Of Computer Science, Colorado State University

IBD Intergiciels et Bases de Données

Modulo II Socket, RMI e Corba

CSci Introduction to Distributed Systems. Communication: RPC In Practice

CS 5523 Operating Systems: Remote Objects and RMI

Concurrent Programming (RIO) Lesson 9. Ch 8 [BenA 06] Messages Channels Rendezvous RPC and RMI. X=f(..); send X to B. OS kernel.

Java WebStart, Applets & RMI

BEA WebLogic. Server. Programming WebLogic RMI

Chapter 4 Remote Procedure Calls and Distributed Transactions

Communication and Distributed Processing

Distributed Programming in Java. Distribution (2)

CC755: Distributed and Parallel Systems

Distributed Objects. Chapter Distributing Objects Overview

Communication and Distributed Processing

Lecture VI: Distributed Objects. Remote Method Invocation

Concurrency Control in Distributed Environment

Remote Method Invocation Benoît Garbinato

Remote Method Invocation. Benoît Garbinato

Last Class: RPCs. Today:

Java RMI Activation: A running example We have the following classes: MyRemoteInterface: the remote interface. Client: the client that invokes a

Outline. Chapter 4 Remote Procedure Calls and Distributed Transactions. Remote Procedure Call. Distributed Transaction Processing.

55:182/22C:182. Distributed Application Frameworks Java RMI, CORBA, Web Services (SOAP)

Desarrollo de Aplicaciones en Red RMI. Introduction. Considerations. Considerations. RMI architecture

Grid Computing. Java Remote Method Invocation (RMI) RMI Application. Grid Computing Fall 2006 Paul A. Farrell 9/5/2006

Lecture 18 Inside Java RMI

Distributed Objects SPL/ SPL 201 / 0 1

Lecture 5: Object Interaction: RMI and RPC

Last Class: RPCs. Today:

BEA WebLogic Server. Programming WebLogic RMI

Department of Computer Science & Engineering. M.Tech(CSE)-I Year-II Semester WEB SERVICES AND SERVICE ORIENTED ARCHITECHTURE (B1513) Mr.K.

IJESRT. http: //

Distributed Computing

RPC and RMI. 2501ICT Nathan

Remote Invocation. Today. Next time. l Overlay networks and P2P. l Request-reply, RPC, RMI

CSci Introduction to Distributed Systems. Communication: RPC

Architecture of So-ware Systems RMI and Distributed Components. Mar<n Rehák

A Typical RMI Application

Web. Remote Method Invocation. core. programming. Training Courses: Java, JSP, Servlets, Struts, & JSF:

A Typical RMI Application. Case Study

Remote Invocation Vladimir Vlassov and Johan Montelius

1 interface TemperatureSensor extends java.rmi.remote 2 { 3 public double gettemperature() throws java.rmi.remoteexception; 4 public void

DIFFERENCE BETWEEN APPLET AND APPLICATION

Transcription:

Last Class: Network Overview =>Processes in a distributed system all communicate via a message exchange. Physical reality: packets Abstraction: messages limited size arbitrary size unordered (sometimes) ordered unreliable reliable machine to machine process to process (routing) asynchronous synchronous insecure secure Unless otherwise stated, assume a reliable end-to-end message delivery. Lecture 25, page 1 Today: Distributed Systems What gets harder when we move from a stand alone system to a distributed environment? resource sharing timing (e.g., synchronization) critical sections deadlock detection and recovery failure recovery Lecture 25, page 2 1

Resource Sharing There are many mechanisms for sharing (hardware, software, data) resources. Data Migration: moving the data around Computation Migration: move the computation to the data Job Migration: moving the job (computation and data) or part of the job => The fundamental tradeoff in resource sharing is to complete user instructions as fast and as cheaply as possible. (Fast and cheap are usually incompatible.) Lecture 25, page 3 Computation versus Communication If communication is fast and cheap, we can utilize all the resources in the distributed environment. If communication is slow and expensive, we should do most processing locally. Reality is usually in the middle somewhere. => we need a quantitative analysis to decide where the cutoffs are. Lecture 25, page 4 2

Data Migration Data Migration may occur when process at site A accesses a file at site B. 1. Copy file B to process A Costly if the file is large Data must be converted to A's data format Multiple copies can cause consistency problems All subsequent accesses at A are local 2. Keep file at B, access file remotely from A Saves file transfer cost Converting the file from A's format to B's may be difficult to do in pieces Single copy of file, so no consistency problems Single file service center for file at B may be a performance bottleneck Lecture 25, page 5 Computation Migration Computation Migration may occur when it is more efficient to transfer the computation itself rather than data. Example: a small program which produces a short summary of a large file, say wc or a database query Remote Procedure Calls (RPC): suppose A wants to access file at site B. B provides a predefined process. A sends a message to the predefined process at B, which performs the requested action, and sends the result back to A. Lecture 25, page 6 3

Job Migration Job Migration: perform the job (or parts of the job) at remote sites by moving the data and computation. Load balancing: even workload across the distributed system Computational speedup: concurrent (parallel) execution of parts of the job. Hardware preference: job may match a given piece of hardware somewhere in the system. Software preference: job may require software only available on a specific site. For example, site specific license of expensive software. User interaction: may want to hide migration from the user. For example, in load balancing. May want the user to specify migration (hardware/software preferences) Lecture 25, page 7 Client/Server Model One of the most common models for structuring distributed computation is by using the client/server paradigm. A server is a process or collection of processes that provide a service, e.g., name service, file service, database service, etc. The server may exist on one or more nodes. A client is a program that uses the service. A client first binds to the server, i.e., locates it in the network and establishes a connection. The client then sends the server a request to perform some action. The server sends back a response. RPC is one common way this structure is implemented. Lecture 25, page 8 4

Remote Procedure Call Basic idea: Servers export procedures for some set of clients to call. To use the server, the client does a procedure call. OS manages the communication. Lecture 25, page 9 Remote Procedure Call: Implementation Issues For each procedure on which we want to support RPC: The RPC mechanism uses the procedure signature (number and type of arguments and return value) to generate a client stub that bundles up the RPC arguments and sends it off to the server, and to generate the server stub that unpacks the message, and makes the procedure call. Lecture 25, page 10 5

Client Stub: build message send message wait for response unpack reply return result Remote Procedure Call: Implementation Issues Server Stub: create threads Lecture 25, page 11 loop wait for a command unpack request parameters call procedure with thread build reply with result(s) send reply end loop Comparison between RPC and a regular procedure call Name of procedure Parameters Result Return address Remote Procedure Call How does the client know the right port? The binding can be static - fixed at compile time. Or the binding can be dynamic - fixed at runtime. In most RPC systems, dynamic binding is performed using a name service. When the server starts up, it exports its interface and identifies itself to a network name server The client, before issuing any calls, asks the name service for the location of a server whose name it knows and then establishes a connection with the server. Lecture 25, page 12 6

Example: Remote Method Invocation (RMI) in Java Java provides the following classes/interfaces: Naming: class that provides the calls to communicate with the remote object registry public static void bind(string name, Remote obj) - Binds a server to a name. public static Remote lookup(string name) - Returns the server object that corresponds to a name. UnicastRemoteObject: supports references to non-replicated remote objects using TCP, exports the interface automatically when the server object is constructed Java provides the following tools: rmiregistry server-side name server rmic: given the server interface, generates client and server stubs that create and interpret packets Lecture 25, page 13 Example: Server in Java Server Defines an interface listing the signatures of methods the server will satisfy Implements each of the methods in the interface Main program for server: Creates one or more server objects - normal constructor call where the object being constructed is a subclass of RemoteObject Registers the objects with the remote object registry Client Looks up the server in the remote object registry Uses normal method call syntax for remote methods Should handle RemoteException Lecture 25, page 14 7

Example: Hello World Server Interface Declare the methods that the server provides: package examples.hello; // All servers must extend the Remote interface. public interface Hello extends java.rmi.remote { // Any remote method might throw RemoteException. // Indicates network failure. String sayhello() throws java.rmi.remoteexception; Lecture 25, page 15 Example: Hello World Server package examples.hello; import java.rmi.*; import java.rmi.server.unicastremoteobject; public class HelloImpl extends UnicastRemoteObject implements Hello { public HelloImpl() throws RemoteException { // The superclass constrctor exports the interface and gets a port super(); public String sayhello() throws RemoteException { // This is the "service" provided. return "Hello World!"; Lecture 25, page 16 8

Example: Hello World Server (contd) public static void main(string args[]) { // Create and install a security manager System.setSecurityManager(new RMISecurityManager()); // Construct the server object. HelloImpl obj = new HelloImpl(); // Register the server with the name server. Naming.rebind("//myhost/HelloServer", obj); Lecture 25, page 17 Example: Hello World Client package examples.hello; import java.awt.*; import java.rmi.*; public class HelloApplet extends java.applet.applet { String message = ""; // The init method begins the execution of the applet on the client // machine that is viewing the Web page containing the reference // to the applet. public void init() { try { // Looks up the server using the name server on the host that // the applet came from. Hello obj = (Hello)Naming.lookup( "//" + getcodebase().gethost() + "/HelloServer"); Lecture 25, page 18 9

Example: Hello World Client (contd) // Calls the sayhello method on the remote object. message = obj.sayhello(); catch (RemoteException e) { System.out.println("HelloApplet RemoteException caught"); public void paint(graphics g) { // The applet will write the string returned by the remote method // call on the display. g.drawstring(message, 25, 50); Lecture 25, page 19 Summary Data, computation, job migration Client-Server Model Mechanism: RPC Most common model for communications in distributed applications. RPC is essentially language support for distributed programming. Relies on a stub compiler to automatically produce client/server stubs from the signatures. RPC is commonly used even on a single node for communication between applications running in different address spaces. Lecture 25, page 20 10