You are on page 1of 63

Networks in Cloud Computing

Chapter 3

Ashim Khadka
Outline

1 Computing

2 Parallel Computing

3 Distributed Systems

4 Service-oriented computing
Service-Oriented Architectures
Web Services

5 Microservices

Ashim Khadka Networks in Cloud Computing 2 / 62


Computing

Computing

Two fundamental and dominant models of computing


1 Sequential
2 Parallel

Ashim Khadka Networks in Cloud Computing 3 / 62


Computing

Sequential Computing

To be run on a single computer having a single Central Processing


Unit (CPU)
A problem is broken into a discrete series of instructions
Instructions are executed one after another
Only one instruction may execute at any moment in time

Ashim Khadka Networks in Cloud Computing 4 / 62


Parallel Computing

Parallel Computing
Parallel computing is the simultaneous use of multiple compute resources
to solve a computational problem
To be run using multiple CPUs
A problem is broken into discrete parts that can be solved concurrently
Each part is further broken down to a series of instructions
Instructions from each part execute simultaneously on different CPUs

Ashim Khadka Networks in Cloud Computing 5 / 62


Parallel Computing

Flynn’s Classical Taxonomy

Flynn’s taxonomy distinguishes multi-processor computer


architectures according to
how they can be classified along the two independent dimensions of
Instruction and Data
Each of these dimensions can have only one of two possible states:
Single or Multiple

Ashim Khadka Networks in Cloud Computing 6 / 62


Parallel Computing

Single-instruction, single-data (SISD) systems


An SISD computing system is a uniprocessor machine capable of
executing a single instruction, which operates on a single data stream
Machine instructions are processed sequentially
All the instructions and data to be processed have to be stored in
primary memory
The speed of the processing element in the SISD model is limited by
the rate at which the computer can transfer information internally
Most conventional computers are built using the SISD model

Ashim Khadka Networks in Cloud Computing 7 / 62


Parallel Computing

Single-instruction, multiple-data (SIMD) systems

An SIMD computing system is a multiprocessor machine capable of


executing the same instruction on all the CPUs but operating on
different data streams
SIMD model based machines are well suited to scientific computing
since they involve lots of vector and matrix operations
For instance,

c=a×b

can be passed to all the


processing elements (PEs)
each PE can process one dataset

Ashim Khadka Networks in Cloud Computing 8 / 62


Parallel Computing

Multiple-instruction, single-data (MISD) systems

An MISD computing system is a multiprocessor machine capable of


executing different instructions on different processing elements but
all of them operating on the same dataset
Machines built using the MISD model are not useful in most of the
applications: a few machines are built (but not of commercial)

For instance,

y = sin(x ) + cos(x ) + tan(x )

perform different operations on


the same dataset

Ashim Khadka Networks in Cloud Computing 9 / 62


Parallel Computing

Multiple-instruction,multiple-data(MIMD)systems

Multiprocessor machine capable of executing multiple instructions on


multiple datasets
Each PE in the MIMD model has and datastreams
Machines built using MIMD model are well suited to any kind of
application
Unlike SIMD and MISD machines,PEs in MIMD machines work
asynchronously.
MIMD machines are broadly categorized into shared-memory MIMD
and distributed-memory MIMD based on the way PEs are coupled to
the main memory.

Ashim Khadka Networks in Cloud Computing 10 / 62


Parallel Computing

Multiple-instruction, multiple-data (MIMD) systems

Ashim Khadka Networks in Cloud Computing 11 / 62


Parallel Computing

Multiple-instruction, multiple-data (MIMD) systems

Ashim Khadka Networks in Cloud Computing 11 / 62


Parallel Computing

Approaches to parallel programming

To make many processors collectively work on a single program, the


program must be divided into smaller independent chunks so that
each processor can work on separate chunks of the problem
Prominent parallel programming approaches
Data parallelism
divide-and-conquer technique is used to split data into multiple sets
each dataset is processed on different PEs using the same instruction
Process parallelism
a given operation has multiple (but distinct) activities that can be
processed on multiple processors
Farmer-and-worker model
one processor is configured as master and all other remaining PEs are
designated as slaves
the master assigns jobs to slave PEs and, on completion slave inform
the master, which in turn collects results

