我注意到2.1和2.0的文档之间略有不同:
akka.default-dispatcher.core-pool-size-max = 64
akka.debug.receive = on
akka.default-dispatcher.fork-join-executor.pool-size-max =64
akka.actor.debug.receive = on
Akka's own documentation的core-pool-size-max
设置为2.0,但没有像pool-size-max
那样的2.1。为什么这在2.0和2.1之间变化?在Play中配置Akka的正确方法是什么?这是其中一个版本的文档错误吗?
(与此同时,我将尝试在我的Play 2.1配置中坚持使用两种配置样式并希望获得最佳效果。)
答案 0 :(得分:1)
首先,请始终使用您正在使用的版本的文档,如果您要链接到未发布的Akka版本(即快照)的快照文档。
以下是2.1.2文档:http://doc.akka.io/docs/akka/2.1.2/scala/dispatchers.html(也可从doc.akka.io访问)
当我们查看该页面时,我们看到在fork-join-executor和thread-pool-executor的示例配置下,它说:“有关更多选项,请参阅default-dispatcher部分配置。“,链接到:
我们可以找到的地方:
# This will be used if you have set "executor = "thread-pool-executor""
thread-pool-executor {
# Keep alive time for threads
keep-alive-time = 60s
# Min number of threads to cap factor-based core number to
core-pool-size-min = 8
# The core pool size factor is used to determine thread pool core size
# using the following formula: ceil(available processors * factor).
# Resulting size is then bounded by the core-pool-size-min and
# core-pool-size-max values.
core-pool-size-factor = 3.0
# Max number of threads to cap factor-based number to
core-pool-size-max = 64
# Minimum number of threads to cap factor-based max number to
# (if using a bounded task queue)
max-pool-size-min = 8
# Max no of threads (if using a bounded task queue) is determined by
# calculating: ceil(available processors * factor)
max-pool-size-factor = 3.0
# Max number of threads to cap factor-based max number to
# (if using a bounded task queue)
max-pool-size-max = 64
# Specifies the bounded capacity of the task queue (< 1 == unbounded)
task-queue-size = -1
# Specifies which type of task queue will be used, can be "array" or
# "linked" (default)
task-queue-type = "linked"
# Allow core threads to time out
allow-core-timeout = on
}
总而言之,如果要使用ThreadPoolExecutor,"thread-pool-executor"
,则需要将default-dispatcher设置为使用akka.default-dispatcher.executor = "thread-pool-executor"
,然后为该线程池执行程序指定配置。
这有帮助吗?
干杯, √