RPC Remote Procedure Call Dave Hollinger Rensselaer Polytechnic Institute Troy, NY.

Slides:



Advertisements
Similar presentations
CS Network Programming CS 3331 Fall CS 3331 Outline Socket programming Remote method invocation (RMI)
Advertisements

1 Senn, Information Technology, 3 rd Edition © 2004 Pearson Prentice Hall James A. Senns Information Technology, 3 rd Edition Chapter 7 Enterprise Databases.
Message Passing Vs Distributed Objects
Chapter 7 Constructors and Other Tools. Copyright © 2006 Pearson Addison-Wesley. All rights reserved. 7-2 Learning Objectives Constructors Definitions.
© 2010 Pearson Addison-Wesley. All rights reserved. Addison Wesley is an imprint of Chapter 5: Repetition and Loop Statements Problem Solving & Program.
18 Copyright © 2005, Oracle. All rights reserved. Distributing Modular Applications: Introduction to Web Services.
4 Copyright © 2005, Oracle. All rights reserved. Creating the Web Tier: Servlets.
11 Copyright © 2005, Oracle. All rights reserved. Creating the Business Tier: Enterprise JavaBeans.
Create an Application Title 1A - Adult Chapter 3.
1 Communication in Distributed Systems REKs adaptation of Tanenbaums Distributed Systems Chapter 2.
REVIEW: Arthropod ID. 1. Name the subphylum. 2. Name the subphylum. 3. Name the order.
Semantic Analysis and Symbol Tables
IP Multicast Information management 2 Groep T Leuven – Information department 2/14 Agenda •Why IP Multicast ? •Multicast fundamentals •Intradomain.
1 public class Newton { public static double sqrt(double c) { double epsilon = 1E-15; if (c < 0) return Double.NaN; double t = c; while (Math.abs(t - c/t)
© 2007 Cisco Systems, Inc. All rights reserved.Cisco Public 1 EN0129 PC AND NETWORK TECHNOLOGY I IP ADDRESSING AND SUBNETS Derived From CCNA Network Fundamentals.
31242/32549 Advanced Internet Programming Advanced Java Programming
© 2012 National Heart Foundation of Australia. Slide 2.
DISTRIBUTED OBJECTS AND REMOTE INVOCATION
Chapter 3: Processes.
Processes Management.
Executional Architecture
Global Analysis and Distributed Systems Software Architecture Lecture # 5-6.
© 2007 Cisco Systems, Inc. All rights reserved.Cisco Public 1 Addressing the Network – IPv4 Network Fundamentals – Chapter 6.
©Brooks/Cole, 2001 Chapter 12 Derived Types-- Enumerated, Structure and Union.
Intracellular Compartments and Transport
PSSA Preparation.
TCP/IP Protocol Suite 1 Chapter 18 Upon completion you will be able to: Remote Login: Telnet Understand how TELNET works Understand the role of NVT in.
Java Network Programming Vishnuvardhan.M. Dept. of Computer Science - SSBN Java Overview Object-oriented Developed with the network in mind Built-in exception.
1 Java Remote Method Invocation java.rmi.* java.rmi.registry.* java.rmi.server.*
CSE 486/586 Distributed Systems Remote Procedure Call
Remote Procedure Call (RPC)
Remote Procedure Call Design issues Implementation RPC programming
RPC Remote Procedure Call Dave Hollinger Rensselaer Polytechnic Institute Troy, NY.
Tam Vu Remote Procedure Call CISC 879 – Spring 03 Tam Vu March 06, 03.
Copyright © 2001 Qusay H. Mahmoud RMI – Remote Method Invocation Introduction What is RMI? RMI System Architecture How does RMI work? Distributed Garbage.
CS490T Advanced Tablet Platform Applications Network Programming Evolution.
OCT 1 Master of Information System Management Organizational Communications and Distributed Object Technologies Lecture 5: Distributed Objects.
Practical Issues of RPCCS-4513, D-Term Remote Procedure Call Practical Issues CS-4513 Distributed Computing Systems (Slides include materials from.
Netprog RPC Overview1 Distributed Program Design n Communication-Oriented Design –Design protocol first. –Build programs that adhere to the protocol.
1 Chapter Client-Server Interaction. 2 Functionality  Transport layer and layers below  Basic communication  Reliability  Application layer.
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Part 4 Other Topics RPC & Middleware.
1 Chapter 38 RPC and Middleware. 2 Middleware  Tools to help programmers  Makes client-server programming  Easier  Faster  Makes resulting software.
CSE 486/586 CSE 486/586 Distributed Systems Remote Procedure Call Steve Ko Computer Sciences and Engineering University at Buffalo.
Chapter 4: Interprocess Communication‏ Pages
1 XDR External Data Representation Process A XDR Encode/Decode Transport Process B XDR Encode/Decode Transport.
Netprog: RPC Programming1 RPC Programming with rpcgen Issues: –Protocol Definition File –Client Programming Creating an "RPC Handle" to a server Calling.
Remote Procedure CallCS-502 Fall Remote Procedure Call (continued) CS-502, Operating Systems Fall 2007 (Slides include materials from Operating System.
The Client-Server Model And the Socket API. Client-Server (1) The datagram service does not require cooperation between the peer applications but such.
Remote Procedure Call RPC
Lecture 4 Mechanisms & Kernel for NOSs. Mechanisms for Network Operating Systems  Network operating systems provide three basic mechanisms that support.
Computer Science Lecture 3, page 1 CS677: Distributed OS Last Class: Communication in Distributed Systems Structured or unstructured? Addressing? Blocking/non-blocking?
Chap 35 Remote Procedure Calls RPC allows one host to make a procedure call that appears to be part of a local process (fig 35.1), but is really executed.
Distributed objects and remote invocation Pages
1 Remote Procedure Calls External Data Representation (Ch 19) RPC Concept (Ch 20)
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.
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
MCA – 405 Elective –I (A) Java Programming & Technology
Lecture 4: RPC Remote Procedure Call Coulouris et al: Chapter 5
Chapter 40 Remote Method Invocation
Lecture 4: RPC Remote Procedure Call CDK: Chapter 5
Distributed Program Design
Chapter 46 Remote Method Invocation
Chapter 46 Remote Method Invocation
Remote invocation (call)
Last Class: Communication in Distributed Systems
Presentation transcript:

RPC Remote Procedure Call Dave Hollinger Rensselaer Polytechnic Institute Troy, NY

Y KermarrecNetprog: RPC Overvie w 2 Distributed Program Design Communication-Oriented Design Design protocol first. Build programs that adhere to the protocol. Application-Oriented Design Build application(s). Divide programs up and add communication protocols. TypicalSocketsApproach RPC

Y KermarrecNetprog: RPC Overvie w 3 RPC Remote Procedure Call Call a procedure (subroutine) that is running on another machine. Issues: identifying and accessing the remote procedure parameters return value

Y KermarrecNetprog: RPC Overvie w 4 blah, blah, blah bar = foo(a,b); blah, blah, blah bar = foo(a,b); blah, blah, blah int foo(int x, int y ) { if (x>100) return(y-2); else if (x>10) return(y-x); else return(x+y); } int foo(int x, int y ) { if (x>100) return(y-2); else if (x>10) return(y-x); else return(x+y); } Client Server protocol Remote Subroutine

Y KermarrecNetprog: RPC Overvie w 5 Sun RPC There are a number of popular RPC specifications. Sun RPC (ONC RPC) is widely used. NFS (Network File System) is RPC based. Rich set of support tools.

Y KermarrecNetprog: RPC Overvie w 6 Sun RPC Organization Procedure 1 Procedure 2 Procedure 3 Shared Global Data Remote Program

Y KermarrecNetprog: RPC Overvie w 7 Procedure Arguments To reduce the complexity of the interface specification, Sun RPC includes support for a single argument to a remote procedure.* Typically the single argument is a structure that contains a number of values (the parameters). * Newer versions can handle multiple args.

Y KermarrecNetprog: RPC Overvie w 8 Procedure Identification Each procedure is identified by: Hostname (IP Address) Program identifier (32 bit integer) Procedure identifier (32 bit integer) –Program Version identifier »for testing and migration »Used also to detect out dated version of a server

Y KermarrecNetprog: RPC Overvie w 9 Program Identifiers Each remote program has a unique ID. Sun divided up the IDs: 0x x1fffffff 0x x3fffffff 0x x5fffffff 0x xffffffff SunSysAdminTransientReserved

Y KermarrecNetprog: RPC Overvie w 10 Procedure Identifiers & Program Version Numbers Procedure Identifiers usually start at 1 and are numbered sequentially Version Numbers typically start at 1 and are numbered sequentially.

Y KermarrecNetprog: RPC Overvie w 11 Iterative Server Sun RPC specifies that at most one remote procedure within a program can be invoked at any given time. If a 2nd procedure is called, the call blocks until the 1st procedure has completed.

Y KermarrecNetprog: RPC Overvie w 12 Iterative can be good Having an iterative server is useful for applications that may share data among procedures. Example: database - to avoid insert/delete/modify collisions. We can provide concurrency when necessary...

Y KermarrecNetprog: RPC Overvie w 13 Call Semantics What does it mean to call a local procedure? the procedure is run exactly one time. What does it mean to call a remote procedure? It might not mean "run exactly once"!

Y KermarrecNetprog: RPC Overvie w 14 Remote Call Semantics To act like a local procedure (exactly one invocation per call) - a reliable transport (TCP) is necessary. Sun RPC does not support reliable call semantics. "At Least Once" Semantics "Zero or More" Semantics

Y KermarrecNetprog: RPC Overvie w 15 Sun RPC Call Semantics At Least Once Semantics if we get a response (a return value) Zero or More Semantics if we don't hear back from the remote subroutine.

Y KermarrecNetprog: RPC Overvie w 16 Remote Procedure deposit() deposit(DavesAccount,$100) Always remember that you don't know how many times the remote procedure was run! The net can duplicate the request (UDP).

Y KermarrecNetprog: RPC Overvie w 17 Network Communication The actual network communication is nothing new - it's just TCP/IP. Many RPC implementations are built upon the sockets library. the RPC library does all the work! We are just using a different API, the underlying stuff is the same!

Y KermarrecNetprog: RPC Overvie w 18 Dynamic Port Mapping Servers typically do not use well known protocol ports! Clients know the Program ID (and host IP address). RPC includes support for looking up the port number of a remote program.

Y KermarrecNetprog: RPC Overvie w 19 Port Lookup Service A port lookup service runs on each host that contains RPC servers. RPC servers register themselves with this service: "I'm program 17 and I'm looking for requests on port 1736"

Y KermarrecNetprog: RPC Overvie w 20 The portmapper Each system which will support RPC servers runs a port mapper server that provides a central registry for RPC services. Servers tell the port mapper what services they offer.

Y KermarrecNetprog: RPC Overvie w 21 More on the portmapper Clients ask a remote port mapper for the port number corresponding to Remote Program ID. The portmapper is itself an RPC server! The portmapper is available on a well-known port (111).

Y KermarrecNetprog: RPC Overvie w 22 Sun RPC Programming The RPC library is a collection of tools for automating the creation of RPC clients and servers. RPC clients are processes that call remote procedures. RPC servers are processes that include procedure(s) that can be called by clients.

Y KermarrecNetprog: RPC Overvie w 23 RPC Programming RPC library XDR routines RPC run time library -call rpc service -register with portmapper -dispatch incoming request to correct procedure Program Generator

Y KermarrecNetprog: RPC Overvie w 24 RPC Run-time Library High- and Low-level functions that can be used by clients and servers. High-level functions provide simple access to RPC services.

Y KermarrecNetprog: RPC Overvie w 25 High-level Client Library int callrpc( char *host, u_long prognum, u_long versnum, u_long procnum, xdrproc_t inproc, char *in, xdrproc_t outproc, char *out);

Y KermarrecNetprog: RPC Overvie w 26 High-Level Server Library int registerrpc( u_long prognum, u_long versnum, u_long procnum, char *(*procname)() xdrproc_t inproc, xdrproc_t outproc);

Y KermarrecNetprog: RPC Overvie w 27 High-Level Server Library (cont.) void svc_run(); svc_run() is a dispatcher. A dispatcher waits for incoming connections and invokes the appropriate function to handle each incoming request.

Y KermarrecNetprog: RPC Overvie w 28 High-Level Library Limitation The High-Level RPC library calls support UDP only (no TCP). You must use lower-level RPC library functions to use TCP. The High-Level library calls do not support any kind of authentication.

Y KermarrecNetprog: RPC Overvie w 29 Low-level RPC Library Full control over all IPC options TCP & UDP Timeout values Asynchronous procedure calls Multi-tasking Servers Broadcasting IPC is InterProcess Communication

Y KermarrecNetprog: RPC Overvie w 30 RPCGEN There is a tool for automating the creation of RPC clients and servers. The program rpcgen does most of the work for you. The input to rpcgen is a protocol definition in the form of a list of remote procedures and parameter types.

Y KermarrecNetprog: RPC Overvie w 31 RPCGEN Input File rpcgen Client Stubs XDR filtersheader file Server skeleton C Source Code ProtocolDescription

Y KermarrecNetprog: RPC Overvie w 32 rpcgen Output Files > rpcgen –C foo.x foo_clnt.c (client stubs) foo_svc.c (server main) foo_xdr.c (xdr filters) foo.h (shared header file)

Y KermarrecNetprog: RPC Overvie w 33 Client Creation > gcc -o fooclient foomain.c foo_clnt.c foo_xdr.c -lnsl foomain.c is the client main() (and possibly other functions) that call rpc services via the client stub functions in foo_clnt.c The client stubs use the xdr functions.

Y KermarrecNetprog: RPC Overvie w 34 Server Creation gcc -o fooserver fooservices.c foo_svc.c foo_xdr.c – lrpcsvc -lnsl fooservices.c contains the definitions of the actual remote procedures.

Y KermarrecNetprog: RPC Overvie w 35 Example Protocol Definition struct twonums { int a; int b; }; program UIDPROG { version UIDVERS { int RGETUID(string ) = 1; string RGETLOGIN( int ) = 2; int RADD(twonums) = 3; } = 1; } = 0x ;

Y Kermarrec Information for the labs You are going to experiment : how to go from a classic procedure call to an RPC How to run a server and activate clients calls What is the magic (the work of rpcgen) behind the scene in terms of socket management, connections, errors and fault detection. Get the initial insights for all the other paradigms (distributed object, Java RMI, web services…) work and are handled

Y Kermarrec Survey RPC is a powerful way to program distributed system quite easily It was initialy an OS feature that has been moved to the programmers world Numerous benefits in terms of transparencies and above all fault tolerance