SlideShare a Scribd company logo
1 of 49
Download to read offline
The 36th Chamber
of Shaolin
Improve Your Microservices Kung Fu
in 36 Easy Steps
freiheit.com technologies - Hamburg, September 29, 2016
code.talks 2016 - Keynote Track
This talk derives from more
than 17+ years of experience
building large-scale Internet
systems.
© freiheit.com
2
Internally we are calling these
principles BLACK & WHITE.
© freiheit.com
3
Black & White principles are
principles that are true most
of the time.
© freiheit.com
4
This talk is about
Microservices.
But as you will see, most of
these principles are true for all
kinds of systems.
© freiheit.com
5
Don’t build your own cloud
or cluster management.
People with far more experience have already done this.
Use what is given.
© freiheit.com
6
Don’t build your own data
center and availability zone
failover.
Again: People with far more experience have already
done this. It is difficult. Use what is given.
© freiheit.com
7
Don’t roll your own service
discovery.
People with far more experience … - you know the spiel.
© freiheit.com
8
One container. One service.
This is how you should use Docker.
© freiheit.com
9
I am a big fan of Kubernetes
running on GCE or AWS.
© freiheit.com
10
A microservice provides a set
of remote procedure calls that
are closely related to each
other (high cohesion).
● It should be as small as needed.
● It should do only one thing and do it well.
● It should do 'one thing' entirely.
● It's better to split later than to build it too small at first.
● A split should be simple.
© freiheit.com
11
Service API
Receives requests
Returns responses
No state,
no session,
“non-sticky”
A MICROSERVICE
© freiheit.com
12
A microservice starts up fast.
Start-up time < 10 sec.
© freiheit.com
13
A microservice has a low
memory footprint.
It doesn’t cache large amounts of data.
© freiheit.com
14
A microservice has well
defined resource constraints.
Memory/heap limits, CPU limits, swap disabled
(or constrained), etc.
© freiheit.com
15
A microservice has a fast
response time.
Like 15ms/50th, 50ms/95th and 100ms/99th percentile.
© freiheit.com
16
A microservice has a low
error rates.
There will be some 404, 500, 503, etc. But not many. And
you should know and understand why they are happening.
© freiheit.com
17
A microservice differentiates
between technical errors and
usage errors.
Technical is like out of memory, usage is like receiving
wrong requests from clients the service is unable to reply
and therefore denies to answer.
© freiheit.com
18
A microservice must be
monitored at all times.
Monitor response time, request count and errors.
Define thresholds and alerts when thresholds are reached.
© freiheit.com
19
© freiheit.com
20
You must be able to trace a
request from the client down
through all services calls.
Each request needs to have a unique ID.
© freiheit.com
21
A microservice never shares
its persistent state (database)
with any other microservice.
Exception: Importer service writes to database.
Online service reads from / writes to database.
© freiheit.com
22
It is totally okay to use a
relational database.
Don’t shoot yourself in the foot with Cassandra and NoSQL.
Rather use really flat data models, no joins, no complicated
queries in a relational database.
© freiheit.com
23
A microservice should never
include both batch and online
processing at the same time.
Separate batch from online processing to make sure that
your online services aren’t getting slow when the batch
processing starts.
© freiheit.com
24
Microservices will and can
call other microservices.
Call as few other microservices as possible.
Prevent circular calls.
© freiheit.com
25
A microservice answers
requests asynchronously.
© freiheit.com
26
One thread
handling
requests fast,
handing off to
worker threads
Receives requests
Returns responses
Many worker
threads running in
the background
ASYNC REQUEST HANDLING
© freiheit.com
27
A microservice sends requests
to other microservices
asynchronously.
Take a look at reactive programming Rx* or other stuff ...
© freiheit.com
28
ASYNC CALLING OTHER SERVICES
Async
Async Async
© freiheit.com
29
If a downstream service fails
your service should still work.
Use graceful degradation to return useful responses
as long as possible.
© freiheit.com
30
If you use REST,
use it asynchronously.
This doesn’t mean “message queues”.
© freiheit.com
31
It is better to use specialized
RPC protocols instead of
REST that can handle
interface changes better.
Like gRPC, Thrift, Finagle.
© freiheit.com
32
Each request needs a
reasonable time-out and
must be cancelable.
Like with gRPC/Context.
© freiheit.com
33
All asynchronous downstream
work resulting from a request
must be cancelable, too.
Like with gRPC/Context.
© freiheit.com
34
A request must be repeatable
providing the same result.
Requests must be idempotent.
© freiheit.com
35
Log the right amount of data
and create actionable,
meaningful log entries.
Or you will drown in your logs with unusable information.
© freiheit.com
36
If you need two or more
requests to succeed, you need
to implement retry/rollback on
error.
This is a distributed system. It can fail anytime.
© freiheit.com
37
No branches. All new code is
in the HEAD branch.
Update your microservices
with very small commits.
Few large commits are more unpredictable than lots of
small commits that are pushed continuously to your cluster.
Your monitoring and alerting will protect you.
© freiheit.com
38
You must be able to identify
which version of your code is
currently running in production.
You can use the commit rev as a Docker release tag.
© freiheit.com
39
Design from the beginning
how to run integration tests.
How to run a test over dozens or hundreds of services,
all having separate databases?
© freiheit.com
40
Share only code where a
change doesn’t force
everybody to update all their
services.
Exception: Crypto, security-related code, etc.
© freiheit.com
41
No commit without tests.
The “good feelings” start at code coverage > 85 %.
70 % unit tests, 20 % integration tests, 10 % end-to-end tests.
© freiheit.com
42
Actively manage your
microservices’ lifecycle.
Handle SIGTERM, readiness & lifeness probes, etc.
© freiheit.com
43
Deploy new versions to a
canary context first.
In Kubernetes you can use namespaces to separate
contexts. Measure and compare key KPIs with your
production context.
© freiheit.com
44
Backend-for-frontend helps
you to reduce the number of
requests and bandwidth
consumption of your clients.
Fewer requests. The least amount of data transferred.
© freiheit.com
45
Simulate real-world traffic
for load testing.
One option is to record live traffic for replay.
See https://github.com/buger/gor.
© freiheit.com
46
Run a chaos monkey in
production.
It randomly kills services and you will learn if everything is
really under control.
© freiheit.com
47
DevOps doesn’t work if it
gets big.
You need dedicated Site Reliability Engineers (SREs) to
team up with your software engineers.
© freiheit.com
48
I lied. There were
more than 36 steps ...
Thank you.
freiheit.com technologies gmbh 2016
Want to work with us and create the future? Talk to us!
jobs@freiheit.com

