Live Long and Prosper
to Monolith
Alex Soto
@alexsotob
Prague, 18-19 October 2018
@alexsotob2
Alex Soto
Red Hat Engineer
www.lordofthejars.com
@alexsotob
Who Am I?
@alexsotob3
https://www.manning.com/books/testing-java-microservices
@alexsotob4
Questions
@alexsotob5
@alexsotob6
@alexsotob7
… due to the given burdens of cost and organisational maturity,
microservices will likely never reach the Adopt phase“ Rebecca Parsons - CTO at ThoughtWorks
@alexsotob8
@alexsotob9
Isolation of Code
@alexsotob10
Isolation of Code
review
api
impl
detail
api
impl
game
api
impl
public
exposes only what is required
favour low-coupling
private
highly cohesive
reduces our memory footprint
IMPL
API
Code Asset, Java 9 Modules
@alexsotob11
Isolation of Code
Java 9 - Modules
module-info.java
@alexsotob12
Isolation of Data
@alexsotob13
Isolation of Data
game schema
Game
Detail
detail schema
Reviewreview schema
Module == Schema
Joins inside Schema
Referential Integrity across Schemas
Global transactions
@alexsotob14
Isolation of Data
game schema
Game
Detail
detail schema
Reviewreview schema
.sql
.sql
.sql
.sql
.sql
?
?
?
@alexsotob15
Isolation of Data
@alexsotob16
Isolation of Data
DB
V2__Update.sql
V1__Initial.sql
SCHEMA_VERSION
@alexsotob17
Isolation of Data
Flyway f = new Flyway();
f.setDataSource();
f.migrate();
mvn flyway:migrate
<configuration>
<url>..</url>
…
</configuration>
<flyway:migrate url=“” user=“”/>
flyway migrate -url=… -user=…
gradle flywayMigrate
flyway {
url=“..”
user=“..
}
@alexsotob18
Reactive Extensions
@alexsotob19
Reactive Java
Creates Stream
Sends data
Where to Run
Combiner
How to combine
Final Run
@alexsotob20
Network
@alexsotob21
Circuit Breaker Pattern
@alexsotob22
Circuit Breaker Pattern
Closed
Open
Half
Open
success
error
[under threshold]
fail
[threshold reached]
success
reset timeoutfail
@alexsotob23
Circuit Breaker
Defines CB
Wrapped function
Recovery
@alexsotob24
DEMO
@alexsotob25
@alexsotob26
@alexsotob27
Your code has
NO BUSINESS VALUE
until it’s deployed
@alexsotob28
@alexsotob29
OPS PMO DBASECBIZ DEV QA
@alexsotob30
@alexsotob31
Your Stack Matters
Server Hardware
Operating System
Application Server
your.war
Java Virtual Machine
Custom Configuration
Linux Kernel Version & Distribution
Java 1.7.0_67
Tomcat, Wildfly, Jetty
JDBC driver, users
@alexsotob32
DevOps Challenges for Multiple Containers
▪ How to scale?
▪ How to avoid port conflicts?
▪ How to manage them on
multiple hosts?
▪ What happens if a host has
trouble?
▪ How to keep them running?
▪ How to update them?
▪ Where are my containers?
Node
Node Node
Node Node
Logger
Node
@alexsotob33
ssh docker run
ssh docker run
ssh docker run
@alexsotob34
@alexsotob35
▪ Greek for “Helmsman,” also the root of the word
“Governor” (from latin: gubernator)
▪ Container orchestrator
▪ Supports multiple cloud and bare-metal
environments
▪ Inspired by Google’s experience with containers
▪ Open source, written in Go
▪ Manage applications, not machines
Meet Kubernetes
@alexsotob36
Kubernetes Cluster
Ops
Dev
Master
api
etcd
scheduler
controllers
Node
Node Node
Node Node
Logger
Node
@alexsotob37
Infrastructure
@alexsotob38
Deploying in Cluster
Always two instances of the image
Docker image to run
Port
@alexsotob39
Deploying in Cluster
Reverse Proxy Router
Number of instances LB
@alexsotob40
Cloud Native Application
@alexsotob41
Infrastructure
sticky session
Shopping Cart User A
@alexsotob42
In-Memory Data Grid
In-Memory DataGrid
Shopping Cart User A Shopping Cart User A
@alexsotob43
Release as Unicorns
@alexsotob44
Release as Unicorns
Build Dockerfile DeployBuild Container Testing in Production Release
s2i, OpenShift, Fabric8, Istio
Teiid, Debezium (Test Prod)
@alexsotob45
Let’s Wind Down
@alexsotob46
Advantages of monolith
> Local Calls
> All parts always up
> Easy to debug
> Easy to test
> Refactor without running surprises
> You see the real world every time
> Easy to deploy (coordination)
> Polyglot Languages, DB
@alexsotob47
Digital Darwinism
Self-Service,
On-Demand,
Elastic,
Infrastructure
as
Code
(Cloud)
Re-Org to
DevOps
Automation
Puppet, Chef,
Ansible

and/or
Kubernetes
CI & CD
Deployment
Pipeline
Advanced
Deployment
Techniques
Microservices
@alexsotob48
https://www.slideshare.net/dbryant_uk/oreilly-sacon-ny-2018-continuous-delivery-patterns-for-contemporary-architecture/2
You In The Near Future
@alexsotob49
@alexsotob50
Stats service
User Service
Awards Service
Question Service
Advertise Service
Question Service
@alexsotob51
NO, it is a monolith
https://www.infoq.com/news/2015/06/scaling-stack-overflow
@alexsotob52
@alexsotob53
@alexsotob asotobue@redhat.com

Long Live and Prosper To Monolith