Ashim Khadka Networks in Cloud Computing 12 / 62


Distributed Systems

Distributed Systems

A single problem is divided into many parts, and each part is solved
by independent computers
computers communicate with each other to solve the problem by
passing message
A distributed system is a collection of independent computers that
appears to its users as a single coherent system
Each computer or host executes components and operates a
distribution middleware
Middleware enables the components to coordinate their activities

Ashim Khadka Networks in Cloud Computing 13 / 62


Distributed Systems

Distributed Systems

Ashim Khadka Networks in Cloud Computing 14 / 62


Distributed Systems

Goals of Distributed Systems

Transparency
Openness
Reliability
Scalability

Ashim Khadka Networks in Cloud Computing 15 / 62


Distributed Systems

Transparency of Distributed Systems


Transparency means that any form of distributed system should hide its
distributed nature from its users, appearing and functioning as a normal
centralized system
Access transparency - Regardless of how resource access and
representation has to be performed on each individual computing
entity, the users of a distributed system should always access
resources in a single, uniform way
Location transparency - Users of a distributed system should not
have to be aware of where a resource is physically located
Migration transparency - Users should not be aware of whether a
resource or computing entity possesses the ability to move to a
different physical or logical location
Replication transparency - If a resource is replicated among several
locations, it should appear to the user as a single resource

Ashim Khadka Networks in Cloud Computing 16 / 62


Distributed Systems

Transparency of Distributed Systems

Concurrent transparency - While multiple users may compete for


and share a single resource, this should not be apparent to any of
them.
Failure transparency - Always try to hide any failure and recovery of
computing entities and resources.
Persistence transparency - Whether a resource lies in volatile or
permanent memory should make no difference to the user.
Relocation transparency - Hide that resource move while in use,
this should not be noticeable to the end user.

Ashim Khadka Networks in Cloud Computing 17 / 62


Distributed Systems

Openness

Open distributed systems are systems that are built according to


generally accepted standards
An open distributed system is a system that is able to interact with
services from other systems irrespective of the underlying environment

Systems should conform to well-defined interfaces


Systems should support portability of applications
Systems should easily interoperate
Systems should easily extensible
Web service standards for service-oriented architectures were
developed to be open standards

Ashim Khadka Networks in Cloud Computing 18 / 62


Distributed Systems

Reliability

Distributed system should be more reliable than single system


Need to be secure
Availability: fraction of time the system is usable. Redundancy
improves it
Fault tolerance: need to mask failures, recover from errors

Ashim Khadka Networks in Cloud Computing 19 / 62


Distributed Systems

Scalability

The ability of a system to deliver a high quality service as demands on


the system increase
Size: by adding more resources to cope with an increasing numbers of
users
Distribution: by geographically dispersing components without
degrading performance
Manageability: by effectively managing a system as it increases in
size, even if its components are located in independent organizations
There is a distinction between scaling-up and scaling-out
Scaling-up means replacing resources with more powerful ones.
Scaling-out means adding additional resources
Scaling-out is often more cost effective, but usually requires that the
system support concurrent processing.

Ashim Khadka Networks in Cloud Computing 20 / 62


Service-oriented computing

Monolithic Application
Suppose e-wallet application is design with following feature:
1 Send money

2 Add money

3 View Balance

Ashim Khadka Networks in Cloud Computing 21 / 62


Service-oriented computing

Problem: Monolithic Application

Need to write code again and again, i.e, No Code reusability


Every block are on chain: if any error occur on block, redeveloped is
required in entire system, i.e, tightly coupled

Ashim Khadka Networks in Cloud Computing 22 / 62


Service-oriented computing

Service-oriented computing
New computing paradigm that utilizes services as the basic constructs
to support the development of rapid, low-cost and easy composition
of distributed applications even in heterogeneous environments
The promise of Service-Oriented Computing is a world of
cooperating services where application components are assembled
with little effort into a network of services that can be loosely
coupled to create flexible dynamic business processes

Ashim Khadka Networks in Cloud Computing 23 / 62


