learning the three types api academy of...
TRANSCRIPT
![Page 1: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/1.jpg)
Learning the Three Types of Microservices
Mike Amundsen@mamund
API Academy
CodeMash 2019http://g.mamund.com/at-newsletter-signup
![Page 2: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/2.jpg)
![Page 3: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/3.jpg)
training.amundsen.com
![Page 4: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/4.jpg)
www.apiacademy.co
![Page 5: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/5.jpg)
http://g.mamund.com/msabook
![Page 6: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/6.jpg)
http://g.mamund.com/cambook
"A reusable guide to the technology, business, and politics of doing APIs
at scale within the enterprise."
-- Kin Lane, API Evangelist
![Page 7: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/7.jpg)
Overview
● Programming the Network● Microservices● Three Types of Microservice Components● Nygard's Stability Patterns● Applying Nygard to Microservices● But Wait, There's More...
![Page 8: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/8.jpg)
Programming the Network
![Page 9: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/9.jpg)
Traveling
![Page 10: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/10.jpg)
Travelingthe Network
![Page 11: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/11.jpg)
Programmingthe Network
![Page 12: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/12.jpg)
![Page 13: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/13.jpg)
![Page 14: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/14.jpg)
"Data on the Inside vs. Data on the Outside, Helland (2005) http://cidrdb.org/cidr2005/papers/P12.pdf
"There is no simultaneity at a distance."
-- Pat Helland (2005)
Programming the Network
Pat Helland
![Page 15: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/15.jpg)
Newton rules the "inside"
Sir Isaac Newton
![Page 16: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/16.jpg)
Einstein rules the "outside"
Albert Einstein
![Page 17: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/17.jpg)
"Data on the Inside vs. Data on the Outside, Helland (2005) http://cidrdb.org/cidr2005/papers/P12.pdf
Programming the Network
Pat Helland
![Page 18: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/18.jpg)
"Data on the Inside vs. Data on the Outside, Helland (2005) http://cidrdb.org/cidr2005/papers/P12.pdf
Programming the Network
Pat Helland
![Page 19: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/19.jpg)
"Data on the Inside vs. Data on the Outside, Helland (2005) http://cidrdb.org/cidr2005/papers/P12.pdf
Programming the Network
Pat Helland
![Page 20: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/20.jpg)
https://en.wikipedia.org/wiki/Fallacies_of_distributed_computing
Fallacies of Distributed Computing (1994)
L Peter Deutsch
![Page 21: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/21.jpg)
The Language of the System, Rich Hickey (2012) https://www.youtube.com/watch?v=ROor6_NGIWU
The Language of the System (2012)
Rich Hickey
![Page 22: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/22.jpg)
Programming the Network brings new challenges
![Page 23: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/23.jpg)
Microservices
![Page 24: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/24.jpg)
"An approach to developing a single application as a suite of
small services, each running in its own process and
communicating with lightweight mechanisms."
-- Martin Fowler, 2014
https://www.thoughtworks.com/insights/blog/microservices-nutshell
![Page 25: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/25.jpg)
"Emphasizes scalability of component interactions, generality of interfaces,
independent deployment of components, and intermediary
components."
-- Roy Fielding, 2000
![Page 26: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/26.jpg)
"A universal linked information system, in which generality and portability are [most] important."
-- Tim Berners-Lee, 1989
![Page 27: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/27.jpg)
Microservice Characteristics
● Make each program do one thing well● Expect the output of every program to be the input of
another program● Design and build software to be tried early● Use tools to lighten the programming task
![Page 28: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/28.jpg)
Unix Operating Principles (1978)
● Make each program do one thing well● Expect the output of every program to be the input of
another program● Design and build software to be tried early● Use tools to lighten the programming task
https://en.wikipedia.org/wiki/Unix_philosophy
![Page 29: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/29.jpg)
Loosely-coupled components running in an
engineered system.
![Page 30: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/30.jpg)
Three Types of Microservices
![Page 31: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/31.jpg)
Three Types of Microservices
● Stateless● Persistence● Aggregator
![Page 32: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/32.jpg)
Stateless Microservices
![Page 33: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/33.jpg)
Stateless Microservices
● Simple processors (converters, translators, etc.)● No dependence on other microservices● No local data storage (disk I/O)
The most common MSC example, but the least useful!
![Page 34: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/34.jpg)
Stateless Microservices
● No shared state● Easy to replace● Easy to scale up
Ephemeral Computing
![Page 35: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/35.jpg)
Stateless Microservices
WARNING: NOT REAL CODE!
![Page 36: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/36.jpg)
Persistence Microservices
![Page 37: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/37.jpg)
Persistence Microservices
● Simple (local) storage (reads and/or writes)● Disk I/O dependent● Possibly VM or one-U dependent
Commonly needed MSC, not the easiest to implement.
![Page 38: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/38.jpg)
Persistence Microservices
● System of Record/Source of Truth● Relatively easy to scale for reads (CQRS)● No cross-service two-phase commits (Saga)
Durable Storage
![Page 39: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/39.jpg)
Persistence Microservices
WARNING: NOT REAL CODE!
![Page 40: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/40.jpg)
Aggregator Microservices
![Page 41: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/41.jpg)
Aggregator Microservices
● Depends on other ("distant") microservices ● Network dependent● Usually Disk I/O dependence, too
The most often-needed; most challenging, too.
![Page 42: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/42.jpg)
Aggregator Microservices
● Sequence vs. Parallel calls● Timing is everything● Easy to scale (should be…)
Workflow Choreography
![Page 43: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/43.jpg)
Aggregator Microservices
WARNING: NOT REAL CODE!
![Page 44: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/44.jpg)
Three Types of Microservices
● Stateless (ephemeral)● Persistence (durable)● Aggregator (workflow)
![Page 45: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/45.jpg)
But, what about the network?
![Page 46: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/46.jpg)
Nygard's Stability Patterns
![Page 47: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/47.jpg)
“Bugs will happen. They cannot be eliminated, so they
must be survived instead.”
-- Michael T. Nygard
![Page 48: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/48.jpg)
![Page 49: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/49.jpg)
Nygard Stability Patterns
● Timeout● Circuit Breaker● Bulkhead● Steady State● Fail Fast● Handshaking
![Page 50: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/50.jpg)
"Nygard Stability Patterns" -- Timeout
"The timeout is a simple mechanism allowing you to stop waiting for an answer once you think it will not come."
-- Chapter 5.1
![Page 51: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/51.jpg)
"Nygard Stability Patterns" -- Timeout
"The timeout is a simple mechanism allowing you to stop waiting for an answer once you think it will not come."
-- Ch 5.1
WARNING: NOT REAL CODE!
![Page 52: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/52.jpg)
"Nygard Stability Patterns" -- Circuit Breaker
"Circuit breakers are a way to automatically degrade functionality when the system is under stress."
-- Chapter 5.2
![Page 53: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/53.jpg)
"Nygard Stability Patterns" -- Circuit Breaker
"Circuit breakers are a way to automatically degrade functionality when the system is under stress."
-- Chapter 5.2
![Page 54: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/54.jpg)
"Nygard Stability Patterns" -- Bulkhead
"The bulkhead enforces a principle of damage containment."-- Chapter 5.3
![Page 55: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/55.jpg)
"Nygard Stability Patterns" -- Bulkhead
"The bulkhead enforces a principle of damage containment."-- Chapter 5.3
![Page 56: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/56.jpg)
"Nygard Stability Patterns" -- Bulkhead
"The bulkhead enforces a principle of damage containment."-- Chapter 5.3
![Page 57: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/57.jpg)
"Nygard Stability Patterns" -- Steady State
"The system should be able to run indefinitely without human intervention."
-- Chapter 5.4● Avoid fiddling● Purge data w/ app logic● Limit caching● Roll the logs
![Page 58: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/58.jpg)
"Nygard Stability Patterns" -- Steady State
"The system should be able to run indefinitely without human intervention."
-- Chapter 5.4● Avoid fiddling● Purge data w/ app logic● Limit caching● Roll the logs
![Page 59: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/59.jpg)
"Nygard Stability Patterns" -- Fail Fast
"If the system can determine in advance that it will fail at an operation, it’s always better to fail fast."
-- Chapter 5.5
![Page 60: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/60.jpg)
"Nygard Stability Patterns" -- Fail Fast
"If the system can determine in advance that it will fail at an operation, it’s always better to fail fast."
-- Chapter 5.5
WARNING: NOT REAL CODE!
![Page 61: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/61.jpg)
"Nygard Stability Patterns" -- Handshaking
"Handshaking is all about letting the server protect itself by throttling its own workload."
-- Chapter 5.6
![Page 62: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/62.jpg)
"Nygard Stability Patterns" -- Handshaking
"Handshaking is all about letting the server protect itself by throttling its own workload."
-- Chapter 5.6
WARNING: NOT REAL CODE!
![Page 63: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/63.jpg)
"Nygard Stability Patterns" -- Cache
"Caching can reduce the load on the server and cut response times to a fraction of what they would be without caching."
-- Chapter 10.2
![Page 64: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/64.jpg)
"Nygard Stability Patterns" -- Cache
"Caching can reduce the load on the server and cut response times to a fraction of what they would be without caching."
-- Chapter 10.2
WARNING: NOT REAL CODE!
![Page 65: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/65.jpg)
"Nygard Stability Patterns" -- Cache
"Caching can reduce the load on the server and cut response times to a fraction of what they would be without caching."
-- Chapter 10.2
WARNING: NOT REAL CODE!
![Page 66: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/66.jpg)
Stabilizing Stateless Microservices
![Page 67: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/67.jpg)
Stateless Microservices
WARNING: NOT REAL CODE!
![Page 68: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/68.jpg)
Networked Stateless
● What if the work takes too long?
![Page 69: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/69.jpg)
Stable Stateless Microservices
1. Fail-Fast
WARNING: NOT REAL CODE!
![Page 70: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/70.jpg)
Stabilizing Persistence Microservices
![Page 71: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/71.jpg)
Persistence Microservices
WARNING: NOT REAL CODE!
![Page 72: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/72.jpg)
Networked Persistence
● What if the work takes too long?● What is the dependent service doesn't respond in time?● What if the dependent service is down?● What if the storage overflows (data, logs, etc.)?
![Page 73: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/73.jpg)
Stable Persistence Microservices
1. Fail-Fast2. Timeout3. Circuit Breaker4. Steady State
WARNING: NOT REAL CODE!
![Page 74: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/74.jpg)
Stabilizing Aggregator Microservices
![Page 75: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/75.jpg)
Aggregator Microservices
WARNING: NOT REAL CODE!
![Page 76: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/76.jpg)
Networked Aggregators
● What if the work takes too long?● What if a dependent services doesn't respond in time?● What if a dependent service is down?● What if storage overflows (data, logs, etc.)?● What if a dependent service is unhealthy?● What if traffic for a service spikes?
![Page 77: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/77.jpg)
Stable Aggregator Microservices
1. Fail-Fast2. Timeout3. Circuit Breaker4. Steady State5. Handshaking6. Bulkhead
WARNING: NOT REAL CODE!
![Page 78: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/78.jpg)
Nygard's Admonition...
![Page 79: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/79.jpg)
Applying Nygard's Patterns to Services● Stateless
○ fail fast● Persistence
○ fail fast, timeout, circuit breaker, steady state● Aggregation
○ fail fast, timeout, circuit breaker, steady state, handshaking, bulkhead
Apply Nygard's Stability Patterns to improve the health
of your components and your system.
![Page 80: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/80.jpg)
![Page 81: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/81.jpg)
https://blogs.technet.microsoft.com/michael_platt/2005/08/30/integration-and-interoperability/
"Interoperation is peer to peer. Integration is where a system is subsumed within another."
-- Michael Platt, Microsoft
Aim for Interop, not Integration...
![Page 82: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/82.jpg)
Aim for Interop, not Integration...
By Wkinterop - Powerpoint -> PNG, CC BY-SA 3.0, https://en.wikipedia.org/w/index.php?curid=35139609
![Page 83: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/83.jpg)
https://blogs.technet.microsoft.com/michael_platt/2005/08/30/integration-and-interoperability/
"There is no simultaneity at a distance."
-- Pat Helland, Salesforce
Include time/distance in your models
Pat Helland
![Page 84: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/84.jpg)
"I'm sorry that coined the term 'objects' for this topic. The big idea is 'messaging'."
Alan Kay, 1998
Include time/distance in your models
![Page 85: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/85.jpg)
https://en.wikipedia.org/wiki/Fallacies_of_distributed_computing
L Peter Deutsch
Remember, you're programming the network
![Page 86: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/86.jpg)
●Safety
Remember, you're programming the network
https://www.w3.org/2011/10/integration-workshop/p/hypermedia-oriented-design.pdf
![Page 87: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/87.jpg)
●Safety The HTTP protocol supports a number of "safe" actions such as HEAD, and GET.
The HTTP methods PUT, POST, and DELETE are categorized as "unsafe" actions.
Remember, you're programming the network
https://www.w3.org/2011/10/integration-workshop/p/hypermedia-oriented-design.pdf
![Page 88: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/88.jpg)
●Safety●Idempotence
Remember, you're programming the network
https://www.w3.org/2011/10/integration-workshop/p/hypermedia-oriented-design.pdf
![Page 89: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/89.jpg)
●Safety●Idempotence
In HTML when a FORM element has the METHOD property set to "get" this represents an idempotent action.
When the same property is set to "post" the affordance represents a non-idempotent action.
Remember, you're programming the network
https://www.w3.org/2011/10/integration-workshop/p/hypermedia-oriented-design.pdf
![Page 90: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/90.jpg)
Other Considerations...
● Interop vs. Integration● Time & Distance● Safety & Idempotence
![Page 91: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/91.jpg)
So...
![Page 92: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/92.jpg)
We need microservices...
![Page 93: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/93.jpg)
So that we can program the network...
![Page 94: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/94.jpg)
Which means applying patterns to our interactions..,
1. Fail-Fast2. Timeout3. Circuit Breaker4. Steady State5. Handshaking6. Bulkhead
![Page 95: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/95.jpg)
And that means understanding the role of semantics...
![Page 96: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/96.jpg)
And the role of distance & time...
![Page 97: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/97.jpg)
And constantly reminding ourselves of the challenge.
![Page 98: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/98.jpg)
That's a lot!
![Page 99: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/99.jpg)
The Best Software Architecture"The best software architecture 'knows' what
changes often and makes that easy."- Paul Clements
![Page 100: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/100.jpg)
Thank you.
![Page 101: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/101.jpg)
http://g.mamund.com/at-newsletter-signup
![Page 102: Learning the Three Types API Academy of …mamund.com/talks/2019-01-codemash/2019-01-codemash-three...Stateless Microservices Simple processors (converters, translators, etc.) No dependence](https://reader035.vdocuments.mx/reader035/viewer/2022071007/5fc4a1d93d101e032d4746a1/html5/thumbnails/102.jpg)
Learning the Three Types of Microservices
Mike Amundsen@mamund
API Academy
CodeMash 2019Please fill out the session survey in the CodeMash app!