SlideShare a Scribd company logo
DEVNET-1184	Microservices Patterns
Microservices Patterns
Jim Bugwadia, Nirmata
DEVNET-1184
About me
• Founder and CEO at Nirmata
• Software Developer (C++, Java, Javascript, Go)
• Large-scale distributed systems
• Why Microservices
• Microservices defined
• Architecture & Design Patterns
• Summary
Agenda
Businesses are adopting Microservices for agility at scale
20% of enterprises will adopt Microservices by 2016” -- Gartner
A Microservices style application is composed of several cooperating
services, each of which is versioned and deployed individually.
Monolith
ms
msms
ms
Microservices  Agility
• The Art of Scalability
AKF Scale Cube
Microservices  Scale
Client Load Balancer Application
Application
Application
X-Axis Scaling
scale by replicating the entire application
Client Load Balancer Orders
Catalog
Customers
Y-Axis Scaling
scale by splitting the application into components /catalog
/orders
/customers
Client Load Balancer
Z-Axis Scaling
scale by splitting the data /catalog[a-i]
/catalog[j-r]
/catalog[s-z]
Catalog
Catalog
Catalog
Client Load Balancer
Microservices combine
X-Y axis scaling
Orders
Catalog
Customers
/catalog
/orders
/customers
scale by splitting the application into services,
and replicating each service
Client Load Balancer Orders
Catalog
Customers
/catalog
/orders
/customers
scale by splitting the application into services,
and replicating each service
Best scalability
Best resiliency
Best efficiency
Microservices combine
X-Y axis scaling
Microservices Defined
1. Elastic: scales up or down independently of other services
2. Resilient: services provide fault isolation boundaries
3. Composable: uniform APIs for each service
4. Minimal: highly cohesive set of entities
5. Complete: loosely coupled with other services
A Microservices application is composed of multiple cooperating services.
Each Service is:
Microservices Architecture &
Design Patterns
The Monolith Pattern
• Tiered approach
• Modules within each tier are
compiled and integrated
• Easier to build and manage
• Long test cycles for any change
• All-or-nothing deploys
Client
Load Balancer
Application
Database
WebUI
Orders Catalog Customers
Reviews Cart Payments
… … …
The Microservices Pattern
• Multiple services with Uniform APIs
• Services can be build, tested, and
deployed separately
• Enables rapid experimentation on
smaller components
• Can have:
• Polyglot languages
• Polyglot data stores
Client
Load Balancer
Gateway
Gateway
Customers
ReviewsPayments
Cart
WebUI
Catalog
Orders
Microservices: Inner and Outer Architecture
• Microservices are meant to be simple
• Complexity gets pushed outside the Microservice
• A platform built for Microservices must absorb this
complexity
That [the complexity you removed from your services to simplify them ]
complexity has moved and, I would argue, increased. It now lives in what I
call the ”outer architecture”. -- Gary Olliffe , Research Director at Gartner
Service Naming, Registration & Discovery
• Each Service has a well known name
• Each Service Instance dynamically
registers its availability
• Clients can resolve a well known
Service name to the location of an
available Service Instance
connect with me at:
orders.shopping.com
192.168.50.11:9762
192.168.10.7:80808
192.168.3.12:42132192.168.100.23:9065
192.168.100.23:9065
e.g. Netflix OSS, Nirmata Service Networking
Service Gateway Pattern
• An entry point for the application
• A single client connection is
multiplexed across backend
services and service instances
• Routes requests based on
content (e.g. URL Path)
• An application can have multiple
gateways
Gateway
Gateway
CustomersWebUI
Catalog
http://shop.io
Load Balancer
/ui
/catalog
/customers
e.g. Zuul, Hipache, Nirmata Gateway Service
Mid-tier Load Balancing
• Services in an application need to
communicate
• Each Service is elastic and
resilient
• Scale-out dynamic load balancing
is required
• Client-based LB
• Host-based
• External service
e.g. Zuul, Nirmata Dynamic Proxy
Gateway
Gateway
CustomersCatalog
http://shop.io
Load Balancer
/catalog
/customers
LB
Distributed Locks
• Coordinate operations across several
Service Instances
• DB level locks are not enough
• Implementations should provide
Mutex, Semaphore, RWLock
semantics
e.g. Curator / Zookeeper
Lock Service
Server Server Server
Catalog Catalog
Lock /catalog/item/12a91kl
Lock /catalog/item/09a9ab
Unlock /catalog/item/09a9ab
…..
Lock /catalog/item/ij98108
Unlock /catalog/item/ij98108
…..
Shared Work Queue
Leader Election
• Select one service instance to perform
a task
• Good for lightweight scheduling of
periodic tasks
• Use different leaders for different
functions
• Run elections periodically
• Nodes can join election at any point
• If leader node goes away, a new
leader is elected
e.g. Curator / Zookeeper
Leader Elector
Server Server Server
Catalog Catalog
-> Elect /catalog/purge-> Elect /catalog/purge
<- Take Leadership
Distributed Workflows
• Coordinate execution of a set of tasks
across services instances
• Each task may be executed by a different
services
• Tasks may execute in parallel, and may
have inter-dependencies
Workflow Service
Server Server Server
e.g. AWS SWS, NirmataOSS Workflow
Catalog Catalog
Summary
Summary
1. Microservices enable agility at scale
2. Microservices push complexity into the platform
3. Microservices require operations tooling and
distributed programming skills
Related Sessions
Come try it live @ DevNet Cloud POD #3
DEVNET-1170 - Intercloud Microservices with Docker
and Nirmata
Thursday, Jun 11, 11:00 AM - 11:30 AM,
DevNet Theater
DEVNET-1137 - Application Centric Microservices Wednesday, Jun 10, 3:00 PM - 4:00 PM.
DevNet Theater
DEVNET-2013 - DevOps In Depth - Adrian Cockroft on
Fast Delivery
Tuesday, Jun 9, 1:45 PM - 2:30 PM,
DevNet Theater
BRKDEV-1002 - What's Hot in Containers Thursday, Jun 11, 1:00 PM - 2:30 PM,
30B Upper Level
References
• Microservices : Building Services with the Guts on the Outside, Gary Oliffe,
http://blogs.gartner.com/gary-olliffe/2015/01/30/microservices-guts-on-the-
outside/
• Migrating to Cloud Native with Microservices, Adrian Cockroft
http://www.slideshare.net/adriancockcroft/qcon-new-york-speed-and-scale
• Microservices: Decomposing Applications for Deployability and Scalability, Chris
Richardson,
http://www.infoq.com/articles/microservices-intro
• Microservices, James Lewis and Martin Fowler,
http://martinfowler.com/articles/microservices.html
• Cloud native software: Microservices, Jim Bugwadia
http://nirmata.com/2014/07/cloud-native-software-microservices/
Thank you
DEVNET-1184	Microservices Patterns
Other Interesting Patterns
• CQRS (Command Query Responsibility Segregation)
Separate model updates from views
http://martinfowler.com/bliki/CQRS.html
• Bounded Context
Keep different models independent
http://martinfowler.com/bliki/BoundedContext.html
• Event Sourcing
Use events, with playback, to manage distributed state
http://martinfowler.com/eaaDev/EventSourcing.html
Single Sync
• Each user call results in a
single synchronous call
• A user call spawns one or
more Distributed Workflows
• Workflow tasks update user
state via APIs
• Retries and failure recovery
are built-in per tasks
Client
Gateway
Service
Orders Service
Payment
Service
Message Queue
1. Place Order
2. Route Request
3. Validate
& Commit 4. Publish {new order}
5. Handle Payment
6. Publish
{payment update}
7. Update Order
Rest Cache
• Services are using REST
APIs to communicate
• Frequent fetching of data
causes latencies
• A local cache can reduce
latencies
• Async Messaging can
update the cache
Orders Service Catalog ServiceREST
Message Queue
Updates
Updates
Catalog
Cache
POST,
PUT,
DELETE

