SlideShare a Scribd company logo
Micro Services
Sebastian Mancke
Creative Commons BY-SA 3.0
24.08.14 2
Monolythic Software
Why are monolythic systems 'evil' ?
Because of their dependencies:
●
Software is not easy to test
●
And hard to refactor
●
Effects of changes can not be isolated
●
Working with multiple developers/teams is challenging
●
No reuse of functionality
●
Runtime and deployment dependencies:
●
Performance and scaling
●
Deployment of features and releases
24.08.14 3
Avoid a Monolyth
Monolyths arise from bad design,
independent of the technology!
●
You can build a monolyth with every software framework.
●
Even distributed systems with a lot of services can be monolythic.
●
And even software with monolythic builds and deployments may have a
good internal structure.
So, chosing a popular micro services framework is not enough!
24.08.14 4
Think Vertical!
Split the application in functional modules
Maximal reduction of dependencies
between different functional parts
Vertical teams (End-to-End)
24.08.14 5
Classical Approach
GUI -Layer
Services
Database/Persistance
24.08.14 6
SOA Approach
GUI -Layer
Business
Service
DB
Business Service
Business
Service
Persistence Service
DB
Persistence Service
DB
Persistence Service
DB
Persistence Service
DB
Persistence Service
24.08.14 7
The Micro Services Way...
GUI
Service
DB
GUI
Service
DB
GUI
Service
DB
GUI
Service
DB
24.08.14 8
Shop Example
Micro Services
24.08.14 10
Micro Services Principles 1/2
Small with a single responsibility
• Each application only does one thing
• Small enough to fit in your head
– “If a service is bigger than your head, than it is too big”
• Small enough that you can throw them away
– Rewrite or Maintain
by James Lewis:
24.08.14 11
Micro Services Principles 2/2
by James Lewis:
Located in different VCS roots
• Each application is completely seperate
• Domain Driven Design / Conway’s law
– Domains in different bounded contexts shoud be distinct - and it is ok to have
duplication
– Use physical separation to enforce this
• There will be common code, but it should be library and infrastructure code
– Treat it as you would any other open source library
– Stick it in a nexus repo somewhere and treat it as a binary dependency
24.08.14 12
Implementation
No application servers
●
Every service runs in it's own process
●
Every service brings it's own environment
Choose the right stack for the requirements
●
1 monolyth 1 stack, 100 Micro Services flexibility→ →
●
Free choice of: OS, language, framework, database, ..
●
But: Be careful!
New feature, new service?
●
At first check, if a feature should build a new functional module
●
Only in the second step extend an existing service
●
Rule: Merging services is easy, splitting is hard!
24.08.14 13
Java Frameworks
●
Spring Boot
●
Dropwizard
●
Vert.x
24.08.14 14
Database
Design goal:
Every service should have it's own exclusive database
Strategies
●
NoSQL / document oriented design
●
Treat foreign keys as REST URI references
●
When a service needs external data: Call a service
●
Don't fear data redundancy
●
Replication of data: Pulling feeds with changelogs
Tradeoff solutions
●
Multiple schemas within the same database
●
Read-only views for data of other services
●
Use DB features for replication (e.g. database link)
24.08.14 15
UI
Design goal:
Services should provide their UI themselves
Strategies
●
Every service serves the full page, including layout and menu bar
●
Commitment on one CSS naming schema
●
Central asset service (menu, styles, common resources)
●
Single page apps only within one service
●
GUI composition only on the client (in the browser)
●
Use UI fragments / widgets when embedding data of another service
24.08.14 16
Security
Problem: The security context is spread over 100 services
Solution: Identity Management System
●
Identity Management is also a service module (or even multiple)
●
Service for management of identities
●
Service for login/logout
●
Service for self administration
●
OAuth2 allows distribution of the login to different services
24.08.14 17
Login implementations
Variant a: Shared Cookie
●
All services are available under the same domain
●
The login service creates a cookie available to all others
●
Username, timestamp, rolles/permissions
●
Crypted and signed
●
All services can verify the cookie by checking the signature
Variant b: Independent Applications
●
Every service maintains it's own session
●
Login is done by OAuth2
●
Double redirect
●
Token exchange
●
The login service maintains a sessions as well
●
Multiple logins are done transparent to the user
24.08.14 18
OSIAM
https://github.com/osiam/
24.08.14 19
Communication
Everything is allowed
But: You should establish one standard for your platform.
Principles
●
Loose coupling – services should not know about each other
●
Smart endpoints, dump pipes
●
No intelligence in the communication channel
●
No ESB
REST is a good choice for many scenarios
●
Easy consumable with all languages
●
Interfaces are maintainable towards compatibility
●
URI references are helpful for navigation to different services and
abstraction of the physical location of resources.
24.08.14 20
Communication– further principles
Asynchronous Messaging
●
Reliable event distribution
●
High performance
●
Load protection of critical services
Resilience
●
Tolerance against failures
●
Error recovery
●
Avoid error cascades
API Versioning
●
Don't do it for internal APIs!
24.08.14 21
Testing
Unit Tests
●
Integration tests suffice in many cases because the services are small
●
Test the isolated service (Other services should be mocked)
Consumer Driven Tests
Idea: The integration tests of a service will be defined and implemented by the
consumer (not by the service provider).
No release before the service passes all consumer's tests
●
Test with the real expectations, not with the service specification
●
Very smart concept, but hard to maintain
●
Has the risk of high test-redundancy for common APIs
24.08.14 22
Deployment
Contiuous Delivery
●
Create a deployment pipeline
●
Need to automate everything
One monolyth may be easy to deploy, 100 Micro Services may not!
Packaging & Provisioning
●
Usage of established standards: DEB, RPM, …
●
Robust init scripts
●
Configuration management: Puppet, Chef, ...
24.08.14 23
Deployment as platform
1 Micro Service : 1 Linux System
Docker
●
LXC based virtualisation
●
Similar to changeroot (but a lot better!)
●
Slim and fast
●
Based on git, so changes of the images can be tracked
For Hardliners
●
Install the Micro Service by shipping and starting the system image
●
No packaging
●
No init scripts
24.08.14 24
Monitoring
Realtime metrics
●
Monitor, what currently happens
●
Fast reaction to problems
●
Do monitoring inside the application, not outside
●
Tools: Metrics, Spring Boot Actuator
Logging
●
Manual search in logs of 100 services is not possible
●
Central log aggregation
●
Filtering and analyses in realtime
●
Tools: Logstash, Graylog2, Kibana, Apache Flume, fluentd
24.08.14 25
Risks
Micro Services are a promising paradigm
But, you should always be careful with new paradigms!
●
Inventarisation of many services
●
Challenging for operations
●
High network load (if not done right)
●
New way of thinking
●
The freedom of technology selection may lead to chaos,
if it is no governance
Thank You!

