SOA to Microservices
@christianposta
Principal Architect at Red Hat
6/30/16
Modernization with microservices
and containers
Christian Posta
Principal Middleware Architect @ Red Hat
Twitter: @christianposta
Blog: http://blog.christianposta.com
Email: christian@redhat.com
•  “Microservices for Java developers” (6/2016)
•  Committer Apache Camel, ActiveMQ, Fabric8, others
•  Worked with large Microservices, web-scale, unicorn company
•  Blogger, speaker about DevOps, integration, and microservices
What if we just do Microservices!
Increased Interoperability
Increased Vendor and Technology Diversity
Increased Federation
Increased Organizational Agility
Sound familiar? That was SOA
Where did we go wrong?
One large database mentality
Layers as a general-purpose architecture
•  Single, self-contained,
autonomous
•  Isolated and Resilient to faults
•  Faster software delivery
•  Own their own data
•  Easier to understand individually
•  Scalability
•  Right technology for the
problem
•  Test individual services
•  Individual deployments
Microservices to the rescue…
Infrastructure for scale
Organizational structure
Identify a useful domain model with boundaries
Microservices: Challenges for Enterprises
People	try	to	copy	Net,lix,	but	they	can	only		
copy	what	they	see.	They	copy	the		
results,	not	the	process.	
Adrian Cockcroft, former Chief Cloud Architect, Netflix
Enterprises have complex domains and scale requirements
We Need Boundaries!
Book checkout / purchase Title Search
Recommendations
Weekly reporting
Domain Complexity
•  Break things into smaller,
understandable models
•  Surround a model and its
“context” with a boundary
•  Implement the model in code
or get a new model
•  Explicitly map between
different contexts
•  Model transactional
boundaries as aggregates
What about the data!?
Which one? Transactional Consistency or Eventual Consistency?
Modeling components
•  Entity
•  Value Object
•  Aggregate
•  Domain Events
Domain Aggregates
Source: https://vaughnvernon.co
Domain Aggregate
•  Design for consistency
boundaries, not data model
composition
•  Single transaction per
aggregate
•  Based on business invariants
•  Eventual consistency between
aggregates
Embrace Autonomy! No Two-Phase Commit!
•  Always use idempotent
consumers
•  Relax foreign key constraints
between aggregates/
bounded contexts
•  Embrace eventual consistency
between time domains
Which one? Transactional Consistency or Eventual Consistency?
Ask yourself “Who’s job is it”?
Automation
•  Self service
•  Built in deployments
•  Cluster logging, metrics, monitoring
•  Blue/Green deployments, Canary deployments
•  Service Discovery built in
•  Continuous Integration / Continuous Delivery
Platform automation
•  Circuit breakers/bulkhead
•  Client-side load balancing
•  Forward proxying
•  Service routing
•  Centralized configuration management
•  Leadership election
Microservices libraries/frameworks
•  Load balancing built-in
•  Service discovery built-in
•  Self healing built-in
•  No complicated service-discovery infrastructure!
•  Just use DNS for the 95% use case
•  Save client-side load balancing for the 5% use case
Kubernetes Services
Implementing these concepts
@christianposta
blog.christianposta.com
github.com/christian-posta
•  WildFly Swarm (wildfly-swarm.io)
•  Kubernetes / OpenShift (openshift.org)
•  Apache Kafka (kafka.apache.org)
•  Debezium (debezium.io)
•  Apache Camel (camel.apache.org)
•  Spring Boot (projects.spring.io/spring-boot/)
•  Liquibase (liquibase.org)
Technologies used
https://github.com/christian-posta/ticket-monster-ui
https://github.com/christian-posta/ticket-monster-admin
https://github.com/christian-posta/ticket-monster-orders
https://github.com/christian-posta/ticket-monster-search
https://github.com/christian-posta/ticket-monster-infra
https://github.com/christian-posta/ticket-monster-admin-camel
https://github.com/christian-posta/ticket-monster-orders-camel
•  Better, richer, aggregate design
•  CQRS for the orders bounded context
•  Security with Keycloak
•  Tracing with Zipkin
•  Sidecar circuit breakers with Netflix OSS Hystrix
•  CI / CD with Fabric8 / OpenShift
Left todo
Christian Posta
Principal Middleware Architect @ Red Hat
Twitter: @christianposta
Blog: http://blog.christianposta.com
Email: christian@redhat.com

SOA to Microservices