Service-oriented computing

Service-oriented computing

There are variety of services or application provide as SaaS


User can directly used any service without creating it
Services have their own structure and process
If service communicate to each other, i.e, any feature of service can
combine with feature of other service to provide user
It requires a protocol and standard, i.e, architecture called
Service-Oriented Architecture (SOA)

Ashim Khadka Networks in Cloud Computing 24 / 62


Service-oriented computing

What is a service?

A service encapsulates as software component that provides a set of


coherent and related functionalities
that can be reused and integrated into bigger and more complex
applications
The term service is a general abstraction of different technologies
and protocols for designing complex and interoperable systems
Distributed systems are meant to be heterogeneous, extensible, and
dynamic
By abstracting away from a specific implementation technology and
platform, they provide a more efficient way to achieve integration
Autonomous components can be more easily reused and aggregated

Ashim Khadka Networks in Cloud Computing 25 / 62


Service-oriented computing Service-Oriented Architectures

Service-Oriented Architectures (SOA)

SOA refers to an architectural approach which includes a collection of


interacting services
Services are delivered to other application components via
communication protocols
These services are designed to be loosely coupled to applications, so
they are only used when needed
Services are also designed to be easily utilized by software developers,
who have to create applications in a consistent way
SOA is independent of services, vendors, and technologies
It is only a concept and not limited to any programming language or
platform

Ashim Khadka Networks in Cloud Computing 26 / 62


Service-oriented computing Service-Oriented Architectures

SOA: examples

1 Google Docs
Go to Extensions → click Add-ons → variety of services (Spell checker)
Google Docs and Spell checker can communicate each other via
policy agreement
2 Banking mobile app

Ashim Khadka Networks in Cloud Computing 27 / 62


Service-oriented computing Service-Oriented Architectures

Component of SOA

Ashim Khadka Networks in Cloud Computing 28 / 62


Service-oriented computing Service-Oriented Architectures

Component of SOA

Service Provider
The service provider is the maintainer of the service and the
organization that makes available one or more services for others to
use
The service provider publishes the interface and the access details
with the Service Registry
The provider must publishes their services using
1 Web services description language (WSDL) : XML language
2 Universal Description, Discovery, and Integration (UDDI)
Service Registry
The registry publish the service together with a service contract that
specifies the nature of the service, how to use it, the requirements for
the service, and the fees charged

Ashim Khadka Networks in Cloud Computing 29 / 62


Service-oriented computing Service-Oriented Architectures

Component of SOA

Service Consumer
The Consumer ensures that it’s possible to locate the service
(discover) that is registered in the service registry and
It binds to the service provider is obtained and invoke the service
that is defined.

SOA is typically implemented with web services such as simple object


access protocol (SOAP) and web services description language (WSDL)

Ashim Khadka Networks in Cloud Computing 30 / 62


Service-oriented computing Service-Oriented Architectures

Service-Oriented Architecture (SOA) Principles


SOA provides a reference model for architecting several software systems.
The following guiding principles characterize SOA platforms:
1 Standardized service contract

Services adhere (follow) to a given communication agreement, which is


specified through one or more service description documents

Ashim Khadka Networks in Cloud Computing 31 / 62


Service-oriented computing Service-Oriented Architectures

Service-Oriented Architecture (SOA) Principles


2 Loose coupling
Services are designed as self-contained components, maintain
relationships that minimize dependencies on other services, and only
require being aware of each other
Service contracts will enforce the required interaction among services.
This simplifies the flexible aggregation of services and enables a more
agile (improve) design strategy that supports the evolution of the
enterprise business.
3 Abstraction
A service is completely defined by service contracts and description
documents
They hide their logic, which is encapsulated within their
implementation
The service shouldn’t show how it performs its functionality
4 Reusability
Designed as components, services can be reused more effectively, thus
reducing development time and the associated costs
Ashim Khadka Networks in Cloud Computing 32 / 62
Service-oriented computing Service-Oriented Architectures

Service-Oriented Architecture (SOA) Principles


