Distributed Systems Lecture 8 RPC and marshalling 1.

Slides:



Advertisements
Similar presentations
COS 461 Fall 1997 Network Objects u first good implementation: DEC SRC Network Objects for Modula-3 u recent implementation: Java RMI (Remote Method Invocation)
Advertisements

CSE 486/586 Distributed Systems Remote Procedure Call
RPC Robert Grimm New York University Remote Procedure Calls.
Remote Procedure Call (RPC)
Remote Procedure Call Design issues Implementation RPC programming
Distributed Objects and Remote Invocation
Tam Vu Remote Procedure Call CISC 879 – Spring 03 Tam Vu March 06, 03.
Lecture 8-1 Computer Science 425 Distributed Systems CS 425 / CSE 424 / ECE 428 Fall 2012 Indranil Gupta (Indy) September 20, 2012 Lecture 8 RPCs and Distributed.
Distributed Object & Remote Invocation Vidya Satyanarayanan.
Remote Procedure CallCS-4513, D-Term Remote Procedure Call CS-4513 Distributed Computing Systems (Slides include materials from Operating System.
Distributed Computing
Copyright © George Coulouris, Jean Dollimore, Tim Kindberg This material is made available for private study and for direct.
CORBA Case Study By Jeffrey Oliver March March 17, 2003CORBA Case Study by J. T. Oliver2 History The CORBA (Common Object Request Broker Architecture)
CS490T Advanced Tablet Platform Applications Network Programming Evolution.
Introduction to Remote Method Invocation (RMI)
OCT 1 Master of Information System Management Organizational Communications and Distributed Object Technologies Lecture 5: Distributed Objects.
Communication in Distributed Systems –Part 2
.NET Mobile Application Development Remote Procedure Call.
CSE 486/586, Spring 2013 CSE 486/586 Distributed Systems Remote Procedure Call Steve Ko Computer Sciences and Engineering University at Buffalo.
CSE 486/586 CSE 486/586 Distributed Systems Remote Procedure Call Steve Ko Computer Sciences and Engineering University at Buffalo.
CS 390- Unix Programming Environment CS 390 Unix Programming Environment Topics to be covered: Distributed Computing Fundamentals.
CS425 /CSE424/ECE428 – Distributed Systems – Fall Nikita Borisov - UIUC1 Material derived from slides by I. Gupta, M. Harandi, J. Hou, S.
11 September 2008CIS 340 # 1 Topics To examine the variety of approaches to handle the middle- interaction (continued) 1.RPC-based systems 2.TP monitors.
Introduction to Distributed Systems Slides for CSCI 3171 Lectures E. W. Grundke.
Chapter 4: Interprocess Communication‏ Pages
Lecture 15-1 Computer Science 425 Distributed Systems CS 425 / CSE 424 / ECE 428 Fall 2010 Indranil Gupta (Indy) October 12, 2010 Lecture 15 RPCs and Distributed.
Distributed Objects and Middleware. Sockets and Ports Source: G. Coulouris et al., Distributed Systems: Concepts and Design.
CSE 451: Operating Systems Winter 2015 Module 22 Remote Procedure Call (RPC) Mark Zbikowski Allen Center 476 © 2013 Gribble, Lazowska,
IS473 Distributed Systems CHAPTER 5 Distributed Objects & Remote Invocation.
Page 1 Remote Procedure Calls Paul Krzyzanowski Distributed Systems Except as otherwise noted, the content of this presentation.
Chapter 5: Distributed objects and remote invocation Introduction Remote procedure call Events and notifications.
CS 425/ECE 428/CSE 424 Distributed Systems (Fall 2009) Lecture 18 Distributed Objects (II) Sections , Chapter
Distributed Objects & Remote Invocation
Distributed Objects and Remote Invocation Source: George Colouris, Jean Dollimore, Tim Kinderberg & Gordon Blair (2012). Distributed Systems: Concepts.
Remote Procedure Call RPC
Lecture 4 Mechanisms & Kernel for NOSs. Mechanisms for Network Operating Systems  Network operating systems provide three basic mechanisms that support.
Today: Distributed Objects and Components 1. Me Greg Paperin MSci Computer Science href= 2.
Computer Science Lecture 3, page 1 CS677: Distributed OS Last Class: Communication in Distributed Systems Structured or unstructured? Addressing? Blocking/non-blocking?
Lecture 8-1 Computer Science 425 Distributed Systems CS 425 / ECE 428 Fall 2013 Indranil Gupta (Indy) September 19, 2013 Lecture 8 RPCs and Distributed.
Distributed objects and remote invocation Pages
© Oxford University Press 2011 DISTRIBUTED COMPUTING Sunita Mahajan Sunita Mahajan, Principal, Institute of Computer Science, MET League of Colleges, Mumbai.
Topic 5: CORBA RMI Dr. Ayman Srour
Computer Science Lecture 4, page 1 CS677: Distributed OS Last Class: RPCs RPCs make distributed computations look like local computations Issues: –Parameter.
Distributed Computing & Embedded Systems Chapter 4: Remote Method Invocation Dr. Umair Ali Khan.
Topic 4: Distributed Objects Dr. Ayman Srour Faculty of Applied Engineering and Urban Planning University of Palestine.
Topic 3: Remote Invocation Dr. Ayman Srour Faculty of Applied Engineering and Urban Planning University of Palestine.
Distributed Web Systems Distributed Objects and Remote Method Invocation Lecturer Department University.
Object Interaction: RMI and RPC 1. Overview 2 Distributed applications programming - distributed objects model - RMI, invocation semantics - RPC Products.
03 – Remote invoaction Request-reply RPC RMI Coulouris 5
CSE 486/586 Distributed Systems Remote Procedure Call
Programming Models for Distributed Application
CSE 451: Operating Systems Winter 2006 Module 20 Remote Procedure Call (RPC) Ed Lazowska Allen Center
DISTRIBUTED COMPUTING
Lecture 4: RPC Remote Procedure Call Coulouris et al: Chapter 5
CSE 451: Operating Systems Autumn 2003 Lecture 16 RPC
CSE 451: Operating Systems Winter 2007 Module 20 Remote Procedure Call (RPC) Ed Lazowska Allen Center
Lecture 4: RPC Remote Procedure Call CDK: Chapter 5
CSE 451: Operating Systems Winter 2004 Module 19 Remote Procedure Call (RPC) Ed Lazowska Allen Center
Remote method invocation (RMI)
CSE 451: Operating Systems Spring 2012 Module 22 Remote Procedure Call (RPC) Ed Lazowska Allen Center
CSE 451: Operating Systems Autumn 2009 Module 21 Remote Procedure Call (RPC) Ed Lazowska Allen Center
Distribution Infrastructures
Lecture 6: RPC (exercises/questions)
Remote invocation (call)
CSE 451: Operating Systems Autumn 2010 Module 21 Remote Procedure Call (RPC) Ed Lazowska Allen Center
Lecture 6: RPC (exercises/questions)
Lecture 7: RPC (exercises/questions)
CSE 451: Operating Systems Winter 2003 Lecture 16 RPC
Last Class: Communication in Distributed Systems
CSE 451: Operating Systems Messaging and Remote Procedure Call (RPC)
Presentation transcript:

Distributed Systems Lecture 8 RPC and marshalling 1

Previous lecture Multicast – Overview – Message ordering 2

Motivation Setting – You write a program where objects call each other – Works well if the program runs on one process – What if you split your objects across multiple processes? – Can Object1 still call Object2.MethodA()? Solution – RMIs: Remote Method Invocations (Object-based) – RPCs: Remote Procedure Calls (non-Object-based) – Access libraries of reusable code across hosts – Pros Supports code reuse Standard interface, independent of applications and OS’s 3 Refer to slides of Indranil IIT

Applications Middleware Provide support to the application Run at all level Request reply protocol External data representation Operating System RPCs and RMIs, e.g., CORBA RPC = Remote Procedure Call RMI = Remote Method Invocation CORBA = Common Object Request Brokerage Architecture Middleware layers

Within one process’ address space Object – Consists of a set of data + set of methods – E.g., C++ object, Java object Object reference – An identifier via which objects can be accessed – I.e., a pointer (e.g., virtual memory address within process) Interface – Provides a definition of the signatures of a set of methods (i.e., the types of their arguments, return values, and exceptions) without specifying their implementation Local objects

May cross multiple process’ address spaces Remote Method Invocation – Method invocations between objects in different processes (processes may be on the same or different host) Remote Procedure Call – Procedure call between functions on different processes in non- object-based system Remote objects – Objects that can receive remote invocations Remote Object Reference – An identifier that can be used globally throughout a distributed system to refer to a particular unique remote object Remote interface – Every remote object has a remote interface that specifies which of its methods can be invoked remotely. E.g., CORBA interface definition language (IDL). Remote objects

Example: remote object and interface interface remote m1 m2 m3 m4 m5 m6 Data implementation remoteobject { of methods Example: remote object reference = (IP, port, objectnumber, signature, time)

Server side failure semantics 8 At most once – If client receives a reply from server then the RPC call has been executed at most once on the server At least once – If client receives a reply from the server then the RPC call has been executed at least once on the server Exactly once – No matter what happens on the server side (crash/restart) the RPC call has been executed exactly once on the server – Difficult to implement  weaker semantics are used  error handling needs to be taken care of explicitly

Client side failure semantics 9 If client crashes before receiving the response most servers discard the response If server runs a long running RPC computation and client fails in between the execution then (orphan RPC calls): – Extermination Server terminates the ongoing RPC computation Overhead on server side to keep track of clients and their states – Reincarnation Server periodically checks client’s state. If it crashed then it terminates the RPC computation – Gentle reincarnation Server broadcasts and checks if client restarted with different ID. If true then it sends the response to it – Expiration RPC computations are assigned timeouts by the server. If a computation exceeds it then it checks client status

Remote and local method invocations invocation remote invocation remote local invocation A B C D E F Local invocation = between objects on same process Has exactly once semantics Remote invocation = between objects on different processes Ideally also want exactly once semantics for remote invocations But difficult (why?) Process Object Process Host A Host B

Failure modes of RMI/RPC Execute Reply correct function Execute, Crash Request Crash Request Execute Reply Execute Reply crash before reply crash before execution lost request Channel fails during reply Client machine fails before receiving reply

Invocation semantics Fault tolerance measures Invocation semantics Retransmit request message Duplicate filtering Re-execute procedure or retransmit reply No Yes Not applicable No Yes Not applicable Re-execute procedure Retransmit old replyAt-most-once At-least-once Maybe Whether or not to retransmit the request message until either a reply is received or the server is assumed to be failed When retransmissions are used, whether to filter out duplicate requests at the server. Whether to keep a history of result messages to enable lost results to be retransmitted without re-executing the operations Java RMI, CORBA Sun RPC Transparency = remote invocation has same behavior as local invocation [Birrell and Nelson, inventors of RPC, 1984] Very difficult to implement in asynchronous network (ok for idempotent operations) Idempotent = same result if applied repeatedly, w/o side effects

Proxy and skeleton in RMI object A object B skeleton Request proxy for B Reply Communication Remote Remote reference Communication module reference module module for B’s class & dispatcher remote client server Process P1 Process P2 MIDDLEWARE

object A object B skeleton Request proxy for B Reply Communication Remote Remote reference Communication module reference module module for B’s class & dispatcher remote client server Process P1 (“client”) Process P2 (“server”) Proxy and skeleton in RMI

Proxy Responsible for making RMI transparent to clients by behaving like a local object to the invoker – The proxy implements (Java term, not literally) the methods in the interface of the remote object that it represents – However Instead of executing an invocation, the proxy forwards it to a remote object On invocation, a method of the proxy marshals the following into a request message: – (i) a reference to the target object – (ii) its own method id, and – (iii) the argument values Request message is sent to the target, then proxy awaits the reply message, un-marshals it and returns the results to the invoker – Invoked object unmarshals arguments from request message, and when done marshals return values into reply message

Marshalling and unmarshalling Scenario – A x86 (Windows) client sends an RMI to a PowerPC (e.g., Unix/Mac) server – Will not work because x86is little endian while PowerPC is big-endian External data representation An agreed, platform-independent, standard for the representation of data structures and primitive values CORBA Common Data Representation (CDR) Allows Windows client (little endian) to interact with Unix server or Mac server (big endian). Marshalling The act of taking a collection of data items (platform dependent) and assembling them into the external data representation (platform independent) Unmarshalling The process of disassembling data that is in external data representation form, into a locally interpretable form Little endian exampleBig endian example

Remote reference module Responsible for translating between local and remote object references and for creating remote object references Has a remote object table – An entry for each remote object held by any process. E.g., B at P2. – An entry for each local proxy. E.g., proxy-B at P1. If a new remote object is seen by the remote reference module, it creates a remote object reference and adds it to the table If a remote object reference arrives in a request or reply message, the remote reference module is asked for the corresponding local object reference, which may refer to either to a local proxy or a remote object If the remote object reference is not in the table, the RMI software creates a new proxy and asks the remote reference module to add it to the table

Server side dispatcher and skeleton Each process has one dispatcher + skeleton for each local object (actually, for the class) The dispatcher receives all request messages from the communication module – For the request message, it uses the method ID to select the appropriate method in the appropriate skeleton, passing on the request message Skeleton implements the methods in the remote interface. – A skeleton method un-marshals the arguments in the request message and invokes the corresponding method in the local object (the actual object) – It waits for the invocation to complete and marshals the result, together with any exceptions, into a reply message

Summary of RMI Object A Object B Comm. Module Skeleton for B’s Class Server Process Client Process Proxy Object B Remote Reference Module Dispatcher Proxy object is a hollow container of Method names. Remote Reference Module translates between local and remote object references. Dispatcher sends the request to Skeleton Object Skeleton unmarshals parameters, sends it to the object, & marshals the results for return Remote Reference Module MIDDLEWARE

Generation of proxies, dispatchers, and skeletons Programmer writes object implementations and interfaces Proxies, Dispatchers and Skeletons generated automatically from the specified interfaces Examples – In CORBA Programmer specifies interfaces of remote objects in CORBA IDL Then, the interface compiler automatically generates code for proxies, dispatchers, and skeletons – In Java RMI The programmer defines the set of methods offered by a remote object as a Java interface implemented in the remote object The Java RMI compiler generates the proxy, dispatcher and skeleton classes from the class of the remote object

Binder and activator Binder –A separate service that maintains a table containing mappings from textual names to remote object references. (sort of like DNS, but for the specific middleware) –Used by servers to register their remote objects by name. Used by clients to look them up. E.g., Java RMI Registry, CORBA Naming Svc. Activation of remote objects –A remote object is active when it is available for invocation within a running process. –A passive object consists of (i) implementation of its methods; and (ii) its state in the marshalled form (a form that is shippable). –Activation creates a new instance of the class of a passive object and initializes its instance variables. It is called on-demand –An activator is responsible for Registering passive objects at the Binder Starting named server processes and activating remote objects in them Keeping track of the locations of the servers for remote objects it has already activated –Example Activator = Inetd, Passive Object/service = FTP (invoked on demand)

Client and server stub procedures in RPC client procedure Request Reply Communication module dispatcher service client stub server stub procedure client processserver process procedure

Stub s Generated automatically from interface specifications. Hide details of (un)marshalling from application programmer & library code developer Take care of invocation Client Stubs perform marshalling into request messages and unmarshalling from reply messages Server Stubs perform unmarshalling from request messages and marshalling into reply messages

The stub generation process Interface Specification Stub Generator Server Stub Common Header Client Stub Client Source RPC LIBRARY Server Source Compiler / Linker RPC LIBRARY Client Program Server Program Compiler / Linker e.g., in SUN XDR e.g., rpcgen gcc.o,.exe.c.h gcc

Next lecture Leader election 25