SlideShare a Scribd company logo
Microservices:
lessons from the trenches
Team Lead at ThoughtWorks
Mehdi Khalili
twitter: @MehdiKhalili
http://www.mehdi-khalili.com/presentations/microservices-lessons-
dddmel/
http://www.mehdi-khalili.com/microservices-lessons/
Microservices lessons from trenches
Microservices is
AWESOME!!
Benefits of microservices
• Scalability
• Loose Coupling
• Fault Tolerance
• Scalable Development
• Technical Diversification
• Continuous Delivery
http://giphy.com/gifs/parkour-tJLFLygAbaxYk
http://giphy.com/gifs/fail-parkour-dZeSENj3pXT6o
Challenges
• Fault Tolerance
• Loose Coupling
• Greenfield
• Culture
Fault Tolerance
http://giphy.com/gifs/fail-parkour-movement-
7SqLFyxYHal6o
30 services with 99.9% up-time
43m downtime per service a month
1296m downtime a month
one day of downtime a month
The Akamai story!
contain the failure
Netflix:
assumed broken components
Reading
• caching
• data duplication!
• graceful degradation
Actions and events
• guaranteed delivery
• eventual consistency
be proactive about failure
The story of recycling app pool!
• monitoring endpoints
• synthetic monitoring
be proactive about failure
troubleshooting
The story of missing param!
• extensive logging
• correlation id
• log aggregation
troubleshooting
Correlation Id Service From Timestamp Message
996a3975-4996 Registration::Creat
e
nil 02 Aug 2014 19:55:15 AEST
+10:00
bbbe64ab-c84c Cart::Get nil 02 Aug 2014 19:55:15 AEST
+10:00
996a3975-4996 Accounting::Creat
e
Registration::Create 02 Aug 2014 19:55:16 AEST
+10:00
996a3975-4996 Avatar::Create Registration::Create 02 Aug 2014 19:55:16 AEST
+10:00
NullReferenc
e
• extensive logging
• correlation id
• log aggregation
troubleshooting
Correlation Id Service From Timestamp Message
996a3975-4996 Registration::Creat
e
nil 02 Aug 2014 19:55:15 AEST
+10:00
bbbe64ab-c84c Cart::Get nil 02 Aug 2014 19:55:15 AEST
+10:00
996a3975-4996 Accounting::Creat
e
Registration::Create 02 Aug 2014 19:55:16 AEST
+10:00
996a3975-4996 Avatar::Create Registration::Create 02 Aug 2014 19:55:16 AEST
+10:00
NullReferenc
e
• extensive logging
• correlation id
• log aggregation
troubleshooting
Correlation Id Service From Timestamp Message
996a3975-4996 Registration::Creat
e
nil 02 Aug 2014 19:55:15 AEST
+10:00
bbbe64ab-c84c Cart::Get nil 02 Aug 2014 19:55:15 AEST
+10:00
996a3975-4996 Accounting::Creat
e
Registration::Create 02 Aug 2014 19:55:16 AEST
+10:00
996a3975-4996 Avatar::Create Registration::Create 02 Aug 2014 19:55:16 AEST
+10:00
NullReferenc
e
Loose Coupling
http://giphy.com/gifs/fail-parkour-2BuleA8z0C4uY
you need the big picture
The soft-delete story!
you need the big picture
beautiful diagrams!
you need the big picture
Correlation Id Service From Timestamp Message
0a669422-5e44 Registration::Creat
e
nil 02 Aug 2014 19:55:15 AEST
+10:00
bbbe64ab-c84c Accounting::Create User::AddAccount 01 Aug 2014 05:10:01 AEST
+10:00
996a3975-4996 Accounting::Create Registration::Create 02 Aug 2014 19:55:16 AEST
+10:00
e30e4e37-b1e1 Avatar::Create Registration::Create 02 Aug 2014 19:55:16 AEST
+10:00
NullReferenc
e
catch contract violation at build
time not run-time
consumer
provider
consumer
consumer driven contracts
catch contract violation at build time
catch contract violation at build time
consumer
provider
consumer
service libraries
service lib
service lib
catch contract violation at build time
Greenfield
Microservices
http://giphy.com/gifs/zSmGb2eYIAx3y
you need well defined
service boundaries
greenfield leads to
unknown boundaries
The nano-services story!
nanoservice
killmenow
monolith
Size
pain
always start with monolith
extract the bits that would
benefit from microservices
every greenfield project is a
startup“a human institution
designed to create
a new product or
service under
conditions of
extreme
Minimum Viable Product
“that version of a
new product which
allows a team to
collect the maximum
amount of validated
learning about
microservices is hard to
implement
and deploy
and monitor
Microservices
is NOT MVP
never start with
microservices
The Culture
http://giphy.com/gifs/fail-parkour-jCi66sK0E770s
nothing can save you from
cultural failure
“our release process has 43
manual and approval steps”
“fixing the bug took me 5 minutes,
releasing it to prod took 3 weeks!”
heavy processes
“test automation might work for others but
our system is different.”
“we have 30 developers
and 85 testers!”
no automation
“we need to stop obsessing
about quality and focus on
getting this out soon.”
no respect for quality
“we need a DevOps team!”
“shortcut” to happiness
test automation
deployment automation
infrastructure automation
DevOps culture
The Culture
Netflix:
” you code it, you'll deploy it
and you'll be on pager-duty.”
How do you sell microservices?
DO NOT
takeaways
Fault tolerance
• Contain the failure
• Caching, data duplication and graceful degradation
• Guaranteed delivery and eventual consistency
• Be proactive about failure
• Monitoring
• Use extensive logging
Loose coupling
• You need the big picture
• Self documenting application
• Build-time contract verification
• Consumer Driven Contracts
• Service Libraries
Avoid greenfield microservices
• Start with monolith
• Learn your domain model
• Microservices is NOT MVP
takeaway
• Culture, culture, culture!
• Test automation
• Deployment automation
• Infrastructure automation
• DevOps culture
microservices is
awesome
benefits vs overheads
Scalability
Operations &
monitoring
Loose coupling Contract violation
Fault tolerance Fault isolation
Scalable development
Communication
overhead
Lower cognitive load Losing the big picture
Tech diversification
Too many things to
learn
Continuous delivery DevOps culture
do it to the extent its
benefits outweigh
overheads and challenges
Next time you want to do microservices
• Do you actually need it?
• Do you need it now?
• Are the challenges worth the benefits?
• Does it fit your CULTURE?
Resources
Thank you
twitter: @MehdiKhalili
http://www.mehdi-khalili.com/presentations/microservices-lessons-
dddmel/
http://www.mehdi-khalili.com/microservices-lessons/