More Related Content

What's hot

Secrets of Successful Digital Transformers
Secrets of Successful Digital TransformersSecrets of Successful Digital Transformers
Secrets of Successful Digital TransformersVMware Tanzu
 
New trends of web technology on mobile: HTML5, PhoneGap & NaCl - Barcamp Saig...
New trends of web technology on mobile: HTML5, PhoneGap & NaCl - Barcamp Saig...New trends of web technology on mobile: HTML5, PhoneGap & NaCl - Barcamp Saig...
New trends of web technology on mobile: HTML5, PhoneGap & NaCl - Barcamp Saig...Vũ Nguyễn
 
Consumer Driven Contracts and Your Microservice Architecture
Consumer Driven Contracts and Your Microservice ArchitectureConsumer Driven Contracts and Your Microservice Architecture
Consumer Driven Contracts and Your Microservice ArchitectureVMware Tanzu
 
.Net framework vs .net core a complete comparison
.Net framework vs .net core  a complete comparison.Net framework vs .net core  a complete comparison
.Net framework vs .net core a complete comparisonKaty Slemon
 
WebRTC - Brings Real-Time to the Web
WebRTC - Brings Real-Time to the WebWebRTC - Brings Real-Time to the Web
WebRTC - Brings Real-Time to the WebVũ Nguyễn
 
