SlideShare a Scribd company logo
1 of 36
Microservices
What are they, why use them, and how?
Who Am I?
Rob Raisch
Senior Staff Software Engineer @ Yieldbot
Team Lead - Config Services
More than 30 years online experience - "Internet Greybeard"
Overview
What are Microservices?
Definition, History
Why are they desirable?
Characteristics, Drawbacks
How should I organize/define them?
Business Domains
How about a quick example?
What Are Microservices?
What are Microservices? - Definition
An Architectural Design Pattern of:
Small, Autonomous Modular Services
That Are Independently and Automatically Deployable
Using Lightweight Communication Mechanisms
What are Microservices? - Definition
An Architectural Design Pattern of:
Small, Autonomous Modular Services
That Are Independently and Automatically Deployable
Using Lightweight Communication Mechanisms
Do Only One Thing And Do It Well
What are Microservices? - Example
Monolithic Service
Graphic blatently stolen from microservices.io
What are Microservices? - Example
Microservices
Graphic blatently stolen from microservices.io
Microservices - History
A World of Small Interconnected Things
Unix Pipefitting - $> cat file.txt | awk '{print $2}' | sort | uniq > result.txt
Remote Procedure Call (RPC) - ASN.1, CORBA/IDL, etc.
Message Passing and Event Busses - Document Object Model, PubSub, ZeroMQ, etc.
SOA - XML, WSDL, SOAP, etc.
Microservices
Microservices - History
A World of Small Interconnected Things
Unix Pipefitting - $> cat file.txt | awk '{print $2}' | sort | uniq > result.txt
Remote Procedure Call (RPC) - ASN.1, CORBA/IDL, etc.
Message Passing and Event Busses - Document Object Model, PubSub, ZeroMQ, etc.
SOA - XML, WSDL, SOAP, etc.
Everything is deeply intertwingled. - Ted Nelson
Why Are Microservices Desirable?
Why Are Microservices Desirable?
Why Are Microservices Desirable?
Why Are Microservices Desirable?
Increase Cohesion
Reduce Coupling
Improved Resilience
Optimized for Replaceability
Better Alignment With Business Processes
Better Composability
Better Scaling
Technological Heterogeneity
Why Are Microservices Desirable?
Increase Cohesion
Group related functionality together
"Gather together those things that change for the same reason and separate
those things that change for different reasons."
- Robert C. Martin's Single Responsibility Principle
Why Are Microservices Desirable?
Reduce Coupling - Separation of responsibilities
Coupling - the manner and degree of interdependence between software
components.
Connascence - where a change to one software component requires changes
to other components.
Why Are Microservices Desirable?
Improved Resilience
Monolithic systems tend to fail completely.
Design so a failure of one software component will not cause the entire system
to fail, thus improving overall "fault tolerance"
Service boundaries become natural "bulkheads" and so reduce the "cascade"
of failure.
Why Are Microservices Desirable?
Optimized for Replaceability
As long as service contracts remain the same, all components can be easily
replaced.
Lessen technical debt
Reduce costs to replace underlying technologies
Why Are Microservices Desirable?
Better Alignment With Business Processes
Organized around business domains
Reduce development team size
Help focus participation from elsewhere in the organization
Why Are Microservices Desirable?
Better Composability
Monolithic systems cannot be easily reorganized as needs change
Lots of little independent workers that can be organized in different ways
Better software reuse - "DRY it up!"
Why Are Microservices Desirable?
Better Scaling
In Monolithic systems, everything must be scaled together
Using routing, requests can be directed to one of several instances of the
same service (see nginx)
The architecture can be scaled as needed
Why Are Microservices Desirable?
Technological Heterogeneity
Monolithic systems are typically written in a single language.
No requirement that all services be expressed in the same language
Use "the right tool for the right job"
Why Are Microservices Desirable?
Ease of Deployment
New functionality can be easily deployed as needed.
No "BIG" deploys reduce downtime.
"Deliver often" - Continuous Integration/Deployment
What Are The Drawbacks Of Microservices?
Distributed systems can be much more complex than monolithic ones.
The "Big Picture" can be difficult to envision without good documentation.
Operational Overhead
Interactions can be hard to track without copious, centralized logging.
Network latency must be monitored and managed well.
Why Are Microservices Desirable?
Why Are Microservices Desirable?
How Should Microservices Be
Designed?
How Should Microservices Be Designed?
Identify Domains Aligned to Business Units
Authorization
Payments - Deposits, Ledgers, Reconciliation
Billing
Reporting
Support
Not Components! Responsibilities!
How Should Microservices Be Designed?
Identify Stakeholders And Include Them In Design Process
Carve Out Well-Defined Functionality
Keep Martin's Single Responsibility Principle in mind at all times.
How Should Microservices Be Designed?
Identify Stakeholders And Include Them In Design Process
Carve Out Well-Defined Functionality
Keep Martin's Single Responsibility Principle in mind at all times.
"Gather together those things that change for the same reason and separate those
things that change for different reasons."
How Should Microservices Be Designed?
The BIG QUESTION:
How to determine the best size for a microservice?
How Should Microservices Be Designed?
The BIG QUESTION:
How to determine the best size for a microservice?
The BIG ANSWER:
As Small As They Need To Be To Solve A Need
How Should Microservices Be Designed?
The BIG QUESTION:
How to determine the best size for a microservice?
The BIG ANSWER:
As Small As They Need To Be To Solve A Need
BUT NO SMALLER!
Why Are Microservices Desirable?
Why Are Microservices Desirable?
An Example Using Node/Seneca
Microservice in Seneca - Server
const _ = require('lodash');
const SenecaFactory = require('seneca');
const seneca = SenecaFactory();
seneca.add('cmd:sum', (msg, respond) => {
let errs = [];
const left = Number(_.get(msg,'left',0));
const right = Number(_.get(msg,'right',0));
if(_.isNaN(left)) errs.push(new Error('left operand must evaluate to a number'));
if(_.isNaN(right)) errs.push(new Error('right operand must evaluate to a number'));
if(errs.length) {
respond(errs);
}
else {
const result = Math.floor(left) + Math.floor(right);
respond(null, { answer: result });
}
});
Microservice in Seneca - Server Side Call
// To call microservice from the same process…
seneca.act({cmd: 'sum', left: 1, right: 2}, (err, result) => {
if (err) {
console.error(err);
return;
}
console.log(`The result is ${result}`);
});
Summary
Architectural Pattern of Small, Independent Loosely-Coupled Services
Many Useful Benefits For Medium/Large Systems
Though By No Means A Panacea!
Do Only One Thing But Do It Very Well
Organize Around Business Domains
Carve Out Well-Defined Functionality
As Small As Needs Dictate But No Smaller
Summary
Architectural Pattern of Small, Independent Loosely-Coupled Services
Many Useful Benefits For Medium/Large Systems
Though By No Means A Panacea!
Do Only One Thing But Do It Very Well
Organize Around Business Domains
Carve Out Well-Defined Functionality
As Small As Needs Dictate But No Smaller
We Are Hiring!
IT Lead
Engineering Manager, Infrastructure
Front End Software Engineer
Server-side Javascript Engineer
DevOps Engineer
Software Test Engineer - Ad Serving Platform
Platform Software Engineer - Ad Serving
Thanks for your time!
rraisch@yieldbot.com

