multithreadingakkaakka-clusterakka-remote-actorakka-dispatcher

Which dispatcher configuration in AKKA is efficient for more no of actor processing in parallel?


When we us pinned dispatcher we have to assign a single thread for an actor.
In Default dispatcher we have a thread pool with a allocated threads used by many actors.

If we use a dispatcher with 1000 threads and for a 5000 actors sharing that.
How to efficiently configure it when more than 1000 actors receiving messages in mailbox.

What are the things to configured in dispatcher end to use threads efficient way.


Solution

  • The PinnedDispatcher uses a different threadpool (of size 1) for every actor, so if you have 5000 actors using a pinned dispatcher, there will be up to 5000 threads (because idle threadpools will be shutdown and restarted as needed).

    The pinned dispatcher is intended to be used with a fairly small number of very busy actors; what exactly a small number is depends on the application and the infrastructure it's running on, but in general any number greater than 100 is almost certainly not fairly small for this purpose. You can have multiple dispatchers in an application: the vast majority of your actors will be best off running in other dispatchers.