2. Christian Posta
Chief Architect, cloud application development
Twitter: @christianposta
Blog: http://blog.christianposta.com
Email: christian@redhat.com
Slides: http://slideshare.net/ceposta
ā¢ Author āMicroservices for Java developersā
ā¢ Committer/contributor lots of open-source
projects
ā¢ Worked with large Microservices, web-scale,
unicorn company
ā¢ Blogger, speaker about DevOps, integration,
and microservices
3.
4. Rough path of discussions
today
ā¢ Microservices: What, Why, When?
ā¢ āCloud-nativeā with a Platform
ā¢ Microservices frameworks
ā¢ Service decomposition and boundaries
ā¢ Microservice resilience, routing, and control
@christianposta
6. āThe microservice architectural style is an
approach to developing a single application as
a suite of small services, each running in its
own process and communicating with
lightweight mechanisms, often an HTTP
resource API. These services are built around
business capabilities and independently
deployable by fully automated deployment
machinery.ā
A microservices definition
7. ā¢ 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?
@christianposta
8. ā¢ System complexity
ā¢ Operational complexity
ā¢ Testing is harder across services
ā¢ Security
ā¢ Hard to get boundaries right (transactions,
APIs, etc)
ā¢ Resource overhead
ā¢ Network overhead
ā¢ Lack of tooling
Drawbacks to microservices
@christianposta
9. Why would one implement a system
as microservices?
@christianposta
10. Pain we may feelā¦
@christianposta
ā¢ Making changes in one place negatively affects
unrelated areas
ā¢ Low confidence making changes that donāt break
things
ā¢ Spend lots of time trying to coordinate work between
team members
ā¢ Structure in the application has eroded or is non-
existant
ā¢ We have no way to quantify how long code merges
will take
11. @christianposta
ā¢ Development time is slow simply because the project
is so big (IDE bogs down, running tests is slow, slow
bootstrap time, etc)
ā¢ Changes to one module force changes across other
modules
ā¢ Difficult to sunset outdated technology
ā¢ Weāve built our new applications around old
premises like batch processing
ā¢ Application steps on itself at runtime managing
resources, allocations, computations
Pain we may feelā¦
13. If change is happening on the
outside faster than on the inside
the end is in sight.
S&P company life expectancy
@christianposta
Jack Welch, former CEO, GE
15. Competitive advantage is transient.
We need to continuously re-invent our
business models to compete and stay
relevant.
We need to continuously innovate.
@christianposta
16. Innovation is admitting we donāt
have all the answers
Mark Schwartz ā Former CIO USCIS
@christianposta
17. We need to figure out the right
questions to askā¦
Mark Schwartz ā Former CIO USCIS
@christianposta
18. How do we do this?
@christianposta
ā¢ Identify goals
ā¢ Free teams to explore possible solution spaces
ā¢ Generate hypothesis
ā¢ Design cheap experiments to test hypothesis
ā¢ Work in small batches
ā¢ Learn from results
ā¢ Calibrate investment; rinse, repeat
19. āIf I invest $5-$10M in your company and you fail, I have 30
other investments. Itās just a footnote in my investment history.ā
https://medium.com/@mattklein123/optimizing-impact-why-i-will-not-start-an-envoy-platform-company-8904286658cb
https://barryoreilly.com/2017/04/06/optimize-to-be-wrong-not-right/
Create options through experiments
27. DONāT optimize for microservices ifā¦
@christianposta
ā¢ Youāre building a Minimum Viable Product (MVP), testing a
hypothesis
ā¢ Youāre building a CRUD application
ā¢ You system isnāt CRUD, but the business logic not very
complicated
ā¢ Your system doesnāt have > 10 people all trying to
coordinate to work on it
ā¢ Your application doesnāt need to scale
ā¢ You deliver packaged software
ā¢ Youāre building HPC systems
29. We can now assert with confidence that
high IT performance correlates with
strong business performance, helping
to boost productivity, profitability and
market share.
@christianposta
https://puppet.com/resources/whitepaper/2014-state-devops-report
30. High performing IT teams
@christianposta
ā¢ ā¦are encouraged to experiment
ā¢ ā¦learn from failure
ā¢ ā¦work in small batches
ā¢ ā¦focus on getting continuous feedback
ā¢ ā¦are held to outcomes, not output
ā¢ ā¦continuously prioritize and reprioritize based on
cost of delay (http://blackswanfarming.com/cost-of-
delay/)
31. High performing IT teams need these
IT capabilities and practices
@christianposta
ā¢ Continuous Integration (build from master)
ā¢ Continuous Delivery (automated pipelines)
ā¢ Safe, reliable delivery mechanisms
ā¢ Modern, scalable, resilient application architectures
ā¢ Self-service, on-demand infrastructure
ā¢ Automated testing
ā¢ Metrics, logs, traces, observability
ā¢ Feedback loops
ā¢ Security as part of the pipeline
51. ā¢ 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
Focus on domain models, not data models
@christianposta
52. Service Cutter: A systemic approach to
service
decomposition
@christianposta
https://servicecutter.github.io
54. How do we share information?
ā¢ REST, RPC
ā¢ Streams/Events(ActiveMQ, JMS, AMQP, STOMP, Kafka,
etc)
ā¢ Legacy (SOAP, mainframe, file processing, proprietary)
ā¢ Routing, Aggregation, Splitting, Transactions,
Compensations, Filtering, etc.
@christianposta
55. ā¢ Small Java library
ā¢ 200+ components for integrating systems (bring along only
the ones you use)
ā¢ Powerful EIPs (routing, transformation, error handling)
ā¢ Distributed-systems swiss-army knife!
ā¢ Declarative DSL
ā¢ Embeddable into any JVM (EAP, Karaf, Tomcat, Spring
Boot, Dropwizard, Wildfly Swarm, no container, etc)
Apache Camel
@christianposta
57. public class OrderProcessorRouteBuilder extends RouteBuilder {
@Override
public void configure() throws Exception {
rest().post(ā/order/socksā)
.description(āNew Order for pair of socksā)
.consumes(āapplication/jsonā)
.route()
.to(āactivemq:topic:newOrderā)
.log(āreceived new order ${body.orderId}ā)
.to(āibatis:storeOrder?statementType=Insertā);
}
Camel REST DSL
@christianposta
59. Things you must solve for becauseā¦
distributed systems
ā¢ Service discovery
ā¢ Retries
ā¢ Timeouts
ā¢ Load balancing
ā¢ Rate limiting
ā¢ Thread bulk heading
ā¢ Circuit breaking
60. ā¦continued
ā¢ Routing between services (adaptive, zone-aware)
ā¢ Deadlines
ā¢ Back pressure
ā¢ Outlier detection
ā¢ Health checking
ā¢ Traffic shaping
ā¢ Request shadowing
76. ā¢ Have self-service infrastructure automation?
ā¢ Have self-service application automation?
ā¢ Have working CI/CD?
ā¢ Have health checking, monitoring,
instrumentation?
ā¢ Have logging, distributed tracing?
ā¢ Able to release services independently?
ā¢ Honoring backward and forward
Are you doing microservices?
@christianposta
77. ā¢ Number of features accepted
ā¢ % of features completed
ā¢ User satisfaction
ā¢ Feature Cycle time
ā¢ defects discovered after deployment
ā¢ customer lifetime value (future profit as a result of relationship with the
customer) https://en.wikipedia.org/wiki/Customer_lifetime_value
ā¢ revenue per feature
ā¢ mean time to recovery
ā¢ % improvement in SLA
ā¢ number of changes
ā¢ number of user complaints, recommendations, suggestions
ā¢ % favorable rating in surveys
ā¢ % of users using which features
ā¢ % reduction in error rates
ā¢ avg number of tx / user
ā¢ MANY MORE!
Focus on going fast and learning
78. ā¢ The hardest part of microservices? Your data
https://developers.redhat.com/blog/2016/08/02/the-hardest-part-about-microservices-your-data/
ā¢ Microservices patterns:
circuit breaking with Envoy Proxy
https://developers.redhat.com/blog/2017/05/31/microservices-patterns-with-envoy-sidecar-proxy-
part-i-circuit-breaking/
ā¢ Monolith to microservices Part I
https://developers.redhat.com/blog/2017/09/26/low-risk-monolith-microservice-evolution-part/
ā¢ Monolith to microservices Part II
https://developers.redhat.com/blog/2017/10/23/low-risk-monolith-microservice-evolution-part-ii/
More material
@christianposta
79. ā¢ Download and explore OpenShift
ā¢ https://www.openshift.org/minishift/
ā¢ Checkout Spring Boot/WildFlySwarm/Vert.x on
OpenShift:
ā¢ https://launch.openshift.io
ā¢ Reach out to your Red Hat rep to discuss more and/or
get me/my team involved with your initiatives
What next?
80.
81. Thanks!
BTW: Hand drawn diagrams made with Paper by FiftyThree.com ļ@christianposta
Twitter: @christianposta
Blog: http://blog.christianposta.com
Email: christian@redhat.com
Slides: http://slideshare.net/ceposta
Follow up links:
ā¢ http://openshift.io
ā¢ http://launch.openshift.io
ā¢ http://blog.openshift.com
ā¢ http://developers.redhat.com/blog
ā¢ https://www.redhat.com/en/open-innovation-labs
ā¢ https://www.redhat.com/en/technologies/jboss-middleware/3scale
ā¢ https://www.redhat.com/en/technologies/jboss-middleware/fuse