Chapter 4 Communication
Chapter 4 Communication
Fundamentals
Layered Protocols
Solution:
Allowing programs to call procedures located on other machines.
When a process on machine A calls a procedure on machine B, the calling process on A is
suspended, and execution of the called procedure takes place on B.
Information can be transported from the caller to the callee in the parameters and be returned in the
procedure result.
No message passing is visible to the programmer.
This method is known as Remote Procedure Call, or often just RPC.
Figure 1: (a) Parameter passing in a local procedure call: the stack before the call to read and (b) The
stack while the called procedure is active.
When the message arrives at the server, the stub examines the message to see which procedure is
needed and then makes the appropriate call.
The actual call from the stub to the server looks like the original client call, except that the parameters
are variables initialized from the incoming message.
When the server has finished, the server stub gains control again.
It takes the result sent back by the server and packs it into a message.
This message is sent back to the client stub, which unpacks it to extract the result and returns the value
to the waiting client procedure.
Parameter Passing
Message-Oriented Communication
Message-queuing model
The basic idea behind a message-queuing system is that applications communicate by inserting messages in
specific queues. These messages are forwarded over a series of communication servers and are eventually
delivered to the destination, even if it was down when the message was sent. In practice, most
communication servers are directly connected to each other. In other words, a message is generally
transferred directly to a destination server. In principle, each application has its own private queue to which
other applications can send messages. A queue can be read only by its associated application, but it is also
possible for multiple applications to share a single queue.
An important aspect of message-queuing systems is that a sender is generally given only the guarantees that
its message will eventually be inserted in the recipient's queue. No guarantees are given about when, or
even if the message will actually be read, which is completely determined by the behavior of the recipient.
Messages can, in principle, contain any data. The only important aspect from the perspective of middleware
is that messages are properly addressed. In practice, addressing is done by providing a system wide unique
name of the destination queue. In some cases, message size may be limited, although it is also possible that
the underlying system takes care of fragmenting and assembling large messages in a way that is completely
With the advent of peer-to-peer technology, and notably structured overlay management, it became easier
to set up communication paths. As peer-to-peer solutions are typically deployed at the application layer,
various application level multicasting techniques have been introduced.
A crucial design issue is the construction of the overlay network. In essence, there are two approaches:
First, nodes may organize themselves directly into a tree, meaning that there is a unique (overlay) path
between every pair of nodes. An alternative approach is that nodes organize into a mesh network in which
every node will have multiple neighbors and, in general, there exist multiple paths between every pair of
nodes. The main difference between the two is that the latter generally provides higher robustness: if a
connection breaks (e.g., because a node fails there will still be an opportunity to disseminate information
without having to immediately reorganize the entire overlay network.
Flooding-based multicasting
Multicasting refers to sending a message to a subset of all the nodes, that is, a specific group of nodes. A
key design issue when it comes to multicasting is to minimize the use of intermediate nodes for which the
message is not intended. To make this clear, if the overlay is organized as a multi-level tree, yet only the
leaf nodes are the ones who should receive a multicast message, then clearly there may be quite some nodes
who need to store and subsequently forward a message that is not meant for them.
One simple way to avoid such inefficiency is to construct an overlay network per multicast group. As a
consequence, multicasting a message m to a group G is the same as broadcasting m to G. The drawback of
this solution is that a node belonging to several groups, will, in principle, need to maintain a separate list of
its neighbors for each group of which it is a member.
If we assume that an overlay corresponds to a multicast group, and thus that we need to broadcast a
message, a naive way of doing so is to apply flooding. In this case, each node simply forwards a message m
to each of its neighbors, except to the one from which it received m. Furthermore, if a node keeps track of
the messages it received and forwarded, it can simply ignore duplicates. We will roughly see twice as many
messages being sent as there are links in the overlay network, making flooding quite inefficient.
Epidemic algorithms are based on the theory of epidemics, which studies the spreading of infectious
diseases. In the case of large scale distributed systems, instead of spreading diseases, they spread
information. Designers of epidemic algorithms for distributed systems will try to “infect” all nodes with
new information as fast as possible.
A node that is part of a distributed system is called infected if it holds data that it is willing to spread to
other nodes. A node that has not yet seen this data is called susceptible. Finally, an updated node that is not
willing or able to spread its data is said to have been removed. Note that we assume we can distinguish old
from new data, for example, because it has been time-stamped or versioned. In this light, nodes are also
said to spread updates.
A popular propagation model is that of anti-entropy. In this model, a node P picks another node Q at
random, and subsequently exchanges updates with Q. There are three approaches to exchanging updates:
In a pure push-based approach, updates can be propagated only by infected nodes. However, if many nodes
are infected, the probability of each one selecting a susceptible node is relatively small. Consequently,
chances are that a particular node remains susceptible for a long period simply because it is not selected by
an infected node.
In contrast, the pull-based approach works much better when many nodes are infected. In that case,
spreading updates is essentially triggered by susceptible nodes. Chances are big that such a node will
contact an infected one to subsequently pull in the updates and become infected as well. If only a single
node is infected, updates will rapidly spread across all nodes using either form of anti-entropy, although
push-pull remains the best strategy