Presentation is loading. Please wait.

Presentation is loading. Please wait.

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.

Similar presentations


Presentation on theme: "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."— Presentation transcript:

1 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 3.Object brokers 4.Object monitors 5.Message-oriented middleware 6.Message brokers 

2 9 September 2008CIS 340 # 2 Basic Middleware: RPC - motivation One cannot expect the programmer to implement a complete infrastructure for every distributed application. –Sockets API = send & recv calls = I/O Instead, one can use an RPC system –our first example of low level middleware Remote Procedure Calls (RPC) –Goal: to provide a procedural interface for distributed (i.e., remote) services –To make distributed nature of service transparent to the programmer Remote Method Invocation (RMI) –RPC + Object Orientation –Allows objects living in one process to invoke methods of an object living in another process

3 9 September 2008CIS 340 # 3 Basic Middleware: RPC What does an RPC system do? Hides distribution behind procedure calls interface definition language (IDL)Provides an interface definition language (IDL) to describe the services Generates all the additional code necessary to make a procedure call remote and to deal with all the communication aspects binder/bindingProvides a binder/binding in case it has a distributed name and directory service system Basis for 2-tier, client/server First introduction of elements common to all middleware

4 Middleware layers 11 September 2008CIS 340 # 4

5 Request-reply communication 11 September 2008CIS 340 # 5

6 Conventional Procedure Call (a) Parameter passing in a local procedure call: the stack before the call to read(fd,buf,bytes) (b) The stack while the called procedure is active 11 September 2008CIS 340 # 6

7 Remote Procedure Call 11 September 2008CIS 340 # 7

8 Remote Procedure Calls Remote procedure call (RPC) abstracts procedure calls between processes on networked systems. Stubs – client-side proxy for the actual procedure on the server. The client-side stub locates the server and marshalls the parameters. The server-side stub receives this message, unpacks the marshalled parameters, and performs the procedure on the server. 11 September 2008CIS 340 # 8

9 9 September 2008CIS 340 # 9 IDL sources interface headers IDL compiler IDL client code client stub language specific call interface server code server stub language specific call interface client processserver process development environment Copyright Springer Verlag Berlin Heidelberg 2004 Remote Procedure Call (RPC): Development Components/Aspects interface definition language – “specification of the services” == parameters 1 2 piece of code compiled & linked with client local call does not take care of the implementation implements the invocation “possesses” code for receiving, formatting,....

10 9 September 2008CIS 340 # 10 communication module client procedure call client stub bind marshal serialize send client process communication module server procedure server stub unmarshal deserialize receive server process dispatcher (select stub) Copyright Springer Verlag Berlin Heidelberg 2004 Remote Procedure Call (RPC): Functioning Elements

11 Steps of a Remote Procedure Call 1.Client procedure calls client stub in normal way 2.Client stub builds message, calls local OS 3.Client's OS sends message to remote OS 4.Remote OS gives message to server stub 5.Server stub unpacks parameters, calls server 6.Server does work, returns result to the stub 7.Server stub packs it in message, calls local OS 8.Server's OS sends message to client's OS 9.Client's OS gives message to client stub 10.Stub unpacks result, returns to client 11 September 2008CIS 340 # 11

12 Passing Value Parameters (1) 11 September 2008CIS 340 # 12

13 Passing Value Parameters (2) 11 September 2008CIS 340 # 13 a) Original message on the Pentium b) The message after receipt on the SPARC c) The message after being inverted. The little numbers in boxes indicate the address of each byte

14 Parameter Specification and Stub Generation 11 September 2008CIS 340 # 14

15 Writing a Client and a Server 11 September 2008CIS 340 # 15

16 9 September 2008CIS 340 # 16 Dynamic Binding vs. static binding Adds a layer of “indirection” Layer == name and directory server Invocation of remote procedure by client stub  Requests name and directory server to identify server to execute procedure  Response by name and directory server == address of server Tightly coupled COST for dynamic flexibility? Additional layer

17 11 September 2008CIS 340 # 17

18 RMI RMI = RPC + Object-orientation –Java RMI –CORBA Middleware that is language-independent –Microsoft DCOM/COM+ –SOAP RMI on top of HTTP 11 September 2008CIS 340 # 18