More Related Content

What's hot (20)

PDF
Service mesh in Microservice World to Manage end to end service communications
Satya Syam
 
PDF
Microservice Architecture
Rich Lee
 
PPTX
Lightweight ESB Alternatives
Chris Haddad
 
PDF
Microservices: Where do they fit within a rapidly evolving integration archit...
Kim Clark
 
PDF
Introduction to microservices Jornada Microservices
Roan Brasil Monteiro
 
PPTX
Microservice architecture design principles
Sanjoy Kumar Roy
 
PDF
Introduction to microservices (from rails monolith)
Leandro Parazito
 
PDF
Integration Microservices
Kasun Indrasiri
 
PPTX
Introduction to Microservices
Roger van de Kimmenade
 
PDF
Deploying Microservices as Containers
Veer Muchandi
 
PDF
[WSO2Con EU 2017] Microservices for Enterprises
WSO2
 
PPTX
An introduction to Microservices
Cisco DevNet
 
PDF
Deep-dive into Microservice Outer Architecture
WSO2
 
ODP
Microservices
Karol Grzegorczyk
 
PDF
Microservices in Practice
Kasun Indrasiri
 
PPTX
Microservices Architecture (MSA) - Presentation made at AEA-MN quarterly even...
Somasundram Balakrushnan
 
