0

Akka documentation says here: The ask operation involves creating an internal actor for handling this reply, which needs to have a timeout after which it is destroyed in order not to leak resources

Is there any way we can stop this internal actor creation?

Prog_G
  • 1,539
  • 1
  • 8
  • 22

2 Answers2

1

If you still want to ask, then it will create that internal actor regardless, and there is no way to avoid.

If you want to avoid the internal actor for whatever reason, you will have to use tell instead of ask.

yiksanchan
  • 1,890
  • 1
  • 13
  • 37
  • But under some scenario where the system wants to have a synchronous communication for every event in the streaming pipeline ask will be a heavy operation because it will include the creation and termination of an internal actor. – Prog_G Oct 20 '20 at 03:43
  • @Prog_G can you help elaborate the scenario? What does the streaming pipeline does and why do you want to have synchronous communication? – yiksanchan Oct 20 '20 at 16:03
0

There is no way to avoid this : ask() results in an actor created in the /temp/ namespace.

Some notes on the above :

Actor creation is very lightweight. Creating an actor is virtually no overhead. Doing ask() in a stream is perfectly valid. Just don't block.

Igmar Palsenberg
  • 637
  • 4
  • 10
  • there is some performance impact because of internal actor creation. Please take a look at this issue. https://github.com/akkadotnet/akka.net/issues/3784 – Prog_G Nov 05 '20 at 03:52