rpc and middle ware

45
RPC and Middleware Mostafa Hassan Khamees Omar Shaaban Ibrahim Douglas e. comer, computer networks and internets, chapter 38 , RPC and Middleware

Upload: omargw

Post on 04-Apr-2015

86 views

Category:

Documents


4 download

DESCRIPTION

RPC is one of the earliest facilities that help programmer to write Client-Server software.

TRANSCRIPT

Page 1: RPC and Middle Ware

RPC and Middleware

By: Mostafa Hassan KhameesOmar Shaaban Ibrahim

Douglas e. comer, computer networks and internets, chapter 38 , RPC and Middleware

Page 2: RPC and Middle Ware

outline

Introduction RPC RPC paradigm Communication stubs External data representation Middleware and Object-Oriented

Middleware Common middleware and object-oriented

middleware technologies. Questions.

Douglas e. comer, computer networks and internets, chapter 38 , RPC and Middleware

Page 3: RPC and Middle Ware

RPC

RPC is an acronym to Remote Procedure Call. RPC is one of the earliest facilities that help

programmer to write Client-Server software.

Douglas e. comer, computer networks and internets, chapter 38 , RPC and Middleware

Page 4: RPC and Middle Ware

The Idea of RPC

Instead of the programmer deal with communication primitives such as socket interface* it hide communication from programmer by using conventional programming language facility.

Programming mechanism is Procedure Call.

*Socket interface such as TCP and UDP interface.

Douglas e. comer, computer networks and internets, chapter 38 , RPC and Middleware

Page 5: RPC and Middle Ware

RPC Mechanism

RPC mechanism allow programmer to place procedures in two or more machines and automatically generates code that will allow procedure call to pass from one computer to another.

Page 6: RPC and Middle Ware

The structure of conventional program.

Consider the structure of a conventional program.

This graphical representation known as procedure call graph

MainProgram

ProcC

ProcB

Proc A

ProcD

ProcE

ProcF

MainProgram

ProcC

ProcB

MainProgram

ProcC

Proc A

ProcB

MainProgram

ProcC

ProcD

Proc A

ProcB

MainProgram

ProcC

ProcE

ProcD

Proc A

ProcB

MainProgram

ProcC

ProcF

ProcE

ProcD

Proc A

ProcB

MainProgram

ProcC

ProcF

ProcE

ProcD

Proc A

ProcB

MainProgram

ProcC

ProcF

ProcE

ProcD

Proc A

ProcB

MainProgram

ProcC

ProcF

ProcE

ProcD

Proc A

ProcB

MainProgram

ProcC

ProcF

ProcE

ProcD

Proc A

ProcB

MainProgram

ProcC

ProcF

ProcE

ProcD

Proc A

ProcB

MainProgram

ProcC

ProcF

ProcE

ProcD

Proc A

ProcB

MainProgram

ProcC

Page 7: RPC and Middle Ware

When defining a procedures each procedure is parameterized (take a formal parameters)

Example (C language) int sum(int a , int b)

{ return a+b;}This procedure (sum) take two integer parameters an return

the summation of these inputs

Douglas e. comer, computer networks and internets, chapter 38 , RPC and Middleware

Page 8: RPC and Middle Ware

Because parameterized procedure have worked well as a programming abstraction, researcher examined ways to use a procedure abstraction to build client and server.

The premise of the research is: If programmer follow the same procedure call paradigm used to build a conventional programs when building client and server software, the programmer will find the task easier and will make fewer mistakes.

Douglas e. comer, computer networks and internets, chapter 38 , RPC and Middleware

Page 9: RPC and Middle Ware

To follow the premise: Researchers have investigate ways to

make client server programming as much like conventional programming as possible.

Most researches have focused on extending existing language.

Douglas e. comer, computer networks and internets, chapter 38 , RPC and Middleware

Page 10: RPC and Middle Ware

The idea is to devise a tool that accept a high level program specification, create a code to handle the network communication details and automatically build a client and server programs.

Douglas e. comer, computer networks and internets, chapter 38 , RPC and Middleware

