[go: up one dir, main page]

0% found this document useful (0 votes)
386 views46 pages

Introduction To Micro-Services

The document provides an introduction to microservices using Spring Boot. It discusses prerequisites, objectives, setup requirements and an overview of service oriented architecture including roles, communication models and web service concepts.

Uploaded by

roshni2012
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
386 views46 pages

Introduction To Micro-Services

The document provides an introduction to microservices using Spring Boot. It discusses prerequisites, objectives, setup requirements and an overview of service oriented architecture including roles, communication models and web service concepts.

Uploaded by

roshni2012
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 46

1

Introduction to Micro-Services
with Spring Boot
Prakash Badhe
prakash.badhe@vishwasoft.in
About Me: Prakash Badhe 2

Technology Practices Trainer, Consultant.


Enterprise Technologies Consultant-Trainer for 19+ years
Passion for technologies and frameworks
Proficient in application frameworks, libraries and tools.
Proficient in DevOps tools and technologies.
Proficient in Docker, Kubernetes etc.
Supports agile technical practices and setup in agile
development and production environments.
Worked with Symantec,Samsung,PTC,Cognizant etc. for
setting up the DevOps environments.
3

About you..
Prerequisite : Experience with server side java applications
development and deployment.
Linux system commands exposure.
Tell about your
Objectives for this Training
Job Role and skill-Set : In web application development.
Experience in different Technologies and tools.
Prior experience with Virtual machines, Docker or any
other tools on Linux platforms.
Setup 4

• Windows 10/Linux 64 bit


• Adobe PDF Reader
• JDK1.8 64 bit
• Spring Tool Suite
• Apache Kafka
• MongoDB
• Live Internet connection

Vishwasoft Technologies
5

SOA : Service Oriented


Architecture

Vishwasoft Technologies
Why SOA..? 6

• Distributed Processing..
• Applications need data sharing and communication in the network
across different machines.
• Heterogeneous applications with different programming and different
Operating systems.
• Lots of data compatibility issues
• Standard protocol and data format needed.

Vishwasoft Technologies
7

Applications as services
• At abstract level if the applications are
defined as platform independent services,
then they can share the data and
understand the data exchange...
• The SOA is the answer..
• Service Oriented Architecture.

Vishwasoft Technologies
8
Service Oriented Architecture
• In a service-oriented architecture, applications
are made up from loosely coupled software
services, which interact to provide all the
functionality needed by the application.
• The applications exchange information across
the platforms.
• Each service is generally designed to be very
self-contained and stateless to simplify the
communication that takes place between them.

Vishwasoft Technologies
9
Roles Involved In A SOA
Three main roles involved in a service-oriented
architecture

– Service provider
– Service broker
– Service requestor

Vishwasoft Technologies
10
SOA Communication Model

Service
Broker
Machine 2

Service Service
Requestor bind Provider
Machine 1 Machine 3

Service Oriented Architecture


Vishwasoft Technologies
11
Web Application Process
lookup publish(“domainName”,
(“domainName”) Ip Address)
DNS Server
(DNS Registry)

Web
Hosting
Service

Connect (ip Address,


Web Browser Port) Web Application
client On Web Server

Vishwasoft Technologies
12
RPC/RMI Architecture
rebind (“MyObj”, obj)
RMIRegistry
(port No 1099)
(Hello) lookup (“MyObj”)

(Hello) .sayHello( )

RMI Client RMI Server

Vishwasoft Technologies
13

Web Services Conceptually

Service Registry
Find Publish

Invoke
[RPC]

Web Service Requestor Web Service Provider

Vishwasoft Technologies
Web Service client
Web Service Deployed
14
Web Programming Model
• Involves client-server interaction on web.
• Uses http protocol and html for information exchange
• Exchange Messages that carry MIME-typed data
• Web applications are loosely coupled than the traditional
distributed programming models like RPC, DCOM, and
CORBA.

Vishwasoft Technologies
15

Web Service As SOA