5 Autonomy
Services have control over the logic they encapsulate and, from a
service consumer point of view, there is no need to know about their
implementation
6 Lack of state
Services should stay stateless
services should not keep data from one state to the other
This would be required to be done from each client application
7 Discoverability
Services can be discovered (usually in a service registry)
Service discovery provides an effective means for utilizing third-party
resources
8 Composability
Using services as building blocks, sophisticated and complex operations
can be implemented
It breaks large problems into tiny problems
Ashim Khadka Networks in Cloud Computing 33 / 62
Service-oriented computing Service-Oriented Architectures

Characteristics of Service-Oriented Architecture

supports loose coupling


supports interoperability (operate in conjunction with each other)
supports vendor diversity
increases the quality of service
location-transparent

Ashim Khadka Networks in Cloud Computing 34 / 62


Service-oriented computing Service-Oriented Architectures

SOA Advantages

Service Reusability: Applications are built from existing services.


The services can be re-used to create many other applications
Easy Maintenance: As services are independent of each other, they
can be updated and transformed easily without harming other services
Availability: These facilities are effortlessly available to anyone on
demand
Platform independent: SOA allows making a complex application
by combining services picked from different sources, independent of
the platform
Reliability: These applications are extra secure because it is simple to
test short code rather than large codes
Scalability: Services can work on various servers within an
environment, this improves scalability

Ashim Khadka Networks in Cloud Computing 35 / 62


Service-oriented computing Service-Oriented Architectures

SOA Disadvantages

Standards dependency: depends on the implementation of


standards
High overhead: A validation of input parameters of services is done
whenever services interact this decreases performance as it increases
load and response time.
High investment: A huge initial investment is required for SOA.
Complex service management: When services interact they
exchange messages to tasks. The number of messages may go in
millions. It becomes a cumbersome task to handle a large number of
messages.

Ashim Khadka Networks in Cloud Computing 36 / 62


Service-oriented computing Service-Oriented Architectures

Applications of SOA
To manage a data (e.g: university students, banking data)
To consolidate different services (e.g: banking, healthcare)
To manage workflow (e.g: top-level, middle-level, low-level
management)
To improve customer services (e.g: different services at single
platform)
For more effective partnership (e.g: payment gateway from mobile
banking)
To trim cost
To increase agility of services

Ashim Khadka Networks in Cloud Computing 37 / 62


Service-oriented computing Web Services

Web Services
Web services are applications that allow for communication between
devices over the internet
Usually independent of the technology or language the devices are
built on as they use standardised eXtensible Markup Language (XML)
for information exchange
A client or user is able to invoke a web service by sending an XML
message and then in turn gets back and XML response message.

Ashim Khadka Networks in Cloud Computing 38 / 62


Service-oriented computing Web Services

Web Services
Collection of open protocols and standards used for exchanging data
between application or system
To communicate one service with another
Web service can be searched for over the internet and can also be
invoked accordingly

Ashim Khadka Networks in Cloud Computing 39 / 62


Service-oriented computing Web Services

Web service Characteristics

1 XML-based:
A web service’s information representation and record transport layers
employ XML
Web offering-based applications are highly interactive
2 Loosely Coupled:
the client and the web service are not bound to each other
if the web service changes over time, it should not change the way the
client calls the web service
3 Synchronous or Asynchronous functionality:
In synchronous operations, the client will actually wait for the web
service to complete an operation
If data is read from one database and subsequently written to another,
then the operations have to be done in a sequential manner
Asynchronous operations allow a client to invoke a service and then
execute other functions in parallel

Ashim Khadka Networks in Cloud Computing 40 / 62


Service-oriented computing Web Services

Web service Characteristics

4 Ability to support Remote Procedure Calls (RPCs):


Web services enable clients to invoke procedures, functions, and
methods on remote objects using an XML-based protocol
Remote procedures expose input and output parameters that a web
service must support
5 Heterogeneous languages and environments:
Enables web services that are built on various programming languages
to communicate with each other

Ashim Khadka Networks in Cloud Computing 41 / 62


Service-oriented computing Web Services

Web Service Components

Three major web service components.


1 Simple Object Access Protocol (SOAP)