Curious Coders Java Web Frameworks Comparison
Curious Coders Java Web Frameworks ComparisonCurious Coders Java Web Frameworks Comparison
Curious Coders Java Web Frameworks ComparisonHamed Hatami
 
Cloud design pattern using azure
Cloud design pattern using azureCloud design pattern using azure
Cloud design pattern using azureKarthikeyan VK
 
Migrate To Lightning Web Components from Aura framework to increase performance
Migrate To Lightning Web Components from Aura framework to increase performance Migrate To Lightning Web Components from Aura framework to increase performance
Migrate To Lightning Web Components from Aura framework to increase performance Bohdan Dovhań
 
Joseph Ardolino CV (1)
Joseph Ardolino CV (1)Joseph Ardolino CV (1)
Joseph Ardolino CV (1)Joe Ardolino
 
Alexey Kupriyanenko "Release Early, Often, Stable"
Alexey Kupriyanenko "Release Early, Often, Stable"Alexey Kupriyanenko "Release Early, Often, Stable"
Alexey Kupriyanenko "Release Early, Often, Stable"Fwdays
 
Rational Rhapsody Workflow Integration with Visual Studio
Rational Rhapsody Workflow Integration with Visual Studio Rational Rhapsody Workflow Integration with Visual Studio
Rational Rhapsody Workflow Integration with Visual Studio Frank Braun
 
vodQA Pune (2019) - Jenkins pipeline As code
vodQA Pune (2019) - Jenkins pipeline As codevodQA Pune (2019) - Jenkins pipeline As code
vodQA Pune (2019) - Jenkins pipeline As codevodQA
 
M365 global developer bootcamp 2019
M365 global developer bootcamp 2019M365 global developer bootcamp 2019
M365 global developer bootcamp 2019Thomas Daly
 
Controle do ciclo de vida do desenvolvimento de software com tfs vsts
Controle do ciclo de vida do desenvolvimento de software com tfs  vstsControle do ciclo de vida do desenvolvimento de software com tfs  vsts
Controle do ciclo de vida do desenvolvimento de software com tfs vstsRodrigo Kono
 
QVSource Brain Dump
QVSource Brain DumpQVSource Brain Dump
QVSource Brain DumpChris Brain
 
Micro Front-End & Microservices - Plansoft
Micro Front-End & Microservices - PlansoftMicro Front-End & Microservices - Plansoft
Micro Front-End & Microservices - PlansoftMiki Lombardi
 
Designing and Debugging Mobile Apps with an Embedded, Scriptable Web Server
Designing and Debugging Mobile Apps with an Embedded, Scriptable Web ServerDesigning and Debugging Mobile Apps with an Embedded, Scriptable Web Server
Designing and Debugging Mobile Apps with an Embedded, Scriptable Web ServerAll Things Open
 
apidays LIVE Helsinki - Implementing OpenAPI and GraphQL Services with gRPC b...
apidays LIVE Helsinki - Implementing OpenAPI and GraphQL Services with gRPC b...apidays LIVE Helsinki - Implementing OpenAPI and GraphQL Services with gRPC b...
apidays LIVE Helsinki - Implementing OpenAPI and GraphQL Services with gRPC b...apidays
 
Grails At Linked
Grails At LinkedGrails At Linked
Grails At LinkedLinkedIn
 
Rapid Application Development with Docker
Rapid Application Development with DockerRapid Application Development with Docker
Rapid Application Development with DockerNiklas Heidloff
 

What's hot (20)

Secrets of Successful Digital Transformers
Secrets of Successful Digital TransformersSecrets of Successful Digital Transformers
Secrets of Successful Digital Transformers
 
New trends of web technology on mobile: HTML5, PhoneGap & NaCl - Barcamp Saig...
New trends of web technology on mobile: HTML5, PhoneGap & NaCl - Barcamp Saig...New trends of web technology on mobile: HTML5, PhoneGap & NaCl - Barcamp Saig...
New trends of web technology on mobile: HTML5, PhoneGap & NaCl - Barcamp Saig...
 
