Open Horusiath opened 7 years ago
So if i understand this correctly. It allows one to pin an actor, or a group of actors, to a specific AffinityPool, therefore forcing those actor(s) to always run on a certain thread. Right ?
Yes. There's an article which describes the problem in greater detail: https://blog.scalac.io/improving-akka-dispatcher.html
Isn't this exactly what we did with the very early versions of the dedicated thread pool? Which we later scrapped as zombie actors hogging a thread would prevent any other actors scheduled onto the same thread queue to run.
So at least be weary of the risk here (unless I'm really missing something in the affinity pool)
@rogeralsing I think, we indeed could talk about it in early days, but I cannot recall what were our concerns there. By zombie actors hogging you mean actor doing a long-running thread blocking operations? I guess it's not the issue of dispatcher itself, rather a design issue. There's also a blog post from ScyllaDB, which also seems to choose similar direction.
By zombie actors hogging you mean actor doing a long-running thread blocking operations?
Yes.
And absolutely, but a framework that is supposed to help with fault tolerance and compartmentalization, if that framework lets design issues in one actor cascade over to other actors due to the design of the dispatcher, then that is a bad design in itself.
just my 2 cents, but IMO favoring isolation over synthetic performance gains is better.
I think, we could offer a choice with both - safe, isolated dispatcher vs. constrained affinity pool - question is more, which should be the default. While there should be a way to work with long running thread blocking ops, my bet is that for 99% of the time it's not the case.
First, try it out and see how it works. is there a significant gain? is it worth the risk etc. (Scheduling on .NET != scheduling on JVM. very different behaviors.)
See: https://github.com/akka/akka/pull/23104 and https://github.com/akka/akka/pull/23315
I must admit, this was something I was thinking about myself. We could create a task scheduler, which would pin an actor execution to the particular threads. What I hope for is beside avoiding moving between thread caches, we could potentially fix the problem of loosing actor's
Context
/Self
references in taks continuations.