Page 11: RPC and Middle Ware

outline

Introduction RPC RPC paradigm Communication stubs External data representation Middleware and Object-Oriented

Middleware Common middleware and object-oriented

middleware technologies. Questions.

Douglas e. comer, computer networks and internets, chapter 38 , RPC and Middleware

Page 12: RPC and Middle Ware

RPC paradigm

When using RPC: Programmer doesn’t focus on the computer

network or communication protocols. Programmer will be interested in the problem

being solved. The programmer will imagine how the problem

will be solved by a conventional program running on a single computer.

The programmer design and build the program, using the procedure call as basic architectural feature.

Douglas e. comer, computer networks and internets, chapter 38 , RPC and Middleware

Page 13: RPC and Middle Ware

After the program has been finished, programmer consider how to divide the program into two pieces.

Programmer must divide the call graph into two parts:

Part contain main program and some procedures it calls, becomes the client.

The remaining procedure become the server.

Douglas e. comer, computer networks and internets, chapter 38 , RPC and Middleware

Page 14: RPC and Middle Ware

The programmer must consider the global data that each procedure references.

It must be located on the same computer as the procedure.

Douglas e. comer, computer networks and internets, chapter 38 , RPC and Middleware

Page 15: RPC and Middle Ware

ProcF

ProcE

ProcD

Proc A Proc

B

MainProgram

ProcC

Client

Server

Page 16: RPC and Middle Ware

Other division of the call graph are possible.

We can not tell from the figure why the programmer made this particular choice.

Example: Procedure A and D may be in the client

because they handle interaction with user or reference global variable.

Douglas e. comer, computer networks and internets, chapter 38 , RPC and Middleware

Page 17: RPC and Middle Ware

Instead of procedure call occur on one machine RPC extends call mechanism to allow a procedure in the client to call a remote procedure across the network in the server.

Douglas e. comer, computer networks and internets, chapter 38 , RPC and Middleware

Page 18: RPC and Middle Ware

How to call procedure located on the server?

When a procedure call in the client side occurs:

A thread of control appears to pass across the network from the client to server.

When procedure returns: A thread of control appears to pass

back from the server to the client.

Douglas e. comer, computer networks and internets, chapter 38 , RPC and Middleware

Page 19: RPC and Middle Ware

RPC tool

Programmer creates a specification that describe the set of procedure that will be remote.

Example:Programmer must specify types it’s

parameters.RPC tool creates software that handle

necessary communications.

Douglas e. comer, computer networks and internets, chapter 38 , RPC and Middleware

Page 20: RPC and Middle Ware

outline

Introduction RPC RPC paradigm Communication stubs External data representation Middleware and Object-Oriented

Middleware Common middleware and object-oriented

middleware technologies. Questions.

Douglas e. comer, computer networks and internets, chapter 38 , RPC and Middleware

Page 21: RPC and Middle Ware

Communication Stubs

It’s uses client server interactions. Uses conventional protocols to send a

request message from client to server. The request identifies the procedure to

invoke. Extra software must be added to each

part of the program to impalement the interaction.

Douglas e. comer, computer networks and internets, chapter 38 , RPC and Middleware

Page 22: RPC and Middle Ware

Extra software in the client side

Handles the details of a sending message across the network and waiting for response.

Douglas e. comer, computer networks and internets, chapter 38 , RPC and Middleware

Page 23: RPC and Middle Ware

Extra software in the server side

Handles the details of receiving message, specified the calling procedure, and sending a response back to the client.

Each piece of added software is called communication stub or proxy.

The two stubs handle all communication details.

In addition the stubs are constructed to fit local procedure.

Douglas e. comer, computer networks and internets, chapter 38 , RPC and Middleware

Page 24: RPC and Middle Ware

How does stubs work?

If a call is made to a procedure in the server side:

Client stub intercept the procedure call. Gathers the values for the arguments

(argument marshalling). Send the message across the network

to the communication stub in the server.

Douglas e. comer, computer networks and internets, chapter 38 , RPC and Middleware

