CLOUD COMPUTING TECHNOLOGIES
MC4203
UNIT I
DISTRIBUTED SYSTEMS
What is a Distributed System?
• Distributed System is a collection of autonomous computer
systems that are physically separated but are connected by a
centralized computer network that is equipped with distributed
system software.
• The autonomous computers will communicate among each system
by sharing resources and files and performing the tasks assigned
to them.
Example of Distributed System:
Any Social Media can have its Centralized Computer Network as its
Headquarters and computer systems that can be accessed by any user
and using their services will be the Autonomous Systems in the
Distributed System Architecture.
Distributed System Software: This Software enables computers to coordinate
their activities and to share the resources such as Hardware, Software, Data,
etc.
Database: It is used to store the processed data that are processed by each
Node/System of the Distributed systems that are connected to the Centralized
network.
• As we can see that each Autonomous System has a common
Application that can have its own data that is shared by the
Centralized Database System.
• To Transfer the Data to Autonomous Systems, Centralized System
should be having a Middleware Service and should be connected to a
Network
• Middleware Services enable some services which are not present in
the local systems or centralized system default by acting as an
interface between the Centralized System and the local systems. By
using components of Middleware Services systems communicate and
manage data.
• The Data which is been transferred through the database will be
divided into segments or modules and shared with Autonomous
systems for processing.
• The Data will be processed and then will be transferred to the
Centralized system through the network and will be stored in the
database.
Characteristics of Distributed System:
Resource Sharing: It is the ability to use any Hardware, Software, or Data
anywhere in the System.
Openness: It is concerned with Extensions and improvements in the system
(i.e., How openly the software is developed and shared with others)
Concurrency: It is naturally present in Distributed Systems, that deal with
the same activity or functionality that can be performed by separate users who
are in remote locations. Every local system has its independent Operating
Systems and Resources.
Scalability: It increases the scale of the system as a number of processors
communicate with more users by accommodating to improve the
responsiveness of the system.
Fault tolerance: It cares about the reliability of the system if there is a failure
in Hardware or Software, the system continues to operate properly without
degrading the performance the system.
Transparency: It hides the complexity of the Distributed Systems to the
Users and Application programs as there should be privacy in every system.
Heterogeneity: Networks, computer hardware, operating systems,
programming languages, and developer implementations can all vary and
differ among dispersed system components.
Advantages of Distributed System:
Applications in Distributed Systems are Inherently
Distributed Applications.
Information in Distributed Systems is shared among
geographically distributed users.
Resource Sharing (Autonomous systems can share
resources from remote locations).
It has a better price performance ratio and flexibility.
It has shorter response time and higher throughput.
It has higher reliability and availability against
component failure.
It has extensibility so that systems can be extended in
more remote locations and also incremental growth.
Disadvantages of Distributed System:
Relevant Software for Distributed systems does not
exist currently.
Security possess a problem due to easy access to data as
the resources are shared to multiple systems.
Networking Saturation may cause a hurdle in data
transfer i.e., if there is a lag in the network then the user
will face a problem accessing data.
In comparison to a single user system, the database
associated with distributed systems is much more
complex and challenging to manage.
If every node in a distributed system tries to send data at
once, the network may become overloaded.
Applications Area of Distributed System:
Finance and Commerce: Amazon, eBay, Online Banking, E-Commerce websites.
Information Society: Search Engines, Wikipedia, Social Networking, Cloud
Computing.
Cloud Technologies: AWS, Salesforce, Microsoft Azure, SAP.
Entertainment: Online Gaming, Music, youtube.
Healthcare: Online patient records, Health Informatics.
Education: E-learning.
Transport and logistics: GPS, Google Maps.
Environment Management: Sensor technologies.
Challenges of Distributed Systems:
While distributed systems offer many advantages, they also present some
challenges that must be addressed. These challenges include:
Network latency: The communication network in a distributed system can
introduce latency, which can affect the performance of the system.
Distributed coordination: Distributed systems require coordination among the
nodes, which can be challenging due to the distributed nature of the system.
Security: Distributed systems are more vulnerable to security threats than
centralized systems due to the distributed nature of the system.
Data consistency: Maintaining data consistency across multiple nodes in a
distributed system can be challenging.
Architecture Styles in Distributed Systems
Centralized System :
A centralized system consists of a single machine.
All calculations are done by a particular computer.
Its performance is low as the workload is not divided.
There is also no machine present in backup if the original computer
system fails.
Distributed Systems :
A distributed system consists of multiple machines.
All computation work is divided among the different systems.
Its performance is high as the workload is divided among different
computers to efficiently use their capacity.
There are systems present in backup, so if the main system fails then
work will not stop.
A distributed system contains multiple nodes that are
physically separate but mixed together using the
communication networks
Architecture Styles:
1. Layered Architecture
2. Object-Oriented Architecture
3. Data Centered Architecture
4. Event-Based Architecture
1. Layered Architecture:
In Layered architecture, different components are organized in layers.
Each layer communicates with its adjacent layer by sending requests
and getting responses. The layered architecture separates components
into units. It is an efficient way of communication. Any layer can not
directly communicate with another layer. A layer can only
communicate with its neighbouring layer and then the next layer
transfers information to another layer and so on the process goes on.
2. Object-Oriented Architecture:
In this type of architecture, components are treated as objects which convey
information to each other. Object-Oriented Architecture contains an
arrangement of loosely coupled objects. Objects can interact with each other
through method calls. Objects are connected to each other through the Remote
Procedure Call (RPC) mechanism or Remote Method Invocation (RMI)
mechanism. Web Services and REST API are examples of object-oriented
architecture. Invocations of methods are how objects communicate with one
another. Typically, these are referred to as Remote Procedure Calls (RPC).
REST API Calls, Web Services, and Java RMI are a few well-known
examples. These characteristics apply to this.
3. Data Centered Architecture:
Data Centered Architecture is a type of architecture in which a common data
space is present at the centre. It contains all the required data in one place a
shared data space. All the components are connected to this data space and
they follow publish/subscribe type of communication. It has a central data
repository at the centre. Required data is then delivered to the components.
Distributed file systems, producer-consumer systems, and web-based data
services are a few well-known examples.
For example Producer-Consumer system. The producer produces data in
common data space and consumers request data.
4. Event-Based Architecture:
Event-Based Architecture is almost similar to Data centered architecture just
the difference is that in this architecture events are present instead of data.
Events are present at the centre in the Event bus and delivered to the required
component whenever needed. In this architecture, the entire communication is
done through events. When an event occurs, the system, as well as the
receiver, get notified. Data, URLs etc are transmitted through events. The
components of this system are loosely coupled that’s why it is easy to add,
remove and modify them. Heterogeneous components can communicate
through the bus. One significant benefit is that these heterogeneous
components can communicate with the bus using any protocol.
Communication Protocols for Remote Procedure Calls:
The following are the communication protocols that are used:
Request Protocol
Request/Reply Protocol
The Request/Reply/Acknowledgement-Reply Protocol
Request Protocol:
• The Request Protocol is also known as the R protocol.
• It is used in Remote Procedure Call (RPC) when a request is made from
the calling procedure to the called procedure. After execution of the
request, a called procedure has nothing to return and there is no
confirmation required of the execution of a procedure.
• Because there is no acknowledgement or reply message, only one
message is sent from client to server.
• A reply is not required so after sending the request message the client
can further proceed with the next request.
• May-be call semantics are provided by this protocol, which eliminates
the requirement for retransmission of request packets.
• In an Asynchronous Remote Procedure Call (RPC) in case
communication fails, the RPC Runtime does not retry the request. TCP is
a better option than UDP since it does not require retransmission and is
connection-oriented.
Request/Reply Protocol:
•The Request-Reply Protocol is also known as the RR protocol.
•It works well for systems that involve simple RPCs.
•The parameters and result values are enclosed in a single packet buffer
in simple RPCs. The duration of the call and the time between calls are
both briefs.
•This protocol has a concept base of using implicit acknowledgements
instead of explicit acknowledgements.
•To deal with failure handling e.g. lost messages, the timeout
transmission technique is used with RR protocol.
•If a client does not get a response message within the predetermined
timeout period, it retransmits the request message.
•Exactly-once semantics is provided by servers as responses get held in
reply cache that helps in filtering the duplicated request messages and
reply messages are retransmitted without processing the request again.
•If there is no mechanism for filtering duplicate messages then at least-
call semantics is used by RR protocol in combination with timeout
transmission.
The Request/Reply/Acknowledgement-Reply Protocol:
• This protocol is also known as the RRA protocol
(request/reply/acknowledge-reply).
• Exactly-once semantics is provided by RR protocol which refers to
the responses getting held in reply cache of servers resulting in
loss of replies that have not been delivered.
• The RRA (Request/Reply/Acknowledgement-Reply ) Protocol is
used to get rid of the drawbacks of the RR (Request/Reply)
Protocol.
• In this protocol, the client acknowledges the receiving of reply
messages and when the server gets back the acknowledgement
from the client then only deletes the information from its cache.
• Because the reply acknowledgement message may be lost at times,
the RRA protocol requires unique ordered message identities. This
keeps track of the acknowledgement series that has been sent.
Remote Procedure Call (RPC)
• Remote Procedure Call (RPC) is a communication
technology that is used by one program to make a
request to another program for utilizing its service on a
network without even knowing the network’s details..
• It is based on the client-server concept. An RPC, like a
local procedure call, is based on the synchronous
operation that requires the requesting application to be
stopped until the remote process returns its results.
• Multiple RPCs can be executed concurrently by utilizing
lightweight processes or threads that share the same
address space.
• Remote Procedure Call program as often as possible
utilizes the Interface Definition Language (IDL), a
determination language for describing a computer
program component’s Application Programming
Interface (API). In this circumstance, IDL acts as an
interface between machines at either end of the
connection, which may be running different operating
systems and programming languages.
Complicated RPCs
•RPCs that involve long-duration calls or large gaps between
calls.
•RPCs that involve parameters(arguments) and/or result in
values that are too large to fit in a single datagram packet.
RPCs that involve long-duration calls or large gaps
between calls:
• The client probes the server regularly: After the
submission of a request message from a client to the
server, the client continuously sends a probe packet
which a server needs to acknowledge.The exception
status is communicated to the corresponding user if a
communication failure occurs. Each probe packet
contains the message identifier from the initial request
message.
The server generates an acknowledgement regularly:
If the generation of the next packet by the server gets delayed
then the predicted retransmission time interval, then it
generates an acknowledgement on its own. Hence, during a
long-duration call, many acknowledgements may be generated
from the server as several acknowledgements directly
correspond to the call duration. If within the set interval of time
the response or acknowledgement from the server has not been
received by the client then it comes to the conclusion that either
server has crashed or the failure occurs on the client-side or in
case of communication failure user is alerted about the
exception condition.
RPCs that involve parameters/arguments and/or result in
values that are too large to fit in a single datagram packet:
• RPCs with Long Messages: To handle such an RPC,
employ many physical RPCs for a single logical RPC.
• The sending of data in each physical RPC is made in the
size of a single datagram packet. This technique is
inefficient since each RPC incurs a set amount of
overhead regardless of the quantity of data transmitted.
Multidatagram Messages:
• Multidatagram messages are another approach for
dealing with sophisticated RPCs in this category. It
involves the division of long RPC
parameters(arguments) or result into many packets and
then sent in multiples. All the packets in a multi
datagram message utilize a single acknowledgement
packet for enhancing communication performance.
RMI (Remote Method Invocation)
Is a way that a programmer, using the Java programming language
and development environment, can write object-oriented
programming in which objects on different computers can interact
in a distributed network.
The RMI (Remote Method Invocation) is an API that provides a
mechanism to create distributed application in java. The RMI allows
an object to invoke methods on an object running in another JVM.
The RMI provides remote communication between the applications
using two objects stub and skeleton.
Stub − A stub is a representation (proxy) of the remote object at
client. It resides in the client system; it acts as a gateway for the
client program.
Skeleton − This is the object which resides on the server side. stub
communicates with this skeleton to pass request to the remote
object.
The following diagram shows the architecture of an RMI
application
Let us now discuss the components of this architecture.
Transport Layer
This layer connects the client and the server. It manages the
existing connection and also sets up new connections.
Stub
A stub is a representation (proxy) of the remote object at client.
It resides in the client system; it acts as a gateway for the client
program.
Skeleton
This is the object which resides on the server
side. stub communicates with this skeleton to pass request to
the remote object.
RRL(Remote Reference Layer)
It is the layer which manages the references made by the client
to the remote object.
Working of an RMI Application
The following points summarize how an RMI application works −
When the client makes a call to the remote object, it is received
by the stub which eventually passes this request to the RRL.
When the client-side RRL receives the request, it invokes a
method called invoke() of the object remoteRef. It passes the
request to the RRL on the server side.
The RRL on the server side passes the request to the Skeleton
(proxy on the server) which finally invokes the required object
on the server.
The result is passed all the way back to the client
Marshalling and Unmarshalling
Marshalling:
These parameters may be of primitive type or objects. In case of
primitive type, the parameters are put together and a header is
attached to it. In case the parameters are objects, then they are
serialized. This process is known as marshalling.
Unmarshalling.
At the server side, the packed parameters are unbundled and
then the required method is invoked. This process is known
as Unmarshalling.
Marshalling is the process of writing Java objects to XML
file. Unmarshalling is the process of converting XML content to
Java objects.
RMI Registry
RMI registry is a namespace on which all server objects are
placed. Each time the server creates an object, it registers this
object with the RMIregistry.
The Java Remote Method Invocation (RMI) application
programming interface (API) enables client and server
communications over the net. Typically, client programs send
requests to a server program, and the server program responds
to those requests
Goals of RMI
To minimize the complexity of the application.
To preserve type safety.(It implies that Java prevents the
programs from accessing memory in inappropriate ways by
controlling the memory access of each object)
Distributed garbage collection. Garbage Collection is process
of reclaiming the runtime unused memory automatically. In
other words, it is a way to destroy the unused objects
To write an RMI Java application, you would have to follow the
steps given below
1. Define the remote interface
2.Develop the implementation class (remote object)
3. Develop the server program
4. Develop the client program
5. Compile the application
6. Execute the application
Group Communication
Communication between two processes in a distributed system is
required to exchange various data, such as code or a file, between the
processes. When one source process tries to communicate with
multiple processes at once, it is called Group Communication.
A group is a collection of interconnected processes with abstraction.
This abstraction is to hide the message passing so that the
communication looks like a normal procedure call.
Group communication also helps the processes from different hosts
to work together and perform operations in a synchronized manner,
therefore increasing the overall performance of the system.
Types of Group Communication in a Distributed System:
Broadcast Communication :
When the host process tries to communicate with every process in
a distributed system at same time. Broadcast communication comes
in handy when a common stream of information is to be delivered
to each and every process in most efficient manner possible. Since
it does not require any processing whatsoever, communication is
very fast in comparison to other modes of communication.
However, it does not support a large number of processes and
cannot treat a specific process individually.
Multicast Communication :
When the host process tries to communicate with a designated
group of processes in a distributed system at the same time. This
technique is mainly used to find a way to address problem of a
high workload on host system and redundant information from
process in system. Multitasking can significantly decrease time
taken for message handling.
Unicast Communication :
When the host process tries to communicate with a single
process in a distributed system at the same time. Although,
same information may be passed to multiple processes. This
works best for two processes communicating as only it has to
treat a specific process only. However, it leads to overheads as
it has to find exact process and then exchange
information/data.
Coordination in group communication:
we consider a generation of distributed systems that assume that the
various components of a system are inherently distributed and that
the real problem in developing such systems lies in coordinating the
activities of different components. In other words, instead of
concentrating on the transparent distribution of components,
emphasis lies on the coordination of activities between those
components.
Key to the approach followed in coordination-based systems is the
clean separation between computation and coordination.
Adapting their terminology to distributed systems in general, we
make a distinction between models along two different dimensions.
Ordered Multicast:
A multicast protocol is ordered (or totally ordered) if it ensures that
messages multicast to a group of nodes are delivered in the same
order at each destination node, even when those messages are
generated concurrently from several sources.
FIFO ordering:
If a correct process issues multicast(g,m) and then multicast(g,m'),
then every correct process that delivers m' will have already delivered
m.
Causal ordering:
If multicast(g,m) multicast(g,m') then any correct process that
delivers m' will have already delivered m.
Time ordering
Lamport [1978] proposed a model of logical time that can be used to
provide an ordering among the events at processes running in
different computers in a distributed system. Logical time allows to
infer the order in which the events have occurred without recourse to
clocks.
The order in which events happen. They allow us to understand
the sequence of events in chronological order, from first to last.
This is helpful when you're telling a story or something that
happened - whether you're writing it down or just telling it to a
friend.
Physical clock synchronization
Physical clock synchronization deals with synchronizing time-
of-day clocks among groups of machines. In this case, we want
to ensure that all machines can report the same time, regardless
of how imprecise their clocks may be or what the network
latencies are between the machines.
Synchronization in Distributed Systems
Distributed System is a collection of computers connected via a
high-speed communication network. In the distributed system,
the hardware and software components communicate and
coordinate their actions by message passing
Each node in distributed systems can share its resources with
other nodes. So, there is a need for proper allocation of resources
to preserve the state of resources and help coordinate between the
several processes.
To resolve such conflicts, synchronization is used.
Synchronization in distributed systems is achieved via clocks. The
physical clocks are used to adjust the time of nodes. Each node in
the system can share its local time with other nodes in the system.
The time is set based on UTC (Universal Time Coordination).
UTC is used as a reference time clock for the nodes in the system.
1.External clock synchronization is the one in which an external
reference clock is present. It is used as a reference and the nodes
in the system can set and adjust their time accordingly.
2.Internal clock synchronization is the one in which each node
shares its time with other nodes and all the nodes set and adjust
their times accordingly.
There are 2 types of clock synchronization algorithms:
Centralized and Distributed.
Centralized is the one in which a time server is used as a
reference. The single time-server propagates it’s time to the
nodes, and all the nodes adjust the time accordingly. It is
dependent on a single time-server, so if that node fails, the whole
system will lose synchronization. Examples of centralized are-
Berkeley the Algorithm, Passive Time Server, Active Time
Server etc.
Distributed is the one in which there is no centralized time-
server present. Instead, the nodes adjust their time by using their
local time and then, taking the average of the differences in time
with other nodes. Distributed algorithms overcome the issue of
centralized algorithms like scalability and single point failure.
Examples of Distributed algorithms are – Global Averaging
Algorithm, Localized Averaging Algorithm, NTP (Network time
protocol), etc.
Centralized clock synchronization algorithms suffer from two
major drawbacks:
They are subject to a single-point failure.
If the time-server node fails, the clock synchronization operation
cannot be performed.
If one goes down, the rest should continue to function correctly.
From a scalability point of view, it is generally not acceptable to
get all the time requests serviced by a single-time server.
In a large system, such a solution puts a heavy burden on that one
process.
Distributed algorithms overcome these drawbacks as there is no
centralized time-server present. Instead, a simple method for
clock synchronization may be to equip each node of the system
with a real-time receiver so that each node’s clock can be
independently synchronized in real-time. Multiple real-time
clocks (one for each node) are normally used for this purpose.
Logical Time and Logical Clocks.
logical time:
The logical time in distributed systems is used to maintain
the consistent ordering of events.
The concept of causality, i.e. the causal precedence
relationship, is fundamental for distributed systems. Usually,
it is tracked using physical time, but physical clocks are hard
to maintain in a distributed system, so logical clocks are used
instead.
The idea that makes logical clocks different is that these are
designed to maintain the information about the order of
events rather than pertaining to the same notion of time as the
physical clocks.
Rules
A logical clock must specify the following two rules to
implement proper functionality:
Rule 1 determines how a local process updates its clock when
an event occurs.
Rule 2 determines how a local process updates its global
clock upon receiving a message from another process to
update its view of global time.
Applications
Logical time has many applications in distributed systems.
It is used to resolve conflicts, track individual events, and
take concurrency measures.
Logical time also has its application in debugging distributed
systems. With all the information about the causal
relationship of events, it is easy to spot which event caused
the error.
Logical Clocks:
Logical Clocks refer to implementing a protocol on all machines
within your distributed system, so that the machines are able to
maintain consistent ordering of events within some virtual
timespan. A logical clock is a mechanism for capturing
chronological and causal relationships in a distributed system.
Distributed systems may have no physically synchronous
global clock, so a logical clock allows global ordering on events
from different processes in such systems.
Example:
We always maintain the procedure or an organization that is
planned before. In a similar way, we should do the operations on
our PCs one by one in an organized way.
Suppose, we have more than 10 PCs in a distributed system and
every PC is doing it’s own work but then how we make them
work together. There comes a solution to this i.e. LOGICAL
CLOCK.