PPTX
Microservice architecture
Touraj Ebrahimi
 
PDF
Full lifecycle of a microservice
Luigi Bennardis
 
PDF
Nats meetup sf 20150826
Apcera
 
PDF
Introduction to Microservices
Yury Kisliak
 
Service mesh in Microservice World to Manage end to end service communications
Satya Syam
 
Microservice Architecture
Rich Lee
 
Lightweight ESB Alternatives
Chris Haddad
 
Microservices: Where do they fit within a rapidly evolving integration archit...
Kim Clark
 
Introduction to microservices Jornada Microservices
Roan Brasil Monteiro
 
Microservice architecture design principles
Sanjoy Kumar Roy
 
Introduction to microservices (from rails monolith)
Leandro Parazito
 
Integration Microservices
Kasun Indrasiri
 
Introduction to Microservices
Roger van de Kimmenade
 
Deploying Microservices as Containers
Veer Muchandi
 
[WSO2Con EU 2017] Microservices for Enterprises
WSO2
 
An introduction to Microservices
Cisco DevNet
 
Deep-dive into Microservice Outer Architecture
WSO2
 
Microservices
Karol Grzegorczyk
 
Microservices in Practice
Kasun Indrasiri
 
Microservices Architecture (MSA) - Presentation made at AEA-MN quarterly even...
Somasundram Balakrushnan
 
Microservice architecture
Touraj Ebrahimi
 
Full lifecycle of a microservice
Luigi Bennardis
 
Nats meetup sf 20150826
Apcera
 
Introduction to Microservices
Yury Kisliak
 

Viewers also liked (20)

PDF
Microservices deployment patterns
Abhishek Tiwari
 
PPTX
The Role of Enterprise Integration in Digital Transformation
Kasun Indrasiri
 
PDF
DEVNET-1170 Intercloud Microservices with Docker and Nirmata
Cisco DevNet
 
PDF
Containerizing Traditional Applications
Jim Bugwadia
 
PDF
Multi-cloud Container Management for vRealize Automation
Jim Bugwadia
 
ODP
Microservices Patterns and Anti-Patterns
Corneil du Plessis
 
PPTX
Kubernetes meetup: Networking for Microservices
Sukhesh Halemane
 
PPTX
Contiv kubernetes-microservices-feb25-v0.3
Sukhesh Halemane
 
PDF
Building a microservice ecosystem
Haufe-Lexware GmbH & Co KG
 
PDF
Multi-Cloud Microservices - DevOps Summit Silicon Valley 2015
Jim Bugwadia
 
PDF
The seven more deadly sins of microservices final
Haufe-Lexware GmbH & Co KG
 
PPTX
Data stream processing and micro service architecture
Vyacheslav Benedichuk
 
PPTX
Enterprise Cloud Native
Cloud Best Practices Network
 
PPTX
Container Networking Challenges for Production Readiness
Vipin Jain
 
PPTX
Running Netflix OSS on Docker with Nirmata
Damien Toledo
 
PDF
Adventures with Microservices
Anand Agrawal
 
PPTX
Docker meetup oct14
Vipin Jain
 