More Related Content

PPTX
Understanding Azure Disaster Recovery
PPTX
Introduction To Microservices
ODP
Openshift Container Platform
PPTX
Comparison of Cloud Providers
PDF
Kubernetes From Scratch .pdf
PPTX
App Modernization Pitch Deck.pptx
PDF
Kubernetes Networking - Sreenivas Makam - Google - CC18
PDF
Building .NET Microservices
Understanding Azure Disaster Recovery
Introduction To Microservices
Openshift Container Platform
Comparison of Cloud Providers
Kubernetes From Scratch .pdf
App Modernization Pitch Deck.pptx
Kubernetes Networking - Sreenivas Makam - Google - CC18
Building .NET Microservices

What's hot (20)

PDF
Hands-On Introduction to Kubernetes at LISA17
PPTX
Azure migration
PDF
Microservices Design Patterns
PPTX
Azure Service Bus
PDF
Microsoft Azure Overview
PDF
Understanding Azure Networking Services
PPSX
On-premise to Microsoft Azure Cloud Migration.
PPTX
Jenkins CI presentation
PPTX
Azure AKS
PDF
Azure 101
PDF
The Layman's Guide to Microsoft Azure
PDF
IaC on AWS Cloud
PPTX
Jenkins tutorial
PPTX
Azure integration services from the IT Professional perspective
PPTX
Azure DevOps CI/CD For Beginners
PDF
Azure Container Apps
PPTX
Azure DevOps Best Practices Webinar
PPTX
The Microservices world in. NET Core and. NET framework
PPTX
The Power of Azure DevOps
PPTX
Introduction to Microsoft Azure
Hands-On Introduction to Kubernetes at LISA17
Azure migration
Microservices Design Patterns
Azure Service Bus
Microsoft Azure Overview
Understanding Azure Networking Services
On-premise to Microsoft Azure Cloud Migration.
Jenkins CI presentation
Azure AKS
Azure 101
The Layman's Guide to Microsoft Azure
IaC on AWS Cloud
Jenkins tutorial
Azure integration services from the IT Professional perspective
Azure DevOps CI/CD For Beginners
Azure Container Apps
Azure DevOps Best Practices Webinar
The Microservices world in. NET Core and. NET framework
The Power of Azure DevOps
Introduction to Microsoft Azure
Ad

