Microservices
Why do we need them?
Microservices Main Characteristics
By Martin Fowler:
1. Components via services
2. Organized around business capabilities
3. Products not Projects
4. Smart endpoints and dump pipes
5. Decentralized governance
6. Decentralized data management
7. Infrastructure automation
8. Design for failure
9. Evolutionary design
Grouped by `idea`:
1. Components via services, not libraries
2. Arranging efforts around business needs:
● Some microproducts are being created that rule all the business logic and processes within the service
● Decentralization in product and product storage management
3. Infrastructure:
○ Design for failure
○ Evolutionary design
○ CI & Monitoring
Microservices Main Characteristics
The main idea is to make ...
an independently replaceable & independently updatable components
b1
b2
b3
a1 c1
c2
d1 d2
There are 2 main types of components:
1. Libraries (require a new vendor or create your own)
2. Services
Types Of Application Components
Component
a1 b2
Library
a1
Service
b2
Service
Monolithic Architecture - tightly coupled application components, all updates cause the whole application code
to be deployed, even if there was one one comma missing somewhere (use libraries and/or library-based components)
Service Oriented Architecture - gives the ability to replace or update either of application components (use
standalone services, mainly via http API)
Types Of Applications
SOA
Microservices
Organized around business capabilities
Monolithic app. / SOA Microservices / SOA
Organized around technologies Organized around business capabilities
UI
Server
DBA
Payments
Marketing
CRM
Microservice Team
● “2 pizza team” rule
● Each team must be as fullstack as possible
● Each team is responsible for all the Microservice processes, starting from the
communication with end users and ending by deploying some features to the production
environment
Service Oriented Architecture
Service Oriented Architecture (SOA) - a powerful piece of a middleware that will
automatically do all the staff (route messages, apply business rules, do filtering, validations
and lots of other things).
This kind of middleware is also called an ESB (Enterprise Service Bus or, jokingly, Egregious
Spaghetti Box).
Here a, b, c are the dumb
endpoints of certain
services. ESB
a
b
c
Diff SOA Microservices
ESB
a
b
c
a
b
c
All smartness moves to the end-points
ESB becomes just a good piping mechanism
Example: Internet
The main idea is a Decentralization
Application Evolution
Monolithic application - one hunky big relational database and it commits to all across the application
components
SOA - lots of services each pulling data from one logically large database
Microsevice - each service is responsible for it’s own data and it’s own persistence
Amazons’ example
One of the rules in the Amazon when they shifted to a service oriented architecture is:
“One may never talk to another services’ data store, one can
only talk to another service through it’s API”
Microservices Main Advantages
1) it removes the mess with integration of different stuff through a database (even with
an ORM support)
2) languages and tools should individually be chosen by a microservice development
team
Example: individual microservices use a database that make sense for them (one
oracle, another one - fancy nosql, another may be mysql, etc)
Infrastructure automation
- Partial application deployment
- It’s important to put stuff to live with zero downtime
- Blue-Green deployment
Failover Design
- Lots of emphasis on monitoring
- Sooner or later remote services gonna fail, particularly if you distribute them
between multiple nodes (part of the reason why monitoring is so important)
- Tool: Simian Army (Chaos Monkey, Janitor Monkey, Conformity Monkey)
- One has to assume the things gonna break
Resources
● https://www.youtube.com/watch?v=wgdBVIX9ifA
● http://martinfowler.com/articles/microservices.html
● https://github.com/Netflix/SimianArmy/wiki
● http://martinfowler.com/bliki/BlueGreenDeployment.html

Microservices (en)

  • 1.
  • 2.
    Microservices Main Characteristics ByMartin Fowler: 1. Components via services 2. Organized around business capabilities 3. Products not Projects 4. Smart endpoints and dump pipes 5. Decentralized governance 6. Decentralized data management 7. Infrastructure automation 8. Design for failure 9. Evolutionary design
  • 3.
    Grouped by `idea`: 1.Components via services, not libraries 2. Arranging efforts around business needs: ● Some microproducts are being created that rule all the business logic and processes within the service ● Decentralization in product and product storage management 3. Infrastructure: ○ Design for failure ○ Evolutionary design ○ CI & Monitoring Microservices Main Characteristics
  • 4.
    The main ideais to make ... an independently replaceable & independently updatable components b1 b2 b3 a1 c1 c2 d1 d2
  • 5.
    There are 2main types of components: 1. Libraries (require a new vendor or create your own) 2. Services Types Of Application Components Component a1 b2 Library a1 Service b2 Service
  • 6.
    Monolithic Architecture -tightly coupled application components, all updates cause the whole application code to be deployed, even if there was one one comma missing somewhere (use libraries and/or library-based components) Service Oriented Architecture - gives the ability to replace or update either of application components (use standalone services, mainly via http API) Types Of Applications SOA Microservices
  • 7.
    Organized around businesscapabilities Monolithic app. / SOA Microservices / SOA Organized around technologies Organized around business capabilities UI Server DBA Payments Marketing CRM
  • 8.
    Microservice Team ● “2pizza team” rule ● Each team must be as fullstack as possible ● Each team is responsible for all the Microservice processes, starting from the communication with end users and ending by deploying some features to the production environment
  • 9.
    Service Oriented Architecture ServiceOriented Architecture (SOA) - a powerful piece of a middleware that will automatically do all the staff (route messages, apply business rules, do filtering, validations and lots of other things). This kind of middleware is also called an ESB (Enterprise Service Bus or, jokingly, Egregious Spaghetti Box). Here a, b, c are the dumb endpoints of certain services. ESB a b c
  • 10.
    Diff SOA Microservices ESB a b c a b c Allsmartness moves to the end-points ESB becomes just a good piping mechanism Example: Internet The main idea is a Decentralization
  • 11.
    Application Evolution Monolithic application- one hunky big relational database and it commits to all across the application components SOA - lots of services each pulling data from one logically large database Microsevice - each service is responsible for it’s own data and it’s own persistence
  • 12.
    Amazons’ example One ofthe rules in the Amazon when they shifted to a service oriented architecture is: “One may never talk to another services’ data store, one can only talk to another service through it’s API”
  • 13.
    Microservices Main Advantages 1)it removes the mess with integration of different stuff through a database (even with an ORM support) 2) languages and tools should individually be chosen by a microservice development team Example: individual microservices use a database that make sense for them (one oracle, another one - fancy nosql, another may be mysql, etc)
  • 14.
    Infrastructure automation - Partialapplication deployment - It’s important to put stuff to live with zero downtime - Blue-Green deployment
  • 15.
    Failover Design - Lotsof emphasis on monitoring - Sooner or later remote services gonna fail, particularly if you distribute them between multiple nodes (part of the reason why monitoring is so important) - Tool: Simian Army (Chaos Monkey, Janitor Monkey, Conformity Monkey) - One has to assume the things gonna break
  • 16.
    Resources ● https://www.youtube.com/watch?v=wgdBVIX9ifA ● http://martinfowler.com/articles/microservices.html ●https://github.com/Netflix/SimianArmy/wiki ● http://martinfowler.com/bliki/BlueGreenDeployment.html