61
CHAPTER - 4 REMOTE COMMUNICATION

CHAPTER - 4 REMOTE COMMUNICATION · 2014-03-17 · © Oxford University Press 2011 Remote Procedure Call Basic RPC operation

  • Upload
    others

  • View
    8

  • Download
    0

Embed Size (px)

Citation preview

Page 1: CHAPTER - 4 REMOTE COMMUNICATION · 2014-03-17 · © Oxford University Press 2011 Remote Procedure Call Basic RPC operation

CHAPTER - 4

REMOTE COMMUNICATION

Page 2: CHAPTER - 4 REMOTE COMMUNICATION · 2014-03-17 · © Oxford University Press 2011 Remote Procedure Call Basic RPC operation

© Oxford University Press 2011

Topics

• Introduction to Remote Communication

• Remote Procedural Call Basics

• RPC Implementation

• RPC Communication

• Other RPC Issues

• Case Study: Sun RPC

• Remote invocation Basics

• RMI Implementation

Page 3: CHAPTER - 4 REMOTE COMMUNICATION · 2014-03-17 · © Oxford University Press 2011 Remote Procedure Call Basic RPC operation

© Oxford University Press 2011

Introduction to Remote

Communication

Page 4: CHAPTER - 4 REMOTE COMMUNICATION · 2014-03-17 · © Oxford University Press 2011 Remote Procedure Call Basic RPC operation

© Oxford University Press 2011

Introduction

Middleware

Page 5: CHAPTER - 4 REMOTE COMMUNICATION · 2014-03-17 · © Oxford University Press 2011 Remote Procedure Call Basic RPC operation

© Oxford University Press 2011

Remote Procedural Call Basics

Page 6: CHAPTER - 4 REMOTE COMMUNICATION · 2014-03-17 · © Oxford University Press 2011 Remote Procedure Call Basic RPC operation

© Oxford University Press 2011

Local Procedure Call

Page 7: CHAPTER - 4 REMOTE COMMUNICATION · 2014-03-17 · © Oxford University Press 2011 Remote Procedure Call Basic RPC operation

© Oxford University Press 2011

Remote Procedure Call

Basic RPC operation

Page 8: CHAPTER - 4 REMOTE COMMUNICATION · 2014-03-17 · © Oxford University Press 2011 Remote Procedure Call Basic RPC operation

© Oxford University Press 2011

RPC operation

Page 9: CHAPTER - 4 REMOTE COMMUNICATION · 2014-03-17 · © Oxford University Press 2011 Remote Procedure Call Basic RPC operation

© Oxford University Press 2011

Elements of RPC mechanism

implementation

Client

Client stub

RPC Runtime

Server stub

Server

Page 10: CHAPTER - 4 REMOTE COMMUNICATION · 2014-03-17 · © Oxford University Press 2011 Remote Procedure Call Basic RPC operation

© Oxford University Press 2011

RPC Execution

Page 11: CHAPTER - 4 REMOTE COMMUNICATION · 2014-03-17 · © Oxford University Press 2011 Remote Procedure Call Basic RPC operation

© Oxford University Press 2011

Stub generation

Manual generation

Auto generation using Interface Definition Language

(IDL)

Page 12: CHAPTER - 4 REMOTE COMMUNICATION · 2014-03-17 · © Oxford University Press 2011 Remote Procedure Call Basic RPC operation

© Oxford University Press 2011

RPC Compilation

Page 13: CHAPTER - 4 REMOTE COMMUNICATION · 2014-03-17 · © Oxford University Press 2011 Remote Procedure Call Basic RPC operation

© Oxford University Press 2011

RPC Implementation

Page 14: CHAPTER - 4 REMOTE COMMUNICATION · 2014-03-17 · © Oxford University Press 2011 Remote Procedure Call Basic RPC operation

© Oxford University Press 2011

RPC implementation

RPC messages:

Call / Request

Reply

Page 15: CHAPTER - 4 REMOTE COMMUNICATION · 2014-03-17 · © Oxford University Press 2011 Remote Procedure Call Basic RPC operation

© Oxford University Press 2011

RPC Call/ Request message