Viewers also liked (20)

PDF
Design Patterns in Micro-services architectures & Gilmour
PDF
Micro-services Battle Scars
PPTX
An Unexpected Solution to Microservices UI Composition
PPTX
From SOA to MSA
PPTX
Micro Service Architecture
PDF
Developing applications with a microservice architecture (SVforum, microservi...
PDF
You Call that Micro, Mr. Docker? How OSv and Unikernels Help Micro-services S...
PDF
Micro Services - Neither Micro Nor Service
PPTX
Towards Realizing Dynamic QoS-aware Web Service Composition
PDF
BBVA Arquitectura - Demo DevOps
PDF
Continuous Delivery and Micro Services - A Symbiosis
PDF
Microservices 101 - The Big Why?
PPTX
Containers #101 Meetup: Building a micro-service using Node.js and Docker - P...
PPTX
A High-Performance Solution to Microservice UI Composition @ XConf Hamburg
PPTX
Micro Services Architecture
PPTX
A High-Performance Solution To Microservices UI Composition
PDF
Micro Services - Smaller is Better?
PDF
MicroServices, yet another architectural style?
PPTX
Global Big Data Conference Sept 2014 AWS Kinesis Spark Streaming Approximatio...
PDF
Deep-dive into Microservice Outer Architecture
Design Patterns in Micro-services architectures & Gilmour
Micro-services Battle Scars
An Unexpected Solution to Microservices UI Composition
From SOA to MSA
Micro Service Architecture
Developing applications with a microservice architecture (SVforum, microservi...
You Call that Micro, Mr. Docker? How OSv and Unikernels Help Micro-services S...
Micro Services - Neither Micro Nor Service
Towards Realizing Dynamic QoS-aware Web Service Composition
BBVA Arquitectura - Demo DevOps
Continuous Delivery and Micro Services - A Symbiosis
Microservices 101 - The Big Why?
Containers #101 Meetup: Building a micro-service using Node.js and Docker - P...
A High-Performance Solution to Microservice UI Composition @ XConf Hamburg
Micro Services Architecture
A High-Performance Solution To Microservices UI Composition
Micro Services - Smaller is Better?
MicroServices, yet another architectural style?
Global Big Data Conference Sept 2014 AWS Kinesis Spark Streaming Approximatio...
Deep-dive into Microservice Outer Architecture
Ad

Similar to micro services architecture (FrosCon2014) (20)

PDF
Microservice architecture
PPTX
Montreal MuleSoft_Meetup_16-Aug.pptx
PPTX
Warsaw MuleSoft Meetup #13.pptx
PDF
The journey to Native Cloud Architecture & Microservices, tracing the footste...
PDF
Microservices
PPTX
Design Like a Pro: Planning Enterprise Solutions
PPTX
Design Like a Pro: Planning Enterprise Solutions
PDF
Moving from Monolith to Microservices
PDF
MuleSoft Manchester Meetup #4 slides 11th February 2021
PPTX
Microservices: Yes or not?
PPTX
Yotpo microservices
PDF
Montreal Kubernetes Meetup: Developer-first workflows (for microservices) on ...
PDF
Microservices Architecture
PDF
Kenzan: Architecting for Microservices
PDF
API Microservices with Node.js and Docker
PPTX
Introduction to CloudHub 2.0
PPTX
10 Steps to Architecting a Sustainable SCADA System
PPTX
10 Steps to Architecting a Sustainable SCADA System
PDF
Devops - Microservice and Kubernetes
PDF
LinuxTag 2013
Microservice architecture
Montreal MuleSoft_Meetup_16-Aug.pptx
Warsaw MuleSoft Meetup #13.pptx
The journey to Native Cloud Architecture & Microservices, tracing the footste...
Microservices
Design Like a Pro: Planning Enterprise Solutions
Design Like a Pro: Planning Enterprise Solutions
Moving from Monolith to Microservices
MuleSoft Manchester Meetup #4 slides 11th February 2021
Microservices: Yes or not?
Yotpo microservices
Montreal Kubernetes Meetup: Developer-first workflows (for microservices) on ...
Microservices Architecture
Kenzan: Architecting for Microservices
API Microservices with Node.js and Docker
Introduction to CloudHub 2.0
10 Steps to Architecting a Sustainable SCADA System
10 Steps to Architecting a Sustainable SCADA System
Devops - Microservice and Kubernetes
LinuxTag 2013

More from smancke (6)

PPTX
micro services
ODP
crowdgovernance, laterale it governance mit agilen teams
ODP
mobile development platforms
ODP
Jalimo Slides Linuxtag2008
ODP
Jalimo Slides Linuxtag2007 (English)
ODP
Jalimo Slides Linuxtag2007
micro services
crowdgovernance, laterale it governance mit agilen teams
mobile development platforms
Jalimo Slides Linuxtag2008
Jalimo Slides Linuxtag2007 (English)
Jalimo Slides Linuxtag2007

micro services architecture (FrosCon2014)

  • 2. 24.08.14 2 Monolythic Software Why are monolythic systems 'evil' ? Because of their dependencies: ● Software is not easy to test ● And hard to refactor ● Effects of changes can not be isolated ● Working with multiple developers/teams is challenging ● No reuse of functionality ● Runtime and deployment dependencies: ● Performance and scaling ● Deployment of features and releases
  • 3. 24.08.14 3 Avoid a Monolyth Monolyths arise from bad design, independent of the technology! ● You can build a monolyth with every software framework. ● Even distributed systems with a lot of services can be monolythic. ● And even software with monolythic builds and deployments may have a good internal structure. So, chosing a popular micro services framework is not enough!
  • 4. 24.08.14 4 Think Vertical! Split the application in functional modules Maximal reduction of dependencies between different functional parts Vertical teams (End-to-End)
  • 5. 24.08.14 5 Classical Approach GUI -Layer Services Database/Persistance
  • 6. 24.08.14 6 SOA Approach GUI -Layer Business Service DB Business Service Business Service Persistence Service DB Persistence Service DB Persistence Service DB Persistence Service DB Persistence Service
  • 7. 24.08.14 7 The Micro Services Way... GUI Service DB GUI Service DB GUI Service DB GUI Service DB
  • 10. 24.08.14 10 Micro Services Principles 1/2 Small with a single responsibility • Each application only does one thing • Small enough to fit in your head – “If a service is bigger than your head, than it is too big” • Small enough that you can throw them away – Rewrite or Maintain by James Lewis:
  • 11. 24.08.14 11 Micro Services Principles 2/2 by James Lewis: Located in different VCS roots • Each application is completely seperate • Domain Driven Design / Conway’s law – Domains in different bounded contexts shoud be distinct - and it is ok to have duplication – Use physical separation to enforce this • There will be common code, but it should be library and infrastructure code – Treat it as you would any other open source library – Stick it in a nexus repo somewhere and treat it as a binary dependency
  • 12. 24.08.14 12 Implementation No application servers ● Every service runs in it's own process ● Every service brings it's own environment Choose the right stack for the requirements ● 1 monolyth 1 stack, 100 Micro Services flexibility→ → ● Free choice of: OS, language, framework, database, .. ● But: Be careful! New feature, new service? ● At first check, if a feature should build a new functional module ● Only in the second step extend an existing service ● Rule: Merging services is easy, splitting is hard!
  • 13. 24.08.14 13 Java Frameworks ● Spring Boot ● Dropwizard ● Vert.x
  • 14. 24.08.14 14 Database Design goal: Every service should have it's own exclusive database Strategies ● NoSQL / document oriented design ● Treat foreign keys as REST URI references ● When a service needs external data: Call a service ● Don't fear data redundancy ● Replication of data: Pulling feeds with changelogs Tradeoff solutions ● Multiple schemas within the same database ● Read-only views for data of other services ● Use DB features for replication (e.g. database link)
  • 15. 24.08.14 15 UI Design goal: Services should provide their UI themselves Strategies ● Every service serves the full page, including layout and menu bar ● Commitment on one CSS naming schema ● Central asset service (menu, styles, common resources) ● Single page apps only within one service ● GUI composition only on the client (in the browser) ● Use UI fragments / widgets when embedding data of another service
  • 16. 24.08.14 16 Security Problem: The security context is spread over 100 services Solution: Identity Management System ● Identity Management is also a service module (or even multiple) ● Service for management of identities ● Service for login/logout ● Service for self administration ● OAuth2 allows distribution of the login to different services
  • 17. 24.08.14 17 Login implementations Variant a: Shared Cookie ● All services are available under the same domain ● The login service creates a cookie available to all others ● Username, timestamp, rolles/permissions ● Crypted and signed ● All services can verify the cookie by checking the signature Variant b: Independent Applications ● Every service maintains it's own session ● Login is done by OAuth2 ● Double redirect ● Token exchange ● The login service maintains a sessions as well ● Multiple logins are done transparent to the user
  • 19. 24.08.14 19 Communication Everything is allowed But: You should establish one standard for your platform. Principles ● Loose coupling – services should not know about each other ● Smart endpoints, dump pipes ● No intelligence in the communication channel ● No ESB REST is a good choice for many scenarios ● Easy consumable with all languages ● Interfaces are maintainable towards compatibility ● URI references are helpful for navigation to different services and abstraction of the physical location of resources.
  • 20. 24.08.14 20 Communication– further principles Asynchronous Messaging ● Reliable event distribution ● High performance ● Load protection of critical services Resilience ● Tolerance against failures ● Error recovery ● Avoid error cascades API Versioning ● Don't do it for internal APIs!
  • 21. 24.08.14 21 Testing Unit Tests ● Integration tests suffice in many cases because the services are small ● Test the isolated service (Other services should be mocked) Consumer Driven Tests Idea: The integration tests of a service will be defined and implemented by the consumer (not by the service provider). No release before the service passes all consumer's tests ● Test with the real expectations, not with the service specification ● Very smart concept, but hard to maintain ● Has the risk of high test-redundancy for common APIs
  • 22. 24.08.14 22 Deployment Contiuous Delivery ● Create a deployment pipeline ● Need to automate everything One monolyth may be easy to deploy, 100 Micro Services may not! Packaging & Provisioning ● Usage of established standards: DEB, RPM, … ● Robust init scripts ● Configuration management: Puppet, Chef, ...
  • 23. 24.08.14 23 Deployment as platform 1 Micro Service : 1 Linux System Docker ● LXC based virtualisation ● Similar to changeroot (but a lot better!) ● Slim and fast ● Based on git, so changes of the images can be tracked For Hardliners ● Install the Micro Service by shipping and starting the system image ● No packaging ● No init scripts
  • 24. 24.08.14 24 Monitoring Realtime metrics ● Monitor, what currently happens ● Fast reaction to problems ● Do monitoring inside the application, not outside ● Tools: Metrics, Spring Boot Actuator Logging ● Manual search in logs of 100 services is not possible ● Central log aggregation ● Filtering and analyses in realtime ● Tools: Logstash, Graylog2, Kibana, Apache Flume, fluentd
  • 25. 24.08.14 25 Risks Micro Services are a promising paradigm But, you should always be careful with new paradigms! ● Inventarisation of many services ● Challenging for operations ● High network load (if not done right) ● New way of thinking ● The freedom of technology selection may lead to chaos, if it is no governance