Building Microservices - Sam Newman Flashcards

1
Q

What are Microservices?

A

Fine grained services, with their own lifecycle, built around a business capability, that collaborate together.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the programming principle that Microservices better enforce?

A

Decoupling (a change to one service should not require a change in another)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Why are Microservices good to test new technologies?

A

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 well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How can Microservices improve system resilience?

A

Because when a well designed Microservice fails, it can degrade just part of the system, not everything.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How can Microservices improve scaling?

A

Because with Microservices one can scale business capabilities independently.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is the difference between SOA and Microservices?

A

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 well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How can Microservices improve software deployment?

A

Changes can be smaller and deploys can be smaller and safer.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What are the 3 main challenges of Microservices over Monoliths?

A

Deployment coordination is harder
Distributed transactions may appear
Eventual consistency

(revise this after finishing book)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What can help us frame our architectural decision making?

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What are two good strategies for encouraging best architectural practices?

A

Using one real-world service as examplar.

Creating project templates for new services.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is Hystrix?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

In a simple way, what is technical governance?

A

Is about ensuring that the teams are following the technical vision.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is a bounded context?

A

A specific responsibility enforced by explicit boundaries (interface)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Getting service boundaries wrong can be very costly. What is a strategy to mitigate that risk?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Why you should think about capabilities and not just data to define a service/bounded context?

A

Because capabilites defines what a service do to other part of the business. Thinking only about data may lead to anemic crud based services.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

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)

A

The service may not be cohesive. A change in one business capability may lead to change in multiple services.

17
Q

Why integration through database is bad?

A

Because we are exposing the implementation details of the service that owns the data. Also, it only shares data, not behavior.

18
Q

What is the difference between orchestrated and choreographed architectural styles for service integration

A

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.

19
Q

What is RPC?

A

Remote Procedure Call, is a technique of making a local call and having it execute on a remote service somewhere.
Ex: Java RMI, SOAP

20
Q

What is the problem of RPC technologies that hide too much of the remote details?

A

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

21
Q

What is HATEOS?

A

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

22
Q

What is the downside of creating client libraries for your api?

A

It creates a stronger coupling between clients and your api than using, for example, hypermedia for api discovery.

23
Q

When communication over HTTP not recommended?

A

When you need very low latency and message size

24
Q

What is the drawback of asynchronous communication between services using messages?

A

The need of a broker Middleware increases complexity (more moving parts).
More complex error scenarios

25
Q

What are Reactive Extensions? (Rx)

A

A mechanism to compose the result of multiple calls together and run operations on them. You compose observables of remote calls.

26
Q

What is a “tolerant reader”?

A

It is a client that is tolerant to change in the data that is return to it by our services. Example is a client that uses a deserialization technology for our service response that is tolerant to the addition of new data or removal of unused data.

27
Q

What are the difficulties of maintaining two versions of a service running (an older endpoint and a newer endpoint)?

A
  • two branches of the same codebase to be maintained
  • complexity of routing clients to the correct service
  • database model must support both versions of the codebase
28
Q

What is the problem of developing an UI that calls multiple backend services?

A

This communication can be chatty and consume too mutch internet bandwidth from the client.

29
Q

What is a pattern to solve the problem of chatty communication between UI and multiple backend services?

A

The backends for front-end pattern, whereby we create backend services that serve a specific front-end and aggregate calls for other backends

30
Q

What is the strangler pattern?

A

It is a pattern used to break an existing monolith into smaller Microservices.
You begin by identifying domain concepts and creating proxy Microservices for those concepts, delegating to the monolith. When every domain concept is covered you can begin implementing the proxies with real implementation.

31
Q

What is a seam?

A

It is a portion of the code of a system that can be treated in isolation and worked on without impacting the rest of the codebase.

32
Q

What are the two phases in a two-phase commit algorithm?

A
  1. Voting: participants vote if they can commit their local transaction
  2. Commit: participants commit
33
Q

What is the name of the software that coordinated a distributed transaction?

A

Transaction Manager

34
Q

In terms of Microservices and boundary definition, what is the best thing to do when you encounter a business process or state that must be kept consistent at all times?

A

Avoid splitting the state or process in multiple services to maintain the possibility of using transactions

35
Q

If we have a reporting system for our service what is the downside of having it access the service database?

A

The database becomes a contract (Api) between them.

36
Q

What are the three ways that a reporting tool can consume data from multiple services?

A
  1. Acessing each services reporting specific APIs
  2. Create a data pump process on service side that sends new data to reporting tool/db
  3. Use service events as data pump to the reporting tool
37
Q

What is a solution for mitigating the long time it takes for provisioning tools (ansible, chef), to set up all the software in the machine?

A

We can create virtual machine images with the necessary software already installed.

38
Q

What is the concept of immutable servers?

A

The ideia is to store all environment and service configuration of a host in source control. Service host is always created based on that configuration and manual change in the host is not allowed.