我在官方网站上阅读了有关调度员的文档。但目前还不清楚什么调度员是野兽。例如,它可以配置如下:
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
}
Run Code Online (Sandbox Code Playgroud)
问题:
这是否意味着每个actor系统只有一个实例代表任何已配置的调度程序?
一个调度程序的一个实例可以管理多个执行程序(线程池、fork-join 池)吗?
如果每个配置的调度程序只有一个实例,不同的参与者(可能在不同的节点上)如何与其交互?
最简单的方法是将调度程序视为用于运行actor 的线程池(它确实是)。根据您的演员的性质,您可以在 fork-join 线程池(最常见)或 CachedThreadPool(如果您是 dong IO)等上运行它们。我强烈推荐这篇文章,它非常好地解释了线程池。
回答具体问题:
您可以使用上面的配置创建多个相同类型的 Dispatcher。