Consumer Driven Contracts and Your Microservice Architecture
Consumer Driven Contracts and Your Microservice ArchitectureConsumer Driven Contracts and Your Microservice Architecture
Consumer Driven Contracts and Your Microservice Architecture
 
.Net framework vs .net core a complete comparison
.Net framework vs .net core  a complete comparison.Net framework vs .net core  a complete comparison
.Net framework vs .net core a complete comparison
 
WebRTC - Brings Real-Time to the Web
WebRTC - Brings Real-Time to the WebWebRTC - Brings Real-Time to the Web
WebRTC - Brings Real-Time to the Web
 
Curious Coders Java Web Frameworks Comparison
Curious Coders Java Web Frameworks ComparisonCurious Coders Java Web Frameworks Comparison
Curious Coders Java Web Frameworks Comparison
 
Cloud design pattern using azure
Cloud design pattern using azureCloud design pattern using azure
Cloud design pattern using azure
 
Migrate To Lightning Web Components from Aura framework to increase performance
Migrate To Lightning Web Components from Aura framework to increase performance Migrate To Lightning Web Components from Aura framework to increase performance
Migrate To Lightning Web Components from Aura framework to increase performance
 
Joseph Ardolino CV (1)
Joseph Ardolino CV (1)Joseph Ardolino CV (1)
Joseph Ardolino CV (1)
 
Alexey Kupriyanenko "Release Early, Often, Stable"
Alexey Kupriyanenko "Release Early, Often, Stable"Alexey Kupriyanenko "Release Early, Often, Stable"
Alexey Kupriyanenko "Release Early, Often, Stable"
 
Rational Rhapsody Workflow Integration with Visual Studio
Rational Rhapsody Workflow Integration with Visual Studio Rational Rhapsody Workflow Integration with Visual Studio
Rational Rhapsody Workflow Integration with Visual Studio
 
vodQA Pune (2019) - Jenkins pipeline As code
vodQA Pune (2019) - Jenkins pipeline As codevodQA Pune (2019) - Jenkins pipeline As code
vodQA Pune (2019) - Jenkins pipeline As code
 
M365 global developer bootcamp 2019
M365 global developer bootcamp 2019M365 global developer bootcamp 2019
M365 global developer bootcamp 2019
 
Controle do ciclo de vida do desenvolvimento de software com tfs vsts
Controle do ciclo de vida do desenvolvimento de software com tfs  vstsControle do ciclo de vida do desenvolvimento de software com tfs  vsts
Controle do ciclo de vida do desenvolvimento de software com tfs vsts
 
QVSource Brain Dump
QVSource Brain DumpQVSource Brain Dump
QVSource Brain Dump
 
Micro Front-End & Microservices - Plansoft
Micro Front-End & Microservices - PlansoftMicro Front-End & Microservices - Plansoft
Micro Front-End & Microservices - Plansoft
 
Designing and Debugging Mobile Apps with an Embedded, Scriptable Web Server
Designing and Debugging Mobile Apps with an Embedded, Scriptable Web ServerDesigning and Debugging Mobile Apps with an Embedded, Scriptable Web Server
Designing and Debugging Mobile Apps with an Embedded, Scriptable Web Server
 
apidays LIVE Helsinki - Implementing OpenAPI and GraphQL Services with gRPC b...
apidays LIVE Helsinki - Implementing OpenAPI and GraphQL Services with gRPC b...apidays LIVE Helsinki - Implementing OpenAPI and GraphQL Services with gRPC b...
apidays LIVE Helsinki - Implementing OpenAPI and GraphQL Services with gRPC b...
 
Grails At Linked
Grails At LinkedGrails At Linked
Grails At Linked
 
Rapid Application Development with Docker
Rapid Application Development with DockerRapid Application Development with Docker
Rapid Application Development with Docker
 

Similar to 36 Chamber Microservices Kung Fu

FEVR - Micro Frontend
FEVR - Micro FrontendFEVR - Micro Frontend
FEVR - Micro FrontendMiki Lombardi
 
Microservices for performance - GOTO Chicago 2016
Microservices for performance - GOTO Chicago 2016Microservices for performance - GOTO Chicago 2016
Microservices for performance - GOTO Chicago 2016Peter Lawrey
 