PPTX
Microservice Architecture
Dhaval Shah
 
PDF
Developing and Deploying Java applications on the Amazon Elastic Compute Clou...
Chris Richardson
 
PPTX
Deployment Automation with Microservices
Ganesh Ghag
 
Microservices deployment patterns
Abhishek Tiwari
 
The Role of Enterprise Integration in Digital Transformation
Kasun Indrasiri
 
DEVNET-1170 Intercloud Microservices with Docker and Nirmata
Cisco DevNet
 
Containerizing Traditional Applications
Jim Bugwadia
 
Multi-cloud Container Management for vRealize Automation
Jim Bugwadia
 
Microservices Patterns and Anti-Patterns
Corneil du Plessis
 
Kubernetes meetup: Networking for Microservices
Sukhesh Halemane
 
Contiv kubernetes-microservices-feb25-v0.3
Sukhesh Halemane
 
Building a microservice ecosystem
Haufe-Lexware GmbH & Co KG
 
Multi-Cloud Microservices - DevOps Summit Silicon Valley 2015
Jim Bugwadia
 
The seven more deadly sins of microservices final
Haufe-Lexware GmbH & Co KG
 
Data stream processing and micro service architecture
Vyacheslav Benedichuk
 
Enterprise Cloud Native
Cloud Best Practices Network
 
Container Networking Challenges for Production Readiness
Vipin Jain
 
Running Netflix OSS on Docker with Nirmata
Damien Toledo
 
Adventures with Microservices
Anand Agrawal
 
Docker meetup oct14
Vipin Jain
 
Microservice Architecture
Dhaval Shah
 
Developing and Deploying Java applications on the Amazon Elastic Compute Clou...
Chris Richardson
 
Deployment Automation with Microservices
Ganesh Ghag
 
Ad

Similar to DEVNET-1184 Microservices Patterns (20)

PDF
Reference architectures shows a microservices deployed to Kubernetes
Rakesh Gujjarlapudi
 
PPTX
Business and IT agility through DevOps and microservice architecture powered ...
Lucas Jellema
 
PPTX
Application Centric Microservices from Redhat Summit 2015
Ken Owens
 
PPSX
Microservices Docker Kubernetes Istio Kanban DevOps SRE
Araf Karsh Hamid
 
PPTX
Do You Need A Service Mesh?
NGINX, Inc.
 
PPTX
MRA AMA Part 10: Kubernetes and the Microservices Reference Architecture
NGINX, Inc.
 
PDF
[APIdays Paris 2019] API Management in Service Mesh Using Istio and WSO2 API ...
WSO2
 
PDF
Migrating to Microservices Patterns and Technologies (edition 2023)
Ahmed Misbah
 
PPTX
QConSF-MicroServices-IPC-Netflix-Sudhir-2014.pptx
VimalKumar143058
 
PDF
Service Mesh Talk for CTO Forum
Rick Hightower
 
PDF
Istio as an enabler for migrating to microservices (edition 2022)
Ahmed Misbah
 
PDF
APIdays Paris 2019 - Cloud native API Management for Microservices on a Servi...
apidays
 
PPTX
NGINX, Istio, and the Move to Microservices and Service Mesh
NGINX, Inc.
 
PPTX
Disruptive Trends in Application Development
WaveMaker, Inc.
 
PPTX
CloudComputing
Adi Challa
 
PPTX
Cloud presentation NELA
Edward Iglesias
 
PPTX
Introduction to microservices
Anil Allewar
 
PDF
Evolving your Architecture to MicroServices
Hector Tapia
 
PPTX
Do I Need A Service Mesh.pptx
PINGXIONG3
 
PPTX
AWS Cloud Solution - An Overview
Dony Riyanto
 
Reference architectures shows a microservices deployed to Kubernetes
Rakesh Gujjarlapudi
 
Business and IT agility through DevOps and microservice architecture powered ...
Lucas Jellema
 
Application Centric Microservices from Redhat Summit 2015
Ken Owens
 
Microservices Docker Kubernetes Istio Kanban DevOps SRE
Araf Karsh Hamid
 
Do You Need A Service Mesh?
NGINX, Inc.
 
