Building Microservices - Sam Newman Flashcards
(38 cards)
What are Microservices?
Fine grained services, with their own lifecycle, built around a business capability, that collaborate together.
What is the programming principle that Microservices better enforce?
Decoupling (a change to one service should not require a change in another)
Why are Microservices good to test new technologies?
The biggest barrier in adopting new technologies on monolithic systems is the risk associated in changing the whole system.
With Microservices one can choose a service the is low risk to test new technologies.
How can Microservices improve system resilience?
Because when a well designed Microservice fails, it can degrade just part of the system, not everything.
How can Microservices improve scaling?
Because with Microservices one can scale business capabilities independently.
What is the difference between SOA and Microservices?
Deep down they want the same thing: to break monoliths and tackle the problems associated with then.
The difference is that SOA was pretty much driven by Middleware and Tools vendors, that wanted to push their solutions and make money. Microservices arose from real world architectural discussions and solutions for the monolith problem.
How can Microservices improve software deployment?
Changes can be smaller and deploys can be smaller and safer.
What are the 3 main challenges of Microservices over Monoliths?
Deployment coordination is harder
Distributed transactions may appear
Eventual consistency
(revise this after finishing book)
What can help us frame our architectural decision making?
Defining the strategic goals and principles that help us achieve those goals.
Ex:
strategic goal: expand to 30 new countries
principle: every service must be born internationalized
What are two good strategies for encouraging best architectural practices?
Using one real-world service as examplar.
Creating project templates for new services.
What is Hystrix?
It is a circuit breaker library by Netflix that allow to wrap every request to an external service in order to prevent failures and latency to impact the whole system.
In a simple way, what is technical governance?
Is about ensuring that the teams are following the technical vision.
What is a bounded context?
A specific responsibility enforced by explicit boundaries (interface)
Getting service boundaries wrong can be very costly. What is a strategy to mitigate that risk?
Starting with a monolith and define the bounded contexts inside the Monolith. Divide them with modules and once things stabilize, extract the module to a Microservice.
Why you should think about capabilities and not just data to define a service/bounded context?
Because capabilites defines what a service do to other part of the business. Thinking only about data may lead to anemic crud based services.
What is the problem of splitting service boundaries based on technical seams instead of business seams? (ex: split into front end service and backend service)
The service may not be cohesive. A change in one business capability may lead to change in multiple services.
Why integration through database is bad?
Because we are exposing the implementation details of the service that owns the data. Also, it only shares data, not behavior.
What is the difference between orchestrated and choreographed architectural styles for service integration
Orchestrated: a central entity/class controls the process of calling the multiple services that integrate the use case. Generally this is implemented via synchronous request/response.
Choreographed: each services is smarter to understand what it needs to do. Generally a central entity/class would send an event all the collaborating services would listen to the event and act accordingly. This can lead to more loosely coupled services, but the big picture of the process is implicit among the system.
What is RPC?
Remote Procedure Call, is a technique of making a local call and having it execute on a remote service somewhere.
Ex: Java RMI, SOAP
What is the problem of RPC technologies that hide too much of the remote details?
It can trick the developer that he is not making a remote call. The network is always unreliable, and we should deal with local and remote calls very differently
What is HATEOS?
Hypermedia as the engine of application state.
It is a REST principle to reduce coupling between client and server, by using hypermedia links to abstract away the URIs the client need to do some action on a resource
What is the downside of creating client libraries for your api?
It creates a stronger coupling between clients and your api than using, for example, hypermedia for api discovery.
When communication over HTTP not recommended?
When you need very low latency and message size
What is the drawback of asynchronous communication between services using messages?
The need of a broker Middleware increases complexity (more moving parts).
More complex error scenarios