SlideShare a Scribd company logo
Microservices
Lucian Neghina
Big Data & Cloud Computing
by Developer for Developers
Before Microservices
Traditional SOA
Looser coupling
Elements must be
coordinated each other
Monolithic
Tight coupling
All elements must agree on
each change
Microservice
Decoupled
Elements can be changed
or added without prior
coordination with others
Microservice benefits
Autonomy
Autonomous team
with isolated
implementation
Speed of change
Build and deploy
small independent
services
Scale
Functional and
Team Scaling
Tech Diversity
Allows try-out of
new technologies
Intelligible
Lower cognitive
load
Microservices
the main characteristics
Scalability & High-availability
Organized around business capabilities
UI
Server
DBA
Shipping
Orders
Catalog
Decentralized Data Management
Disadvantages
of distributed computing
● Latency
● Partial failure
● Infrastructure
Designing
Microservices
● Size
Single Responsibility Principle
● Scope
Agile / Independent development
and deployment
● Capabilities
Bounded Context in
Domain-Driven-Design
Microservices Architecture
Communication
Interaction Styles
Synchronous
Asynchronous
Request / Response --
Notification Publish / Subscribe
Request / Async response Publish / Async response
One-to-One One-to-Many
Point-to-point style
Inventory microserviceREST API
Accounting microserviceREST API
Checkout microserviceREST API
Consumer
Store microserviceREST API
Api-Gateway style
Inventory microserviceREST API
Accounting microserviceREST API
Checkout microserviceREST API
Consumer
Store microserviceREST API
API Gateway
Message-Broker style
Inventory microservice
Accounting microservice
Checkout microservice
Store microservice
Consumer
publisher
subscriber
publisher
publisher
subscriber
subscriber
Service Discovery
Server-side and Client-side
Why use
Service Discovery
● Dynamically network location
● Autoscaling
● Failures
● Upgrades
Server-Side Discovery
Inventory microservice
Instance 1
REST API
Registry
Client
Inventory microservice
Instance 2
REST API
Inventory microservice
Instance 3
REST API
Inventory stack
Service
Registry
Registry
Client
Registry
Client
Register
Consumer
Service
Request
Router
Request
Discover
service
Service
location
Client-Side Discovery
Inventory microservice
Instance 1
REST API
Registry
Client
Inventory microservice
Instance 2
REST API
Inventory microservice
Instance 3
REST API
Inventory stack
Service
Registry
Registry
Client
Registry
Client
Discover
service
Register
Consumer
Service
Request
Service
location
Fault-Tolerance
Distributed Systems
Circuit Breaker
Hystrix Fallback
Event-Driven
data management
Problem of Distributed Data
Checkout Context
Order
Accounting Context
Custommer
id customer_id satus total id credit ...
CUSTOMERORDER
Event-Driven Architecture
Checkout Context
Order
Accounting Context
id customer_id satus total
909 101 OPEN 1234
id credit ...
202 5000
Place Order
Order
Create event
Order
Create event
Message
Broker
Credit
Reserved
Credit
Reserved
Custommer
CUSTOMER
ORDER
cust_id order_id amount
202 909 1234
RESERVED_CREDIT
Security
Patterns and Best Practices
Security Model
Availability is guarantee of reliable access to
the information by authorized people.
Integrity is the assurance that the
information is trustworthy and accurate.
Confidentiality is set of rules that limits
access to information.
API Gateway / Perimeter security
● Requests are authenticated and authorized by the gateway
● The public LB cannot send request to apps directly
● Apps trust all traffic they receive by assumption
Pros
● Network setup can virtually guarantee assumptions
● Apps have stateless security
Cons
● Does noting for internal threats
Basic + Central Auth DB
● All apps get to do authentication and authorization themselves
● Credentials are verified against a central DB
● Basic credentials are passed along in every request
Pros
● Stateless - authenticate every time
● Central user store
Cons
● Auth DB is hit every request
● DB lookup logic needs to be implemented everywhere
● User’s credentials can unlock all functionality
Sessions everywhere
● Same as before but each app gets to maintain a session with the client device
Pros
● Auth DB is hit once per session
Cons
● Hard to manage all the sessions
● No single sign on
● DB lookup logic needs to be implemented everywhere
● User’s credentials can unlock all functionality
API Tokens
● Username and password is exchanged for a token at a centralized auth server
● Apps validate the token for each request by hitting the auth server
Pros
● App don’t see user credentials
Cons
● Auth server bottleneck
● Token provides all or nothing access
Microservices
Security Concerns
● Central user store bottleneck
● Single Sign On
● Statelessness
● User credentials
● Fine grained authorization
● Interoperability with non browser
OAuth2 and OpenID Connect
Inventory microserviceREST API
Accounting microserviceREST API
Checkout microserviceREST API
Consumer
Store microserviceREST API
API Gateway
Authorization
Server
User Store
JWT processing at each
microservice
Access Token
Access Token JWT
JWT
Testing
Strategies
Testing Pyramid
End-to-End
Tests
Contract Tests
Component Tests
Integration Tests
Unit Tests
TimeRequiredtoExecute
NumberofTests
FrequencyofExecution
Verisimilitude
Unit Testing
Make sure that the each component
behave as expect.
● Domain
● Gateways
● Resources
● Persistence
Integration Testing
Verifying the communications and
interactions between components
● Persistence
● Gateways
Component Testing
Testing the service in isolation
● In Memory DB
● Stub HTTP Client
● Simulate external service
Contract Testing
Verifying the agreements between
producer and consumers services
● Input & Output data structure
● Calls attributes
End-to-End Testing
Testing the behaviour of the
entire system
● Business flow
● Proxies
● Load Balancers
Deployment
Strategy
Multiple Service Instances per Host
Pros
● Efficient resource utilization
● Fast deployment
Cons
● Poor isolation
● Difficult to limit resource utilization
● Risk to dependency version
conflicts
● Poor encapsulation of
implementation technology
Service Instance per Virtual Machine
Pros
● Great isolation
● Great manageability
● VM encapsulates implementation
technology
Cons
● Less efficient resource utilization
● Slow deployment
Service Instance per Container
Pros
● Great isolation
● Great manageability
● Container encapsulates
implementation technology
● Efficient resource utilization
● Fast deployment
Cons
● Immature infrastructure for
deploying containers
Deployment
Patterns
Rolling Update
Instance 1
V1
Instance 2
V1
Instance 3
V1
Old Group New Group
Router
Rolling Update
Instance 1
V1
Instance 2
V1
Instance 3
V1
Old Group
Instance 1
V2
New Group
Router
Rolling Update
Instance 1
V1
Instance 2
V1
Instance 3
V1
Old Group
Instance 1
V2
New Group
Router
Rolling Update
Instance 2
V1
Instance 3
V1
Old Group
Instance 1
V2
Instance 2
V2
New Group
Router
Rolling Update
Instance 3
V1
Old Group
Instance 1
V2
Instance 2
V2
Instance 3
V2
New Group
Router
Rolling Update
Old Group
Instance 1
V2
Instance 2
V2
Instance 3
V2
New Group
Router
Canary Release
Old Version
Instance 1
V2
Instance 2
V2
Instance 3
V2
New Version
Instance 1
V1
Instance 2
V1
Instance 3
V1
All users - 100% 0%
Router
Canary Release
Old Version
Instance 1
V2
Instance 2
V2
Instance 3
V2
New Version
Instance 1
V1
Instance 2
V1
Instance 3
V1
Most users - 95% Some users - 5%
Router
Canary Release
Old Version
Instance 1
V2
Instance 2
V2
Instance 3
V2
New Version
Instance 1
V1
Instance 2
V1
Instance 3
V1
0% All users - 100%
Router
Blue-Green
Old Group
Instance 1
V1
Instance 2
V1
Instance 3
V1
DNS
service-1.domain.com
Router
Blue-Green
Old Group
Instance 1
V2
Instance 2
V2
Instance 3
V2
New Group
Instance 1
V1
Instance 2
V1
Instance 3
V1
DNS
service-1.domain.com
Router Router
Blue-Green
Old Group
Instance 1
V2
Instance 2
V2
Instance 3
V2
New Group
Instance 1
V1
Instance 2
V1
Instance 3
V1
DNS
service-1.domain.com
Router Router
Monitoring
Microservices
What to monitor?
● Hosts
CPU, Memory, I/O, Network, File system
● Containers
CPU, Memory, I/O, Restarts, Bottleneck
● Applications
Latency, Traffic, Errors
Metrics & Alerts
Service
Instance
JMX
Prometheus
Metrics database
Container
Docker Engine
Service
Instance
JMX
Container
Grafana
Visualize metrics
cAdvisor
Collect
Containers metrics
VM
Node
Exporter
Collect
OS metrics
Scrape metrics AlertManager
Send notifications
Email
Slack
Pushover
Query
Push
Logging & Tracing