• A Web service is a software application designed to
support interoperable machine-to-machine
interaction over a network
• Generally web services are small task /service
operations supported by applications on the
server/s.
• These tasks are reusable across different OS
platforms and programming language applications.
• Web services operate in a distributed environment.

Vishwasoft Technologies
16
Web service features
• Loosely coupled Web programming model for use in
applications that may not be browser-based.
• Provides a platform for building distributed applications
using software components that are..
– running on different operating systems and devices,
– written using different programming languages and tools from
multiple vendors,
– all developed and deployed independently

Vishwasoft Technologies
17
Clients for Web Service
Servlets, jsp

xml

Service
Vishwasoft Technologies
Provider
18
XML Usage
• Web Services fundamentally use XML to
standardize the behaviors and data.
• Key XML standards to understand
– XML : extensible mark up across
programming languages.
– XML Schema specifies xml structure.
– XML Namespace avoids naming conflicts and
categorizes elements as per the functionality

Vishwasoft Technologies
19
Web Service Standards
• SOAP
• – Simple Object Access Protocol for web service
and clients to communicate.
• WSDL
• – Web Service Definition Language for web services
to describe their services and other information.
• UDDI
• – Universal Description, Discovery, and Integration
protocol for Web Services to discover web services.
• All these are specified in XML format.

Vishwasoft Technologies
20
Soap Web Services
• Manage language independent interactions across different
platforms and applications
• Different versions evolved one by one to support additional
features.
• Interoperability is still an issue across different
implementations and versions.
• Heavy dependencies on the soap library and other xml
implementations.
• Non-xml data format support is limited only in the form of
attachments.
• Performance is an issue for mission critical applications.
21
Soap Web Services
RESTing the SOAP ?

• Manage language independent interactions across


different platforms and applications
• Different versions evolved one by one to support
additional features.
• Interoperability is still an issue across different
implementations and versions.
• Heavy dependencies on the soap library and other
xml implementations.
• Non-xml data format support is limited only in the
form of attachments.
• Performance is an issue for mission critical
applications.
22
Enter ‘REST’ Services
• REST is ‘Representational State Transfer’..
• REST is an architectural style rather than a protocol
which removes the dependencies on soap and xml
standards as wsdl,uddi etc.
• REST supports any understandable data formats
across applications.
• REST works currently only with Http.
• REST specifies Resources/data on server rather
than actions on them..
• REST specifies transfer of the state of Resource
across applications.
23
Resources on the Web
Resources are not only represented as XML

• XML formats (HTML, XHTML, RSS, etc.)


• JPG, GIF, PNG
• MP3, WAV, OGG
• Anything else that can be on the web.
24
Resource Nouns
• Important ‘things’ (nouns) are Resources
– Addressed through a URI

• Uniform interface (verbs)


– In HTTP: GET, PUT, POST, DELETE

• Verb-noun séparation makes intégration


