Java EE microservices architecture - evolving the monolith
-
Upload
markus-eisele -
Category
Software
-
view
6.504 -
download
0
Transcript of Java EE microservices architecture - evolving the monolith
![Page 1: Java EE microservices architecture - evolving the monolith](https://reader033.fdocuments.in/reader033/viewer/2022052116/587e34fa1a28ab9f5d8b4777/html5/thumbnails/1.jpg)
Java EE Microservices Architecture
Evolving the monoliths
![Page 2: Java EE microservices architecture - evolving the monolith](https://reader033.fdocuments.in/reader033/viewer/2022052116/587e34fa1a28ab9f5d8b4777/html5/thumbnails/2.jpg)
@myfearblog.eisele.net
Red Hat Developer Advocate
![Page 3: Java EE microservices architecture - evolving the monolith](https://reader033.fdocuments.in/reader033/viewer/2022052116/587e34fa1a28ab9f5d8b4777/html5/thumbnails/3.jpg)
monolith/ ˈmɒn(ə)lɪθ/nounnoun: monolith; plural noun: monoliths
![Page 4: Java EE microservices architecture - evolving the monolith](https://reader033.fdocuments.in/reader033/viewer/2022052116/587e34fa1a28ab9f5d8b4777/html5/thumbnails/4.jpg)
![Page 5: Java EE microservices architecture - evolving the monolith](https://reader033.fdocuments.in/reader033/viewer/2022052116/587e34fa1a28ab9f5d8b4777/html5/thumbnails/5.jpg)
The Curse Of The Monolith
We know how to operate them
• We know how to develop
• We know how to deploy
• We know how to scale
but there is a price to pay
• Large code-bases
• Hard to understand and modify
• Complex configuration
![Page 6: Java EE microservices architecture - evolving the monolith](https://reader033.fdocuments.in/reader033/viewer/2022052116/587e34fa1a28ab9f5d8b4777/html5/thumbnails/6.jpg)
service oriented/ˈsəːvɪs/noun
![Page 7: Java EE microservices architecture - evolving the monolith](https://reader033.fdocuments.in/reader033/viewer/2022052116/587e34fa1a28ab9f5d8b4777/html5/thumbnails/7.jpg)
![Page 8: Java EE microservices architecture - evolving the monolith](https://reader033.fdocuments.in/reader033/viewer/2022052116/587e34fa1a28ab9f5d8b4777/html5/thumbnails/8.jpg)
The Curse Of SOA
Increased everything
• Interoperability
• Federation
• Business and technology alignment
but there is a price to pay
• Centralized infrastructures
• Restricted communication protocols
• Vendor driven movement
![Page 9: Java EE microservices architecture - evolving the monolith](https://reader033.fdocuments.in/reader033/viewer/2022052116/587e34fa1a28ab9f5d8b4777/html5/thumbnails/9.jpg)
micro services/ˈmʌɪkrəʊ/noun
![Page 10: Java EE microservices architecture - evolving the monolith](https://reader033.fdocuments.in/reader033/viewer/2022052116/587e34fa1a28ab9f5d8b4777/html5/thumbnails/10.jpg)
![Page 11: Java EE microservices architecture - evolving the monolith](https://reader033.fdocuments.in/reader033/viewer/2022052116/587e34fa1a28ab9f5d8b4777/html5/thumbnails/11.jpg)
What Are Microservices?
SOA for DevOps
• Single, self-contained, autonomous
• Easy(er) to understand individually
• Scalability
• Testing independently
• Individually deployed, has own lifecycle
• Single service going down should not impact other services
• Right technology stack for the problem (language, databases, etc)
• Fail fast
• Faster innovation, iteration
We want flexible systems and organizations that can adapt to their complex environments, make changes without rigid dependencies and coordination, can learn, experiment, and exhibit emergent behavior.
„
![Page 12: Java EE microservices architecture - evolving the monolith](https://reader033.fdocuments.in/reader033/viewer/2022052116/587e34fa1a28ab9f5d8b4777/html5/thumbnails/12.jpg)
Why now?Why me?
![Page 13: Java EE microservices architecture - evolving the monolith](https://reader033.fdocuments.in/reader033/viewer/2022052116/587e34fa1a28ab9f5d8b4777/html5/thumbnails/13.jpg)
![Page 14: Java EE microservices architecture - evolving the monolith](https://reader033.fdocuments.in/reader033/viewer/2022052116/587e34fa1a28ab9f5d8b4777/html5/thumbnails/14.jpg)
Enterprise Goals and Objectives
Resistant to Change and Economically Efficient
Developers Left Alone
Technology-Centric Versus Business-Centric
![Page 15: Java EE microservices architecture - evolving the monolith](https://reader033.fdocuments.in/reader033/viewer/2022052116/587e34fa1a28ab9f5d8b4777/html5/thumbnails/15.jpg)
Single Vendor Platform decisions increasingly unattractive
OpenSource moves quickly into this direction
Platform as a Service offerings mature
Increasing need for business value from software
Quicker turnaround cycles for changes required
![Page 16: Java EE microservices architecture - evolving the monolith](https://reader033.fdocuments.in/reader033/viewer/2022052116/587e34fa1a28ab9f5d8b4777/html5/thumbnails/16.jpg)
We need to build systems for flexibility and resiliency, not just efficiency and robustness.
![Page 17: Java EE microservices architecture - evolving the monolith](https://reader033.fdocuments.in/reader033/viewer/2022052116/587e34fa1a28ab9f5d8b4777/html5/thumbnails/17.jpg)
And we need to start building them today with what we have.
![Page 18: Java EE microservices architecture - evolving the monolith](https://reader033.fdocuments.in/reader033/viewer/2022052116/587e34fa1a28ab9f5d8b4777/html5/thumbnails/18.jpg)
From monolith to microservice architecture
?
![Page 19: Java EE microservices architecture - evolving the monolith](https://reader033.fdocuments.in/reader033/viewer/2022052116/587e34fa1a28ab9f5d8b4777/html5/thumbnails/19.jpg)
Technology alonewon’t solve your problem.
![Page 20: Java EE microservices architecture - evolving the monolith](https://reader033.fdocuments.in/reader033/viewer/2022052116/587e34fa1a28ab9f5d8b4777/html5/thumbnails/20.jpg)
Software DesignOuter Architecture
Methodology and Organization
Distributed Systems
Platform As A Service
![Page 21: Java EE microservices architecture - evolving the monolith](https://reader033.fdocuments.in/reader033/viewer/2022052116/587e34fa1a28ab9f5d8b4777/html5/thumbnails/21.jpg)
Organisation
• Autonomous, self-directed teams
• Transparency
• Small (2-pizza rule)
• Purpose, Trust, Empathy driven
• Feedback
• Experimentation
• Respond quickly to change
• Own services, delivery, operations
• Build it, you own it
![Page 22: Java EE microservices architecture - evolving the monolith](https://reader033.fdocuments.in/reader033/viewer/2022052116/587e34fa1a28ab9f5d8b4777/html5/thumbnails/22.jpg)
Model culture after open source organizations: meritocracy, shared consciousness, transparency, network, platforms.(Christian Posta, Red Hat)
„
![Page 23: Java EE microservices architecture - evolving the monolith](https://reader033.fdocuments.in/reader033/viewer/2022052116/587e34fa1a28ab9f5d8b4777/html5/thumbnails/23.jpg)
DEV
Continuously deliver software
Focus on adding value, not maintenance
Deliver features faster
OPS
Minimize manual, repetitive work
Stabilize operating environments
Encounter issues of reduced complexity
Resolve problems quicker
![Page 24: Java EE microservices architecture - evolving the monolith](https://reader033.fdocuments.in/reader033/viewer/2022052116/587e34fa1a28ab9f5d8b4777/html5/thumbnails/24.jpg)
WATERFALL AGILE
http://blog.procademysoftware.com/agile-is-waterfall/
![Page 25: Java EE microservices architecture - evolving the monolith](https://reader033.fdocuments.in/reader033/viewer/2022052116/587e34fa1a28ab9f5d8b4777/html5/thumbnails/25.jpg)
Software Design
Architecture Principles
• Single Responsible Principle
• Service Oriented Architecture• Encapsulation
• Separation of Concern
• Loose Coupling
• Hexagonal Architecture
Design Patterns
• Domain-driven Design
• Bounded Contexts
• Event Sourcing
• CQRS
• Eventual Consistency
• Context Maps
![Page 26: Java EE microservices architecture - evolving the monolith](https://reader033.fdocuments.in/reader033/viewer/2022052116/587e34fa1a28ab9f5d8b4777/html5/thumbnails/26.jpg)
Design Constraints
• Availability
• Scalability
• Performance
• Usability
• Flexibility
![Page 27: Java EE microservices architecture - evolving the monolith](https://reader033.fdocuments.in/reader033/viewer/2022052116/587e34fa1a28ab9f5d8b4777/html5/thumbnails/27.jpg)
Best Practices
• Design for Automation
• Designed for failure
• Service load balancing and automatic scaling
• Design for Data Separation
• Design for Integrity
• Design for Performance
![Page 28: Java EE microservices architecture - evolving the monolith](https://reader033.fdocuments.in/reader033/viewer/2022052116/587e34fa1a28ab9f5d8b4777/html5/thumbnails/28.jpg)
Strategies For Decomposing
Verb or Use Casee.g. Checkout UI
Noune.g. Catalog product service
Single Responsible Principlee.g. Unix utilities
![Page 29: Java EE microservices architecture - evolving the monolith](https://reader033.fdocuments.in/reader033/viewer/2022052116/587e34fa1a28ab9f5d8b4777/html5/thumbnails/29.jpg)
Distributed Systems
• The network is unreliable
• Design time coupling
• Unintended, run-time coupling
• Components will fail
• Design for resilience, not just robustness
![Page 30: Java EE microservices architecture - evolving the monolith](https://reader033.fdocuments.in/reader033/viewer/2022052116/587e34fa1a28ab9f5d8b4777/html5/thumbnails/30.jpg)
Control Dependencies
• What components depend on the others
• Which teams need to engage to make a change
• What services need to be changed if one changes
• Coordination, contention, synchronization, blocking
• Hidden dependencies
![Page 31: Java EE microservices architecture - evolving the monolith](https://reader033.fdocuments.in/reader033/viewer/2022052116/587e34fa1a28ab9f5d8b4777/html5/thumbnails/31.jpg)
Platform as a Service
• Docker, Kubernetes
• Developer focused workflow
• Source 2 Image builds
• Build as first-class citizen
• Deployments as first-class citizen
• Software Defined Networking (SDN)
• Docker native format/packaging
• Run docker images
• CLI/Web based tooling
![Page 32: Java EE microservices architecture - evolving the monolith](https://reader033.fdocuments.in/reader033/viewer/2022052116/587e34fa1a28ab9f5d8b4777/html5/thumbnails/32.jpg)
Outer Architecture
Load Balancer
ServiceAA DBClient Cache
AP
I G
ate
wa
y
Se
cu
rity
ServiceRegistry
Operational Capabilities (Scaling, SLA, Monitoring, Logging, Deployment)
Developer Enablement (Documentation, Discovery, Debugging)
![Page 33: Java EE microservices architecture - evolving the monolith](https://reader033.fdocuments.in/reader033/viewer/2022052116/587e34fa1a28ab9f5d8b4777/html5/thumbnails/33.jpg)
Why now?
Why me?
![Page 34: Java EE microservices architecture - evolving the monolith](https://reader033.fdocuments.in/reader033/viewer/2022052116/587e34fa1a28ab9f5d8b4777/html5/thumbnails/34.jpg)
Java EE 7 Features
![Page 35: Java EE microservices architecture - evolving the monolith](https://reader033.fdocuments.in/reader033/viewer/2022052116/587e34fa1a28ab9f5d8b4777/html5/thumbnails/35.jpg)
Migration Approaches
![Page 36: Java EE microservices architecture - evolving the monolith](https://reader033.fdocuments.in/reader033/viewer/2022052116/587e34fa1a28ab9f5d8b4777/html5/thumbnails/36.jpg)
Load Balancer
App
ServiceSDApp
ServiceSD
Java EE .ear
.war
.war
.jar
.jar
.jar
.jar
DBClient
App
ServiceSDApp
ServiceSD
ServiceAA
.war
.jar
.jar
DBCache
GLUE
![Page 37: Java EE microservices architecture - evolving the monolith](https://reader033.fdocuments.in/reader033/viewer/2022052116/587e34fa1a28ab9f5d8b4777/html5/thumbnails/37.jpg)
Load Balancer
App
ServiceSDApp
ServiceSD
Java EE .ear
.war
.war
.jar
.jar
.jar
.jar
DB
Client
App
ServiceSDApp
ServiceSD
ServiceAA
.war
.jar
.jar
DBCache
/service
/orderRead-only
Access!
![Page 38: Java EE microservices architecture - evolving the monolith](https://reader033.fdocuments.in/reader033/viewer/2022052116/587e34fa1a28ab9f5d8b4777/html5/thumbnails/38.jpg)
![Page 39: Java EE microservices architecture - evolving the monolith](https://reader033.fdocuments.in/reader033/viewer/2022052116/587e34fa1a28ab9f5d8b4777/html5/thumbnails/39.jpg)
Let’s look at some patterns
![Page 40: Java EE microservices architecture - evolving the monolith](https://reader033.fdocuments.in/reader033/viewer/2022052116/587e34fa1a28ab9f5d8b4777/html5/thumbnails/40.jpg)
Aggregator
AppService1
AppServiceSD
AppService1
AppServiceWQ
AppService3
AppServiceTR
DB
DB
DB
Client
Cache
Cache
Cache
Load Balancer
![Page 41: Java EE microservices architecture - evolving the monolith](https://reader033.fdocuments.in/reader033/viewer/2022052116/587e34fa1a28ab9f5d8b4777/html5/thumbnails/41.jpg)
LB / Proxy
AppService1
AppServiceSD
AppService1
AppServiceWQ
AppService3
AppServiceTR
DB
DB
DB
Client
Cache
Cache
Cache
![Page 42: Java EE microservices architecture - evolving the monolith](https://reader033.fdocuments.in/reader033/viewer/2022052116/587e34fa1a28ab9f5d8b4777/html5/thumbnails/42.jpg)
Load Balancer
AppService1
AppServiceBN
AppService1
AppServiceFD
AppService3
AppServiceSA
DB DB DB
Client
CacheCacheCache
![Page 43: Java EE microservices architecture - evolving the monolith](https://reader033.fdocuments.in/reader033/viewer/2022052116/587e34fa1a28ab9f5d8b4777/html5/thumbnails/43.jpg)
Load Balancer
AppService1
AppServiceRE
AppService1
AppServiceGH
AppService3
AppServiceDR
DB
DB DB
AppService3
AppServiceKJ
DB
Client
Cache
Cache
Cache Cache
![Page 44: Java EE microservices architecture - evolving the monolith](https://reader033.fdocuments.in/reader033/viewer/2022052116/587e34fa1a28ab9f5d8b4777/html5/thumbnails/44.jpg)
Load Balancer
AppService1
AppServiceXY
AppService1
AppServiceEW
AppService3
AppServiceCV
DB
DB
DB
AppService3
AppServiceTR
DB
AppService3
AppServiceYU
Load Balancer
Client
Client
Cache
Cache
Cache
Cache
![Page 45: Java EE microservices architecture - evolving the monolith](https://reader033.fdocuments.in/reader033/viewer/2022052116/587e34fa1a28ab9f5d8b4777/html5/thumbnails/45.jpg)
Respect The Challenge
• No silver bullet; distributed systems are *hard*
• Dependency hell, custom shared libraries
• Fragmented and inconsistent management
• Team communication challenges
• Health checking, monitoring, liveness
• Over architecting, performance concerns, things spiraling out of control fast
![Page 46: Java EE microservices architecture - evolving the monolith](https://reader033.fdocuments.in/reader033/viewer/2022052116/587e34fa1a28ab9f5d8b4777/html5/thumbnails/46.jpg)
http://martinfowler.com/bliki/MicroservicePremium.html
The fulcrum of whether or not to use microservices is the complexity of the system you're contemplating.(M.Fowler)
“
![Page 47: Java EE microservices architecture - evolving the monolith](https://reader033.fdocuments.in/reader033/viewer/2022052116/587e34fa1a28ab9f5d8b4777/html5/thumbnails/47.jpg)
Lessons Learned Today
• Correct functional decomposition is crucial for microservices:• pretty hard to get right from the start
• a modular system can evolve to microservices
• balance the needs with the costs
• work on it evolutionary
• Java EE can be a platform for microservices
• You need a lot more than just technology
![Page 48: Java EE microservices architecture - evolving the monolith](https://reader033.fdocuments.in/reader033/viewer/2022052116/587e34fa1a28ab9f5d8b4777/html5/thumbnails/48.jpg)
Fit all the pieces together
![Page 49: Java EE microservices architecture - evolving the monolith](https://reader033.fdocuments.in/reader033/viewer/2022052116/587e34fa1a28ab9f5d8b4777/html5/thumbnails/49.jpg)
http://bit.ly/ModernJavaEE
• Understand the challenges of starting a greenfield development vs tearing apart an existing brownfield application into services
• Examine your business domain to see if microserviceswould be a good fit
• Explore best practices for automation, high availability, data separation, and performance
• Align your development teams around business capabilities and responsibilities
• Inspect design patterns such as aggregator, proxy, pipeline, or shared resources to model service interactions
![Page 50: Java EE microservices architecture - evolving the monolith](https://reader033.fdocuments.in/reader033/viewer/2022052116/587e34fa1a28ab9f5d8b4777/html5/thumbnails/50.jpg)