0
votes

I started using Akka in my project in order to introduce parallelization and enhance the performance of my application.

In this regard, I have a question related to the use of the getContext.parent() method versus the GetSender() method, when one needs to send a message back to an actor who is both the parent of the current actor, and the sender of the currently-handled message.

Context of the question

My program creates a system with a Report actor, and child Page actors.

I have my Report actor asking each page to perform various treatments with a getToWork message, and the Page sends back a jobFinished message to the Report actor, so that it knows every page is done.

Questions

Which, between getContext().parent().tell (using ActorRef.noSender() for the getToWork message) and getSender().tell() (using getSelf() for the getToWork message):

  • Is the fastest?
  • Is the most memory-efficient?
  • Is the least prone to errors?

Considering that I work on a Big Data project, which will have to treat as many objects as quickly as possible, these questions interests me.

1

1 Answers

0
votes

I don't see any big differences in efficiency between the alternatives. Sending to the sender might make your actors a little easier to test and/or refactor.