MRA AMA Part 10: Kubernetes and the Microservices Reference Architecture
NGINX, Inc.
 
[APIdays Paris 2019] API Management in Service Mesh Using Istio and WSO2 API ...
WSO2
 
Migrating to Microservices Patterns and Technologies (edition 2023)
Ahmed Misbah
 
QConSF-MicroServices-IPC-Netflix-Sudhir-2014.pptx
VimalKumar143058
 
Service Mesh Talk for CTO Forum
Rick Hightower
 
Istio as an enabler for migrating to microservices (edition 2022)
Ahmed Misbah
 
APIdays Paris 2019 - Cloud native API Management for Microservices on a Servi...
apidays
 
NGINX, Istio, and the Move to Microservices and Service Mesh
NGINX, Inc.
 
Disruptive Trends in Application Development
WaveMaker, Inc.
 
CloudComputing
Adi Challa
 
Cloud presentation NELA
Edward Iglesias
 
Introduction to microservices
Anil Allewar
 
Evolving your Architecture to MicroServices
Hector Tapia
 
Do I Need A Service Mesh.pptx
PINGXIONG3
 
AWS Cloud Solution - An Overview
Dony Riyanto
 
Ad

More from Cisco DevNet (20)

PPTX
How to Contribute to Ansible
Cisco DevNet
 
PPTX
Rome 2017: Building advanced voice assistants and chat bots
Cisco DevNet
 
PPTX
How to Build Advanced Voice Assistants and Chatbots
Cisco DevNet
 
PPTX
Cisco Spark and Tropo and the Programmable Web
Cisco DevNet
 
PPTX
Device Programmability with Cisco Plug-n-Play Solution
Cisco DevNet
 
PPTX
Building a WiFi Hotspot with NodeJS: Cisco Meraki - ExCap API
Cisco DevNet
 
PPTX
Application Visibility and Experience through Flexible Netflow
Cisco DevNet
 
PPTX
WAN Automation Engine API Deep Dive
Cisco DevNet
 
PPTX
Cisco's Open Device Programmability Strategy: Open Discussion
Cisco DevNet
 
PPTX
Open Device Programmability: Hands-on Intro to RESTCONF (and a bit of NETCONF)
Cisco DevNet
 
PPTX
NETCONF & YANG Enablement of Network Devices
Cisco DevNet
 
PPTX
UCS Management APIs A Technical Deep Dive
Cisco DevNet
 
PPTX
OpenStack Enabling DevOps
Cisco DevNet
 
PPTX
NetDevOps for the Network Dude: How to get started with API's, Ansible and Py...
Cisco DevNet
 
PPTX
Getting Started: Developing Tropo Applications
Cisco DevNet
 
PPTX
Cisco Spark & Tropo API Workshop
Cisco DevNet
 
PPTX
Coding 102 REST API Basics Using Spark
Cisco DevNet
 
PPTX
Cisco APIs: An Interactive Assistant for the Web2Day Developer Conference
Cisco DevNet
 
PPTX
DevNet Express - Spark & Tropo API - Lisbon May 2016
Cisco DevNet
 
PPTX
DevNet @TAG - Spark & Tropo APIs - Milan/Rome May 2016
Cisco DevNet
 
How to Contribute to Ansible
Cisco DevNet
 
Rome 2017: Building advanced voice assistants and chat bots
Cisco DevNet
 
How to Build Advanced Voice Assistants and Chatbots
Cisco DevNet
 
Cisco Spark and Tropo and the Programmable Web
Cisco DevNet
 
Device Programmability with Cisco Plug-n-Play Solution
Cisco DevNet
 
Building a WiFi Hotspot with NodeJS: Cisco Meraki - ExCap API
Cisco DevNet
 
Application Visibility and Experience through Flexible Netflow
Cisco DevNet
 
WAN Automation Engine API Deep Dive
Cisco DevNet
 
Cisco's Open Device Programmability Strategy: Open Discussion
Cisco DevNet
 
Open Device Programmability: Hands-on Intro to RESTCONF (and a bit of NETCONF)
Cisco DevNet
 