apidays LIVE Australia - The Evolution of APIs: Events and the AsyncAPI speci...
apidays LIVE Australia - The Evolution of APIs: Events and the AsyncAPI speci...apidays LIVE Australia - The Evolution of APIs: Events and the AsyncAPI speci...
apidays LIVE Australia - The Evolution of APIs: Events and the AsyncAPI speci...apidays
 
Running microservices successfully | Bastian Hofmann | CODEiD
Running microservices successfully | Bastian Hofmann | CODEiDRunning microservices successfully | Bastian Hofmann | CODEiD
Running microservices successfully | Bastian Hofmann | CODEiDCODEiD PHP Community
 
Service Mesh Pain & Gain. Experiences from a client project.
Service Mesh Pain & Gain. Experiences from a client project.Service Mesh Pain & Gain. Experiences from a client project.
Service Mesh Pain & Gain. Experiences from a client project.QAware GmbH
 
Low latency microservices in java QCon New York 2016
Low latency microservices in java   QCon New York 2016Low latency microservices in java   QCon New York 2016
Low latency microservices in java QCon New York 2016Peter Lawrey
 
Microservices: Why and When? - Alon Fliess, CodeValue - Cloud Native Day Tel ...
Microservices: Why and When? - Alon Fliess, CodeValue - Cloud Native Day Tel ...Microservices: Why and When? - Alon Fliess, CodeValue - Cloud Native Day Tel ...
Microservices: Why and When? - Alon Fliess, CodeValue - Cloud Native Day Tel ...Cloud Native Day Tel Aviv
 
Challenges behind the scenes of the large Swiss e-Commerce shop apfelkiste.ch...
Challenges behind the scenes of the large Swiss e-Commerce shop apfelkiste.ch...Challenges behind the scenes of the large Swiss e-Commerce shop apfelkiste.ch...
Challenges behind the scenes of the large Swiss e-Commerce shop apfelkiste.ch...nine
 
High-Speed Reactive Microservices
High-Speed Reactive MicroservicesHigh-Speed Reactive Microservices
High-Speed Reactive MicroservicesRick Hightower
 
Tef con2016 (1)
Tef con2016 (1)Tef con2016 (1)
Tef con2016 (1)ggarber
 
High-Speed Reactive Microservices - trials and tribulations
High-Speed Reactive Microservices - trials and tribulationsHigh-Speed Reactive Microservices - trials and tribulations
High-Speed Reactive Microservices - trials and tribulationsRick Hightower
 
NATS in action - A Real time Microservices Architecture handled by NATS
NATS in action - A Real time Microservices Architecture handled by NATSNATS in action - A Real time Microservices Architecture handled by NATS
NATS in action - A Real time Microservices Architecture handled by NATSRaül Pérez
 
Nats in action a real time microservices architecture handled by nats
Nats in action   a real time microservices architecture handled by natsNats in action   a real time microservices architecture handled by nats
Nats in action a real time microservices architecture handled by natsRaul Perez
 
Introduction to Serverless through Architectural Patterns
Introduction to Serverless through Architectural PatternsIntroduction to Serverless through Architectural Patterns
Introduction to Serverless through Architectural PatternsMathieu Mailhos
 
Microservices With Istio Service Mesh
Microservices With Istio Service MeshMicroservices With Istio Service Mesh
Microservices With Istio Service MeshNatanael Fonseca
 
Study Notes - Using an API Gateway
Study Notes - Using an API GatewayStudy Notes - Using an API Gateway
Study Notes - Using an API GatewayRick Hwang
 
Javaone 2016 - Operational Excellence with Hystrix
Javaone 2016 - Operational Excellence with HystrixJavaone 2016 - Operational Excellence with Hystrix
Javaone 2016 - Operational Excellence with HystrixBilly Yuen
 
Lecture on Cloud Computing at Mumbai Education Trust Mumbai , India
Lecture on Cloud Computing at Mumbai Education Trust Mumbai , India Lecture on Cloud Computing at Mumbai Education Trust Mumbai , India
Lecture on Cloud Computing at Mumbai Education Trust Mumbai , India amodkadam
 