Page 16: CHAPTER - 4 REMOTE COMMUNICATION · 2014-03-17 · © Oxford University Press 2011 Remote Procedure Call Basic RPC operation

© Oxford University Press 2011

RPC reply conditions

Page 17: CHAPTER - 4 REMOTE COMMUNICATION · 2014-03-17 · © Oxford University Press 2011 Remote Procedure Call Basic RPC operation

© Oxford University Press 2011

RPC reply message

Page 18: CHAPTER - 4 REMOTE COMMUNICATION · 2014-03-17 · © Oxford University Press 2011 Remote Procedure Call Basic RPC operation

© Oxford University Press 2011

Parameter Passing Semantics

• Call-by-value semantic

– Marshalling

• Call-by –reference semantic

• Call-by-copy/restore semantic

Call-by-value copies all parameters into a message

before transmission . Call-by-reference passes

pointers to the parameters that are passed from the

client to the server. Call-by-copy/restore uses

temporary storage accessible to both programs

Page 19: CHAPTER - 4 REMOTE COMMUNICATION · 2014-03-17 · © Oxford University Press 2011 Remote Procedure Call Basic RPC operation

© Oxford University Press 2011

Call-by-value semantic

Page 20: CHAPTER - 4 REMOTE COMMUNICATION · 2014-03-17 · © Oxford University Press 2011 Remote Procedure Call Basic RPC operation

© Oxford University Press 2011

Byte ordering

Page 21: CHAPTER - 4 REMOTE COMMUNICATION · 2014-03-17 · © Oxford University Press 2011 Remote Procedure Call Basic RPC operation

© Oxford University Press 2011

Server management

Server implementation

Stateless server

Stateful server

Server management

Instance per call

Instance per session

Persistent servers

Page 22: CHAPTER - 4 REMOTE COMMUNICATION · 2014-03-17 · © Oxford University Press 2011 Remote Procedure Call Basic RPC operation

© Oxford University Press 2011

RPC communication

RPC call semantics

Page 23: CHAPTER - 4 REMOTE COMMUNICATION · 2014-03-17 · © Oxford University Press 2011 Remote Procedure Call Basic RPC operation

© Oxford University Press 2011

Orphan calls

Calls whose caller has expired due to a node crash

Handle orphan calls by using:

Extermination

Reincarnation

Gentle reincarnation

Expiration

Page 24: CHAPTER - 4 REMOTE COMMUNICATION · 2014-03-17 · © Oxford University Press 2011 Remote Procedure Call Basic RPC operation

© Oxford University Press 2011

RPC communication protocols

Request protocol

Request/Reply protocol

Request/Reply/ Acknowledge- Reply protocol

Page 25: CHAPTER - 4 REMOTE COMMUNICATION · 2014-03-17 · © Oxford University Press 2011 Remote Procedure Call Basic RPC operation

© Oxford University Press 2011

Request protocol

Page 26: CHAPTER - 4 REMOTE COMMUNICATION · 2014-03-17 · © Oxford University Press 2011 Remote Procedure Call Basic RPC operation

© Oxford University Press 2011

Asynchronous RPC

Page 27: CHAPTER - 4 REMOTE COMMUNICATION · 2014-03-17 · © Oxford University Press 2011 Remote Procedure Call Basic RPC operation

© Oxford University Press 2011

Request/Reply protocol

Page 28: CHAPTER - 4 REMOTE COMMUNICATION · 2014-03-17 · © Oxford University Press 2011 Remote Procedure Call Basic RPC operation

© Oxford University Press 2011

Request/Reply/ Acknowledge- Reply

protocol

Page 29: CHAPTER - 4 REMOTE COMMUNICATION · 2014-03-17 · © Oxford University Press 2011 Remote Procedure Call Basic RPC operation

© Oxford University Press 2011

Client server binding process

Page 30: CHAPTER - 4 REMOTE COMMUNICATION · 2014-03-17 · © Oxford University Press 2011 Remote Procedure Call Basic RPC operation

© Oxford University Press 2011

Client Server binding

Issues

Server naming

Server locating

Binding agent

primitives

Register

Deregister

Lookup

Types of binding

Fixed binding

Dynamic binding

At compile time

At link time

At run time