More Related Content

PPTX
Accelerate DevOps/Microservices and Kubernetes
PDF
Accelerate Delivery: Business Case for Agile DevOps, CI/CD and Microservices
PDF
[WSO2Con EU 2017] Writing Microservices Using MSF4J
PPT
Complex End-to-End Testing
PDF
Microservices Architecture
PDF
[WSO2Con EU 2017] How a Large Organization Weighted on a WSO2 Integration Pla...
PDF
Java Middleware Surgery
PDF
MQTT and Apache Kafka: The Solution to Poor Internet Connectivity in Africa (...
Accelerate DevOps/Microservices and Kubernetes
Accelerate Delivery: Business Case for Agile DevOps, CI/CD and Microservices
[WSO2Con EU 2017] Writing Microservices Using MSF4J
Complex End-to-End Testing
Microservices Architecture
[WSO2Con EU 2017] How a Large Organization Weighted on a WSO2 Integration Pla...
Java Middleware Surgery
MQTT and Apache Kafka: The Solution to Poor Internet Connectivity in Africa (...

What's hot (20)

PDF
A Year of “Testing” the Cloud for Development and Test
PDF
Co je nového v XenDesktop 7.6 a XenApp 7.6
PDF
Microservices architecture
PDF
Testing the Migration of Monolithic Applications to Microservices on the Cloud
PPTX
Oracle SOA Suite Performance Tuning- UKOUG Application Server & Middleware SI...
PPTX
VMworld 2015: The Best SDDC!
PPT
Health monitoring and alerting for xen app, xendesktop and netscaler
PPTX
Windows Accelerate IT Pro Bootcamp: App-V (Module 6 of 8)
PPTX
Kaseya Connect 2012 - THE ABC'S OF MONITORING
PPTX
Pivotal Cloud Foundry + NSX
PDF
Applying a Comprehensive, Automated Assurance Framework to Validate Cloud Rea...
PPTX
VMworld 2015: Monitoring and Managing Applications with vRealize Operations 6...
PPTX
VMware Horizon Customer Presentation EN
PPTX
Microservices with Spring
PDF
Event-Driven Microservices With NATS Streaming
PDF
Citrix Day 2014: XenApp / XenDesktop 7.6
PDF
KACE Endpoint Systems Management Appliances - What’s New for 2017
PPTX
Applications Performance Monitoring with Applications Manager part 1
PPTX
VMworld 2015: Take Virtualization to the Next Level vSphere with Operations M...
PPTX
VMware Log Insight
A Year of “Testing” the Cloud for Development and Test
Co je nového v XenDesktop 7.6 a XenApp 7.6
Microservices architecture
Testing the Migration of Monolithic Applications to Microservices on the Cloud
Oracle SOA Suite Performance Tuning- UKOUG Application Server & Middleware SI...
VMworld 2015: The Best SDDC!
Health monitoring and alerting for xen app, xendesktop and netscaler
Windows Accelerate IT Pro Bootcamp: App-V (Module 6 of 8)
Kaseya Connect 2012 - THE ABC'S OF MONITORING
Pivotal Cloud Foundry + NSX
Applying a Comprehensive, Automated Assurance Framework to Validate Cloud Rea...
VMworld 2015: Monitoring and Managing Applications with vRealize Operations 6...
VMware Horizon Customer Presentation EN
Microservices with Spring
Event-Driven Microservices With NATS Streaming
Citrix Day 2014: XenApp / XenDesktop 7.6
KACE Endpoint Systems Management Appliances - What’s New for 2017
Applications Performance Monitoring with Applications Manager part 1
VMworld 2015: Take Virtualization to the Next Level vSphere with Operations M...
VMware Log Insight
Ad

Similar to Microservices Architecture (20)

PPTX
QConSF-MicroServices-IPC-Netflix-Sudhir-2014.pptx
PDF
#ATAGTR2020 Presentation - Microservices – Explored
PPTX
.Net Microservices with Event Sourcing, CQRS, Docker and... Windows Server 20...
PDF
Microservices - Hitchhiker's guide to cloud native applications
PDF
Modern Software Architecture - Cloud Scale Computing
PPTX
Microservices-101
PDF
#JaxLondon keynote: Developing applications with a microservice architecture
PDF
Developing Applications with a Micro Service Architecture - Chris Richardson
PDF
Xebia Knowledge Exchange (jan 2011) - Trends in Enterprise Applications Archi...
PDF
Everything you want to know about microservices
PPTX
Microservices architecture
PDF
Microservices Interview Questions and Answers PDF By ScholarHat
PPTX
Microservices session 1
PPTX
Microservice intro
PPTX
Ledingkart Meetup #1: Monolithic to microservices in action
PDF
Developing applications with a microservice architecture (svcc)
PDF
Microservices for Application Modernisation
PDF
Microservice Architecture
PDF
Microservices: Decomposing Applications for Deployability and Scalability (ja...
PDF
Developing applications with a microservice architecture (SVforum, microservi...
QConSF-MicroServices-IPC-Netflix-Sudhir-2014.pptx
#ATAGTR2020 Presentation - Microservices – Explored
.Net Microservices with Event Sourcing, CQRS, Docker and... Windows Server 20...
Microservices - Hitchhiker's guide to cloud native applications
Modern Software Architecture - Cloud Scale Computing
Microservices-101
#JaxLondon keynote: Developing applications with a microservice architecture
Developing Applications with a Micro Service Architecture - Chris Richardson
Xebia Knowledge Exchange (jan 2011) - Trends in Enterprise Applications Archi...
Everything you want to know about microservices
Microservices architecture
Microservices Interview Questions and Answers PDF By ScholarHat
Microservices session 1
Microservice intro
Ledingkart Meetup #1: Monolithic to microservices in action
Developing applications with a microservice architecture (svcc)
Microservices for Application Modernisation
Microservice Architecture
Microservices: Decomposing Applications for Deployability and Scalability (ja...
Developing applications with a microservice architecture (SVforum, microservi...
Ad

Recently uploaded (20)

PPT
Teaching material agriculture food technology
PPTX
Big Data Technologies - Introduction.pptx
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Machine learning based COVID-19 study performance prediction
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPTX
Spectroscopy.pptx food analysis technology
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Encapsulation_ Review paper, used for researhc scholars
Teaching material agriculture food technology
Big Data Technologies - Introduction.pptx
Diabetes mellitus diagnosis method based random forest with bat algorithm
Per capita expenditure prediction using model stacking based on satellite ima...
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Machine learning based COVID-19 study performance prediction
Dropbox Q2 2025 Financial Results & Investor Presentation
MYSQL Presentation for SQL database connectivity
Mobile App Security Testing_ A Comprehensive Guide.pdf
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Digital-Transformation-Roadmap-for-Companies.pptx
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Programs and apps: productivity, graphics, security and other tools
Building Integrated photovoltaic BIPV_UPV.pdf
Spectroscopy.pptx food analysis technology
The Rise and Fall of 3GPP – Time for a Sabbatical?
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Encapsulation_ Review paper, used for researhc scholars

Microservices Architecture