Akka Flashcards

(62 cards)

1
Q

Akka is made up of

A

Modules that are distributed as JAR files

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

What does the Akka concept of ‘let it crash?’ anticipate

A

There will be cases of individual handlers failing to carry out their tasks, and it is prepared to reroute that work to avoid a catastrophic failure.

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

What happens if the failure occurs up the chain?

A

Underlings can carry on until a new supervisor arrives. There is no broken chain, and most importantly, it is no longer the duty of the developer to find all the ways that chain might break catastrophically and provide specialized handling for each case

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

Actors are lightweight because

A

They run on top of dispatchers

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

How many threads fit in 1GB of memory and how many actors

A

4096

2.7 Million

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

How do you get an actor reference to an actor in the hierarchy?

A

You use the actor path

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

actors are a lot like ___________ without the configuration and ________ ________
installation overhead

A

message queues

message broker

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

Messages are simple data structures that …

A

can’t be changed after they’ve been created,

or in a single word, they’re immutable.

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

Actors can receive messages one at a time and execute some behaviour whenever a
message is received. Unlike queues, they can

A

also send messages

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

What are the points made in the reactive manifesto

A

 Blocking I/O limits opportunities for parallelism, so nonblocking I/O is preferred.
 Synchronous interaction limits opportunities for parallelism, so asynchronous interaction is preferred.
 Polling reduces opportunity to use fewer resources, so an event-driven style is preferred.
 If one node can bring down all other nodes, that’s a waste of resources. So you need isolation of errors (resilience) to avoid losing all your work.

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

What two goals should we aim for in attempting to make applications scalable?

A

Complexity must stay as low as possible.

Resources must be used as efficiently as possible while you scale the application

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

Scaling out with ____ and scaling up with ____ are not good ideas

A

RPC

Low level threading

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

Why is scaling out with RPC not a good idea?

A

Every RPC call needs to bloc the current thread and wait for a response from the network. Impeded the goal of using resources efficiently.

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

Why is using a combination of RPC and threading not a good idea?

A

You need to know exactly where you scale up or scale out. (Increase in complexity)

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

Spinning up thousands of servers is simple today, but

A

the same cannot be said for programming them

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

Actors are nothing new at all, in and of themselves. It’s … that make them unique

A

It is the way that actors are provided in Akka to scale applications both up and out on the JVM

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

This type of database is often called a journal

A

when changes are kept as a sequence of events

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

The technique of storing changes as a sequence of events is called

A

event sourcing

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

How can event sourcing be kept consistent across two servers?

A

sharding or partitioning

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

Most general purpose programming languages are written in sequence. A ________ ______ ____ is required to bridge the gap between sequential definition and parallel execution

A

concurrent programming model

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

Whereas parallelization is all about executing processes simultaneously, concurrency concerns itself with

A

defining processes that can function simultaneously, or can overlap in time, but don’t necessarily need to run simultaneously.

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

An actor is a lightweight process that has only four core operations:

A

create, send, become, and supervise

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

Any actor can be a supervisor but

A

only for actors that it creates itself

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

How are actors decoupled?

A