Page 31: CHAPTER - 4 REMOTE COMMUNICATION · 2014-03-17 · © Oxford University Press 2011 Remote Procedure Call Basic RPC operation

© Oxford University Press 2011

Other RPC Issues

Page 32: CHAPTER - 4 REMOTE COMMUNICATION · 2014-03-17 · © Oxford University Press 2011 Remote Procedure Call Basic RPC operation

© Oxford University Press 2011

Other issues in RPC implementation

Exception handing and security

Failure handling

Optimizing RPC execution

Various types of complicated RPCs

Page 33: CHAPTER - 4 REMOTE COMMUNICATION · 2014-03-17 · © Oxford University Press 2011 Remote Procedure Call Basic RPC operation

© Oxford University Press 2011

RPC in heterogeneous environment

Data presentation

Transport protocol

Control protocol

Page 34: CHAPTER - 4 REMOTE COMMUNICATION · 2014-03-17 · © Oxford University Press 2011 Remote Procedure Call Basic RPC operation

© Oxford University Press 2011

Failure handling mechanism in RPC

Client cannot find the server

Request from client to the server is lost

Reply from server to the client is lost

Server crashes after getting the request

Client crashes after sending the request

Page 35: CHAPTER - 4 REMOTE COMMUNICATION · 2014-03-17 · © Oxford University Press 2011 Remote Procedure Call Basic RPC operation

© Oxford University Press 2011

RPC Optimization

Page 36: CHAPTER - 4 REMOTE COMMUNICATION · 2014-03-17 · © Oxford University Press 2011 Remote Procedure Call Basic RPC operation

© Oxford University Press 2011

Concurrent access to multiple servers

Use of threads

Early reply technique

Call buffering approach

Serving multiple requests simultaneously

Reducing call workload of server

Using reply cache for idempotent RPC

Page 37: CHAPTER - 4 REMOTE COMMUNICATION · 2014-03-17 · © Oxford University Press 2011 Remote Procedure Call Basic RPC operation

© Oxford University Press 2011

Early Reply technique

Page 38: CHAPTER - 4 REMOTE COMMUNICATION · 2014-03-17 · © Oxford University Press 2011 Remote Procedure Call Basic RPC operation

© Oxford University Press 2011

Call buffer approach

Page 39: CHAPTER - 4 REMOTE COMMUNICATION · 2014-03-17 · © Oxford University Press 2011 Remote Procedure Call Basic RPC operation

© Oxford University Press 2011

Complicated and special RPCs

Complicated RPCs

RPCs with long duration calls or with gaps between

calls

RPCs with long messages

Special RPCs:

Call back RPC

Broadcast RPC

Batch mode RPC

Page 40: CHAPTER - 4 REMOTE COMMUNICATION · 2014-03-17 · © Oxford University Press 2011 Remote Procedure Call Basic RPC operation

© Oxford University Press 2011

Call back RPC

Client handle is provided to the server

Client process should wait for callback RPC

Handle callback deadlocks

Page 41: CHAPTER - 4 REMOTE COMMUNICATION · 2014-03-17 · © Oxford University Press 2011 Remote Procedure Call Basic RPC operation

© Oxford University Press 2011

Case Study: Sun RPC

Page 42: CHAPTER - 4 REMOTE COMMUNICATION · 2014-03-17 · © Oxford University Press 2011 Remote Procedure Call Basic RPC operation

© Oxford University Press 2011

Case Study- Sun RPC

Uses rpcgen compiler which generates

Header file

XDR filter file

Client stub file

Server stub file

Page 43: CHAPTER - 4 REMOTE COMMUNICATION · 2014-03-17 · © Oxford University Press 2011 Remote Procedure Call Basic RPC operation

© Oxford University Press 2011

Remote invocation Basics

Page 44: CHAPTER - 4 REMOTE COMMUNICATION · 2014-03-17 · © Oxford University Press 2011 Remote Procedure Call Basic RPC operation

© Oxford University Press 2011

Remote Object Invocation

Distributed object concept

Remote objects reference

Remote interface

Page 45: CHAPTER - 4 REMOTE COMMUNICATION · 2014-03-17 · © Oxford University Press 2011 Remote Procedure Call Basic RPC operation

© Oxford University Press 2011

