Is it possible to control the run-time exeuction of an Akka program?

For testing purposes, I have been trying to figure out a way to control the run-time message passing within an actor system with some sort of external (separate from the acor system) controller. In other words, given an actor system: how do I set up a sort of controller that controls the message passing within it?

For instance, with two actors, A and B: I would want to a controller to do something like:

  1. Actor A received message “Start” from the outside and sends “Message” to Actor B
  2. Perform some blocking logic on the controller, i.e the actor system will idly wait for this logic to be performed.
  3. Now that the logic has been executed, the controller sends a green light for the actor system to resume the message passing.
  4. Actor B receives “Message” and does some work.
  5. Controller checks whether the actor system is terminated, which it is, and performs some additional logic.

In short, I want the external controller to be able to control the message passing within the actor system at run-time.

Is this doable?

Nothing out of the box that would allow something like that with a low level tool.

We have a nice actor testkit which will allow you to test a single actor in isolation as though it had other actors around it (Using TestProbe), this way you could send message “Start” to actor A, let it do it’s thing, verify that it sent the right message to what it thinks is actor B. And then as a separate test case do the same for the actual actor B.
You can read more about the testkit in the docs.

You could probably also write actors interacting with a “controller” to not move forward until they have gotten the green light, etc. But that would be more invasive and effect how they work when not under test as well.

Having that said, a “fuzzing” tool exists and was used to publish a number of scientific papers researching implementation and protocol correctness of RAFT impls (my toy implementation) https://github.com/NetSys/demi

It likely is not easy to use since primary goal was to make the papers published I believe.

This is the home of Distributed Execution Minimizer (DEMi), a fuzzing and test case reducing tool for distributed systems. Currently we only support applications built on top of Akka

Although DEMi’s features are fairly well fleshed out, so far it has only been used by us. That is to say, there isn’t a whole lot of documentation.

One of the blogs which lead to the publication of an actual paper is here: http://colin-scott.github.io/blog/2015/10/07/fuzzing-raft-for-fun-and-profit/

The paper was released here: https://people.eecs.berkeley.edu/~rcs/research/nsdi16.pdf by Colin Scott et al at Berkley

1 Like

@johanandren Thank you for the reply. I was looking around in the testkit, and didn’t really find what I was looking for. For now, I went with the second option, i.e, rewrite the actors so that they interact with the controller before moving forward.

@ktoso This is exactly what I was looking for! Unfortunately, I already started the process of doing the above workaround. However, I will surely read the paper and look at their implementation. Thank you for the invaluable tip.