a tale of two microservices - pablo chacin
TRANSCRIPT
![Page 1: A tale of two microservices - Pablo Chacin](https://reader034.vdocument.in/reader034/viewer/2022042707/58f2a3021a28ab9c698b457d/html5/thumbnails/1.jpg)
A Tale of Two MicroservicesPablo Chacin@pablochacin
![Page 2: A tale of two microservices - Pablo Chacin](https://reader034.vdocument.in/reader034/viewer/2022042707/58f2a3021a28ab9c698b457d/html5/thumbnails/2.jpg)
Who is talking
20+ years experience
CTO of a startup
PhD in Distributed Systems
Software Architect
All things backend nut
Bare-hand developer (have an issue with frameworks)
Retro-futuristic technology observer
![Page 3: A tale of two microservices - Pablo Chacin](https://reader034.vdocument.in/reader034/viewer/2022042707/58f2a3021a28ab9c698b457d/html5/thumbnails/3.jpg)
Most of the industry feels like …
But this time we are going to use microservices
We have this new project, with tight deadlines
And we are going to rule ….
![Page 4: A tale of two microservices - Pablo Chacin](https://reader034.vdocument.in/reader034/viewer/2022042707/58f2a3021a28ab9c698b457d/html5/thumbnails/4.jpg)
But things are more likely to end like this
![Page 5: A tale of two microservices - Pablo Chacin](https://reader034.vdocument.in/reader034/viewer/2022042707/58f2a3021a28ab9c698b457d/html5/thumbnails/5.jpg)
Are we talking about the same?
So, I’m doing this microservices stuff ...
Yeah, you mean REST api and containers, right?
![Page 6: A tale of two microservices - Pablo Chacin](https://reader034.vdocument.in/reader034/viewer/2022042707/58f2a3021a28ab9c698b457d/html5/thumbnails/6.jpg)
This is not an ideological debate
It is a journey to explore the two dominant microservice approaches
Expect to clarify concepts and help in making sound design decisions.
What is this talk about
![Page 7: A tale of two microservices - Pablo Chacin](https://reader034.vdocument.in/reader034/viewer/2022042707/58f2a3021a28ab9c698b457d/html5/thumbnails/7.jpg)
Microservice Architecture describes a particular way of designing software applications
There are certain common characteristics
There is no precise definition of this architectural style
Martin Fowler
Back to the basics
Independently deployable
Organized around Business Capabilities
Smart endpoints and dumb pipes
Decentralized Governance
Decentralized Data Management
Infrastructure Automation
![Page 8: A tale of two microservices - Pablo Chacin](https://reader034.vdocument.in/reader034/viewer/2022042707/58f2a3021a28ab9c698b457d/html5/thumbnails/8.jpg)
Just SOA by another name?
Complex applications are composed of small, independent services communicating with each other using APIs.
These services are small, highly decoupled and focus on doing a small task
![Page 9: A tale of two microservices - Pablo Chacin](https://reader034.vdocument.in/reader034/viewer/2022042707/58f2a3021a28ab9c698b457d/html5/thumbnails/9.jpg)
Decoupled? That’s just like your opinion, man
![Page 10: A tale of two microservices - Pablo Chacin](https://reader034.vdocument.in/reader034/viewer/2022042707/58f2a3021a28ab9c698b457d/html5/thumbnails/10.jpg)
Coupling
Services that interact with others suffer differents types of coupling
Time (synchronization)
Location (binding)
Knowledge (schema)
Control (orchestration)
Context (transactions)
State (persistence)
![Page 11: A tale of two microservices - Pablo Chacin](https://reader034.vdocument.in/reader034/viewer/2022042707/58f2a3021a28ab9c698b457d/html5/thumbnails/11.jpg)
Exactly, what could possibly go Wrong?
![Page 12: A tale of two microservices - Pablo Chacin](https://reader034.vdocument.in/reader034/viewer/2022042707/58f2a3021a28ab9c698b457d/html5/thumbnails/12.jpg)
Law of conservation of complexity
“When we break big things into small pieces we invariably push the complexity to their interactions”
Michael Feathers
https://michaelfeathers.silvrback.com/microservices-until-macro-complexity
![Page 13: A tale of two microservices - Pablo Chacin](https://reader034.vdocument.in/reader034/viewer/2022042707/58f2a3021a28ab9c698b457d/html5/thumbnails/13.jpg)
What we can learn from the (recent) past
“I predicted that in the next few years all the suite of WS-* standards will be re-invented for micro services, and it will be the fourth time I have seen such a set of standards being re-invented” - Greg Young
![Page 14: A tale of two microservices - Pablo Chacin](https://reader034.vdocument.in/reader034/viewer/2022042707/58f2a3021a28ab9c698b457d/html5/thumbnails/14.jpg)
How to decouple services?
![Page 15: A tale of two microservices - Pablo Chacin](https://reader034.vdocument.in/reader034/viewer/2022042707/58f2a3021a28ab9c698b457d/html5/thumbnails/15.jpg)
Microservices - Services the Unix Way
“Write programs that do one thing and do it well. Write programs to work together. Write programs to handle text streams, because that is a universal interface”
Doug McIlroy
![Page 16: A tale of two microservices - Pablo Chacin](https://reader034.vdocument.in/reader034/viewer/2022042707/58f2a3021a28ab9c698b457d/html5/thumbnails/16.jpg)
Know your services
A Service is the authority for a given business capability everywhere:
Owns of all the data that support this business capability
Enforces business rules
Is autonomous: does not rely on any other service
![Page 17: A tale of two microservices - Pablo Chacin](https://reader034.vdocument.in/reader034/viewer/2022042707/58f2a3021a28ab9c698b457d/html5/thumbnails/17.jpg)
Service boundaries
Define service data boundaries so that consistency can be achieved within one service but is not necessary between services
Most transactionality problems can be solved by looking at the use case and re-evaluating the consistency thesis
![Page 18: A tale of two microservices - Pablo Chacin](https://reader034.vdocument.in/reader034/viewer/2022042707/58f2a3021a28ab9c698b457d/html5/thumbnails/18.jpg)
Event based communication
Asynchronous signaling by means of events
Events != messaging
log files anyone?
No global transactions
No coupling
No shared state
![Page 19: A tale of two microservices - Pablo Chacin](https://reader034.vdocument.in/reader034/viewer/2022042707/58f2a3021a28ab9c698b457d/html5/thumbnails/19.jpg)
Sagas: distributed coordination without transactions
A coordinator of long-running processes
Subscribe to relevant events from multiple services
Keep process’ progress state
Triggers new events to drive process work flow
Emits compensating events to handle failures
![Page 20: A tale of two microservices - Pablo Chacin](https://reader034.vdocument.in/reader034/viewer/2022042707/58f2a3021a28ab9c698b457d/html5/thumbnails/20.jpg)
One brief example
![Page 21: A tale of two microservices - Pablo Chacin](https://reader034.vdocument.in/reader034/viewer/2022042707/58f2a3021a28ab9c698b457d/html5/thumbnails/21.jpg)
A typical order fulfillment system
(source: Microservices: It’s not (only) the size that matters, it’s (also) how you use them by Jeppe Cramon)
![Page 22: A tale of two microservices - Pablo Chacin](https://reader034.vdocument.in/reader034/viewer/2022042707/58f2a3021a28ab9c698b457d/html5/thumbnails/22.jpg)
An example
(taken from Microservices: It’s not (only) the size that matters, it’s (also) how you use them by Jeppe Cramon)
![Page 23: A tale of two microservices - Pablo Chacin](https://reader034.vdocument.in/reader034/viewer/2022042707/58f2a3021a28ab9c698b457d/html5/thumbnails/23.jpg)
Complex Service UI Integration
(taken from Microservices: It’s not (only) the size that matters, it’s (also) how you use them – part 5 by Jeppe Cramon)
Traditional service mashups just shifts service coupling one layer up to to UI
If services own data everywhere, they must supply also a display of this data
Platform specific apps (IOS, Android) poses a challenge
![Page 24: A tale of two microservices - Pablo Chacin](https://reader034.vdocument.in/reader034/viewer/2022042707/58f2a3021a28ab9c698b457d/html5/thumbnails/24.jpg)
I strongly recommend reading “Microservices: It’s not (only) the size that matters, it’s (also) how you use them”, a series of articles by Jeppe Cramon
Kudos
https://www.tigerteam.dk/2014/micro-services-its-not-only-the-size-that-matters-its-also-how-you-use-them-part-1/
![Page 25: A tale of two microservices - Pablo Chacin](https://reader034.vdocument.in/reader034/viewer/2022042707/58f2a3021a28ab9c698b457d/html5/thumbnails/25.jpg)
Conclusions
“Life is pain. Anyone saying differently is selling something”
Iñigo Montoya
![Page 26: A tale of two microservices - Pablo Chacin](https://reader034.vdocument.in/reader034/viewer/2022042707/58f2a3021a28ab9c698b457d/html5/thumbnails/26.jpg)
Questions? … Thanks!