Post on 19-Jul-2018
1. KEY CONCEPTS Microservices, containers, etc.
2. HOLISTIC VIEW Making businesses agile
3. ARCHITECTURE Faster, flatter, and more flexible
4. LAB MATERIALS Hands-on workshop
AGENDA
4
Small, autonomous
services that work together.
5
CONTAINER
CONTAINER
CLIENTR
ES
T A
PI
SERVICE
DATASTORE
WHAT ARE MICROSERVICES?
As Robert C. Martin put it:
“Gather together those things that change for the
same reason, and separate those things that change
for different reasons.”
HOW SMALL IS SMALL?
6 http://bit.ly/2rNZUSZ
WHAT IS A CONTAINER?
7
A container image is a lightweight, stand-alone, executable package of a piece of software that includes their entire runtime environment—all of the files necessary to run:
● Programing language
● System tools
● Libraries, settings, etc.
9
2000
2010
2005
2015
2000:
JAILS ADDED
TO FREEBSD
2006:
GENERIC PROCESS
CONTAINERS
2008:
KERNEL AND USER
NAMESPACES
2014:
KUBERNETES
2008:
LINUX CONTAINER
PROJECT (LXC)
2015:
STANDARDS VIA
OCI AND CNCF
2013:
RED HAT
ENTERPRISE LINUX
2013:
DOTCLOUD
BECOMES DOCKER
2007:
GPC RENAMED
CONTROL GROUPS
2003:
SELINUX ADDED TO
LINUX MAINLINE
2015:
RHT CONTAINER
PLATFORM
2001:
LINUX -VSERVER
PROJECT
2013:
DOTCLOUD PYCON
LIGHTNING TALK
2005:
FULL RELEASE OF
SOLARIS ZONES
CONTAINER HISTORY
BUT…, ENABLE TRUE MICROSERVICES
CONTAINER
CLIENT
RE
ST
AP
I
SERVICE
CONTAINER
NodeJSService
CONTAINER
Spring BootService
CONTAINER
JBoss EAPService
CONTAINER
TomcatService
CLIENT
RE
ST
AP
I
CLIENT
RE
ST
AP
I
CLIENT
RE
ST
AP
I
CLIENT
RE
ST
AP
I
CONTAINER
DATASTORE
CONTAINER
PostgreSQLDatastore
CONTAINER
MongoDBDatastore
CONTAINER
MySQLDatastore
CONTAINER
JBoss DGDatastore
1
0
1
3http://bit.ly/2sQMc1R
“Organizations which design systems ... are
constrained to produce designs which are
copies of the communication structures of
these organizations”
CONWAY’S LAW
PRINCIPLES AND PRACTICES
1
6
● Independence aids agility
● Modeled around business domains
● Culture of automation (DevOps)
● Isolate deployment and configuration changes (independence)
● Control costs more effectively (scaling)
● Release independently (deployment)
● Adopt technology more quickly (polyglot)
● Antifragile - increased robustness and resilience under pressure
● API / contract focused (promises)
● Decentralized data management
1
7
Small autonomous services
can be developed and
delivered faster
Automating delivery and
monitoring of small services
is easier
Fine grained scalability is
easier and uses less
resources
SCALABILITY
BENEFITS OF MSA?
FAST TIME TO MARKET EFFICIENCY
CLIENT
RE
ST
AP
I
CLIENT
RE
ST
AP
I
CLIENT
RE
ST
AP
I
CLIENT
RE
ST
AP
I
HOW DO I MANAGE THIS?
CONTAINER
NodeJSService
CONTAINER
Spring BootService
CONTAINER
JBoss EAPService
CONTAINER
TomcatService
CONTAINER
PostgreSQLDatastore
CONTAINER
MongoDBDatastore
CONTAINER
MySQLDatastore
CONTAINER
JBoss DGDatastore
1
8
CHALLENGES OF MSA?
2
0
WE NEED STANDARDS!
● How is incomplete or outdated documentation handled?
● How are new services integrated into the ecosystem?
● What if a downstream service you call takes longer than normal to
respond? What action do you take?
● What is a “good citizen” service in your system?
● How should all services emit health and general monitoring-related
metrics?
● Mandate connection pooling? Circuit breaker criteria?
● What about build, test, deploy, and release?
● Etc...
Self-Service
Multi-language
Automation
Collaboration
Seamless
Standards-based
Web-scale
Open Source
Enterprise Grade
Secure
CONTAINER APPLICATION PLATFORM
2
5
OpenShift Container Platform provides features like:
● Deploy Independently
● Scale Independently
● Release Independently
CONTAINER DEPLOYMENT & MANAGEMENT
● CI/CD (DevOps)
● Antifragile
● Polyglot
26
Workshop Material http://naps-redhat.com/
Login Credentials http://naps-redhat.com/files/lab_info.xlsx
OpenShift Console 1 https://master.ocp.naps-redhat.com:8443/console/
OpenShift Console 2 https://master.ocp.lab-emergent360.com:8443/console/
Remote Desktop 1 https://85.190.181.16/guacamole/#/
Remote Desktop 2 https://31.220.69.63/guacamole/#/
Remote Desktop 3 https://85.190.177.63/guacamole/#/
Remote Desktop 4 https://85.190.180.29/guacamole/#/
Remote Desktop 5 https://153.92.39.111/guacamole/#/29
COOLSTORE APPLICATION● Online shop for selling products
● Web-based polyglot application
using
○ AngularJS
○ Node
○ Java with multiple frameworks
(Spring, Java EE, etc)
● Microservices architecture
● Deployed using containers
3
1
COOLSTORE MSA
3
3
Inventory Service
JBoss EAP
CartService
JBoss EAP
Catalog Service
JWS
Coolstore Gateway
JBoss FIS
PSQLPSQL
Web UIAngularNodeJS
ProjectGit Repository
SOURCE CONTROL MANAGEMENT
DeveloperGit Repository
fork
pull requestcommit
clone
Developer
12
3 4
35
BUILDING CONTAINER IMAGES WITH SOURCE-TO-IMAGE (S2I)
codeGit Repository
Source-to-Image(S2I)
Application Container
deploy
CODE
BUILD
DEPLOY
Container Image
ImageRegistry
OP
SD
EV
36
DEPLOY CODE WITHOUT BUILD DELAYS
write code
Developer
OpenShift
CONTAINER
Spring BootService
CONTAINER
JBoss EAPService
JBoss Developer Studio
Shell
rsync
HotSwap
rsync
HotSwap
37
ProjectGit Repository
BUILDING QUALITY INTO THE PROCESS
DeveloperGit Repository
fork
pull requestcommit
clone
Developer
Code Reviewer
review pull request
merge pull request
12
3 4
5 6
38
CoolStore TEST CoolStore PROD
Inventory TEST
Run Tests in
INV TEST
CONTINUOUS DELIVERY PIPELINE
BuildJAR
Builddocker Image
Deploy toINV TEST
Deploy toTEST
Run Tests inin TEST
Deploy toPROD
(no traffic)Go Live
SwitchProduction
Traffic
TeamGit Repo
git push
Approve?
39
END TO END ENVIRONMENT CONSISTENCY
Developer’s Local Env (laptop, desktop)
CDKJBDS
VCS (Git)
Build
Run
Test
Jen
kin
sNexus(Library Management)
Deployment Pipeline
Automatic Testing
Release management
40
● Strangling - incrementally replacing functionality in app with something better (cheaper, faster, easier to maintain).
● As functionality is replaced, “dead” parts of monolith can be removed/retired.
● You can also wait for all functionality to be replaced before retiring anything!
● You can optionally include new functionality during strangulation to make it more attractive to business stakeholders.
http://paulhammant.com/2013/07/14/legacy-application-strangulation-case-studies
Time
42
STRANGLING THE MONOLITH DESIGN PATTERN
CLIENT AGGREGATION
BENEFITS DRAWBACKS
● Network bandwidth
● Unfriendly protocols - web proxies,
ports, etc.
● Unnecessarily complicated
● No development bottleneck on
the server / ESB-style funnel
● Reuse of functionality
44
CHAINING
BENEFITS DRAWBACKS
● Cascading failures
● Complex “stack traces” when
things go wrong
● Exposes internal structure of
application logic
● Client code simpler - there is only
one single entry into the chain
● Less network bandwidth
45
SERVICE RESILIENCE PATTERN
JBoss Fuse
microservice API
JBoss Fuse
microservice API
microservice
microservice API
microservice
microservice API
Chain reaction
JBoss Fuse
microservice API
SLOW!!
Clie
nt
46
API GATEWAY
BENEFITS DRAWBACKS
● Bottlenecking with the addition of
new services
● Encapsulates internal structure
● Less chatty network traffic
● Simplified client code
47
API GATEWAY MICROSERVICE COMPOSITION
Container
Application
Camel Spring Boot Starter
Camel route
ConfigurationsAuto-wires componentsTomcat, UndertowJDBC Messaging(application.properties/yml)
Auto-detects routes
Auto-configure Camelcontext, register Camel utilities
48
THANK YOU
plus.google.com/+RedHat
linkedin.com/company/red-hat
youtube.com/user/RedHatVideos
facebook.com/redhatinc
twitter.com/RedHatNews
Hystrix
<camelContext xmlns="http://camel.apache.org/schema/spring"><route>
<from uri="direct:start"/><hystrix><to uri="http://fooservice.com/slow"/><onFallback>
<transform><constant>Fallback message</constant>
</transform></onFallback>
</hystrix><to uri="mock:result"/>
</route></camelContext>
JBoss Fuse
microservice API
APIService SaaS
Slow! No response!
Timeout
Fallback
53
COOLSTORE APPLICATION
Inventory Service
JBoss EAP
CartService
JBoss EAP
Catalog Service
JWS
Coolstore Gateway
JBoss FIS
MongoDBPSQL
Web UINodeJS
Turbine
Server
Hystrix
Dashboard
5
4
EVENT-DRIVEN MICROSERVICES
POD
SERVICE
PODPOD
SERVICE
POD
ROUTE
POD
Rebalance trafficsRedirect request to available Pods
Replace failing podStarts another pod and bind to serviceHealth Checks
periodically performs diagnostics on a running container.
55
RED HAT JBOSS FUSE
microservice
160+Smart Endpoints
FB
Salesforce
SaaS
Database
Msg Broker
Kafka
….
XMLJSONHL7…...
HTTP
Netty
FTP
….
RESTAPI
ResourceConnector
….
56
RED HAT JBOSS FUSE
microservice microservice microservice microservice
microservice
Enterprise IntegrationPatterns
57
microservice byRED HAT JBOSS FUSE
REST DSL
SwaggerAPI Doc
API
Data Format Transform
microservice byRED HAT JBOSS FUSE
API
microservice byRED HAT JBOSS FUSE
Consume
Exposes
3S
cale
AP
I ma
na
ge
me
nt
External clientsCommunity, Partners, Customers
58
CI/CD PIPELINE
BLUE/GREEN DEPLOYMENT PART 1
Inventory Green
InventoryBlue
Router
DeployPROD
(no traffic)Go Live
SwitchTraffic
On
Approve?
deploynew version
64
CI/CD PIPELINE
BLUE/GREEN DEPLOYMENT PART 2
Inventory Green
InventoryBlue
Router
DeployPROD
(no traffic)Go Live
SwitchTraffic
On
Approve?
switchproductiontraffic
65
6
6
* Field survey conducted by ActualTech Media of more than 1,200 IT professionals with regard to their thoughts
around Software-defined storage (SDS) and Human-computer interaction (HCI).
Agile Integration
Cloud native solutions Lean artifacts, individually deployable Container based scaling and high availability
● Lightweight● Pattern Based● Reusable
Connectors● Community Sourced
● Cloud native solutions
● Lean artifacts, individually deployable
● Container based scaling and high availability
● Well defined, re-usable, and well managed end-points
● Ecosystem leverage
Flexibility Scalability Re-Usability
DistributedIntegration
Container API
67