Performance tuning Grails applications SpringOne 2GX 2014
Performance tuning Grails applications SpringOne 2GX 2014Performance tuning Grails applications SpringOne 2GX 2014
Performance tuning Grails applications SpringOne 2GX 2014Lari Hotari
 

Similar to 36 Chamber Microservices Kung Fu (20)

FEVR - Micro Frontend
FEVR - Micro FrontendFEVR - Micro Frontend
FEVR - Micro Frontend
 
Microservices for performance - GOTO Chicago 2016
Microservices for performance - GOTO Chicago 2016Microservices for performance - GOTO Chicago 2016
Microservices for performance - GOTO Chicago 2016
 
apidays LIVE Australia - The Evolution of APIs: Events and the AsyncAPI speci...
apidays LIVE Australia - The Evolution of APIs: Events and the AsyncAPI speci...apidays LIVE Australia - The Evolution of APIs: Events and the AsyncAPI speci...
apidays LIVE Australia - The Evolution of APIs: Events and the AsyncAPI speci...
 
Running microservices successfully | Bastian Hofmann | CODEiD
Running microservices successfully | Bastian Hofmann | CODEiDRunning microservices successfully | Bastian Hofmann | CODEiD
Running microservices successfully | Bastian Hofmann | CODEiD
 
Service Mesh Pain & Gain. Experiences from a client project.
Service Mesh Pain & Gain. Experiences from a client project.Service Mesh Pain & Gain. Experiences from a client project.
Service Mesh Pain & Gain. Experiences from a client project.
 
Low latency microservices in java QCon New York 2016
Low latency microservices in java   QCon New York 2016Low latency microservices in java   QCon New York 2016
Low latency microservices in java QCon New York 2016
 
Microservices: Why and When? - Alon Fliess, CodeValue - Cloud Native Day Tel ...
Microservices: Why and When? - Alon Fliess, CodeValue - Cloud Native Day Tel ...Microservices: Why and When? - Alon Fliess, CodeValue - Cloud Native Day Tel ...
Microservices: Why and When? - Alon Fliess, CodeValue - Cloud Native Day Tel ...
 
Challenges behind the scenes of the large Swiss e-Commerce shop apfelkiste.ch...
Challenges behind the scenes of the large Swiss e-Commerce shop apfelkiste.ch...Challenges behind the scenes of the large Swiss e-Commerce shop apfelkiste.ch...
Challenges behind the scenes of the large Swiss e-Commerce shop apfelkiste.ch...
 
High-Speed Reactive Microservices
High-Speed Reactive MicroservicesHigh-Speed Reactive Microservices
High-Speed Reactive Microservices
 
Tef con2016 (1)
Tef con2016 (1)Tef con2016 (1)
Tef con2016 (1)
 
High-Speed Reactive Microservices - trials and tribulations
High-Speed Reactive Microservices - trials and tribulationsHigh-Speed Reactive Microservices - trials and tribulations
High-Speed Reactive Microservices - trials and tribulations
 
NATS in action - A Real time Microservices Architecture handled by NATS
NATS in action - A Real time Microservices Architecture handled by NATSNATS in action - A Real time Microservices Architecture handled by NATS
NATS in action - A Real time Microservices Architecture handled by NATS
 
Nats in action a real time microservices architecture handled by nats
Nats in action   a real time microservices architecture handled by natsNats in action   a real time microservices architecture handled by nats
Nats in action a real time microservices architecture handled by nats
 
Introduction to Serverless through Architectural Patterns
Introduction to Serverless through Architectural PatternsIntroduction to Serverless through Architectural Patterns
Introduction to Serverless through Architectural Patterns
 
Microservices With Istio Service Mesh
Microservices With Istio Service MeshMicroservices With Istio Service Mesh
Microservices With Istio Service Mesh
 
Study Notes - Using an API Gateway
Study Notes - Using an API GatewayStudy Notes - Using an API Gateway
Study Notes - Using an API Gateway
 