easier
– GET /customer/45 Instead of getCustomer(45)
25
REST Nouns and Verbs
• REST works with resources as nouns with their
identities.
• The state of these nouns is shared with clients over
http methods as verbs(operations)
• The http methods as verbs in REST
– Get: get the resource state/values
– Post : post new resource
– Put : update the resource state
– Delete :delete the resource on server
– Options: read the options available with server.
– Head : set the http headers on server.
26
REST Commandments
• Give every “thing” an ID
• Link things together
• Use standard methods
• Communicate statelessly
27
SOAP and REST
• REST is ready for the enterprise
• REST is strong at:
– Internet scale computing
– High levels of interoperability
– Resource Oriented operations
• SOAP/WS is strong at:
– Complex security (Trust and Federation)
– Multi-transport services
– Occasionally connected applications
• In the real world they are typically enabled by a combination of
Soap and REST
28
Java support for REST
• Jax-RS is the java specification standard
for implementing and consuming REST
web services.
• Implementations a are Jboss
RestEasy,Jersey platforms.
• Spring with Spring-Boot
• Oracle and IBM SOA Suite
• Eclipse Micro-Profile
29
Application Layers
• Presentation — responsible for handling HTTP requests
and responding with either HTML or JSON/XML (for web
services APIs).
• Business logic — the application’s business logic.
• Database access — data access objects responsible for
access the database.
• Application integration — integration with other services
(e.g. via messaging or REST API).
• Even with this modular layered architecture, the
application is packaged and deployed as a single
monolith. (All in One)
Vishwasoft Technologies
30
Monolith Benefits
• Simple to develop.
• Simple to test. For example you can
implement end-to-end testing by simply
launching the application and testing it.
• Simple to deploy. You just have to copy
the packaged application to a server.
• Simple to scale horizontally by running
multiple copies behind a load balancer.
Vishwasoft Technologies
31
Monolith Drawbacks
• Limitation in size and complexity.
• Application is too large and complex to fully understand
and to be able to update with new changes fast and
correctly.
• The size of the application can slow down the start-up
time.
• The response time and performance becomes slow
because of all execution happening in same process.
• The entire application has to be re-deployed on each
update and during down time nothing of it can be
accessible.
• Difficult to manage team based development.
Vishwasoft Technologies
32
Monolith - Reliability
Bug in any module (e.g. memory leak) can
potentially bring down the entire process.
Moreover, since all instances of the
application are identical, that bug impact the
availability of the entire application

Vishwasoft Technologies
33
Scaling the Monolith
Challenging to scale when different modules
have conflicting resource requirements.

Vishwasoft Technologies
34
Monolith- Sharing and Reuse
• The good parts of one application cannot
be shared or re-used by other
applications.
• Sharing of database for other processes
and parallel updates is a challenge.

Vishwasoft Technologies
35
Breaking the Monolith
• The application is architecture is broken into a
set of smaller, interconnected services (isolated
processes) called as micro-services.
• Some micro-services expose a REST, RPC or
message-based API and most services
consume APIs provided by other services.
• Some micro-services might implement a web UI.
• Micro-Services are loosely coupled applications
as services.

Vishwasoft Technologies
36

Monolith to Micro-Services

Vishwasoft Technologies
37

Vishwasoft Technologies
38
MicroService Benefits
• MicroServices reinforce modular structure, which is
particularly important for larger teams.
• Services are easier to deploy, and since they are
autonomous, are less likely to cause entire system
failures when they go wrong.
• With MicroServices you can mix multiple technologies,
languages, development frameworks and data-storage
technologies.
• Reduced complexity.
• Each MicroService is to be deployed independently. As a
result, it makes continuous deployment possible for
complex applications
Vishwasoft Technologies
39
MicroService Benefits
• MicroService architecture enables each service to be
scaled independently.
• Performance is improved.
• Better testability — services are smaller and faster to
test.
• Better deploy-ability — services can be deployed
independently.
• Improved fault isolation; for memory leak in one service
then only that service is affected.

Vishwasoft Technologies
40
Sharing of Database
• Instead of sharing a single database
schema with other services, each service
has its own database schema.
• Tthis can result in duplication of some
data. However, having a database
schema per service is essential to get
the benefit from micro-services, because it
ensures loose coupling.

Vishwasoft Technologies
41
Cost of MicroServices
• Distributed systems are harder to implement, since
remote calls are slow and are always at risk of failure.
Uniform programming model can reduce the difficulties.
• Maintaining strong consistency is extremely difficult for a
distributed system, which means everyone has to
manage eventual consistency. With high availability
nodes in clusters, this effect can be reduced.
• Need a mature operations team to manage lots of
services, which are being redeployed regularly, with
automation CI/CD this can be eased.
• The network, technology, bandwidth limits the
performance and flexibility.
Vishwasoft Technologies
How to de-compose 42

Identify Modules by domain, categories,


business use, related dependencies.

Vishwasoft Technologies
43
Database break-up
Break out database tables, wrap with service
and, update dependencies

Vishwasoft Technologies
44
Service Modules

Vishwasoft Technologies
45
UI Extraction

Vishwasoft Technologies
46
Load Balancing

Vishwasoft Technologies

You might also like