RMI

Page 46: CHAPTER - 4 REMOTE COMMUNICATION · 2014-03-17 · © Oxford University Press 2011 Remote Procedure Call Basic RPC operation

© Oxford University Press 2011

RMI vs LMI

Page 47: CHAPTER - 4 REMOTE COMMUNICATION · 2014-03-17 · © Oxford University Press 2011 Remote Procedure Call Basic RPC operation

© Oxford University Press 2011

RMI Implementation

Page 48: CHAPTER - 4 REMOTE COMMUNICATION · 2014-03-17 · © Oxford University Press 2011 Remote Procedure Call Basic RPC operation

© Oxford University Press 2011

RMI implementation

Design issues in RMI

RMI invocation

semantics

Level of transparency

Marshalling

Message passing

Task of locating and

contacting the remote

object for the client

• RMI invocation semantics

Maybe semantics

At-least-once semantics

At-most-once semantics

Page 49: CHAPTER - 4 REMOTE COMMUNICATION · 2014-03-17 · © Oxford University Press 2011 Remote Procedure Call Basic RPC operation

© Oxford University Press 2011

Invocation semantics

Page 50: CHAPTER - 4 REMOTE COMMUNICATION · 2014-03-17 · © Oxford University Press 2011 Remote Procedure Call Basic RPC operation

© Oxford University Press 2011

Level of Transparency

Page 51: CHAPTER - 4 REMOTE COMMUNICATION · 2014-03-17 · © Oxford University Press 2011 Remote Procedure Call Basic RPC operation

© Oxford University Press 2011

Components of RMI

Page 52: CHAPTER - 4 REMOTE COMMUNICATION · 2014-03-17 · © Oxford University Press 2011 Remote Procedure Call Basic RPC operation

© Oxford University Press 2011

RMI execution components

Communication module

Remote reference module

RMI software

Server program

Client program

Binder

Page 53: CHAPTER - 4 REMOTE COMMUNICATION · 2014-03-17 · © Oxford University Press 2011 Remote Procedure Call Basic RPC operation

© Oxford University Press 2011

RMI execution

Page 54: CHAPTER - 4 REMOTE COMMUNICATION · 2014-03-17 · © Oxford University Press 2011 Remote Procedure Call Basic RPC operation

© Oxford University Press 2011

RMI software

Proxy

Dispatcher

Skeleton

Page 55: CHAPTER - 4 REMOTE COMMUNICATION · 2014-03-17 · © Oxford University Press 2011 Remote Procedure Call Basic RPC operation

© Oxford University Press 2011

Types of objects

Page 56: CHAPTER - 4 REMOTE COMMUNICATION · 2014-03-17 · © Oxford University Press 2011 Remote Procedure Call Basic RPC operation

© Oxford University Press 2011

Remote invocation readiness

Page 57: CHAPTER - 4 REMOTE COMMUNICATION · 2014-03-17 · © Oxford University Press 2011 Remote Procedure Call Basic RPC operation

© Oxford University Press 2011

RMI binding

Implicit binding

Explicit binding

Page 58: CHAPTER - 4 REMOTE COMMUNICATION · 2014-03-17 · © Oxford University Press 2011 Remote Procedure Call Basic RPC operation

© Oxford University Press 2011

Parameter passing in RMI

Pass by value

Pass by reference

Page 59: CHAPTER - 4 REMOTE COMMUNICATION · 2014-03-17 · © Oxford University Press 2011 Remote Procedure Call Basic RPC operation

© Oxford University Press 2011

Case study: Java RMI

Page 60: CHAPTER - 4 REMOTE COMMUNICATION · 2014-03-17 · © Oxford University Press 2011 Remote Procedure Call Basic RPC operation

© Oxford University Press 2011

Java RMI layer

Page 61: CHAPTER - 4 REMOTE COMMUNICATION · 2014-03-17 · © Oxford University Press 2011 Remote Procedure Call Basic RPC operation

© Oxford University Press 2011

Summary

• Introduction to Remote Communication

• Remote Procedural Call Basics

• RPC Implementation

• RPC Communication

• Other RPC Issues

• Case Study: Sun RPC

• Remote invocation Basics

• RMI Implementation