19 Interfaces in distributed systems Programs organized as a set of modules that communicate with one another via procedure calls/method invocations Explicit interfaces defined for each module in order to control interactions between modules In distributed systems, modules can be in different processes A remote interface specifies the methods of an object that are available for invocation by objects in other processes defining the types of the input and output arguments of each of them 11 September 2008CIS 340 # 19

20 11 September 2008CIS 340 # 20

21 Object model Object references –Objects accessed via object references –Object references can be assigned to variables, passed as arguments and returned as results Interfaces –Provides a signature of a set of methods (types of arguments, return values and exceptions) without specifying their implementations Actions (invocations) Exceptions Garbage Collection 11 September 2008CIS 340 # 21

22 Distributed Objects Remote object references –An identifier that can be used throughout a distributed system to refer to a particular remote object Remote interfaces –CORBA provides an interface definition language (IDL) for specifying a remote interface –JAVA RMI: Java interface that extends Remote interface Actions: remote invocations Remote Exceptions may arise for reasons such as partial failure or message loss Distributed Garbage Collection: cooperation between local garbage collectors needed 11 September 2008CIS 340 # 22

23 Remote and local method invocations 11 September 2008CIS 340 # 23

24 A remote object and its remote interface 11 September 2008CIS 340 # 24

25 RMI Programming RMI software –Generated by IDL compiler –Proxy Behaves like remote object to clients (invoker) Marshals arguments, forwards message to remote object, unmarshals results, returns results to client –Skeleton Server side stub; Unmarshals arguments, invokes method, marshals results and sends to sending proxy’s method –Dispatcher Receives the request message from communication module, passes on the message to the appropriate method in the skeleton Server and Client programs 11 September 2008CIS 340 # 25

26 11 September 2008CIS 340 # 26

27 RMI Programming Binder –Client programs need a means of obtaining a remote object reference –Binder is a service that maintains a mapping from textual names to remote object references –Servers need to register the services they are exporting with the binder –Java RMIregistry, CORBA Naming service Server threads –Several choices: thread per object, thread per invocation –Remote method invocations must allow for concurrent execution 11 September 2008CIS 340 # 27

28 Java RMI Features –Integrated with Java language + libraries Security, write once run anywhere, multithreaded Object orientation –Can pass “behavior” Mobile code Not possible in CORBA, traditional RPC systems Distributed Garbage Collection Remoteness of objects intentionally not transparent 11 September 2008CIS 340 # 28

29 Remote Interfaces, Objects, and Methods Objects become remote by implementing a remote interface –A remote interface extends the interface java.rmi.Remote –Each method of the interface declares java.rmi.RemoteException in its throws clause in addition to any application-specific clauses 11 September 2008CIS 340 # 29

30 11 September 2008CIS 340 # 30

31 11 September 2008CIS 340 # 31

32 11 September 2008CIS 340 # 32

33 11 September 2008CIS 340 # 33

34 11 September 2008CIS 340 # 34

35 11 September 2008CIS 340 # 35

36

37 11 September 2008CIS 340 # 37 Machine independent representations: Marshalling, Serializing Consider (in C) sprintf and sscanf Message= “Vitolo” “GU” “2006” char *name=“Vitolo”, place=“GU”; int year=2006; sprintf(message, “%d %s %d %s %d”), strlen(name), name, strlen(place), place, year); Message after marshalling = “6 Vitolo 2 GU 2006” NOTE: type and number of parameters is known, ….only need to agree on the syntax... SUN XDR approach: Messages transformed into a sequence of 4 byte objects, each byte being in ASCII code Defines how to pack different data types into these objects expense of bandwidthGIST? To simplify computation at the expense of bandwidth 6 V i t o l o 2 G U 2 0 0 6 String length cardinal eXternal Data Representation

38 11 September 2008CIS 340 # 38 Remote Procedure Call (RPC): Functionality of Stubs BINDINGMARSHALINGSERIALIZINGSENDING RECEIVINGDESERIALIZINGUNMARSHALING Client process Creates a local association – handle – to the server Think of “binding a variable” Client process Packages data into message format needed by the recipient server Client process Transforms data/message into bytes Server process Undoes the steps


Download ppt "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."

Similar presentations


Ads by Google