120 likes | 281 Views
Remote Procedure Call and Serialization. By: Aaron Mckay. Remote Procedure Call (RPC). What is RPC? An inter-process communication that allows a computer to cause a subroutine or procedure to execute in another space (such as another computer on a network) RPC on the OSI model
E N D
Remote Procedure Call and Serialization By: Aaron Mckay
Remote Procedure Call (RPC) • What is RPC? • An inter-process communication that allows a computer to cause a subroutine or procedure to execute in another space (such as another computer on a network) • RPC on the OSI model • Contains elements of session and presentation layers • Why use RPC? • To make distribution more transparent and easier to accomplish
RPC Toolkits • Typical toolkits automatically handle: • Reliability such as communication errors and transactions • Security • Serialization
Serialization • Serialization – The process of translating data structures or object state into a format that can be stored and reconstructed in the same or another computer environment. • When referring to RPC, Serialization is used to transmit data across a network and deserialization is used to extract a data structure. • There are many different versions of serialization. Custom serialization is even an option as long as the serialization and deserialization processes are defined for the object.
Local Procedure Call vs Remote Procedure Call • Local Procedure Call • Transfer control from one part of a process to another. The control must be returned at the end of the procedure. • Remote Procedure Call • Local process starts a process on a remote system. • Waits for a response from this system.
Transparency • Network code is hidden in the client and server stubs. • The stubs are usually generated automatically • Keeps the user from having to deal with sockets, byte ordering, acknowledgements, etc.
Call Semantics • Exactly Once • Procedure was executed exactly once (subtracting money from a bank account) • At Most Once • If a normal return to caller occurs then the procedure occurred one time. If an error is made then it is uncertain if the procedure executed once or not at all. • At Least Once • Client stub keeps making procedure calls until it receives a valid response.
Iterative RPC Server Loop { Wait for RPC request Receive RPC request decode arguments execute desired function reply result to client } Problem: RPC server cannot accept new RPC until function is executed
Concurrent RPC Server Loop { Wait for RPC request Receive RPC request decode arguments Spawn a process or thread { execute desired function reply result to client } }
Summary • RPC is useful for having transparent communication. • It is the basis for many client/server applications • Easy to use • It will end world hunger • Enjoy catching Pokémon on Google Maps