on three axes - namely

  • Space / location
  • Time
  • Interface
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
What happens when an actor is decoupled in space
An actor gives no guarantee and has no expectation about where another actor is located
26
What happens when an actor is decoupled in time
An actor gives no guarantee and has no expectation about when its work will be done
27
What happens when an actor is decoupled from interface - that is it has no defined interface
The actor has no expectation about which messages other components can understand.
28
The first thing that every Akka application does is ...
Create the Actor System
29
Which actors can the actor system create
The so called top-level actors
30
The actor system can create so called top-level actors, and it’s a common pattern to
Create only one top-level actor for all actors in the application. The Supervisor actor that monitors everything
31
An ActorSystem returns an address to create the top-level actor instead of the actor itself. This is called an
ActorRef
32
An ActorSystem returns an address to the created top-level actor instead of the actor itself. This address is called an ActorRef. The ActorRef can be used to send messages to the actor. This makes sense when you think about the fact that
the actor could be on another server
33
Sometimes you would like to look up an actor in the actor system this is where _____ _____ come in.
Actor Paths come in
34
You could compare the hierarchy of actors to a URL path structure. Every actor has a name. This name needs to be ...
unique per level in the hierarchy: two sibling actors can’t have the same name
35
All actor references can be located directly by
an actor path (absolute or relative)
36
What does a dispatcher do?
pushes the messages in the mailbox through the actors
37
The type of dispatcher determines ...
which threading model is used to push the messages through
38
All kinds of dispatchers can be configured in some way, and you can allocate a dispatcher to an
- actor - a specific group of actors - all of the actors in a system
39
When you send a message to an actor, all you are really doing is
leaving a message behind in its mailbox. Eventually a dispatcher will push it through the actor
40
Per the REST conventions, a GET whose URL ends with an entity type should return
a list of known instances of that entity
41
Why is implicit val ec = system.dispatcher needed in order to call Http().bindAndHandle
bindAndHandle is asynchronous and requires an implicit ExecutionContext
42
what happens after | implicit val system = ActorSystem()
the actor system is immediately available
43
When you define an implicit val with execution context it does what?
determines which execution context will be used by Future(s) in scope of its definition
44
Dispatchers implement the ExecutionContext interface and can thus be
used to run Future invocations etc.
45
an asynchronous method returns a ______ before it is completed
future
46
How would you program an actor to respond to a message assuming there were three types of message namely Larry, Curly and Mo
``` def receive = { case Larry(punch) => case Curly() => case Mo(something) => } ```
47
actors created with the context of another actor are
its children and subject to the parent actor’s supervision
48
what does | Http().bindAndHandle(api, host, port) do?
``` binds the routes defined in the RestApi (api) to the HTTP server It is asynchronous so it returns a 'future' before it is completed ```
49
Services interfaces, as they grow, need
more sophisticated routing of requests
50
Actors exist in a supervision hierarchy - what does this mean
each actor has a supervisor and can have one or several child actors for which it is responsible
51
An actor can send and receive messages of any kind using the _______ method
receive
52
An actor can send and receive messages of any kind using the receive method, which is a so-called partial function that uses ...
Scala’s pattern matching to figure out which case statement will deal with the incoming message.
53
What is a partial function?
A partial function is a function that does not provide an answer for every possible input value it can be given
54
Since the ’90s, nothing much has changed in how programming languages support networking, either. Many technologies still essentially use ____________ to communicate over the network
RPC (remote procedure calls)
55
One doomsday scenario is where you’d need to pay increasingly more for more underutilized resources. Another nightmare scenario is
where the complexity of the application shoots through the roof when more resources are added.
56
Spinning up thousands of servers is simple today, but
the same cannot be said for programming them
57
It shouldn’t matter if we send a message locally on one server or remotely to another. So we need _______________________________ It will also need to ________________________________. This is one of the things that _______ does for you.
1. some service that takes care of sending the messages to actors on other servers if necessary. 2. It will also need to keep track of where actors live and be able to provide references so other servers can communicate with the actors. 3. Akka
58
This is the biggest impediment to building applications that can recover from failure and scale according to demand.
Coupling components in location, time, and interface is the biggest impediment to building applications that can recover from failure and scale according to demand.
59
The messages that an actor can receive or send back on a request are bundled together in
the actors’ companion object
60
If an actor is created using the system - as in | createBoxOffice = system.actorOf(BoxOffice.props, BoxOffice.name) how are the child actors created?
Using their context | CreateTicketSeller = context.actorOf(TicketSeller.props(name), name)
61
What does a materializer do?
makes actors execute a graph to produce results
62
A graph, in its simplest form, consists of
a source that provides elements, and a sink that consumes elements.