More Related Content

PPT
Microservices: lessons from the trenches
PDF
Microservices the Good Bad and the Ugly
PDF
Cloud-Native Roadshow - Microservices - Toronto
PDF
The future of Activiti Cloud @ DevCon 2019
PDF
NECOS Industrial Workshop Introduction by Prof. Christian Rothenberg (UNICAMP)
PDF
Microxchg Analyzing Response Time Distributions for Microservices
PDF
Code Performance Means Business Performance (presented by Christophe Dujarric...
PPTX
A High-Performance Solution to Microservice UI Composition @ XConf Hamburg
Microservices: lessons from the trenches
Microservices the Good Bad and the Ugly
Cloud-Native Roadshow - Microservices - Toronto
The future of Activiti Cloud @ DevCon 2019
NECOS Industrial Workshop Introduction by Prof. Christian Rothenberg (UNICAMP)
Microxchg Analyzing Response Time Distributions for Microservices
Code Performance Means Business Performance (presented by Christophe Dujarric...
A High-Performance Solution to Microservice UI Composition @ XConf Hamburg

Viewers also liked (6)

PPTX
Automated UI testing done right (DDDSydney)
PPTX
Automated UI Testing Done Right (QMSDNUG)
PDF
CQRS and Event Sourcing with Akka, Cassandra and RabbitMQ
PDF
codecentric AG: CQRS and Event Sourcing Applications with Cassandra
PDF
A pattern language for microservices (#gluecon #gluecon2016)
PDF
Microservices + Events + Docker = A Perfect Trio (dockercon)
Automated UI testing done right (DDDSydney)
Automated UI Testing Done Right (QMSDNUG)
CQRS and Event Sourcing with Akka, Cassandra and RabbitMQ
codecentric AG: CQRS and Event Sourcing Applications with Cassandra
A pattern language for microservices (#gluecon #gluecon2016)
Microservices + Events + Docker = A Perfect Trio (dockercon)
Ad

Similar to Microservices lessons from trenches (20)

PPTX
Making sense of microservices, service mesh, and serverless
PDF
SRE Topics with Charity Majors and Liz Fong-Jones of Honeycomb
PDF
From Monoliths to Services: Paying Your Technical Debt
PPTX
Sps toronto introduction to azure functions microsoft flow
PDF
Cloud Foundry API for Fun and Ops
PPTX
Serverless: What happens next will blow your mind!
PPTX
CyberArkUIPath_RPA Final (1).pptx
PPTX
CyberArkUIPath_RPA Final (2).pptx
PPTX
CyberArkUIPath_RPA Final (2).pptx
PPTX
Serverless Toronto helps Startups
PDF
Building and evolving microservices: lessons from the frontlines - Ilias Bart...
PDF
Building and evolving microservices
PDF
QCon 2015 - Microservices Track Notes
PDF
Chris Munns, DevOps @ Amazon: Microservices, 2 Pizza Teams, & 50 Million Depl...
PDF
Making operations visible - Nick Gallbreath
PDF
Making operations visible - devopsdays tokyo 2013
PDF
The DevOps Revolution And Beyond...
PDF
Machine Learning with PyCaret
PPTX
Tech campmemphis slides_post_session
PDF
John Rhodes - DevOps Automated Testing
Making sense of microservices, service mesh, and serverless
SRE Topics with Charity Majors and Liz Fong-Jones of Honeycomb
From Monoliths to Services: Paying Your Technical Debt
Sps toronto introduction to azure functions microsoft flow
Cloud Foundry API for Fun and Ops
Serverless: What happens next will blow your mind!
CyberArkUIPath_RPA Final (1).pptx
CyberArkUIPath_RPA Final (2).pptx
CyberArkUIPath_RPA Final (2).pptx
Serverless Toronto helps Startups
Building and evolving microservices: lessons from the frontlines - Ilias Bart...
Building and evolving microservices
QCon 2015 - Microservices Track Notes
Chris Munns, DevOps @ Amazon: Microservices, 2 Pizza Teams, & 50 Million Depl...
Making operations visible - Nick Gallbreath
Making operations visible - devopsdays tokyo 2013
The DevOps Revolution And Beyond...
Machine Learning with PyCaret
Tech campmemphis slides_post_session
John Rhodes - DevOps Automated Testing
Ad

Recently uploaded (20)

PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
DOCX
The AUB Centre for AI in Media Proposal.docx
 
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
 
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Spectral efficient network and resource selection model in 5G networks
PPTX
Big Data Technologies - Introduction.pptx
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
 
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
 
PDF
solutions_manual_-_materials___processing_in_manufacturing__demargo_.pdf
PDF
Empathic Computing: Creating Shared Understanding
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
The AUB Centre for AI in Media Proposal.docx
 
Review of recent advances in non-invasive hemoglobin estimation
CIFDAQ's Market Insight: SEC Turns Pro Crypto
 
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Diabetes mellitus diagnosis method based random forest with bat algorithm
Spectral efficient network and resource selection model in 5G networks
Big Data Technologies - Introduction.pptx
The Rise and Fall of 3GPP – Time for a Sabbatical?
 
NewMind AI Weekly Chronicles - August'25 Week I
Reach Out and Touch Someone: Haptics and Empathic Computing
Chapter 3 Spatial Domain Image Processing.pdf
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
 
solutions_manual_-_materials___processing_in_manufacturing__demargo_.pdf
Empathic Computing: Creating Shared Understanding
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows

Microservices lessons from trenches

Editor's Notes

  • #6: We see something awesome and we get really excited about it and think I want to be like that. I want to do that
  • #13: Assume everything your system talks to is broken and write it so it can cope!
  • #16: Don't wait for it to fail
  • #18: to expose the error count, response times, up time, transaction per second simulate an action or path that a customer or end-user would take. functionality, availability, and response time measures
  • #19: Don't wait for it to fail
  • #20: We were getting exception on an endpoint because it was missing a param
  • #21: Create on the edge service and pass it on to all services
  • #27: We were missing the big picture
  • #32: Promotes bad api design
  • #33: fallbacks, caching Publish the lib on build time and verify the consumers on CI
  • #37: Too chatty Had to deploy a few services each time Eventual consistency was a pain
  • #38: Very chatty Transaction boundaries Req/Res
  • #42: Fault isolation Eventual consistency Asynchrony Who’s in charge of auth? What happens when a new service is created?
  • #44: Create the cheapest MVP
  • #45: Doesn’t matter how technically good you are. You can’t win the cultural battle
  • #46: This actually shows one of the bigger risks with microservices: when it hurts, it really hurts!!
  • #52: Had to revert my unit tests!! Long manual release processes with sign-offs and approval gates Configuration drift Unfair on your ops team to monitor many services Is your dev team ready to be on-call?