2. Microservices Core Concepts Flashcards

1
Q

How do services communicate in a microservices architecture?

A

All communication between services leverage REST over HTTP. There are other methods like event-based communications. However, the intra-service calls are all REST based.

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

What is one of the top concerns when it comes to documenting APIs in microservices architecture and why?

A

Unifying service documentation. There is no standard way of documenting RESTful services. So, developing common means of service documentation is critical, especially in a large organisation.

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

What does the way that the microservices communicate mean for different teams working on the same project, and why?

A

Each team can consume the services of another team, because they all communicate in a common way (REST).

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

What can be said about the concepts of “size” and “operations” in the context of microservices?

A

Size isn’t as critical as operations. A microservice handles one set of related functions with little or no cross-domain operations.

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

In a microservices architecture, what’s the relationship between a service, domain, and objects?

A

A service operates on a well-defined domain. Operations aren’t defined on data objects or business objects. Instead, on the domain as a whole. However, there also might be services that handle a set of related business processes that may spin one or more domains.

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

What kind of services should a microservices architecture include when it comes to dealing with data operations, and what do these services often expose?

A

Very low-level, data-focused services. These services often expose domain-specific CRUD operations on a domain object, but the domain can also spin multiple data objects. You can also build a service to handle a set of related business processes that may span one or more domains.

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

What should the size of a service in a microservices architecture focus on?

A

Domain operations.

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

What are the two common mistakes that a team moving onto a microservices architecture make?

A

Building their services either too fine-grained or not fine-grained enough.

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

What’s the drawback of building too fine-grained services in a microservices architecture?

A

The distribution tax will hit you hard as the latency of calls really kicks in.

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

What is the benefit of having smaller services?

A

They build faster, have fewer test scenarios, and deploy and start up much quicker.

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

What does protocol-aware heterogeneous interoperability mean?

A

Services are bound to a protocol and execute communication over that protocol in a way that works in a mixed, or heterogeneous, environment.

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

What’s the benefit of a microservices architecture when it comes to different teams working in different languages?

A

Each team member can build their services in a language that’s native to them, and then expose those services to others to consume using ReST.

Other teams that need to consume these services don’t need to have any knowledge whatsoever of how the services themselves work, nor do they need to learn some special communication technology. They simply leverage ReST the same way they would if they were calling their own services.

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

Where does the agility of microservices architecture come from?

A

The fact that each team works in a language and framework that is natural to them. This means that they can deliver code quickly because they aren’t constrained by artificial boundaries imposed by the rules of an architecture pattern that’s unknown to them.

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

What is the risk associated with the fact that each service can call any other service in a microservices architecture?

A

There is no clear delineation of who’s calling the service.

There are no constraints on who can call what, which means orchestration is key. Each service must maintain a certain level of passivity in their APIs, or there’s a risk of system failure.

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

What can be said about microservices in regards to distribution and scaling?

A

The communication pattern of microservices lends itself to a truly distributed model. While distribution beyond a single data centre is not a requirement, it definitely is a one of the benefits.

Along with the ability to easily distribute your system as a whole, the microservices architecture model provides for a highly scalable system.

Both of these properties are very powerful for a modern application suite.

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

What does distribution entail in a microservices architecture?

A

Each service is accessed over a remote network call regardless of being in a local or a remote data centre. Therefore, you can theoretically move the services anywhere you want around the globe, and the system will work.

From a reality perspective, though, putting services all over the world is costly both in infrastructure and the latency of the calls themselves. The benefit of this ability, however, shouldn’t be lost on the individual service-to-service calls.

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

What problem does distribution solve in a microservices architecture?

A

Getting infrastructure and services globally available when needed without making all services globally available.

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

How is scalability achieved in a microservices architecture?

A

Each application is independent of every other application in the system. As such, when an individual service comes under load, it can be individually scaled.

In a traditional model, you would have to scale every component in your system to handle the load increases on a single service. A microservices architecture allows you to simply increase the number of instances for a certain service when you experience that load.

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

What are the two “biggest” benefits of a microservices architecture?

A

Distribution and scalability.

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

What are the three low-level costs of a service call in a microservices architecture that mi?

A
  1. Connection setup
  2. Connection teardown
  3. Wire latency
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

What is the significance of latency in a single service in regards to the system as a whole in a microservices architecture?

A

Any latency added to the normal flow can be detrimental to the system as a whole. Latency in a low-level service, or any service for that matter, can become exponentially exaggerated in a model where every call is remote.

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

What is a big risk associated with every service call being remote in a microservices architecture?

A

At a certain point, the latency of service calls can develop into a gridlock of the system as a whole — while calls are waiting for responses, delays can become unbearable. When this occurs, there can be a catastrophic failure of the entire system.

23
Q

What’s the benefit of the way that the services communicate in a microservices architecture.

A

Each team in an organisation can build software as they see fit as long as their services are exposed via REST. Each team can then consume the services of another team because they all communicate in a common way.

24
Q

What can be said about documentation in a microservices architecture?

A

There’s no standard way of documenting RESTful services. Therefore, it is critical to develop common means of service documentation, especially in large organisations.

25
Q

What’s the con of building too fine-grained services in a microservices architecture?

A

The distribution tax will hit you hard as the latency of calls really kicks in.

26
Q

What are circular calls?

A

In a pure microservices architecture, any service can call any other service. This call stack can become circular when a calling service is subsequently called by some downstream service.

