How can I manage the number of cores used by Akka?

I am working with scala and akkov actors and have not found a way to manage cpu cores to manage the level of parallelism, is this possible with akka? or transparent to the programmer ?.

+3


source to share


2 answers


I don't know what exactly you mean by "control of processor cores", so I am assuming that you are asking if it is possible to control threads in Akka. Direct control (i.e. creating them with Thread.start()

and using them to process messages is not possible, but still Akka is very flexible when it comes to configuring flow control.

At its lowest level, Akka uses Dispatcher

s
, which bind members to thread pools. For example, Akka's default executor uses ForkJoinPool

for all message processing. Dispatchers can be the default for ActorSystem

, or they can be specified for each actor; this is explained in detail in the official documentation.



So, you can say that Akka manages threads transparently to the programmer, but if you really want to customize its behavior, you can always do it with the proper configuration.

+3


source


Akka MessageDispatcher is how you control the number of threads used in akka. All MessageDispatcher implementations are also ExecutionContext, which means they can be used to execute arbitrary code like Futures.



See http://doc.akka.io/docs/akka/snapshot/scala/dispatchers.html

+2


source







All Articles