Distributed Computing
Second Edition
Sunita Mahajan
Seema Shah
© Oxford University Press 2013. All rights reserved.
Chapter 4
Remote
Communication
© Oxford University Press 2013. All rights reserved.
OUTLINE
• Introduction to
remote
communication
• Remote procedural
call basics
• RPC implementation
• RPC communication
• Other RPC issues
© Oxford University Press 2013. All rights reserved.
Introduction
• Middleware
© Oxford University Press 2013. All rights reserved.
Remote Procedural Call Basics
Local Procedure Call
© Oxford University Press 2013. All rights reserved.
Remote Procedure Call
Basic RPC operation
© Oxford University Press 2013. All rights reserved.
RPC Operation
© Oxford University Press 2013. All rights reserved.
Elements of RPC Mechanism
Implementation
• Client
• Client stub
• RPC Runtime
• Server stub
• Server
© Oxford University Press 2013. All rights reserved.
RPC Execution
© Oxford University Press 2013. All rights reserved.
Stub Generation
• Manual generation
• Auto generation using Interface Definition Language (IDL)
© Oxford University Press 2013. All rights reserved.
RPC Compilation
© Oxford University Press 2013. All rights reserved.
RPC Implementation
• RPC messages
– Call / Request
– Reply
© Oxford University Press 2013. All rights reserved.
RPC Call/ Request Message
© Oxford University Press 2013. All rights reserved.
RPC Reply Conditions
© Oxford University Press 2013. All rights reserved.
RPC Reply Message
© Oxford University Press 2013. All rights reserved.
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
© Oxford University Press 2013. All rights reserved.
Call-by-value Semantic
© Oxford University Press 2013. All rights reserved.
Byte Ordering
© Oxford University Press 2013. All rights reserved.
Server Management
• Server implementation
– Stateless server
– Stateful server
• Server management
– Instance per call
– Instance per session
– Persistent servers
© Oxford University Press 2013. All rights reserved.
RPC Communication
RPC call semantics
© Oxford University Press 2013. All rights reserved.
Orphan Calls
• Calls whose caller has expired due to a node crash
• Handle orphan calls by using
– Extermination
– Reincarnation
– Gentle reincarnation
– Expiration
© Oxford University Press 2013. All rights reserved.
RPC Communication Protocols
• Request protocol
• Request/Reply protocol
• Request/Reply/Acknowledge-Reply protocol
© Oxford University Press 2013. All rights reserved.
Request Protocol
© Oxford University Press 2013. All rights reserved.
Asynchronous RPC
© Oxford University Press 2013. All rights reserved.
Request/Reply Protocol
© Oxford University Press 2013. All rights reserved.
Request/Reply/Acknowledge-Repl
y Protocol
© Oxford University Press 2013. All rights reserved.
Client-server Binding Process
© Oxford University Press 2013. All rights reserved.
Client-server Binding
• Issues • Types of binding
– Server naming – Fixed binding
– Server locating – Dynamic binding
• At compile time
• At link time
• Binding agent primitives • At run time
– Register
– Deregister
– Lookup
Other Issues in RPC Implementation
• Exception handing and security
• Failure handling
• Optimizing RPC execution
• Various types of complicated RPCs
© Oxford University Press 2013. All rights reserved.
RPC in Heterogeneous Environment
• Data presentation
• Transport protocol
• Control protocol
© Oxford University Press 2013. All rights reserved.
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
© Oxford University Press 2013. All rights reserved.
RPC Optimization
© Oxford University Press 2013. All rights reserved.
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
© Oxford University Press 2013. All rights reserved.
Early Reply Technique
© Oxford University Press 2013. All rights reserved.
Call Buffer Approach
© Oxford University Press 2013. All rights reserved.
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
© Oxford University Press 2013. All rights reserved.
Callback RPC
• Client handle is provided to the server
• Client process should wait for callback RPC
• Handle callback deadlocks
© Oxford University Press 2013. All rights reserved.
Remote invocation Basics
Remote Object Invocation
• Distributed object concept
– Remote objects reference
– Remote interface
© Oxford University Press 2013. All rights reserved.
RMI
© Oxford University Press 2013. All rights reserved.
RMI vs LMI
© Oxford University Press 2013. All rights reserved.
RMI Implementation
Design issues in RMI
• RMI invocation semantics • RMI invocation semantics
– Maybe semantics
• Level of transparency
– Marshalling – At-least-once semantics
– Message passing – At-most-once semantics
– Task of locating and
contacting the remote
object for the client
Invocation Semantics
© Oxford University Press 2013. All rights reserved.
Level of Transparency
© Oxford University Press 2013. All rights reserved.
Components of RMI
© Oxford University Press 2013. All rights reserved.
RMI Execution Components
• Communication module
• Remote reference module
• RMI software
• Server program
• Client program
• Binder
© Oxford University Press 2013. All rights reserved.
RMI Execution
© Oxford University Press 2013. All rights reserved.
RMI Software
• Proxy
• Dispatcher
• Skeleton
© Oxford University Press 2013. All rights reserved.
Types of Objects
© Oxford University Press 2013. All rights reserved.
Remote Invocation Readiness
© Oxford University Press 2013. All rights reserved.
RMI Binding
• Implicit binding
• Explicit binding
© Oxford University Press 2013. All rights reserved.
Parameter Passing in RMI
• Pass by value
• Pass by reference
© Oxford University Press 2013. All rights reserved.