27
Q

What negative situation might circular calls cause?

A

A gridlock. If circular calls occur, latency can become a problem much more quickly as multiple services can depend on a service involved in this circular call stack.

28
Q

What pattern can you use to control the negative reactions of the system to gridlock and latency?

A

Circuit Breaker

29
Q

What is the Circuit Breaker pattern and why is it useful?

A

It’s a pattern where you build a standard flow through your application.

When latency starts becoming a problem and time-outs start occurring, it trips the circuit and executes a default behaviour. While the functionality of your system may suffer, it’s often better that this happens rather than a complete failure. When the services are back to normal, the circuit closes and the normal operation through your systems returns.

30
Q

What are the features you can implement to your system to prevent or at least alleviate failure?

A
  1. Strong timeouts
  2. Global distribution of all service offerings
  3. Scaling of individual services under load
  4. Leveraging patterns such as Circuit Breaker
31
Q

What can DDD help us within a microservices architecture?

A

Understanding how to properly decompose an application.

Most of the early mistakes in migrating an existing monolith into a microservices architecture come from either making your services either too granular or not granular enough. The key to finding the sweet spot for granularity is to leverage Domain-Driven Design.

32
Q

What is a common strategy when deciding how to size your microservices?

A

Domain-Driven Design (DDD)

33
Q

What does DDD suggest that we focus on while designing software?

A

The bounded contexts.

34
Q

What are the three core concepts of DDD?

A
  1. Investigate working system
  2. Determine the domains
  3. Break services up accordingly
35
Q

How does DDD contribute to the success of a microservices architecture?

A

DDD promotes the idea of evaluating the domains and building strong bounded contexts, which reduces the number of calls made in your system as a whole. By reducing the distribution tax on your system, you will have better overall system health, which in turn will make your microservices architecture more successful.

36
Q

What is one of the hardest challenges, especially for larger enterprise systems, when it comes to dealing with data transactions in a Microservices architecture?

A

Removing the transactional boundaries in an existing database.

37
Q

What is the recommended way of moving into a Microservices architecture from a Monolith when it comes to dealing with data transaction and why?

A

To start with the services instead of the database, with the overall objective of minimising the cross-domain calls where possible, enforce your needed transaction boundaries, and then start decomposing your databases.

Building services is significantly easier in a live system
than migrating data, especially if you leverage an API layer for those systems.

By starting with the services and having them all connect to the monolithic database, you’ll start to see if your domains are well defined. You can see the traffic flows across the network and leverage that knowledge to start modelling your data itself.

38
Q

What is the less recommended way of moving into a Microservices architecture from a Monolith when it comes to dealing with data transaction and why?

A

To start with the database itself and break it up into smaller databases and then build the associated services.

Migrating data is significantly harder in a live system than building services.

While this may yield a quicker result than starting with microservices first, it tends to put you in a bind if you tend to make a mistake. If you’re well-versed in your system utilization, though, it can be a quicker path.

39
Q

What is ACID the acronym for, and what is it?

A

Atomic, Consistent, Isolated, Durable.

It’s the concept of making sure that you have data integrity across multiple tables in a traditional database.

40
Q

What is an atomic operation?

A

An operation that either succeeds completely or fails completely, with no grey area in between.

41
Q

What is a consistent operation?

A

An operation that guarantees all of the constraints or data model rules will be enforced.

42
Q

What is an isolated operation?

A

An operation where visibility rules are well-defined, such that no other transaction can read data that is not in the correct state.

43
Q

What is a durable operation?

A

An operation that once completed, will be guaranteed to be in the datastore permanently until it is modified in the future.

44
Q

What can be said about the implementation of ACID in regards to Monoliths, SOAs, and Microservices?

A

ACID works beautifully in a monolithic application where there is no distribution. However, in a Service-Oriented Architecture model, it becomes painful. In a microservices model, it simply doesn’t exist.

45
Q

Is ACID used in microservices?

A

No. In microservices, we embrace BASE and strive for eventual consistency.

46
Q

How does the aim of BASE differ from that of ACID?

A

In BASE’s eventual consistency model, we are not guaranteed immediate, atomic, or isolated transactions such as that ACID provides. Instead, BASE aims for a situation where, assuming the data isn’t modified again, we will eventually achieve the end state in all of the nodes across our distributed datastore.

47
Q

What is BASE the acronym for?

A

Basic-Availability, Soft-State, Eventual Consistency

48
Q

What should be the attitude towards eventual consistency when it comes to microservices and why?

A

You should aim for eventual consistency in as many places as possible and it will improve system health as a whole.

49
Q

What two things should API layers not do in microservices?

A

Transformations or executing logic.

50
Q

What is an API layer in a pure microservices architecture?

A

An aggregated proxy of all of your service offerings.

51
Q

What is an API layer used for in a Microservices architecture?

A

To shield the outside world or your clients from knowing the structure, organisation, or even what exact service is exposing a specific operation.

52
Q

What does an API layer provide in a Microservices architecture?

A

A standardised proxy interface that exposes whatever service endpoints and API operations it is configured to expose.

53
Q

What does an API layer bring to the table in the use case of scaling a Microservices architecture?

A

It prevents the client from needing to know the direct IP address and port of the service it’s calling. If every service is exposed through an API proxy layer, you can break the services up or aggregate them and simply have the proxy configuration changed to match the development operations. The clients will not be impacted, period.