SOAP is a messaging protocol for exchanging information between two


computers based on XML over the internet
that’s why independent of platform and language
2 Web Services Description Language (WSDL)
XML based standard file to tell the client application what does the
web service do
3 Universal Description, Discovery and Integration (UDDI)
XML based standard for describing, publishing and find web service
Platform independent open framework
use WSDL to describe interface to web services

Ashim Khadka Networks in Cloud Computing 42 / 62


Service-oriented computing Web Services

Web Service Components

Figure: Web Service Components

For example
UDDI : Youtube
WSDL : Videos (Cloud Computing)
You can get multiple cloud computing video (WSDL) in Youtube
(UDDI)
Ashim Khadka Networks in Cloud Computing 43 / 62
Service-oriented computing Web Services

How Web Services Work?

A web service takes the help of:


XML: to tag the data
SOAP: to transfer a message
WSDL: to describe the availability of service
UDDI: publish and find services
Ashim Khadka Networks in Cloud Computing 44 / 62
Service-oriented computing Web Services

How Web Services Work?

1 Client would request (invoke) a series of web services calls via


requesting to server through Remote Procedure Call (RPC)
2 The data which is transferred between client and server is inform of
XML
3 Web services use SOAP for sending the XML data between client
applications and web services
4 SOAP does not pose any restriction on transport
Different standards like HTTP, TCP/IP, SMTP, JASON can be used
for sending message over internet
5 The data which is sent from the web services to the application is
called SOAP message (an XML document)

Ashim Khadka Networks in Cloud Computing 45 / 62


Service-oriented computing Web Services

Type of Web Service

1 SOAP web services


2 RESTful web services

Ashim Khadka Networks in Cloud Computing 46 / 62


Service-oriented computing Web Services

SOAP web services

Simple Object Access Protocol (SOAP): is a protocol for exchanging


data between Web services over HTTP ( Hypertext transfer protocol)
or SMTP (simple mail transfer protocol)
SOAP messages use XML Information Set for their formatting.
Three characteristics of SOAP:
neutrality, independence, and extensibility.
Each SOAP document needs to have a root element known as the
<Envelope> element
The "envelope" is in turn divided into 2 parts.
header
body

Ashim Khadka Networks in Cloud Computing 47 / 62


Service-oriented computing Web Services

SOAP Message Building Blocks

Ashim Khadka Networks in Cloud Computing 48 / 62


Service-oriented computing Web Services

SOAP Message Building Blocks


SOAP Envelope
An Envelope element that identifies the XML document as a SOAP
message
Used to encapsulate all the details in the SOAP message
Root element in the SOAP message
SOAP Header
A Header element that contains header information –
authentication credentials which can be used by the calling application
Also contain multiple header blocks
Header block1: username & password to run application
SOAP Body
A body element includes the details of the actual message that need
to be sent from the web service to the calling application
Data includes call and response information
Ashim Khadka Networks in Cloud Computing 49 / 62
Service-oriented computing Web Services

RESTful web services

Representational State Transfer (REST) is an architectural style for


designing loosely coupled application over HTTP
guideline to build a light weight, highly scalable and maintainable and
are very commonly used to create APIs for web-based applications
In a client-server communication, REST suggests to create an object
of the data requested by the client and send the values of the object
in response to the user
For example, if the user is requesting for a movie in Kathmandu at a
certain place and time, then you can create an object on the server-side.
Web services which follow REST architecture style are RESTful Web
services
In the REST architectural style, data and functionality are considered
resources and are accessed using Uniform Resource Identifiers (URIs),
typically links on the Web

Ashim Khadka Networks in Cloud Computing 50 / 62


Service-oriented computing Web Services

RESTful web services

Ashim Khadka Networks in Cloud Computing 51 / 62


Service-oriented computing Web Services

RESTful web services


