Remote Procedure Call and Remote Method Invocation

Slides:



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

RPC Robert Grimm New York University Remote Procedure Calls.
Remote Procedure Call Design issues Implementation RPC programming
Tam Vu Remote Procedure Call CISC 879 – Spring 03 Tam Vu March 06, 03.
XML-RPC Remote Procedure Call (RPC) is a model that specifies how cooperating processes on different nodes in a heterogeneous computing environment can.
Remote Procedure CallCS-4513, D-Term Remote Procedure Call CS-4513 Distributed Computing Systems (Slides include materials from Operating System.
Implementing Remote Procedure Calls Andrew Birrell and Bruce Nelson Presented by Kai Cong.
INF 123 SW ARCH, DIST SYS & INTEROP LECTURE 9 Prof. Crista Lopes.
INF 123 SW ARCH, DIST SYS & INTEROP LECTURE 8 Prof. Crista Lopes.
CS490T Advanced Tablet Platform Applications Network Programming Evolution.
CSE331: Introduction to Networks and Security Lecture 11 Fall 2002.
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)
EEC-681/781 Distributed Computing Systems Lecture 4 Wenbing Zhao Department of Electrical and Computer Engineering Cleveland State University
Using XML for Distributed Computing XML-RPC and SOAP Mark Lewis
.NET Mobile Application Development Remote Procedure Call.
Chapter 5: Distributed objects and remote invocation Introduction Remote procedure call Events and notifications.
Linux RPC Comer Chapter 21 (RPCgen Concept) RFC 1057 – RPC Spec. UNIX Network Programming - Stevens 1.
CSE 486/586, Spring 2013 CSE 486/586 Distributed Systems Remote Procedure Call Steve Ko Computer Sciences and Engineering University at Buffalo.
INF123 – Software Architecture
Remote Procedure CallCS-502 Fall Remote Procedure Call CS-502, Operating Systems Fall 2007 (Slides include materials from Operating System Concepts,
CSE 486/586 CSE 486/586 Distributed Systems Remote Procedure Call Steve Ko Computer Sciences and Engineering University at Buffalo.
CSCI 6962: Server-side Design and Programming Web Services.
Remote Procedure Calls Babak Esfandiari. RPC Introduced by Birrell & Nelson (1984) Remote Procedure Calls allow a program to make use of procedures executing.
CS425 /CSE424/ECE428 – Distributed Systems – Fall Nikita Borisov - UIUC1 Material derived from slides by I. Gupta, M. Harandi, J. Hou, S.
Information Management NTU Interprocess Communication and Middleware.
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.
Distributed Objects and Middleware. Sockets and Ports Source: G. Coulouris et al., Distributed Systems: Concepts and Design.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved RPC Tanenbaum.
IT 344: Operating Systems Winter 2008 Module 19 Networking & Remote Procedure Call (RPC) Chia-Chi Teng CTB 265.
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.
Remote Procedure Calls CS587x Lecture Department of Computer Science Iowa State University.
Remote Procedure CallCS-502 Fall Remote Procedure Call (continued) CS-502, Operating Systems Fall 2007 (Slides include materials from Operating System.
Remote Method Invocation by James Hunt, Joel Dominic, and Adam Mcculloch.
Netprog: Soap & XML-RPC1 XML-RPC and SOAP. Netprog: Soap & XML-RPC2 XML Extensible Markup Language Markup Language. –HTML is also a markup language (but.
Remote Procedure Call (Introduction)
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.
Distributed Systems Lecture 8 RPC and marshalling 1.
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.
Java Distributed Computing
CSE 486/586 Distributed Systems Remote Procedure Call
CORBA Alegria Baquero.
CSE 451: Operating Systems Winter 2006 Module 20 Remote Procedure Call (RPC) Ed Lazowska Allen Center
DISTRIBUTED COMPUTING
CORBA Alegria Baquero.
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
Distributed Computing
Remote Procedure Call (RPC) RPC – RMI - Web Services.
CSE 451: Operating Systems Winter 2004 Module 19 Remote Procedure Call (RPC) Ed Lazowska Allen Center
Creating a Distributed System with Remote Procedure Calls and Web Services Ch.5 B.Ramamurthy 2/17/2019 B.Ramamurthy.
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
CSE 451: Operating Systems Winter 2003 Lecture 16 RPC
CSE 451: Operating Systems Messaging and Remote Procedure Call (RPC)
Presentation transcript:

Remote Procedure Call and Remote Method Invocation INF 123 – Software architecture tdebeauv@uci.edu

Outline RPC theory Sun RPC XML RPC RMI

RPC: theory

The Problem 1980s: Internet and web servers How can a client make a server do something? Sockets are used to transmit data, not functions Sending function code as text is a bad idea Client in Python, server in C#? Server runs eval(evil_code)? Eval is evil …

Dr. Eval eval(readline()), eval(message), …

Reminder: main and subroutines Main calls subroutines Subroutines return values Subroutines have no side-effects AKA “call and return” “Not a real architecture” <- really? Why?

RPC Transparently call a procedure located in another process or machine “make the invocation of a procedure on a remote machine appear as though it were local” http://people.sju.edu/~jhodgson/netw/rpc.html

Solution: RPC Local Procedure Calls Remote Procedure Calls host host 1 program program caller caller r = foo(a, b) r = foo(a, b) Caller stub host 2 callee program define foo(a, b) … end Callee stub define foo(a, b) … end callee

RPC with words The local procedure calls a caller stub The caller stub serializes the call (function name + arguments) and sends it to the callee stub on a remote machine The callee stub calls the remote procedure The remote procedure does its job, and gives the return value to the callee stub The callee stub sends the value back to the caller stub The caller stub passes that value back to the local procedure

Stubs Caller = client (initiate, active end) Callee = server (listen, passive end) The stubs are coupled Client stub must know server stub’s IP and port Sometimes, a port is reserved for RPC Stubs are usually generated by tools Rpcgen for Sun RPC, wscompile for JAX-RPC, … Other naming: server stub = skeleton

(in Interface Def Language) RPC Usual code RPC code RPC belongs to the application layer Caller program (in client language) Procedure Interface Definition (in Interface Def Language) Callee Program (in server language) call generate call Client Stub (in client language) Server Stub (in server language) Serialize and send Deserialize and receive Network OS Network OS

RPC Request-reply protocol, and RPC serialization format RPC as middleware Middleware: software between OS and application Application RPC stubs Middleware layers RPC Request-reply protocol, and RPC serialization format OS

RPC is not P2P In both cases, nodes are clients and servers to each other But in RPC, the goal is to execute a function remotely A client and a server could use RPC Peers could use RPC with each other Peers could simply exchange data, and not use RPC RPC stubs use a client-server paradigm With a request-response messaging pattern

Sun RPC: DATE/Time server example IN C From Unix Network Programming, by Stevens et al. Sun RPC: DATE/Time server example IN C

Sun RPC AKA Open Network Computing Created in the mid 80s by Sun The developer writes: interface.x, the interface definition, in Interface Definition Language callee.c, the server with the remote procedure caller.c, the client calling the remote procedure The rpcgen compiler generates: interface.h, to be imported by caller.c and callee.c callee_stub.c caller_stub.c

XDR eXternal Data Representation Created in the mid 80s by Sun Binary encoding The data format exchanged between stubs Serialization format used by: Network File System (created by Sun) SpiderMonkey (Firefox JS engine, XDR used to exchange compiled JS) R (stats tool)

Sun RPC generated Hand-written Import function signature caller.c interface.h callee.c Generate Call interface.x Call caller_stub.c callee_stub.c Generate Send XDR Recv XDR network

caller.c (I adapted it) server = ‘167.56.7.99’; client = create_client(server, DATE_PROG, DATE_VERS, "udp"); bin_date = get_binary_date(NULL, client); str_date = bin2str_date(bin_date, client); printf("time on server %s: %s", server, *str_date); http://stencel.mimuw.edu.pl/so/3_rpc/G_rpcgen/ http://web.cs.wpi.edu/~rek/DCS/D04/SunRPC.html

caller_stub.c (generated and adapted) #include "date.h" static struct timeval TIMEOUT = { 25, 0 }; long * get_binary_date(void *argp, CLIENT *clnt) { static long clnt_res; // return value is a long memset((char *)&clnt_res, 0, sizeof (clnt_res)); // allocate memory cli_call = client_call(clnt, GET_BIN_DATE, // RPC function number (xdrproc_t) xdr_void, // argument type (caddr_t) argp, // argument value (xdrproc_t) xdr_long, // return value type (caddr_t) &clnt_res, // store in this memory area TIMEOUT); if (cli_call != RPC_SUCCESS) { return (NULL); } return (&clnt_res);

Sun RPC API client_call create_client And more …

XML RPC

XML RPC Over HTTP POST 1998, many language bindings http://xmlrpc.scripting.com/spec.html

XML RPC - request POST /RPC2 HTTP/1.1 User-Agent: Frontier/5.1.2 (WinNT) Host: betty.userland.com Content-Type: text/xml Content-length: 181 <?xml version="1.0"?> <methodCall> <methodName>examples.getStateName</methodName> <params> <param> <value><int>41</int></value> </param> </params> </methodCall>

XML RPC – success response HTTP/1.1 200 OK Connection: close Content-Length: 158 Content-Type: text/xml Date: Fri, 17 Jul 1998 19:55:08 GMT Server: UserLand Frontier/5.1.2-WinNT <?xml version="1.0"?> <methodResponse> <params> <param> <value><string>South Dakota</string></value> </param> </params> </methodResponse>

XML RPC – failure response HTTP/1.1 200 OK Connection: close Content-Length: 426 Content-Type: text/xml Date: Fri, 17 Jul 1998 19:55:02 GMT Server: UserLand Frontier/5.1.2-WinNT <?xml version="1.0"?> <methodResponse> <fault> <value> <struct> <member> <name>faultCode</name> <value><int>4</int></value> </member> <name>faultString</name> <value><string>Too many parameters. </string> </value> </struct> </value> </fault> </methodResponse>

XML RPC vs XML: bandwidth  <struct> <member> <name>ROOM_ID</name> <value> <int>1</int> </value> </member> <name>CODE</name> <value> <string>MR-101</string> </value> <name>NAME</name> <value> <string>Math Room</string> </value> <name>CAPACITY</name> <value> <int>30</int> </value> </struct> <room> <ROOM_ID>1</ROOM_ID> <CODE>MR-101</CODE> <NAME>Math Room</NAME> <CAPACITY>30</CAPACITY> </room> class Room { int id=1; String code="MR-101"; String name="Maths room"; int capacity=30; }; http://stackoverflow.com/questions/1376688/what-is-the-benefit-of-xml-rpc-over-plain-xml

Remote method invocation

Proxy objects Equivalent of stub, but for client objects Goal: make RMI transparent to clients Proxy objects behave like a local object to the invoker Instead of executing, proxy objects serialize arguments and forward the call + arguments to the remote object Human writes class interface with method names RMI compiler generates proxy classes, skeleton classes, and server dispatcher

Remote Method Invocation Client Process Proxy Object B Object A Proxy object is a hollow container of Method names. Remote Reference Module translates between local and remote object references. Remote Reference Module Comm. Module Server Process Comm. Module Remote Reference Module Dispatcher sends the request to Skeleton Object Skeleton deserializes parameters, sends it to the object, & marshals the results for return Dispatcher Object B Skeleton for B’s Class MIDDLEWARE http://courses.engr.illinois.edu/cs425/fa2012/L8.fa12.ppt

More www.cs.bham.ac.uk/~bxb/courses/02_03_DS/Lecture05_Slides.pdf http://courses.engr.illinois.edu/cs425/fa2012/L8.fa12.ppt www2.hh.se/staff/vero/concurrent/lectures/lecture6.pdf Implementing Remote Procedure Calls, Birrell et al. 1984 https://docs.python.org/2/library/xmlrpclib.html http://technet.microsoft.com/en-us/library/cc738291%28v=WS.10%29.aspx http://docs.oracle.com/javaee/1.4/tutorial/doc/JAXRPC3.html