NETCONF & YANG Enablement of Network Devices
Cisco DevNet
 
UCS Management APIs A Technical Deep Dive
Cisco DevNet
 
OpenStack Enabling DevOps
Cisco DevNet
 
NetDevOps for the Network Dude: How to get started with API's, Ansible and Py...
Cisco DevNet
 
Getting Started: Developing Tropo Applications
Cisco DevNet
 
Cisco Spark & Tropo API Workshop
Cisco DevNet
 
Coding 102 REST API Basics Using Spark
Cisco DevNet
 
Cisco APIs: An Interactive Assistant for the Web2Day Developer Conference
Cisco DevNet
 
DevNet Express - Spark & Tropo API - Lisbon May 2016
Cisco DevNet
 
DevNet @TAG - Spark & Tropo APIs - Milan/Rome May 2016
Cisco DevNet
 

Recently uploaded (20)

PDF
CIFDAQ'S Token Spotlight for 16th July 2025 - ALGORAND
CIFDAQ
 
PDF
UiPath vs Other Automation Tools Meeting Presentation.pdf
Tracy Dixon
 
PDF
Rethinking Security Operations - Modern SOC.pdf
Haris Chughtai
 
PDF
Integrating IIoT with SCADA in Oil & Gas A Technical Perspective.pdf
Rejig Digital
 
PDF
Generative AI in Healthcare: Benefits, Use Cases & Challenges
Lily Clark
 
PDF
Lecture A - AI Workflows for Banking.pdf
Dr. LAM Yat-fai (林日辉)
 
PDF
Market Insight : ETH Dominance Returns
CIFDAQ
 
PDF
Meetup Kickoff & Welcome - Rohit Yadav, CSIUG Chairman
ShapeBlue
 
PDF
UiPath on Tour London Community Booth Deck
UiPathCommunity
 
PPTX
Earn Agentblazer Status with Slack Community Patna.pptx
SanjeetMishra29
 
PDF
visibel.ai Company Profile – Real-Time AI Solution for CCTV
visibelaiproject
 
PPTX
Machine Learning Benefits Across Industries
SynapseIndia
 
PDF
Human-centred design in online workplace learning and relationship to engagem...
Tracy Tang
 
PPTX
Lecture 5 - Agentic AI and model context protocol.pptx
Dr. LAM Yat-fai (林日辉)
 
PPTX
Building a Production-Ready Barts Health Secure Data Environment Tooling, Acc...
Barts Health
 
PDF
Women in Automation Presents: Reinventing Yourself — Bold Career Pivots That ...
DianaGray10
 
PDF
Arcee AI - building and working with small language models (06/25)
Julien SIMON
 
PDF
OpenInfra ID 2025 - Are Containers Dying? Rethinking Isolation with MicroVMs.pdf
Muhammad Yuga Nugraha
 
PPTX
The Yotta x CloudStack Advantage: Scalable, India-First Cloud
ShapeBlue
 
PDF
How a Code Plagiarism Checker Protects Originality in Programming
Code Quiry
 
CIFDAQ'S Token Spotlight for 16th July 2025 - ALGORAND
CIFDAQ
 
UiPath vs Other Automation Tools Meeting Presentation.pdf
Tracy Dixon
 
Rethinking Security Operations - Modern SOC.pdf
Haris Chughtai
 
Integrating IIoT with SCADA in Oil & Gas A Technical Perspective.pdf
Rejig Digital
 
Generative AI in Healthcare: Benefits, Use Cases & Challenges
Lily Clark
 
Lecture A - AI Workflows for Banking.pdf
Dr. LAM Yat-fai (林日辉)
 
Market Insight : ETH Dominance Returns
CIFDAQ
 
Meetup Kickoff & Welcome - Rohit Yadav, CSIUG Chairman
ShapeBlue
 
UiPath on Tour London Community Booth Deck
UiPathCommunity
 
Earn Agentblazer Status with Slack Community Patna.pptx
SanjeetMishra29
 
visibel.ai Company Profile – Real-Time AI Solution for CCTV
visibelaiproject
 
Machine Learning Benefits Across Industries
SynapseIndia
 
Human-centred design in online workplace learning and relationship to engagem...
Tracy Tang
 