Javaone 2016 - Operational Excellence with Hystrix
Javaone 2016 - Operational Excellence with HystrixJavaone 2016 - Operational Excellence with Hystrix
Javaone 2016 - Operational Excellence with Hystrix
 
Lecture on Cloud Computing at Mumbai Education Trust Mumbai , India
Lecture on Cloud Computing at Mumbai Education Trust Mumbai , India Lecture on Cloud Computing at Mumbai Education Trust Mumbai , India
Lecture on Cloud Computing at Mumbai Education Trust Mumbai , India
 
Performance tuning Grails applications SpringOne 2GX 2014
Performance tuning Grails applications SpringOne 2GX 2014Performance tuning Grails applications SpringOne 2GX 2014
Performance tuning Grails applications SpringOne 2GX 2014
 
Kafka/SMM Crash Course
Kafka/SMM Crash CourseKafka/SMM Crash Course
Kafka/SMM Crash Course
 

Recently uploaded

Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...OnePlan Solutions
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmSujith Sukumaran
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样umasea
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作qr0udbr0
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfAlina Yurenko
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfPower Karaoke
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - InfographicHr365.us smith
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesŁukasz Chruściel
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesPhilip Schwarz
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)jennyeacort
 

Recently uploaded (20)

Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalm
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdf
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - Infographic
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New Features
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
 

