4 Flashcards
When is the use of a Circuit Breaker pattern appropriate in micro-service architectures?
P40
Sketch the flow of interactions between two actors that implement the Ask pattern using an ephemeral child actor.
P41
- First, the runner actor will send a message to the asker actor with its own address as the replyTo address.
- The asker actor will create an ephemeral child actor that contains the necessary state to handle the reply to the original request and send the necessary reply back to the original requester. For example, this could simply be the original replyTo address.
- The asker actor will then create a request based on the original request and send it to an emailGateway actor. However, the replyTo address for this message will be this of the ephemeral child actor.
- Once the emailGateway actor finishes processing the message, it sends a reply to the ephemeral child actor.
- The ephemeral child actor processes the response and forwards it to the original requester.
- Finally, the ephemeral child actor will terminate itself, automatically cleaning up any remaining, useless state.
What is the relation between the Builder and the Aggregator design patterns?
P43
The aggregator design pattern includes an ephemeral aggregator child component created to combine
the results of multiple parallel service calls to determine the result of an initial service call.
Thus, this micro-service pattern is used when multiple request-response cycles must be completed
to return a result, but the requests are independent of the responses of other cycles so all cycles can
be executed in parallel.
However, because all responses may arrive at the ephemeral aggregator child in a predetermined
order, it will use a Builder design pattern to build the end result. The Builder design pattern is an OO
software design pattern that provides a class with a number of optional fields. The class provides
methods to set these fields, to provide them with default values, to check if all fields are set and also to
eventually display a result based on the current values in the fields. So the result is “built” slowly
instead of giving all the arguments at once to a constructor to create the result.
The ephemeral aggregator child component will ask the builder after each reponse that arrives
whether enough responses have arrived to generate a result. If so, the accumulated result is sent as a
reply to the original requester.
What implementation logic is required on the side of the sender and the side of the recipient to implement reliably message delivery?
P44
What built-in features does Akka provide to facilitate this task?
P44
Illustrate the Domain Object pattern using an example implementation in Akka.
P45
Highlight the differences between the different types of domain-level and actor-level messages.
P46
What is event sourcing?
P47
Give three advantages and three disadvantages that come with the event sourcing design pattern
P47
Compare three options that architects have to prevent a service from becoming overloaded by
incoming requests
P48
How do the patterns for flow control compare to the circuit breaker pattern?
P49
The patterns for flow control are the Pull Pattern, Managed Queue Pattern and Drop Pattern. The Circuit Breaker Pattern, on the other hand, is a Fault Tolerance Pattern.
Flow control patterns are patterns that add logic primarily on the recipient side to prevent it from being overwhelmed by an overload of requests from senders.
In contrast, the Circuit Breaker Pattern adds logic on the requester’s side to prevent requests to
external services that fail from causing us to fail or falter as well. It is thus a protection against so-called cascading failures.
The Circuit Breaker Pattern will go from a Closed circuit to an Open Circuit on slow responses and fail requests quickly. After a while, it may go back to a Half Open circuit to test with a request to see if the service is already healed and then either go back to Closed or Open state. So the flow of requests can be temporarily intentionally broken if the recipient is overloaded or otherwise failing.
Thus, both the Flow Control Patterns and the Circuit Breaker Pattern will ensure that the recipient has some breathing room to avoid or resolve possible load-induced failures. The Circuit Breaker Pattern also allows on the requester’s side to fail its request quickly so that it does not waste time waiting for negative replies. So both types of Pattern will do attempt to increase system responsiveness.
How does Akka’s implementation of the actor model satisfy the infrastructure desiderata forimplementing fault tolerance?
P50
Implement an example actor system in which normal message processing logic is cleanly separated from fault recovery logic.
P51