Microservices In Practice
Irakli Nadareishvili,
Director of Strategy, API Academy
CA Technologies
2 © 2015 CA. ALL RIGHTS RESERVED. inadarei
3 © 2015 CA. ALL RIGHTS RESERVED. inadarei
But, why?
4 © 2015 CA. ALL RIGHTS RESERVED. inadarei
Microservices can greatly improve your capabilities in:
CONTINUOUS DELIVERY
PRODUCING EVOLVABLE AND SCALABLE ARCHITECTURE
ENABLING AGILE SOFTWARE DEVELOPMENT LIFECYCLE
1
2
3
5 © 2015 CA. ALL RIGHTS RESERVED. inadarei
6 © 2015 CA. ALL RIGHTS RESERVED. inadarei
COMMUNICATE USING LANGUAGE-AGNOSTIC APIS
ARE INDEPENDENTLY DEPLOYABLE VIA UNIVERSAL CONTAINERS
PRACTICE DECENTRALIZED DATA MANAGEMENT
1
2
3
Microservices is an architectural style, in
which a complex software application is de-
composed into smaller components ("micro
services") that:
7 © 2015 CA. ALL RIGHTS RESERVED. inadarei
Challenge:
De-centralized Data Management
8 © 2015 CA. ALL RIGHTS RESERVED. inadarei
Tool 1:
Think of Capabilities,
not: Data Models
9 © 2015 CA. ALL RIGHTS RESERVED. inadarei
Bounded Contexts
10 © 2015 CA. ALL RIGHTS RESERVED. inadarei
Eric Evans: Bounded Contexts
An application domain consists of multiple bounded
contexts. Residing within each BC are models that do not
need to be shared outside, as well as other models that are
shared externally.
11 © 2015 CA. ALL RIGHTS RESERVED. inadarei
Bounded Context = Capabilities.
“In your organization, you should be
thinking not in terms of data that is
shared, but about the capabilities those
contexts provide the rest of the domain.”
– Sam Newman, Building Microservices
12 © 2015 CA. ALL RIGHTS RESERVED. inadarei
Caution:
DDD and Bounded Context Identification
Are Far From Trivial or Easy Tasks
13 © 2015 CA. ALL RIGHTS RESERVED. inadarei
Domain-Driven Design – More Information
Eric Evans: "Domain-Driven Design:
Tackling Complexity in the Heart of
Software" - 2003
Vaughn Vernon: "Implementing
Domain-Driven Design" - 2013
Scott Millett: "Patterns, Principles,
and Practices of Domain-Driven
Design" - 2015
14 © 2015 CA. ALL RIGHTS RESERVED. inadarei
Tool 2:
Event Sourcing & CQRS
15 © 2015 CA. ALL RIGHTS RESERVED. inadarei
Event Sourcing
Use an append-only store to record the full series of events
that describe actions taken on data in a domain, rather than
storing just the current state, so that the store can be used
to materialize the domain objects.
https://msdn.microsoft.com/en-gb/library/dn589792.aspx
16 © 2015 CA. ALL RIGHTS RESERVED. inadarei
Command and Query Responsibility Segregation (CQRS)
Segregate operations that read data from operations that
update data by using separate interfaces.
This pattern can maximize performance, scalability, and
security; support evolution of the system over time through
higher flexibility; and prevent update commands from
causing merge conflicts at the domain level.
https://msdn.microsoft.com/en-us/library/dn568103.aspx
17 © 2015 CA. ALL RIGHTS RESERVED. inadarei
Deposit Money Microservice
Deposit Message Queue
Event Store
(e.g. Cassandra)
Transactions List/Query Microservice
Query Index Store
(e.g. ElasticSearch)
Validation
18 © 2015 CA. ALL RIGHTS RESERVED. inadarei
What About Them Transactions?
19 © 2015 CA. ALL RIGHTS RESERVED. inadarei
Tool 3: Sagas
(Long-Lived Distributed Transactions)
20 © 2015 CA. ALL RIGHTS RESERVED. inadarei
Booking Travel
21 © 2015 CA. ALL RIGHTS RESERVED. inadarei
No Shared State = No Distr. Transactions
Source: http://vasters.com/clemensv/2012/09/01/Sagas.aspx
We ♥ Sagas!
Designed by: Hector Garcia-Molina & Kenneth Salem, Princeton, 1987
22 © 2015 CA. ALL RIGHTS RESERVED. inadarei
One More Thing…
23 © 2015 CA. ALL RIGHTS RESERVED. inadarei
24 © 2015 CA. ALL RIGHTS RESERVED. inadarei
“Bounded context should be as
big as it needs to be in order to
fully express its complete
Ubiquitous Language”
– Vaughn Vernon, Implementing Domain –Driven Design.
25 © 2015 CA. ALL RIGHTS RESERVED. inadarei
Many start coarse-grained and
become more granular over time.
That said, companies that have been
building Microservices for long, report
that they end with hundreds of
Microservices.
26 © 2015 CA. ALL RIGHTS RESERVED. inadarei
Where do we get
hundreds of servers?
27 © 2015 CA. ALL RIGHTS RESERVED. inadarei
How do we afford so many servers?
Director of Strategy, API Academy
Irakli Nadareishvili
@inadarei
@apiacademy
@cainc

Microservices In Practice

  • 1.
    Microservices In Practice IrakliNadareishvili, Director of Strategy, API Academy CA Technologies
  • 2.
    2 © 2015CA. ALL RIGHTS RESERVED. inadarei
  • 3.
    3 © 2015CA. ALL RIGHTS RESERVED. inadarei But, why?
  • 4.
    4 © 2015CA. ALL RIGHTS RESERVED. inadarei Microservices can greatly improve your capabilities in: CONTINUOUS DELIVERY PRODUCING EVOLVABLE AND SCALABLE ARCHITECTURE ENABLING AGILE SOFTWARE DEVELOPMENT LIFECYCLE 1 2 3
  • 5.
    5 © 2015CA. ALL RIGHTS RESERVED. inadarei
  • 6.
    6 © 2015CA. ALL RIGHTS RESERVED. inadarei COMMUNICATE USING LANGUAGE-AGNOSTIC APIS ARE INDEPENDENTLY DEPLOYABLE VIA UNIVERSAL CONTAINERS PRACTICE DECENTRALIZED DATA MANAGEMENT 1 2 3 Microservices is an architectural style, in which a complex software application is de- composed into smaller components ("micro services") that:
  • 7.
    7 © 2015CA. ALL RIGHTS RESERVED. inadarei Challenge: De-centralized Data Management
  • 8.
    8 © 2015CA. ALL RIGHTS RESERVED. inadarei Tool 1: Think of Capabilities, not: Data Models
  • 9.
    9 © 2015CA. ALL RIGHTS RESERVED. inadarei Bounded Contexts
  • 10.
    10 © 2015CA. ALL RIGHTS RESERVED. inadarei Eric Evans: Bounded Contexts An application domain consists of multiple bounded contexts. Residing within each BC are models that do not need to be shared outside, as well as other models that are shared externally.
  • 11.
    11 © 2015CA. ALL RIGHTS RESERVED. inadarei Bounded Context = Capabilities. “In your organization, you should be thinking not in terms of data that is shared, but about the capabilities those contexts provide the rest of the domain.” – Sam Newman, Building Microservices
  • 12.
    12 © 2015CA. ALL RIGHTS RESERVED. inadarei Caution: DDD and Bounded Context Identification Are Far From Trivial or Easy Tasks
  • 13.
    13 © 2015CA. ALL RIGHTS RESERVED. inadarei Domain-Driven Design – More Information Eric Evans: "Domain-Driven Design: Tackling Complexity in the Heart of Software" - 2003 Vaughn Vernon: "Implementing Domain-Driven Design" - 2013 Scott Millett: "Patterns, Principles, and Practices of Domain-Driven Design" - 2015
  • 14.
    14 © 2015CA. ALL RIGHTS RESERVED. inadarei Tool 2: Event Sourcing & CQRS
  • 15.
    15 © 2015CA. ALL RIGHTS RESERVED. inadarei Event Sourcing Use an append-only store to record the full series of events that describe actions taken on data in a domain, rather than storing just the current state, so that the store can be used to materialize the domain objects. https://msdn.microsoft.com/en-gb/library/dn589792.aspx
  • 16.
    16 © 2015CA. ALL RIGHTS RESERVED. inadarei Command and Query Responsibility Segregation (CQRS) Segregate operations that read data from operations that update data by using separate interfaces. This pattern can maximize performance, scalability, and security; support evolution of the system over time through higher flexibility; and prevent update commands from causing merge conflicts at the domain level. https://msdn.microsoft.com/en-us/library/dn568103.aspx
  • 17.
    17 © 2015CA. ALL RIGHTS RESERVED. inadarei Deposit Money Microservice Deposit Message Queue Event Store (e.g. Cassandra) Transactions List/Query Microservice Query Index Store (e.g. ElasticSearch) Validation
  • 18.
    18 © 2015CA. ALL RIGHTS RESERVED. inadarei What About Them Transactions?
  • 19.
    19 © 2015CA. ALL RIGHTS RESERVED. inadarei Tool 3: Sagas (Long-Lived Distributed Transactions)
  • 20.
    20 © 2015CA. ALL RIGHTS RESERVED. inadarei Booking Travel
  • 21.
    21 © 2015CA. ALL RIGHTS RESERVED. inadarei No Shared State = No Distr. Transactions Source: http://vasters.com/clemensv/2012/09/01/Sagas.aspx We ♥ Sagas! Designed by: Hector Garcia-Molina & Kenneth Salem, Princeton, 1987
  • 22.
    22 © 2015CA. ALL RIGHTS RESERVED. inadarei One More Thing…
  • 23.
    23 © 2015CA. ALL RIGHTS RESERVED. inadarei
  • 24.
    24 © 2015CA. ALL RIGHTS RESERVED. inadarei “Bounded context should be as big as it needs to be in order to fully express its complete Ubiquitous Language” – Vaughn Vernon, Implementing Domain –Driven Design.
  • 25.
    25 © 2015CA. ALL RIGHTS RESERVED. inadarei Many start coarse-grained and become more granular over time. That said, companies that have been building Microservices for long, report that they end with hundreds of Microservices.
  • 26.
    26 © 2015CA. ALL RIGHTS RESERVED. inadarei Where do we get hundreds of servers?
  • 27.
    27 © 2015CA. ALL RIGHTS RESERVED. inadarei How do we afford so many servers?
  • 28.
    Director of Strategy,API Academy Irakli Nadareishvili @inadarei @apiacademy @cainc

Editor's Notes

  • #6 Healthcare.gov
  • #13 High Cohesion is why Bounded Contexts are critical
  • #14 High Cohesion is why Bounded Contexts are critical
  • #19 High Cohesion is why Bounded Contexts are critical
  • #21 You cannot execute an ACID transaction because there is no way Marriot, US Airways and Hertz would allow me to put a lock on their back-end databases.
  • #22 You do not get transactions, because each microservices encapsulates its own data storage. long-lived distributed transactions. Hector Garcia Mollina and http://www.cs.cornell.edu/andru/cs711/2002fa/reading/sagas.pdf
  • #23 You do not get transactions, because each microservices encapsulates its own data storage. long-lived distributed transactions.
  • #24 You do not get transactions, because each microservices encapsulates its own data storage. long-lived distributed transactions.
  • #25 You do not get transactions, because each microservices encapsulates its own data storage. long-lived distributed transactions.
  • #26 You do not get transactions, because each microservices encapsulates its own data storage. long-lived distributed transactions.
  • #27 You do not get transactions, because each microservices encapsulates its own data storage. long-lived distributed transactions.
  • #28 lightweightness is one benefit another one – better portability (at least for now), VMs are not very portable