Notes On RPC
Notes On RPC
A Remote Procedure Call appears to the user like a call to a function on the local machine.
RPC concept is similar to conventional programming Procedure calling has well understood semantics RPC simplifies access to remote systems
Function parameters are marshalled into a communications packet and sent to the server which calls the appropriate function with the data provided.
Parameter types
Input
basic datatype - pass by value semantics, copy data to server arrays or structures - copy data to server, may be a lot of data pointers to single datatype - copy data item to server pointers in general - not allowed
Output
data, not addresses, copied from server return value copied from server
Environment
no files
Exception handling - what does the communication stub do if the first effort to send a msg fails?
no retry RPC may not work at-least-once Keep sending until it gets there idempotent functions at-most-once retry but server must filter repeats
goals
transparency - it would be nice if an RPC looked just like a local function call portability - allow the application to be used on different systems load balancing - select server with lowest utilization failure recovery - select a different server if original fails efficiency
methods
write server name in code put server name in header file specify to the linker all RPC applications call an initialization function put the server address in the function call environment file of server addresses environment variable ask a human name server broadcast request for a server
Asynchronous RPC
Asynchronous RPC without reply - stub returns to caller after sending message Asynchronous RPC with reply
callbacks - client accepts call from the server promises - each RPC generates a promise. A promise identifies the RPC reply to be provided later. A promise can be ready or blocked. The client can inspect a promise without blocking and can retrieve the results.