[英]Understanding dispatchers in akka
我在官方网站上阅读了有关调度员的文档。 但尚不清楚哪个调度员是野兽。 例如,可以将其配置如下:
my-thread-pool-dispatcher {
# Dispatcher is the name of the event-based dispatcher
type = Dispatcher
# What kind of ExecutionService to use
executor = "thread-pool-executor"
# Configuration for the thread pool
thread-pool-executor {
# minimum number of threads to cap factor-based core number to
core-pool-size-min = 2
# No of core threads ... ceil(available processors * factor)
core-pool-size-factor = 2.0
# maximum number of threads to cap factor-based number to
core-pool-size-max = 10
}
# Throughput defines the maximum number of messages to be
# processed per actor before the thread jumps to the next actor.
# Set to 1 for as fair as possible.
throughput = 100
}
问题:
这是否意味着每个actor系统仅由一个实例表示的任何已配置的调度程序?
调度程序的一个实例可以管理多个执行程序(线程池,派生联接池)吗?
如果每个已配置的调度程序只有一个实例,那么不同的参与者(也许在不同的节点上)如何与之交互?
最简单的方法是将调度程序视为用于运行角色的线程池(实际上是线程池)。 根据角色的性质,您可以在fork-join线程池(最常见)或CachedThreadPool(如果您是IO专家)等上运行它们。我强烈建议您这篇文章,它很好地解释了线程池。
要回答具体问题:
您可以使用上面的配置创建多个相同种类的分派器。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.