The following principles encourage RESTful applications to be simple,
lightweight, and fast:
Resource identification through URI: Resources are identified by
URIs, which provide a global addressing space for resource and service
discovery.
Uniform interface: Resources are manipulated using a fixed set of
four create, read, update, delete operations: PUT, GET, POST, and
DELETE.
PUT creates a new resource
DELETE to remove existing resource
GET retrieves the current state of a resource in some representation
POST transfers a new state onto a resource
Self-descriptive messages: Resources are decoupled from their
representation so that their content can be accessed in a variety of
formats, such as HTML, XML, plain text, PDF, JPEG, JSON, and
others
Ashim Khadka Networks in Cloud Computing 52 / 62
Service-oriented computing Web Services

RESTful web services

Stateful interactions through hyperlinks: Every interaction with a


resource is stateless; i. e., request messages are self-contained
The concept of stateless means that it’s up to the client to ensure that
all the required information is provided to the server
This is required so that server can process the response appropriately
Cache: Each server client request is independent in nature,
sometimes the client might ask the server for the same request again
This request will go to the server, and the server will give a response
This increases the traffic across the network
The cache is a concept implemented on the client to store requests
which have already been sent to the server
if the same request is given by the client, instead of going to the server,
it would go to the cache and get the required information
this saves the amount of to and fro network traffic from the client to
the server

Ashim Khadka Networks in Cloud Computing 53 / 62


Service-oriented computing Web Services

RESTful web services

Cache

Uniform interface

Ashim Khadka Networks in Cloud Computing 54 / 62


Service-oriented computing Web Services

Create Restful web services

Create an empty Asp.Net Web application

Ashim Khadka Networks in Cloud Computing 55 / 62


Microservices

Microservices

Microservice architecture is a software design approach that


decomposes an application into small independent services that
communicate over well-defined APIs
Microservices allow companies to keep teams small and agile
The idea is to decompose the application into small services that can
be autonomously developed and deployed by tightly-knitted teams
Each service can be developed and maintained by autonomous teams,
it is the most scalable method for software development

Ashim Khadka Networks in Cloud Computing 56 / 62


Microservices

Microservice

Ashim Khadka Networks in Cloud Computing 57 / 62


Microservices

Microservice vs. monolith architectures

Ashim Khadka Networks in Cloud Computing 58 / 62


Microservices

Benefits of microservices
1 Scalability: Services can be developed and released independently
without arranging large-scale coordination efforts within the
organization
2 Fault isolation: A benefit of having a distributed system is the ability
to avoid single failure points
3 Smaller teams: With microservices, the development team can stay
small and cohesive. The smaller the group, the less communication
overhead and the better the collaboration
4 Freedom to choose the tech stack: each microservice can use the
tech stack that is most appropriate for solving the task at hand.
Thus, the team can pick the best tool for the job and their skills
5 More frequent releases: The development and testing cycle is
shorter as small teams iterate quicker. And, because they can also
deploy their updates at any time, microservices can be deployed much
more frequently than a monolith
Ashim Khadka Networks in Cloud Computing 59 / 62
Microservices

Microservice properties

Ashim Khadka Networks in Cloud Computing 60 / 62


Microservices

Microservice architecture design challenges


Small: applies both to the team size and the codebase
A microservice must be small enough to be entirely understood by one
person
Your microservice is too big if it would take you more than a sprint to
rewrite it from scratch
Focused on one thing: a service must focus on one aspect of the
problem or perform only one task
Autonomous: autonomy allows a team to choose the most
appropriate language stack and data model
This usually means that each microservice has its own database or
persistence layer that is not shared with other services
Aligned with the bounded context: in software, we create models
to represent the problem we want to solve
A bounded context represents the limits of a given model
Contexts are natural boundaries for services, so finding them is part of
designing a good microservice architecture
Ashim Khadka Networks in Cloud Computing 61 / 62
Microservices

Microservice architecture design challenges

Loosely-coupled: while microservices can depend on other


microservices, we must be careful about how they communicate
Each time a bounded context is crossed, some level of abstraction and
translation is needed to prevent behavior changes in one service from
affecting the others
Independently deployable: being autonomous and loosely-coupled,
a team can deploy their microservice with little external coordination
or integration testing
Microservices should communicate over well-defined APIs and use
translation layers to prevent behavior changes in one service from
affecting the others

Ashim Khadka Networks in Cloud Computing 62 / 62

You might also like