Microservices Flashcards

(30 cards)

1
Q

How many monolithic projects reach the scale required to use microservice?

A

Only 1%

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

How does a microservices system work/run?

A
  1. Multiple programs
  2. Each runs as multiple processes
  3. Communicate via network messages
  4. Each runs in its own address space
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Why is it important to agree on the form of messages in microservices?

A

To ensure smooth communication and integration between microservices.

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

What is REST in microservices?

A

Representational State Transfer: A commonly used network protocol, a conventional form of HTTP.

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

What are the four REST resource archetypes?

A
  1. Document - File-like resources (GET, PUT, DELETE to read/update/remove the resource)
  2. Controller - External resources (POST causes the resource to carry out a task)
  3. Collection - Directory-like resources with generated names (GET to list the resources, POST to create a new one)
  4. Store - Directory-like resources with given names (GET to list resources, PUT to create a new one)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How does a microservices enterprise typically store its data?

A

In a distributed database, accessed by individual microservices.

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

What is the risk of using a distributed database in microservices?

A

When one microservice updates the database, all others must be aware, causing complexity.

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

What are the two ways to manage distributed transactions?

A
  1. Two-Phase Commit
  2. Sagas
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How does Two-Phase Commit work?

A
  1. A coordinator transaction asks participant transactions to vote on committing.
  2. Participants hold locks until a decision is made.
  3. If all agree, they commit; otherwise, they abort.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is a drawback of Two-Phase Commit?

A

Locks and voting take time, which can make customers have to wait for the transaction to finish.

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

How does the Saga transaction model work?

A
  1. A coordinator asks each participant to commit or abort in sequence.
  2. If one aborts, compensating transactions undo previous commits.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is a drawback of Sagas?

A

They sacrifice atomicity and rely on eventual consistency.

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

How is a microservices system typically scaled?

A

Horizontal scaling: adding machines that run one or more microservice instances.

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

Why is horizontal scaling easier than vertical scaling?

A

Adding machines is simpler than upgrading a monolithic system.

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

Why are microservices more reliable than monoliths?

A

If one microservice crashes, it does not bring down the entire system.

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

How does a load balancer help in microservices?

A

It detects failed microservices and stops sending requests to them.

17
Q

What is the main risk of migrating from a monolith to microservices?

A

The system won’t work while upgrading, which takes time and risks losing customers.

18
Q

What is the Strangler Design Pattern?

A

A method for migrating from a monolithic MVP to microservices by gradually replacing modules behind a façade.

19
Q

How does the Strangler Fig analogy relate to microservices migration?

A
  • The strangler fig grows roots around an existing tree and slowly replaces it.
  • Microservices gradually replace monolithic modules behind a façade.
20
Q

What role does a façade play in microservices migration?

A

It acts as a proxy, ensuring customers don’t notice architecture changes.

21
Q

What are Martin Fowler’s 9 characteristics of microservices?

A
  1. Componentisation via services
  2. Organised around business capabilities
  3. Products not projects
  4. Smart endpoints, dumb pipes
  5. Decentralised governance
  6. Decentralised data management
  7. Infrastructure automation
  8. Design for failure
  9. Evolutionary design
22
Q

What is a component?

A

Something that is independently replaceable and upgradeable.

23
Q

Why should microservices be organised around business capabilities?

A

So that each service team connects directly to users and is judged by business impact.

24
Q

Should microservice endpoints be smart or dumb?

A

Endpoints should be smart, and pipes should be dumb.

25
What is the rule for microservice data management?
Every service should be responsible for its own data and persistence.
26
What must be assumed in any distributed system?
That **things will break**, so failure must be planned for.
27
How big should a microservice be?
Small enough to be developed by a team that can be fed with **two pizzas** (Amazon's idea).
28
What must be in place before adopting microservices?
1. Rapid provisioning 2. Basic monitoring 3. Rapid application deployment 4. DevOps culture
29
What is CRUD?
- Create (POST) - Read (GET) - Update (UPDATE) - Delete (DELETE)
30
What does REST 'add' to HTTP?
REST enforces the use of the available HTTP commands as they were meant to be used.