More Related Content

Viewers also liked

4kl ch o_test-2008
4kl ch o_test-20084kl ch o_test-2008
4kl ch o_test-2008Rosislide
 
Data as Currency - OPS
Data as Currency - OPSData as Currency - OPS
Data as Currency - OPSyieldbot
 
Instructions by the symbol ppt
Instructions by the symbol pptInstructions by the symbol ppt
Instructions by the symbol pptkamatchipmu
 
Make Your Own Charting Library with d3
Make Your Own Charting Library with d3Make Your Own Charting Library with d3
Make Your Own Charting Library with d3yieldbot
 
Real-time Intent Beyond Search
Real-time Intent Beyond SearchReal-time Intent Beyond Search
Real-time Intent Beyond Searchyieldbot
 
Bel 4 kl-10_maj_2010-test_klyuchove
Bel 4 kl-10_maj_2010-test_klyuchoveBel 4 kl-10_maj_2010-test_klyuchove
Bel 4 kl-10_maj_2010-test_klyuchoveRosislide
 
Звук и буква Оо, По телефона
Звук и буква Оо, По телефонаЗвук и буква Оо, По телефона
Звук и буква Оо, По телефонаRosislide
 
Building a Lambda Architecture with Elasticsearch at Yieldbot
Building a Lambda Architecture with Elasticsearch at YieldbotBuilding a Lambda Architecture with Elasticsearch at Yieldbot
Building a Lambda Architecture with Elasticsearch at Yieldbotyieldbot
 
Подробен преразказ на разказ
Подробен преразказ на разказПодробен преразказ на разказ
Подробен преразказ на разказRosislide
 

Viewers also liked (11)

4kl ch o_test-2008
4kl ch o_test-20084kl ch o_test-2008
4kl ch o_test-2008
 
Data as Currency - OPS
Data as Currency - OPSData as Currency - OPS
Data as Currency - OPS
 
Mapa capitulo 4 con audio
Mapa capitulo 4 con audioMapa capitulo 4 con audio
Mapa capitulo 4 con audio
 
