Week 2 - Monoliths, Microservices and Communication Flashcards

1
Q

What is a monolith?

A

Where products are programs from a collection of modules, run by a single process. All communication is by procedural calls.

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

Name 3 advantages of monoliths.

A

Modules can be made to correspond directly to business functions identified by domain-driven design.

Modules can be developed by teams working to agreed interfaces through permissionless innovation.

The program as a whole can be easily deployed from version control automatically.

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

What is the microservice architectural style?

A

Where products are applications from a collection of microservices, each a separate program run by a separate process. All communication between microservices is by message passing.

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

What is Conway’s Law?

A

Any organisation that designs a system (defined more broadly here than just information systems) will inevitably produce a design whose structure is a copy of the organisation’s communication structure.

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

What are the two approaches to building a software product MVP?

A

Microservices early and microservices late.

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

What is the microservices late approach?

A

When building a system, first build a single large monolith before (if successful) migrating to many small microservices.

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

What is the idea of microservices late?

A

To enter the marketplace early with a (perhaps poorly-structured) product, ready to learn from the customer.

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

What is the microservices early approach?

A

To begin with microservices when building a system.

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

What is the idea of microservices early?

A

To enter the marketplace later with a better-structured product, ready to make the customer segment pivot.

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

What do the best microservice designs have?

A

High cohesion and loose coupling.

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

What is high cohesion and how does it help microservice design?

A

Related functionality is to be found in one component, while unrelated functionality is to be found in others.

This helps because, should functionality need changing, only one component needs changing.

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

What is loose coupling and how does it help microservice design?

A

Changing one component does not necessitate changing others.

This helps because, should the functionality of one component be changed, no other components need changing.

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

What are advantages of microservices?

A

Development is easier because each microservice can use whatever technology is best for it.

Deployment is easier because each microservice can be released just when it is ready.

Robustness is increased because the failure of one microservice doesn’t cause the failure of another.

Scaling is improved because the resources for one microservice don’t need to be the same as those for another.

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

How does the Strangler pattern manage migrations from monoliths to microservices?

A

The Strangler pattern manages migrations by putting an intermediary facade in front of the monolith.

Initially, the facade provides access to modules.

As modules are replaced by microservices behind the facade, it provides access to them instead.

In this way, the monolith is slowly “strangled” by microservices, which eventually kill it.

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

What does the the Least Knowledge principle say?

A

Components should only know about the structure of components they deal with directly.

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

What does the Don’t Repeat Yourself (DRY) principle say?

A

That things that are duplicated should be merged.

17
Q

What does the Single Responsibility (SRP) principle say?

A

Components should only have one responsibility, and so only one reason to change.

18
Q

What does the microservice bus do?

A

Connects microservices together with an open, pluggable framework.

19
Q

The microservice bus has a single communication protocol, data format and interface convention. What are they?

A

HTTP, JSON and REST

20
Q

What is HTTP?

A

Hypertext Transfer Protocol - a synchronous protocol where the client sends a request and then blocks until a server sends a response.

21
Q

What does a HTTP request consist of?

A

A request line, some headers and an optional body.

22
Q

What are the HTTP request methods and what do they do?

A

POST, GET, PUT and DELETE operate on resources described by URIs (Universal Resource Identifiers).

23
Q

What does a HTTP response consist of?

A

A status line, some headers and an optional body.

24
Q

What do these HTTP statuses mean?
200
400
500

A

200 - OK (everything went well)
400 - Bad Request (client went wrong)
500 - Internal Server Error (server went wrong)

25
Q

What is the data format of the microservice bus?

A

JSON (JavaScript Object Notation)

26
Q

What is the interface convention for the microservice bus?

A

REST (Representational State Transfer)

27
Q

What are the four resource archetypes?

A

Document, Collection, Store, Controller

28
Q

What do microservices provide?

A

One or more resources (larger resources made by plugging smaller resources together).

29
Q

Describe the document resource archetype.

A

Describes operations on file-like resources:
- GET reads the file and returns its contents
- PUT updates the file with its given contents
- DELETE deletes the file

30
Q

Describe the collection resource archetype.

A

Describes operations on directory-like resources:
- GET reads the directory and returns a list of the resources it contains
- POST creates a new resource in the directory with given contents, choosing the resource name and returning it (it chooses the name)

31
Q

Describe the store resource archetype.

A

Describes possible operations on directory-like resources:
- GET reads the directory and returns a list of the resources it contains
- PUT either creates a new resource in the directory using the given resource name and contents, or updates an existing one (you choose the name)

32
Q

Describe the controller resource archetype.

A

Described possible operations on external resources:
- POST causes the external resource to carry out some task and returns any result

33
Q

What is gRPC?

A

Google Remote Procedure Call - an alternative to REST. Services connected using gRPC are defined using protocol buffers (for typed safety) and exchange binary data (for efficient transfer).