Page 25: RPC and Middle Ware

The server stub invoke the specified procedure and send the result back to the client stub.

The client stub receives a responses, it return the result to it’s caller.

Douglas e. comer, computer networks and internets, chapter 38 , RPC and Middleware

Page 26: RPC and Middle Ware

Main program

Proc B

Douglas e. comer, computer networks and internets, chapter 38 , RPC and Middleware

RPC vs Conventional program structure

Page 27: RPC and Middle Ware

Main program

Client stub for B

Server stub for B

Proc B

Client side Server side

Douglas e. comer, computer networks and internets, chapter 38 , RPC and Middleware

Page 28: RPC and Middle Ware

Because the communication stubs interested between two procedures to implement remote procedure call can use exactly the same name and interface as the original procedure call, neither the calling procedure nor the called procedure needed to be changed.

Douglas e. comer, computer networks and internets, chapter 38 , RPC and Middleware

Page 29: RPC and Middle Ware

outline

Introduction RPC RPC paradigm Communication stubs External data representation Middleware and Object-Oriented

Middleware Common middleware and object-oriented

middleware technologies. Questions.

Douglas e. comer, computer networks and internets, chapter 38 , RPC and Middleware

Page 30: RPC and Middle Ware

External data representation

Computers do not all use the same internal data representations:

thus when the client or server send data between heterogeneous computers, they must agree on how to represent these data.

How ?1. Negotiate a representation2. Use a fixed representation and for each the client and server convert

from the local representation to the fixed one. Douglas e. comer, computer networks and internets, chapter 38 , RPC and Middleware

Page 31: RPC and Middle Ware

outline

Introduction RPC RPC paradigm Communication stubs External data representation Middleware and Object-Oriented

Middleware Common middleware and object-oriented

middleware technologies. Questions.

Douglas e. comer, computer networks and internets, chapter 38 , RPC and Middleware

Page 32: RPC and Middle Ware

Middleware and Object-Oriented Middleware

Middleware: a tool can help a programmer build a program that uses RPC, it is called middleware because it provide software that fits “between” a conventional program and a network software.

How to do so?1. The programmer specifies the set of procedures that will be remote.2. Specifies the procedures interface details(i.e. number and type of

arguments) using the tool’s Interface Definition Language (IDL).3. The tool(middleware) reads the IDL specifications and generates the

necessary client and server stubs.4. The programmer then compiles and links two separate programs:

The server program [server stubs + remote procedures] The client program [client stubs + main program + local procedures]

Douglas e. comer, computer networks and internets, chapter 38 , RPC and Middleware

Page 33: RPC and Middle Ware

In the 1990s programming language research shifted focus from procedure paradigm to object-oriented paradigm, as a result most new programming language are object-oriented languages [OOP].

The basic structure facility in OOP is (object) which consist of data items plus a set of operation for those items called (methods).

As a result the designers are creating new middleware systems known as distributed object system that mainly depend on OOP.

Douglas e. comer, computer networks and internets, chapter 38 , RPC and Middleware

Middleware and Object-Oriented Middleware

Page 34: RPC and Middle Ware

outline

Introduction RPC RPC paradigm Communication stubs External data representation Middleware and Object-Oriented

Middleware Common middleware and object-oriented

middleware technologies. Questions.

Douglas e. comer, computer networks and internets, chapter 38 , RPC and Middleware

Page 35: RPC and Middle Ware

Common middleware and object-oriented middleware technologies

Middleware

1. ONC RPC2. DCE /RPC3. MSRPC

Object-Oriented Middleware

1. CORBA2. MSRPC2 (ORPC)3. COM / DCOM4. Java RMI5. Jini6. SOAP7. UDDI8. XML

Douglas e. comer, computer networks and internets, chapter 38 , RPC and Middleware

Page 36: RPC and Middle Ware

Middleware technologies

1- ONC RPC Open Network Computing RPC One of the first RPC mechanisms

developed by Sun Microsystems. Besides Interface Definition Language (IDL) and massage