Instructions by the symbol ppt
Instructions by the symbol pptInstructions by the symbol ppt
Instructions by the symbol ppt
 
Make Your Own Charting Library with d3
Make Your Own Charting Library with d3Make Your Own Charting Library with d3
Make Your Own Charting Library with d3
 
Real-time Intent Beyond Search
Real-time Intent Beyond SearchReal-time Intent Beyond Search
Real-time Intent Beyond Search
 
Bel 4 kl-10_maj_2010-test_klyuchove
Bel 4 kl-10_maj_2010-test_klyuchoveBel 4 kl-10_maj_2010-test_klyuchove
Bel 4 kl-10_maj_2010-test_klyuchove
 
Звук и буква Оо, По телефона
Звук и буква Оо, По телефонаЗвук и буква Оо, По телефона
Звук и буква Оо, По телефона
 
Building a Lambda Architecture with Elasticsearch at Yieldbot
Building a Lambda Architecture with Elasticsearch at YieldbotBuilding a Lambda Architecture with Elasticsearch at Yieldbot
Building a Lambda Architecture with Elasticsearch at Yieldbot
 
Vietnamese cuisine
Vietnamese cuisineVietnamese cuisine
Vietnamese cuisine
 
Подробен преразказ на разказ
Подробен преразказ на разказПодробен преразказ на разказ
Подробен преразказ на разказ
 

Recently uploaded

Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)simmis5
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college projectTonystark477637
 
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTINGMANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTINGSIVASHANKAR N
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations120cr0395
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...Call Girls in Nagpur High Profile
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxupamatechverse
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...roncy bisnoi
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingrknatarajan
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduitsrknatarajan
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Bookingdharasingh5698
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdfKamal Acharya
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Glass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesGlass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesPrabhanshu Chaturvedi
 
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxBSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxfenichawla
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur EscortsRussian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 

Recently uploaded (20)

Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college project
 
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTINGMANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptx
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduits
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdf
 
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINEDJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Glass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesGlass Ceramics: Processing and Properties
Glass Ceramics: Processing and Properties
 
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxBSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur EscortsRussian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
 