36 Chamber Microservices Kung Fu

  • 1. The 36th Chamber of Shaolin Improve Your Microservices Kung Fu in 36 Easy Steps freiheit.com technologies - Hamburg, September 29, 2016 code.talks 2016 - Keynote Track
  • 2. This talk derives from more than 17+ years of experience building large-scale Internet systems. © freiheit.com 2
  • 3. Internally we are calling these principles BLACK & WHITE. © freiheit.com 3
  • 4. Black & White principles are principles that are true most of the time. © freiheit.com 4
  • 5. This talk is about Microservices. But as you will see, most of these principles are true for all kinds of systems. © freiheit.com 5
  • 6. Don’t build your own cloud or cluster management. People with far more experience have already done this. Use what is given. © freiheit.com 6
  • 7. Don’t build your own data center and availability zone failover. Again: People with far more experience have already done this. It is difficult. Use what is given. © freiheit.com 7
  • 8. Don’t roll your own service discovery. People with far more experience … - you know the spiel. © freiheit.com 8
  • 9. One container. One service. This is how you should use Docker. © freiheit.com 9
  • 10. I am a big fan of Kubernetes running on GCE or AWS. © freiheit.com 10
  • 11. A microservice provides a set of remote procedure calls that are closely related to each other (high cohesion). ● It should be as small as needed. ● It should do only one thing and do it well. ● It should do 'one thing' entirely. ● It's better to split later than to build it too small at first. ● A split should be simple. © freiheit.com 11
  • 12. Service API Receives requests Returns responses No state, no session, “non-sticky” A MICROSERVICE © freiheit.com 12
  • 13. A microservice starts up fast. Start-up time < 10 sec. © freiheit.com 13
  • 14. A microservice has a low memory footprint. It doesn’t cache large amounts of data. © freiheit.com 14
  • 15. A microservice has well defined resource constraints. Memory/heap limits, CPU limits, swap disabled (or constrained), etc. © freiheit.com 15
  • 16. A microservice has a fast response time. Like 15ms/50th, 50ms/95th and 100ms/99th percentile. © freiheit.com 16
  • 17. A microservice has a low error rates. There will be some 404, 500, 503, etc. But not many. And you should know and understand why they are happening. © freiheit.com 17
  • 18. A microservice differentiates between technical errors and usage errors. Technical is like out of memory, usage is like receiving wrong requests from clients the service is unable to reply and therefore denies to answer. © freiheit.com 18
  • 19. A microservice must be monitored at all times. Monitor response time, request count and errors. Define thresholds and alerts when thresholds are reached. © freiheit.com 19
  • 21. You must be able to trace a request from the client down through all services calls. Each request needs to have a unique ID. © freiheit.com 21
  • 22. A microservice never shares its persistent state (database) with any other microservice. Exception: Importer service writes to database. Online service reads from / writes to database. © freiheit.com 22
  • 23. It is totally okay to use a relational database. Don’t shoot yourself in the foot with Cassandra and NoSQL. Rather use really flat data models, no joins, no complicated queries in a relational database. © freiheit.com 23
  • 24. A microservice should never include both batch and online processing at the same time. Separate batch from online processing to make sure that your online services aren’t getting slow when the batch processing starts. © freiheit.com 24
  • 25. Microservices will and can call other microservices. Call as few other microservices as possible. Prevent circular calls. © freiheit.com 25
  • 26. A microservice answers requests asynchronously. © freiheit.com 26
  • 27. One thread handling requests fast, handing off to worker threads Receives requests Returns responses Many worker threads running in the background ASYNC REQUEST HANDLING © freiheit.com 27
  • 28. A microservice sends requests to other microservices asynchronously. Take a look at reactive programming Rx* or other stuff ... © freiheit.com 28
  • 29. ASYNC CALLING OTHER SERVICES Async Async Async © freiheit.com 29
  • 30. If a downstream service fails your service should still work. Use graceful degradation to return useful responses as long as possible. © freiheit.com 30
  • 31. If you use REST, use it asynchronously. This doesn’t mean “message queues”. © freiheit.com 31
  • 32. It is better to use specialized RPC protocols instead of REST that can handle interface changes better. Like gRPC, Thrift, Finagle. © freiheit.com 32
  • 33. Each request needs a reasonable time-out and must be cancelable. Like with gRPC/Context. © freiheit.com 33
  • 34. All asynchronous downstream work resulting from a request must be cancelable, too. Like with gRPC/Context. © freiheit.com 34
  • 35. A request must be repeatable providing the same result. Requests must be idempotent. © freiheit.com 35
  • 36. Log the right amount of data and create actionable, meaningful log entries. Or you will drown in your logs with unusable information. © freiheit.com 36
  • 37. If you need two or more requests to succeed, you need to implement retry/rollback on error. This is a distributed system. It can fail anytime. © freiheit.com 37
  • 38. No branches. All new code is in the HEAD branch. Update your microservices with very small commits. Few large commits are more unpredictable than lots of small commits that are pushed continuously to your cluster. Your monitoring and alerting will protect you. © freiheit.com 38
  • 39. You must be able to identify which version of your code is currently running in production. You can use the commit rev as a Docker release tag. © freiheit.com 39
  • 40. Design from the beginning how to run integration tests. How to run a test over dozens or hundreds of services, all having separate databases? © freiheit.com 40
  • 41. Share only code where a change doesn’t force everybody to update all their services. Exception: Crypto, security-related code, etc. © freiheit.com 41
  • 42. No commit without tests. The “good feelings” start at code coverage > 85 %. 70 % unit tests, 20 % integration tests, 10 % end-to-end tests. © freiheit.com 42
  • 43. Actively manage your microservices’ lifecycle. Handle SIGTERM, readiness & lifeness probes, etc. © freiheit.com 43
  • 44. Deploy new versions to a canary context first. In Kubernetes you can use namespaces to separate contexts. Measure and compare key KPIs with your production context. © freiheit.com 44
  • 45. Backend-for-frontend helps you to reduce the number of requests and bandwidth consumption of your clients. Fewer requests. The least amount of data transferred. © freiheit.com 45
  • 46. Simulate real-world traffic for load testing. One option is to record live traffic for replay. See https://github.com/buger/gor. © freiheit.com 46
  • 47. Run a chaos monkey in production. It randomly kills services and you will learn if everything is really under control. © freiheit.com 47
  • 48. DevOps doesn’t work if it gets big. You need dedicated Site Reliability Engineers (SREs) to team up with your software engineers. © freiheit.com 48
  • 49. I lied. There were more than 36 steps ... Thank you. freiheit.com technologies gmbh 2016 Want to work with us and create the future? Talk to us! jobs@freiheit.com