CSE 486/586 CSE 486/586 Distributed Systems Remote Procedure Call Steve Ko Computer Sciences and Engineering University at Buffalo.

Slides:



Advertisements
Similar presentations
CSE 486/586 Distributed Systems Remote Procedure Call
Advertisements

Remote Procedure Call (RPC)
Remote Procedure Call Design issues Implementation RPC programming
CSE 486/586, Spring 2012 CSE 486/586 Distributed Systems Transactions Steve Ko Computer Sciences and Engineering University at Buffalo.
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 Systems Lecture #3: Remote Communication.
Copyright © George Coulouris, Jean Dollimore, Tim Kindberg This material is made available for private study and for direct.
CS490T Advanced Tablet Platform Applications Network Programming Evolution.
Remote Procedure Call Chin-Chih Chang. Remote Procedure Call Remote Procedure Call (RPC) is a protocol that allows programs to call procedures located.
OCT 1 Master of Information System Management Organizational Communications and Distributed Object Technologies Lecture 5: Distributed Objects.
Communication in Distributed Systems –Part 2
Client-Server Communication Sockets Remote Procedure Calls Remote Method Invocation (Java)
Netprog RPC Overview1 Distributed Program Design n Communication-Oriented Design –Design protocol first. –Build programs that adhere to the protocol.
.NET Mobile Application Development Remote Procedure Call.
Slides for Chapter 5: Communication between distributed objects
CSE 486/586, Spring 2013 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.
Sun RPC also called ONC (Open Network Computing) RPC originally designed for client-server communication for Sun Network File System (NFS) provides an.
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.
Politecnico di Milano © 2001 William Fornaciari Operating Systems R P C Remote Procedure Call Lecturer: William Fornaciari Politecnico di Milano
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
Remote Procedure Calls CS587x Lecture Department of Computer Science Iowa State University.
Distributed Objects & Remote Invocation
Remote Procedure CallCS-502 Fall Remote Procedure Call (continued) CS-502, Operating Systems Fall 2007 (Slides include materials from Operating System.
Remote Procedure Call RPC
Computer Science Lecture 3, page 1 CS677: Distributed OS Last Class: Communication in Distributed Systems Structured or unstructured? Addressing? Blocking/non-blocking?
Slides for Chapter 5: Distributed objects and remote invocation From Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edition.
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
RPC Model, Stubs and Skeletons Divya Nampalli
© Oxford University Press 2011 DISTRIBUTED COMPUTING Sunita Mahajan Sunita Mahajan, Principal, Institute of Computer Science, MET League of Colleges, Mumbai.
Distributed Systems Lecture 8 RPC and marshalling 1.
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.
Lecture 5: RPC (exercises/questions). 26-Jun-16COMP28112 Lecture 52 First Six Steps of RPC TvS: Figure 4-7.
Topic 4: Distributed Objects 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
Edition 5, © Addison-Wesley 2012
CMSC621: Advanced Operating Systems Advanced Operating Systems
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
Slides for Chapter 5: Distributed objects and remote invocation
Lecture 4: RPC Remote Procedure Call CDK: Chapter 5
Distributed Computing
CSE 451: Operating Systems Winter 2004 Module 19 Remote Procedure Call (RPC) Ed Lazowska Allen Center
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
Remote invocation (call)
CSE 451: Operating Systems Autumn 2010 Module 21 Remote Procedure Call (RPC) Ed Lazowska Allen Center
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:

CSE 486/586 CSE 486/586 Distributed Systems Remote Procedure Call Steve Ko Computer Sciences and Engineering University at Buffalo

CSE 486/586 Recap Paxos phase 1 –A proposer sends a prepare message. –Acceptors reply with the highest-numbered proposal Paxos phase 2: –The proposer waits for a majority of acceptors. –The proposer chooses the value from the highest-numbered proposal. –Upon receiving a new prooposal, acceptors either: »Accept it »Or, reject it if there was another prepare request with N’ higher than N, and it replied to it (due to the promise in phase 1). 2

CSE 486/586 Recall? 3 TCPUDP IP Device Drivers Network Interface OS App Socket API

CSE 486/586 Socket API 4 socket() bind() listen() accept() read() write() Server block process request Client socket() connect() write() establish connection send request read() send response

CSE 486/586 What’s Wrong with Socket API? Low-level read/write Communication oriented Same sequence of calls, repeated many times Etc, etc… Not programmer friendly 5

CSE 486/586 Another Abstraction RPC (Remote Procedure Call) –Goal: it should appear that the programmer is calling a local function –Mechanism to enable function calls between different processes –First proposed in the 80’s Examples –Sun RPC –Java RMI –CORBA Other examples that borrow the idea –XML-RPC –Android Bound Services with AIDL –Google Protocol Buffers 6

CSE 486/586 RPC Client int main (…) { … rpc_call(…); … } Server … void rpc_call(…) { … } … 7

CSE 486/586 Local Procedure Call E.g., x = local_call(“str”); The compiler generates code to transfer necessary things to local_call –Push the parameters to the stack –Call local_call The compiler also generates code to execute the local call. –Assigns registers –Adjust stack pointers –Saves the return value –Calls the return instruction 8

CSE 486/586 Remote Procedure Call Give an illusion of doing a local call by using whatever the OS gives Closer to the programmers –Language-level construct, not OS-level support What are some of the challenges? –How do you know that there are remote calls available? –How do you pass the parameters? –How do you find the correct server process? –How do you get the return value? 9

CSE 486/586 Stub, Marshalling, & Unmarshalling Stub functions: local interface to make it appear that the call is local. 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. 10

CSE 486/586 RPC Process 11 Client Process Client Function Client Stub Socket API Server Process Server Function Server Stub Socket API Marshalling/unmarshalling

CSE 486/586 CSE 486/586 Administrivia 12

CSE 486/586 How Do You Generate Stubs? Ever heard of C/C++, Java, Python syntax for RPC? –None! Language compilers don’t generate client and server stubs. Common solution: use a separate language and a pre-compiler 13

CSE 486/586 Interface Definition Language (IDL) Allow programmers to express remote procedures, e.g., names, parameters, and return values. Pre-compilers take this and generate stubs, marshalling/unmarshalling mechanisms. Similar to writing function definitions 14

CSE 486/586 Example: SUN XDR 15 const MAX = 1000; typedef int FileIdentifier; typedef int FilePointer; typedef int Length; struct Data { int length; char buffer[MAX]; }; struct writeargs { FileIdentifier f; FilePointer position; Data data; }; struct readargs { FileIdentifier f; FilePointer position; Length length; }; program FILEREADWRITE { version VERSION { void WRITE(writeargs)=1;Data READ(readargs)=2; }=2; } = 9999;

CSE 486/586 Stub Generation 16 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

CSE 486/586 How Do You Find the Server Process? Solution 1 –Central DB (the first solution proposed) Solution 2 –Local DB with a well-known port (SUN RPC) 17

CSE 486/586 Local DB with Well-Known Port 18 Client Program Server procedure Server Stub Client Stub Network Code Port Mapper SERVER CLIENT Finding An RPC: RPCs live on specific hosts at specific ports. Port mapper on the host maps from RPC name to port# When a server process is initialized, it registers its RPCs (handle) with the port mapper on the server A client first connects to port mapper (daemon on standard port) to get this handle The call to RPC is then made by connecting to the corresponding port

CSE 486/586 How to Pass Parameters? Pass by value: no problem –Just copy the value What about pointers/references? –Need to copy the actual data as well –Marshall them at the client and unmarshall them at the server –Pass the local pointers/references What about complex data structures? struct, class, etc. –Need to have a platform independent way of representing data 19

CSE 486/586 External Data Representation Communication between two heterogeneous machines –Different byte ordering (big-endian & little-endian) –Different sizes of integers and other types –Different floating point representations –Different character sets –Alignment requirements Used in general contexts, not just in RPCs 20

CSE 486/586 Example: Google Protocol Buffers Goal: language- and platform-neutral way to specify and serialize data Provides syntax & pre-compiler (open-source) –Pre-compiler generates code to manipulate objects for a specific language, e.g, C++, Java, Python. –The runtime support applies a fast & sloppy compression algorithm. message Book { required string title = 1; repeated string author = 2; optional BookStats statistics = 3; message BookStats { required int32 sales =1; } 21

CSE 486/586 What About Failures? Local calls do not fail. Remote calls might fail. Programmers should deal with this. –No transparency here 22

CSE 486/586 Failure Modes of 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 23

CSE 486/586 Invocation Semantics Local procedure call: exactly-once Remote procedure call: –0 times: server crashed or server process died before executing server code –1 time: everything worked well, as expected –1 or more: excess latency or lost reply from server and client retransmission When do these make sense? –Idempotent functions: OK to run any number of times –Non-idempotent functions: cannot do it What we can offer –At least once –At most once 24

CSE 486/586 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 25

CSE 486/586 Remote Method Invocation (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 (“client”) Process P2 (“server”) 26

CSE 486/586 Summary RPC enables programmers to call functions in remote processes. IDL (Interface Definition Language) allows programmers to define remote procedure calls. Stubs are used to make it appear that the call is local. Semantics –Cannot provide exactly once –At least once –At most once –Depends on the application requirements 27

CSE 486/ Acknowledgements These slides contain material developed and copyrighted by Indranil Gupta (UIUC).