Microservices metrowest web developers 2016-09-14

  • 1. Microservices What are they, why use them, and how?
  • 2. Who Am I? Rob Raisch Senior Staff Software Engineer @ Yieldbot Team Lead - Config Services More than 30 years online experience - "Internet Greybeard"
  • 3. Overview What are Microservices? Definition, History Why are they desirable? Characteristics, Drawbacks How should I organize/define them? Business Domains How about a quick example?
  • 5. What are Microservices? - Definition An Architectural Design Pattern of: Small, Autonomous Modular Services That Are Independently and Automatically Deployable Using Lightweight Communication Mechanisms
  • 6. What are Microservices? - Definition An Architectural Design Pattern of: Small, Autonomous Modular Services That Are Independently and Automatically Deployable Using Lightweight Communication Mechanisms Do Only One Thing And Do It Well
  • 7. What are Microservices? - Example Monolithic Service Graphic blatently stolen from microservices.io
  • 8. What are Microservices? - Example Microservices Graphic blatently stolen from microservices.io
  • 9. Microservices - History A World of Small Interconnected Things Unix Pipefitting - $> cat file.txt | awk '{print $2}' | sort | uniq > result.txt Remote Procedure Call (RPC) - ASN.1, CORBA/IDL, etc. Message Passing and Event Busses - Document Object Model, PubSub, ZeroMQ, etc. SOA - XML, WSDL, SOAP, etc. Microservices
  • 10. Microservices - History A World of Small Interconnected Things Unix Pipefitting - $> cat file.txt | awk '{print $2}' | sort | uniq > result.txt Remote Procedure Call (RPC) - ASN.1, CORBA/IDL, etc. Message Passing and Event Busses - Document Object Model, PubSub, ZeroMQ, etc. SOA - XML, WSDL, SOAP, etc. Everything is deeply intertwingled. - Ted Nelson
  • 11. Why Are Microservices Desirable? Why Are Microservices Desirable? Why Are Microservices Desirable?
  • 12. Why Are Microservices Desirable? Increase Cohesion Reduce Coupling Improved Resilience Optimized for Replaceability Better Alignment With Business Processes Better Composability Better Scaling Technological Heterogeneity
  • 13. Why Are Microservices Desirable? Increase Cohesion Group related functionality together "Gather together those things that change for the same reason and separate those things that change for different reasons." - Robert C. Martin's Single Responsibility Principle
  • 14. Why Are Microservices Desirable? Reduce Coupling - Separation of responsibilities Coupling - the manner and degree of interdependence between software components. Connascence - where a change to one software component requires changes to other components.
  • 15. Why Are Microservices Desirable? Improved Resilience Monolithic systems tend to fail completely. Design so a failure of one software component will not cause the entire system to fail, thus improving overall "fault tolerance" Service boundaries become natural "bulkheads" and so reduce the "cascade" of failure.
  • 16. Why Are Microservices Desirable? Optimized for Replaceability As long as service contracts remain the same, all components can be easily replaced. Lessen technical debt Reduce costs to replace underlying technologies
  • 17. Why Are Microservices Desirable? Better Alignment With Business Processes Organized around business domains Reduce development team size Help focus participation from elsewhere in the organization
  • 18. Why Are Microservices Desirable? Better Composability Monolithic systems cannot be easily reorganized as needs change Lots of little independent workers that can be organized in different ways Better software reuse - "DRY it up!"
  • 19. Why Are Microservices Desirable? Better Scaling In Monolithic systems, everything must be scaled together Using routing, requests can be directed to one of several instances of the same service (see nginx) The architecture can be scaled as needed
  • 20. Why Are Microservices Desirable? Technological Heterogeneity Monolithic systems are typically written in a single language. No requirement that all services be expressed in the same language Use "the right tool for the right job"
  • 21. Why Are Microservices Desirable? Ease of Deployment New functionality can be easily deployed as needed. No "BIG" deploys reduce downtime. "Deliver often" - Continuous Integration/Deployment
  • 22. What Are The Drawbacks Of Microservices? Distributed systems can be much more complex than monolithic ones. The "Big Picture" can be difficult to envision without good documentation. Operational Overhead Interactions can be hard to track without copious, centralized logging. Network latency must be monitored and managed well.
  • 23. Why Are Microservices Desirable? Why Are Microservices Desirable? How Should Microservices Be Designed?
  • 24. How Should Microservices Be Designed? Identify Domains Aligned to Business Units Authorization Payments - Deposits, Ledgers, Reconciliation Billing Reporting Support Not Components! Responsibilities!
  • 25. How Should Microservices Be Designed? Identify Stakeholders And Include Them In Design Process Carve Out Well-Defined Functionality Keep Martin's Single Responsibility Principle in mind at all times.
  • 26. How Should Microservices Be Designed? Identify Stakeholders And Include Them In Design Process Carve Out Well-Defined Functionality Keep Martin's Single Responsibility Principle in mind at all times. "Gather together those things that change for the same reason and separate those things that change for different reasons."
  • 27. How Should Microservices Be Designed? The BIG QUESTION: How to determine the best size for a microservice?
  • 28. How Should Microservices Be Designed? The BIG QUESTION: How to determine the best size for a microservice? The BIG ANSWER: As Small As They Need To Be To Solve A Need
  • 29. How Should Microservices Be Designed? The BIG QUESTION: How to determine the best size for a microservice? The BIG ANSWER: As Small As They Need To Be To Solve A Need BUT NO SMALLER!
  • 30. Why Are Microservices Desirable? Why Are Microservices Desirable? An Example Using Node/Seneca
  • 31. Microservice in Seneca - Server const _ = require('lodash'); const SenecaFactory = require('seneca'); const seneca = SenecaFactory(); seneca.add('cmd:sum', (msg, respond) => { let errs = []; const left = Number(_.get(msg,'left',0)); const right = Number(_.get(msg,'right',0)); if(_.isNaN(left)) errs.push(new Error('left operand must evaluate to a number')); if(_.isNaN(right)) errs.push(new Error('right operand must evaluate to a number')); if(errs.length) { respond(errs); } else { const result = Math.floor(left) + Math.floor(right); respond(null, { answer: result }); } });
  • 32. Microservice in Seneca - Server Side Call // To call microservice from the same process… seneca.act({cmd: 'sum', left: 1, right: 2}, (err, result) => { if (err) { console.error(err); return; } console.log(`The result is ${result}`); });
  • 33. Summary Architectural Pattern of Small, Independent Loosely-Coupled Services Many Useful Benefits For Medium/Large Systems Though By No Means A Panacea! Do Only One Thing But Do It Very Well Organize Around Business Domains Carve Out Well-Defined Functionality As Small As Needs Dictate But No Smaller
  • 34. Summary Architectural Pattern of Small, Independent Loosely-Coupled Services Many Useful Benefits For Medium/Large Systems Though By No Means A Panacea! Do Only One Thing But Do It Very Well Organize Around Business Domains Carve Out Well-Defined Functionality As Small As Needs Dictate But No Smaller
  • 35. We Are Hiring! IT Lead Engineering Manager, Infrastructure Front End Software Engineer Server-side Javascript Engineer DevOps Engineer Software Test Engineer - Ad Serving Platform Platform Software Engineer - Ad Serving
  • 36. Thanks for your time! rraisch@yieldbot.com