Distributed System RPC
Distributed System RPC
CALL
INTRODUCTION
Call Message: are sent by client to server for requesting execution of remote
procedure
Reply Message: are sent by server to client for returning the result of remote
procedure execution
Message Type: used to distinguish call messages from reply messages. Set ‘0’ for
call and ‘1’ for reply messages.
Client Identifier: is used by server to check authenticity and for sending the
reply back.
RPC MESSAGES
Stubs in RPC provides a normal procedure call by hiding the interface of underlying
RPC system from client and server processes.
MARSHALLING involve the transfer of arguments from the client process to the sever
process and transfer results from sever process to the client process. These arguments
and results are language based data structures.
•Marshaling involves following actions:
Taking arguments (of client process) or result (of server process) that will form the
message data.
Encoding of message data from precious step on sender’s computer.
Decoding of message data on receiver’s computer.
• In order that encoding and decoding of an RCP message can be performed successfully,
the order and the representation method(tagged or untagged) must be known to the
client and sever of the RCP.
Marshalling procedure are classified
I. Part of RPC software: Scale data type, compound built from them
II. That are defined by users of RPC: User’s defined \ pointer data types
SERVER MANAGEMENT
Server Implementation
Based on implementation server may be of two types:
Stateful Servers
A stateful server maintains client’s state information from one RPC
to the next. These client state information is subsequently used at
the time of executing the second call.
Stateless Servers
A stateless server doesn’t maintain any client state information.
Hence every request from a client must be accompanied with all
the necessary parameters to a sever for byte stream files that
allows following operations on files is stateless :
SERVER MANAGEMENT
Stateful Server:
For e.g. consider a server for byte stream files that allows following operations
on files:
Open(filename,mode): it opens the file filename in specified mode. When
server executes this it creates entry for this file in file-table (used for
maintain file state information of all the open files). When a file is opened, its
read-write pointer in file-table is set to ‘0’ and server returns a file id (fid)
which is used by client for subsequent use.
Read(fid,n,buffer): this operation get n bytes of data from file with fid into
the buffer. When server executes this it returns client n byte of file data
starting from the byte currently addressed by the read-write pointer.
Write(fid,n,buffer): on executing this the server takes n bytes of data from
buffer, writes it into file fid at the byte position currently addressed by read-
write pointer.
Seek(fid,position): this causes the server to change the value of read-write
pointer of file fid to new value specified as position.
Close(fid): it causes the server to delete from its file-table the file state of
file fid.
SERVER MANAGEMENT
Stateful Server:
SERVER MANAGEMENT
Stateless Server:
It doesn’t maintain any client state information. So every request from client
must be accompanied with all parameters for carrying out operation.
For e.g. a server for byte stream file that allows the following operation is
stateless:
Read (filename, position, n, buffer): on execution the server returns to
client n bytes of data of file filename. The returned data is placed in the
buffer. The position parameter tell from where to begin reading.
Write (filename, position, n, buffer): on execution server takes n bytes of
data from buffer and writes it into the file filename. The position parameter
tells the position from where to start writing. It returns client the actual
number of bytes written.
Stateless Server:
SERVER MANAGEMENT
Instance-per-Call Servers: server exist only for the duration of single call.
Persistent Servers: server created before client and register itself with binding
agent. When Client Calls the binding agent select server arbitrarily or based
on some built-in policy (like min. number of clients bound to it) and returns
the address of server to client.
IMPLEMENTING RPC MECHANISM
Message Transmission
Server Stub
Is the process by which a client becomes associated with a server so that calls
can take place.
The concept behind Binding is that servers ‘exports’ operations to register their
willingness to provide service and client ‘import’ operations asking the RPC
Runtime system to locate a server and establish any state that may be needed
at each end.
Server Naming:
For eg there may be an interface of type file_server, and there may be several
instances of servers providing file services.
The type of an interface usually also has a ‘version number’ field to distinguish
between old and new versions of the interface that may have different sets of
procedures or the same set of procedures with different parameters.
CLIENT-SERVER BINDING
Server Locating:
For locating the server the client uses location mechanism.
Binding Agent:
The binding agent return ‘handle’ ( location of server) to the client when
requested.
CLIENT-SERVER BINDING
Binding Agent:
Binding Time:
Binding can be done at three times:
The binding agent binds the client and server by returning to the client the
server’s handle.
Client caches the handle to avoid calling binding agent several times.
Suitable for those situations in which client calls server several times
Client is bound to a server at the time when it calls the server for the first
time during execution
A method call indirect call method is used
CLIENT-SERVER BINDING
Changing Bindings:
In RPC, the caller and callee processes are located on possibly different nodes.
The normal functioning of RPC may get disrupted due to one of the following
reasons:
• The Call message gets lost
• The Response message gets lost
• The Callee node crashes and is restarted
• The Caller node crashes and is restarted
Used in RPC in which the called procedure has nothing to return as the result
of procedure execution
The client requires no confirmation that the procedure has been executed and
the client normally proceeds immediately after sending the request message.
This protocol provides may-be call semantics and requires no retransmission of
request message
Client performance is improved because the client is not blocked and can
immediately continue to do other work after making the call.
Server performance is improved because the server need not generate and
send any reply for the request
The RPC runtime does not take any responsibility for retrying a request in case
of communication failure.
Suitable forperiodical update services like Time server node for transmission
of time for time synchronization
COMMUNICATION PROTOCOLS FOR RPCs
Request Protocol:
COMMUNICATION PROTOCOLS FOR RPCs
Request/ Reply Protocol (RR):
This is designed for simple RPC where message fills in one packet and
computation time is less than transmission time
The server’s reply message is regarded as an ACK of the client’s request
message
A subsequent call packet from a client is regarded as an ACK of the server’s
reply message of the previous call made by that client
In its basic form, this protocol doesn’t possess failure-handling capabilities.
COMMUNICATION PROTOCOLS FOR RPCs
The server deletes an information from its reply cache only after receiving an
ACK form client
This protocol requires that the unique message identifier associated with
request message must be ordered because of the possibility of ACK getting lost
This helps in matching a reply with its corresponding request and an ACK with
its corresponding reply
COMMUNICATION PROTOCOLS FOR RPCs
There can be an exception condition for each possible error type, and each of
these can have a corresponding exception raised when an error of that type
occurs.
EXCEPTION HANDLING
For languages not having exception handling a conventional method can be used
i.e. return a pre-determined value for any error occurrence.
server crashes:
It also relates to idempotent calls and
can not be solved using sequence number
Client does not know the time of crash
Solutions
At least once semantic: Server is rebooted and last reply is sent
At most once semantic: Give up immediately and report failure
Guarantee nothing, RPC may have been executed 0 to n times, easy to
implement
Exactly one semantic : not easy to implement
EXCEPTION HANDLING
Client crashes : generate orphan calls which waste CPU cycle, lock files or tie
up valuable resources:
Extermination: Disk log is maintained where client makes an entry, after reboot
log is checked and orphans are killed
Reincarnation: Divide time up in to sequentially numbered epochs, after reboot
client broadcast declaring the start of new epoch, all remote computation are
killed
Gentle Reincarnation: when epoch broadcast comes in machines tries to locate
owner of remote computation and then kill if owner is not found
Expiration: Each RPC is given time slot after which it is killed
RPC IN HETROGENOUS ENVIRONMENT
Data Representation:
RPC should take care of differences in data representation between the
architectures of client and server machines of a procedure call
Transport Protocol:
RPC system should be independent of underlying network transport protocol
Control Protocol:
RPC should be independent of underlying control protocol defining control
information in each transport packet.
LIGHT WEIGHT RPC
Simple Data Transfer: LRPC uses a shared arguments stack accessible to both
client and server. Hence fewer copies of data during it transfer from one
domain to another.
RPC SECURITY
This is useful for several application for e.g server manager managing group of
server processes all providing the same service, server manger can multicast a
message to all server requesting that free server volunteer to serve particular
application, similarly to avail a particular service, server process can send
enquiry to all messages.
Group Management:
In One to many communication receiver processes of message form a group.
Group Management:
Closed : one in which only the member of group can send message to the
group. Out sider cannot send a message to the group as a whole. Group of
processes working on common problem.
Open: one in which any process in the system can send a message to the
group as a whole. Group of replicated servers
Message passing system must have a mechanism to manage the groups (create
or delete) and their membership (add/remove) dynamically. One mechanism is
by using centralized ‘group server’ process.
All group related requests are handled by group server.
Issues are: Poor Reliability & Poor Scalability.
If replication of group server, then consistency issues are to be handled
GROUP COMMUNICATION
One to Many Communication
Group Management:
Group Management:
Group Addressing:
Multicast address & Broadcast address are example of Low level naming.
If machine does not support multicast, low level names are machine address of
different machines. This requires one to one communication
GROUP COMMUNICATION
One to Many Communication
The kernel of senders contacts the group server to obtain low level name of
group and list of process identifiers of the processes belonging to group.
GROUP COMMUNICATION
One to Many Communication
When packet reaches a machine, the kernel of that machine extracts the list
of process identifiers from packet.
And forward the message to those processes in the list that belongs to its own
machine.
GROUP COMMUNICATION
One to Many Communication
Multicast Implementation:
Process ‘0’ sending message to group consisting of process ‘1’, ‘3’, ‘4’.
Broadcast Implementation:
Process ‘0’ sending message to group consisting of process ‘1’, ‘2’, ‘3’, ‘4’.
Process ‘2’ does not need message so it simple discard the message.
Unicast Implementation:
Process ‘0’ unicast the message to each process ‘1’, ‘3’, ‘4’ individually.
Unbuffered Multicast: the message is not buffered for the receiving process
and is lost if the receiving process is not in a ready state.
Send -to –all : A copy of the message is sent to each process. And the
message is buffered until it is accepted by all processes in group.
Atomic Multicast
Non selective receiver: it specifies a set of senders i.e. if any one sender in
the set sends a message to this receiver the message exchange takes place.
Issue: Nondeterminism- the receiver may wait for information from any of a
group of senders, rather than from one specific sender.
So when it is not known in advance which member of the group will have the
information available first, such behavior is nondeterministic.
control dynamically : Buffer receiver message from producer, consumer
GROUP COMMUNICATION
Many to One Communication
Issue: Ordered message delivery- it ensures that all messages are delivered to all
receivers in an order acceptable to the application.
Absolute Ordering:
Consistent Ordering:
iv. Receiving kernel saves all messages for receiver in separate queue
vi. Message in the gap are delivered after receiving previous messages
GROUP COMMUNICATION
Many to Many Communication
Causal Ordering: