Professional Documents
Culture Documents
Alberto Salazar,
CTO Advance Latam,
Auth0 Ambassador
@betoSalazar
Alberto Salazar
● Auth0 Ambassador
Cloudbanco
www.advlatam.com www.cloudbanco.com www.ecuadorjug.org
@betoSalazar
@EcuadorJUG
@Auth0Ambassador
Legacy: Is our monolithic
@betoSalazar
Legacy: How it looks after 10 years of code
@betoSalazar
The journey
● Conclusions
@betoSalazar
The evolution of more than 10 years of code
The vision behind the scenes
@betoSalazar
The motivation to migrate
from Monolith to Microservices
asalazar@advlatam.com
@betoSalazar
Microservices
@betoSalazar
Microservices ?
The buzz word
Microservices is the architectural approach that everybody talks about and everybody wants it,
but be prepare to manage a distributed system….
@betoSalazar
The Goal
T Y M E T
O CI I
T RK E
L A
VE M
TO
The goal that organizations need is to increasing velocity & agility;
@betoSalazar
The reasons of this talk
@betoSalazar
The fact - 10 years of code
The Monolithic
asalazar@advlatam.com
@betoSalazar
Legacy: Is our monolithic
@betoSalazar
The Monolith
How it looks
http://microservices.io/patterns/monolithic.html
@betoSalazar
The Monolith
Characteristics
@betoSalazar
How start this legacy
1 Year of code
Always the goal was to keep the modularization
@betoSalazar
Team work on the legacy
5 Years of code
Modularization ?
@betoSalazar
Really ?
10 Years of code
Modular WTF
@betoSalazar
10 Years of code
OMG
@betoSalazar
Migrate several years of code, It will be Easy ?
The challenge
! > 2MM lines of highly coupled code
several years
@betoSalazar
The path - Tips, tricks, pros , cons
Microservices
asalazar@advlatam.com
@betoSalazar
The Monolith to Microservices
How it looks
http://microservices.io/patterns/monolithic.html http://microservices.io/patterns/microservices.html
@betoSalazar
Microservices
Characteristics
! Deployable, executable & scaled independently
architecture)
! Polyglot “Plus”
https://martinfowler.com/articles/microservices.html
https://martinfowler.com/bliki/MicroservicePrerequisites.html
@betoSalazar
The path
Microservices
@betoSalazar
The path -> Split the frontend from the backend
JEE application server
The Monolith (0/5)
MODULE1.war
MODULE1-JS.jar
MODULE2.war
MODULE3.war
css.war
MODULE4.war
theApp.ear
businesslogic.jar
businesslogic.jar
businesslogic.jar
businesslogic.jar
@betoSalazar
The path -> Split the frontend from the backend
@betoSalazar
The path -> Split the frontend from the backend
Facade Code
@betoSalazar
The path -> Split the frontend from the backend
The communication
consumer.jar
businesslogi
MODULE2.war
Message businesslogi
MODULE3.war
Queue businesslogi
businesslogic.jar
css.war
producer.jar
MODULE4.war
Apache ActiveMQ
theApp.ear
RabbitMQ theApp-backend.ear
Apache Kafka……
http://activemq.apache.org
https://www.rabbitmq.com Database
https://kafka.apache.org
http://camel.apache.org/mdc-logging.html
@betoSalazar
The consumer
@betoSalazar
The consumer
@betoSalazar
The path -> Split the frontend from the backend
JEE application server
businesslogic.jar
businesslogic.jar
MODULE1.war
theApp-backend.ear
consumer.jar
MODULE2.war
Message
MODULE3.war
Queue businesslogic.jar
css.war
theApp.ear consumer.jar
businesslogic.jar
Database
theApp-backend.ear
consumer.jar
businesslogic.jar
theApp-backend.ear
@betoSalazar
The path -> Split the frontend from the backend
fat jar
consumer.jar
Service
batch.jar
some api businesslogic.jar
fat jar
consumer.jar
Service
services.jar
some api businesslogic.jar
fat jar
consumer.jar
Service
install just
business-module1.jar
some api businesslogic.jar
Osgi container
Service
consumer.jar
2) Introduce a correlationId
3) Collect the logs
dynamic-camel-routes.jar
some api businesslogic.jar
fat jar
consumer.jar 4) Search by rest API or use Kibana
Service
batch.jar
some api businesslogic.jar
fat jar
consumer.jar
Service
services.jar
some api businesslogic.jar
fat jar
consumer.jar
Service
logstash
business-module1.jar
some api businesslogic.jar
http://www.baeldung.com/mdc-in-log4j-2-logback
https://www.elastic.co/products/elasticsearch
https://www.elastic.co/products/logstash
https://www.elastic.co/products/kibana
@betoSalazar
The path -> Split the frontend from the backend
JEE application server
businesslogic.jar
businesslogic.jar
MODULE1.war
theApp-backend.ear
MODULE2.war
Message Rest-api-layer
consumer.jar
MODULE3.war
Queue businesslogic.jar
css.war
rest-client.jar
producer.jar JEE application server
MODULE4.war theApp-backend.ear
theApp.ear consumer.jar
Rest-api-layer
businesslogic.jar
Database
theApp-backend.ear
consumer.jar
Rest-api-layer
businesslogic.jar
theApp-backend.ear
@betoSalazar
The path -> Split the frontend from the backend
Rest API
Osgi container
Rest-api-layer
Service
engine-orchestrator.jar
businesslogic.jar
some api
Osgi container
Spring MVC
Rest-api-layer
Service
dynamic-camel-routes.jar
some api businesslogic.jar
fat jar
Rest-api-layer
Service
batch.jar
some api businesslogic.jar
fat jar
Rest-api-layer
Service
services.jar
some api businesslogic.jar
fat jar
Rest-api-layer
Service
business-module1.jar
some api businesslogic.jar
https://docs.spring.io/spring/docs/current/spring-framework-
reference/web.html#mvc-introduction
@betoSalazar
The path -> Split the frontend from the backend
https://docs.spring.io/spring/docs/current/spring-framework-reference/web-reactive.html#spring-webflux
@betoSalazar
The path -> Split the frontend from the backend
https://vertx.io/docs/vertx-core/java/
@betoSalazar
The path -> Split the frontend from the backend
https://javaee.github.io/tutorial/jaxrs003.html
@betoSalazar
The path
JWT Service
some api
engine-orchestrator.jar
&
Service
React nodejs some api
dynamic-camel-routes.jar
Login
React nodejs
Authorization Server fat jar
Service
batch.jar
some api
Engine Transaction
fat jar
React nodejs POST bank.com/api/v1/accouts
Service
services.jar
Module n some api
Osgi container
fat jar
Services Service
api-gateway.jar business-module1.jar
api rest some api
fat jar
POST bank.com/api/v1/accouts
Service
some api
business-module-n.jar Database
https://jwt.io/
https://auth0.com
logstash
@betoSalazar
@EcuadorJUG @betoSalazar
The path
Osgi container Rest-api-layer
Service
Rest endpoints & API Gateway some api
businesslogic.jar
engine-orchestrator.jar
Osgi container
Rest-api-layer
Service
businesslogic.jar
dynamic-camel-routes.jar
some api
Services Service
api-gateway.jar businesslogic.jar
services.jar
some api
api rest
fat jar
Rest-api-layer
Service
business-module1.jar
businesslogic.jar
some api
Service businesslogic.jar
business-module-n.jar
some api
https://hazelcast.org/
Discovery services to inspect or rely on the contents of any named IMap
@betoSalazar
The path
The path
Split de database
Osgi container
Rest-api-layer
Service
engine-orchestrator.jar
businesslogic.jar
- Consistency Models:
some api
MODULE1-JS.jar
- ETL Tools fat jar
MODULE2.war Rest-api-layer
Service
batch.jar
MODULE3.war
some api businesslogic.jar
css.war POST bank.com/api/v1/accouts
fat jar
MODULE4.war Rest-api-layer
theApp.ear fat jar Service
services.jar
some api businesslogic.jar
Services
api-gateway.jar fat jar
api rest Rest-api-layer
Service
business-module1.jar
some api businesslogic.jar
POST bank.com/api/v1/accouts
Automate your database
migration https://flywaydb.org/ fat jar Rest-api-layer
Service
https://developers.redhat.com/promotions/migrating- some api
businesslogic.jar
business-module-n.jar
to-microservice-databases/
logstash
@betoSalazar
The path
Osgi container
React nodejs Rest-api-layer
Service
Login JWT some api
dynamic-camel-routes.jar
businesslogic.jar
Services
api-gateway.jar fat jar
api rest Rest-api-layer
Service
business-module1.jar
some api businesslogic.jar
POST bank.com/api/v1/accouts
fat jar Rest-api-layer
Service
businesslogic.jar
business-module-n.jar
https://jwt.io/ some api
https://nodejs.org/es/
https://facebook.github.io/react/
https://angular.io/
https://facebook.github.io/react-native/ logstash
@betoSalazar
Microservices Architecture
@betoSalazar
Containers - Orchestrators - Cloud Istio: Service Mesh
@betoSalazar
Summary &
Code blueprints repositories
asalazar@advlatam.com
@betoSalazar
The conclusion
! Transactions
! Single data repository
! Better problems solver needed (Developers /
architects)
! the system and services have to deal with
network communications, failures, rebalances,
splits.
@betoSalazar
The conclusion
Recommendations
Monolithic apps only look simple from the outside, but you just open the box
Care about logs, monitoring and always use a CORRELATIONID and MDC (Mapped Diagnostic Context)
@betoSalazar
The conclusion
Recommendations
Automate the deployment and delivery process -> CI & CD -> DEVOPS Culture
Secure your APIs - JWT json web token, Json Web Signature, Json Web Encryption
Use lightweight frameworks or java containers (Karaf, Vert.x, Spring boot, Microprofile
(Payara, WildFly Swarm, OpenLiberty, TomEE))
Design for failover, Service load balancing and automatic scaling, data Separation,
Integrity, Performance
@betoSalazar
code blueprints:
https://github.com/lasalazarr/fastdev
https://github.com/lasalazarr/guide-monolithic-to-
microservices
asalazar@advlatam.com
@betoSalazar
THANK YOU
Auth0 Ambassadors.
Helping the developer community make the
internet safer.
asalazar@advlatam.com
@betoSalazar