(Facc) 3#43

advertisement
Implementing Remote Procedure Calls
Andrew D. Birrell and Bruce Jay Nelson
1894 Xerox Palo Alto Research Center
EECS 582 – W16
Overview
• Introduction
• Remote Procedure Call vs Local Procedure Call
• Design choice
• RPC Implementation
•
•
•
•
Basic Structure
Binding
Transport protocol
Exception handling
• Evaluation
EECS 582 – W16
Introduction
• What is a Remote Procedure Call?
Caller
Callee
EECS 582 – W16
Goals of RPC
• Simplicity
• To hide the existence of the network from a program.
• To make distributed computation easy.
• Efficiency
• Even a small performance improvement is important due to heavy uses.
• Security
• Secure end-to-end communications with RPC
EECS 582 – W16
RPC Implementation
EECS 582 – W16
RPC structure
• Caller machine
• User (application code module)
• User-stub
• Caller instance of RPCRuntime (communication subsystem)
• Callee
• Server (server code module)
• Server-stub
• Server instance of RPCRuntime
EECS 582 – W16
Steps in RPC
EECS 582 – W16
When writing a distributed app…
• Design the interface
• Write user code that import(call) the interface.
• Write server code that export(implement) the interface.
• Present the interface to Lupine to generate stubs
• Today, using any IDL(Interface description language)
• On caller, the user is bound to the user-stub.
• On callee, the server-stub is bound to the server.
EECS 582 – W16
Binding Process
Importer of an interface
Binding
Exporter of an interface
• How does a client of the binding mechanism specify what he wants
to be bound to?
• Naming
• How does a caller determine the machine address of the callee
and specify to the callee the procedure to be invoked?
• Locating
EECS 582 – W16
Naming
• Refers to what service the client wants to use.
• Interface consists of two parts:
• Type: Which interface the caller expects the callee to implement.
Service Name (e.g Mail-server)
• Instance: Which particular implementor of an abstract interface is
desired.
Machine Address (e.g Specific mail-server address)
EECS 582 – W16
Locating
• With Grapevine, a distributed database system.
Server 1
(Ebbets)
3#22#
Server 2
(Luther)
3#276#
Server3
(Facc) 3#43#
Grapevine
Database
Type (Group)
Member-list
Instance(Individual)
Connect-site
FileAccess
{Ebbets, Luther, Facc}
Ebbets
3#22#
Luther
3#276#
Facc
3#43#
EECS 582 – W16
Binding Process
Binding Mechanism Advantages
• Stateless:
• Importing an interface has no effect on the state of the exporting
machine
• The use of UID means that bindings are implicitly broken if the
exporter crashes and restarts.
• Restricting the set of users who can update Grapevine DB .
• To avoid security problems
EECS 582 – W16
Transport Protocol
• Why not TCP?
• The goal here is low latency, not high through put
• The cost of setting up and terminating a connection is expensive in
RCP.
• RPC can be characterized as transaction-oriented
communication.
• A single response for a single request.
• A transaction is initiated when a client sends a request and terminated
by the server's response.
EECS 582 – W16
Simple Call
EECS 582 – W16
Complicated call
EECS 582 – W16
Exception Handling
• Communication Failure Exception
• (Explained with complicated call example), considered to be the
primary difference between procedure call and RPC
• Remote Process Exception
• Callee sends exception back to Caller.
• Caller handles exception and send the result to Callee.
EECS 582 – W16
Optimizations
• Use of thread pool (idle processes) in caller and callee machines to
reduce process creation costs.
• The use of process source and destination allow processes to get
the packets they’re waiting for directly from the interrupt handler.
• Use of subsequent packet for implicit acknowledgments of previous
packets.
• Avoid the cost of establishing and terminating connections by the
implementation of packet-level protocol.
EECS 582 – W16
Performance
EECS 582 – W16
Conclusion
• RPC makes distributed programming easier?
• Hard to justify back then due to lack of examples demonstrating the
importance of such performance.
• The idea is now everywhere.
• Whether a sufficient level of performance for RPC can be
achieved by a general purpose transport protocol remains
undecided.
• Today, RPC usually uses UDP, but only switch to TCP when data
cannot fit into single packet.
EECS 582 – W16
Q&A
EECS 582 – W16
Download