format, it also defines a representation standards known as eXternal Data Representation (XDR).

It uses TCP/IP protocols, and allows a programmer to choose UDP or TCP transport.

2- DEC /RPC Distributed Computing Environment developed by the Open

Software Foundation, which is composed of multiple components and tools that are designed to work together.

Permits a client to access more than one server. It uses TCP/IP protocols, and allows a programmer to choose

UDP or TCP transport.Douglas e. comer, computer networks and internets, chapter 38 , RPC and Middleware

Page 37: RPC and Middle Ware

Middleware technologies cont.

3- MSRPC Microsoft RPC developed by Microsoft Corp., it was derived

from DEC/RPC and hence it shares the same central concepts, the different is that MSRPC defines its own Interface Definition Language (IDL) and its own protocols .

Douglas e. comer, computer networks and internets, chapter 38 , RPC and Middleware

Page 38: RPC and Middle Ware

Object-Oriented Middleware technologies

1- CORBA Common Object Request Broker Architecture, the best

known object-oriented middleware tech., Developed by Object Management Group (OMG) .

The main advantage of CORBA its dynamic in terms of creating stubs at runtime, in contrary conventional RPC tech., creates stubs during program construction(i.e. at compile time).

Douglas e. comer, computer networks and internets, chapter 38 , RPC and Middleware

Page 39: RPC and Middle Ware

2- MSRPC2 (ORPC) Object RPC, the second generation of MSRPC, extend the

ordinary MSRPC to support object-oriented concept.

3- COM/DCOM1. Component Object Model developed by Microsoft corp.,

the main advantage of implementing objects that can be used in environments different from the one in which they were created, this is done by forcing component implementers to provide well-defined interfaces that are separate from the implementation.

2. Distributed COM, extend COM to include DCE/RPC features.

Object-Oriented Middleware technologies cont.

Douglas e. comer, computer networks and internets, chapter 38 , RPC and Middleware

Page 40: RPC and Middle Ware

4- Java RMI Java Remote Procedure Invocation, developed by Sun

Microsystems.

5- Jini Developed also by Sun Microsystems, Jini is designed to permit a

client on one computer to use a service on another computer, more important, Jini allows a program to move from one computer to another.

Object-Oriented Middleware technologies cont.

Douglas e. comer, computer networks and internets, chapter 38 , RPC and Middleware

Page 41: RPC and Middle Ware

6- XML Extensible Markup Language, set of rules for encoding documents

specified by World Wide Web Consortium (W3C), and that is used by RPC mechanisms.

7- SOAP Simple Object Access Protocol, lightweight protocol that relies

on Extensible Markup Language (XML) for its message format. proposed to the WWW by a set of designers from Microsoft and

IBM.

Object-Oriented Middleware technologies cont.

Douglas e. comer, computer networks and internets, chapter 38 , RPC and Middleware

Page 42: RPC and Middle Ware

Object-Oriented Middleware technologies cont.

8- UDDI Universal Discovery Description and Integration, is a

registry mechanism for web services that allows clients to locate servers in the internet.

Server registers information about the service it offers, and clients search the registry to locate a service on it.

it is not RPC mechanism but it can be used with it.

Douglas e. comer, computer networks and internets, chapter 38 , RPC and Middleware

Page 43: RPC and Middle Ware

outline

Introduction RPC RPC paradigm Communication stubs External data representation Middleware and Object-Oriented

Middleware Common middleware and object-oriented

middleware technologies. Questions.

Douglas e. comer, computer networks and internets, chapter 38 , RPC and Middleware

Page 44: RPC and Middle Ware

Questions

Q1: What is the main advantage of CORBA ?

1. creating stubs at runtime likewise other technologies that create stubs at compile time.

Q2: define communication stubs?1.Extra software added to the client and the server sides to

handle message sending and receiving between the two parties.

Douglas e. comer, computer networks and internets, chapter 38 , RPC and Middleware

Page 45: RPC and Middle Ware

Thank You

Douglas e. comer, computer networks and internets, chapter 38 , RPC and Middleware