Lecture 5 - Agentic AI and model context protocol.pptx
Dr. LAM Yat-fai (林日辉)
 
Building a Production-Ready Barts Health Secure Data Environment Tooling, Acc...
Barts Health
 
Women in Automation Presents: Reinventing Yourself — Bold Career Pivots That ...
DianaGray10
 
Arcee AI - building and working with small language models (06/25)
Julien SIMON
 
OpenInfra ID 2025 - Are Containers Dying? Rethinking Isolation with MicroVMs.pdf
Muhammad Yuga Nugraha
 
The Yotta x CloudStack Advantage: Scalable, India-First Cloud
ShapeBlue
 
How a Code Plagiarism Checker Protects Originality in Programming
Code Quiry
 

DEVNET-1184 Microservices Patterns

  • 3. About me • Founder and CEO at Nirmata • Software Developer (C++, Java, Javascript, Go) • Large-scale distributed systems
  • 4. • Why Microservices • Microservices defined • Architecture & Design Patterns • Summary Agenda
  • 5. Businesses are adopting Microservices for agility at scale 20% of enterprises will adopt Microservices by 2016” -- Gartner
  • 6. A Microservices style application is composed of several cooperating services, each of which is versioned and deployed individually. Monolith ms msms ms Microservices  Agility
  • 7. • The Art of Scalability AKF Scale Cube Microservices  Scale
  • 8. Client Load Balancer Application Application Application X-Axis Scaling scale by replicating the entire application
  • 9. Client Load Balancer Orders Catalog Customers Y-Axis Scaling scale by splitting the application into components /catalog /orders /customers
  • 10. Client Load Balancer Z-Axis Scaling scale by splitting the data /catalog[a-i] /catalog[j-r] /catalog[s-z] Catalog Catalog Catalog
  • 11. Client Load Balancer Microservices combine X-Y axis scaling Orders Catalog Customers /catalog /orders /customers scale by splitting the application into services, and replicating each service
  • 12. Client Load Balancer Orders Catalog Customers /catalog /orders /customers scale by splitting the application into services, and replicating each service Best scalability Best resiliency Best efficiency Microservices combine X-Y axis scaling
  • 13. Microservices Defined 1. Elastic: scales up or down independently of other services 2. Resilient: services provide fault isolation boundaries 3. Composable: uniform APIs for each service 4. Minimal: highly cohesive set of entities 5. Complete: loosely coupled with other services A Microservices application is composed of multiple cooperating services. Each Service is:
  • 15. The Monolith Pattern • Tiered approach • Modules within each tier are compiled and integrated • Easier to build and manage • Long test cycles for any change • All-or-nothing deploys Client Load Balancer Application Database WebUI Orders Catalog Customers Reviews Cart Payments … … …
  • 16. The Microservices Pattern • Multiple services with Uniform APIs • Services can be build, tested, and deployed separately • Enables rapid experimentation on smaller components • Can have: • Polyglot languages • Polyglot data stores Client Load Balancer Gateway Gateway Customers ReviewsPayments Cart WebUI Catalog Orders
  • 17. Microservices: Inner and Outer Architecture • Microservices are meant to be simple • Complexity gets pushed outside the Microservice • A platform built for Microservices must absorb this complexity That [the complexity you removed from your services to simplify them ] complexity has moved and, I would argue, increased. It now lives in what I call the ”outer architecture”. -- Gary Olliffe , Research Director at Gartner
  • 18. Service Naming, Registration & Discovery • Each Service has a well known name • Each Service Instance dynamically registers its availability • Clients can resolve a well known Service name to the location of an available Service Instance connect with me at: orders.shopping.com 192.168.50.11:9762 192.168.10.7:80808 192.168.3.12:42132192.168.100.23:9065 192.168.100.23:9065 e.g. Netflix OSS, Nirmata Service Networking
  • 19. Service Gateway Pattern • An entry point for the application • A single client connection is multiplexed across backend services and service instances • Routes requests based on content (e.g. URL Path) • An application can have multiple gateways Gateway Gateway CustomersWebUI Catalog http://shop.io Load Balancer /ui /catalog /customers e.g. Zuul, Hipache, Nirmata Gateway Service
  • 20. Mid-tier Load Balancing • Services in an application need to communicate • Each Service is elastic and resilient • Scale-out dynamic load balancing is required • Client-based LB • Host-based • External service e.g. Zuul, Nirmata Dynamic Proxy Gateway Gateway CustomersCatalog http://shop.io Load Balancer /catalog /customers LB
  • 21. Distributed Locks • Coordinate operations across several Service Instances • DB level locks are not enough • Implementations should provide Mutex, Semaphore, RWLock semantics e.g. Curator / Zookeeper Lock Service Server Server Server Catalog Catalog Lock /catalog/item/12a91kl Lock /catalog/item/09a9ab Unlock /catalog/item/09a9ab ….. Lock /catalog/item/ij98108 Unlock /catalog/item/ij98108 ….. Shared Work Queue
  • 22. Leader Election • Select one service instance to perform a task • Good for lightweight scheduling of periodic tasks • Use different leaders for different functions • Run elections periodically • Nodes can join election at any point • If leader node goes away, a new leader is elected e.g. Curator / Zookeeper Leader Elector Server Server Server Catalog Catalog -> Elect /catalog/purge-> Elect /catalog/purge <- Take Leadership
  • 23. Distributed Workflows • Coordinate execution of a set of tasks across services instances • Each task may be executed by a different services • Tasks may execute in parallel, and may have inter-dependencies Workflow Service Server Server Server e.g. AWS SWS, NirmataOSS Workflow Catalog Catalog
  • 25. Summary 1. Microservices enable agility at scale 2. Microservices push complexity into the platform 3. Microservices require operations tooling and distributed programming skills
  • 26. Related Sessions Come try it live @ DevNet Cloud POD #3 DEVNET-1170 - Intercloud Microservices with Docker and Nirmata Thursday, Jun 11, 11:00 AM - 11:30 AM, DevNet Theater DEVNET-1137 - Application Centric Microservices Wednesday, Jun 10, 3:00 PM - 4:00 PM. DevNet Theater DEVNET-2013 - DevOps In Depth - Adrian Cockroft on Fast Delivery Tuesday, Jun 9, 1:45 PM - 2:30 PM, DevNet Theater BRKDEV-1002 - What's Hot in Containers Thursday, Jun 11, 1:00 PM - 2:30 PM, 30B Upper Level
  • 27. References • Microservices : Building Services with the Guts on the Outside, Gary Oliffe, http://blogs.gartner.com/gary-olliffe/2015/01/30/microservices-guts-on-the- outside/ • Migrating to Cloud Native with Microservices, Adrian Cockroft http://www.slideshare.net/adriancockcroft/qcon-new-york-speed-and-scale • Microservices: Decomposing Applications for Deployability and Scalability, Chris Richardson, http://www.infoq.com/articles/microservices-intro • Microservices, James Lewis and Martin Fowler, http://martinfowler.com/articles/microservices.html • Cloud native software: Microservices, Jim Bugwadia http://nirmata.com/2014/07/cloud-native-software-microservices/
  • 30. Other Interesting Patterns • CQRS (Command Query Responsibility Segregation) Separate model updates from views http://martinfowler.com/bliki/CQRS.html • Bounded Context Keep different models independent http://martinfowler.com/bliki/BoundedContext.html • Event Sourcing Use events, with playback, to manage distributed state http://martinfowler.com/eaaDev/EventSourcing.html
  • 31. Single Sync • Each user call results in a single synchronous call • A user call spawns one or more Distributed Workflows • Workflow tasks update user state via APIs • Retries and failure recovery are built-in per tasks Client Gateway Service Orders Service Payment Service Message Queue 1. Place Order 2. Route Request 3. Validate & Commit 4. Publish {new order} 5. Handle Payment 6. Publish {payment update} 7. Update Order
  • 32. Rest Cache • Services are using REST APIs to communicate • Frequent fetching of data causes latencies • A local cache can reduce latencies • Async Messaging can update the cache Orders Service Catalog ServiceREST Message Queue Updates Updates Catalog Cache POST, PUT, DELETE