1

我注意到 2.1 和 2.0 的文档略有不同:

2.0

akka.default-dispatcher.core-pool-size-max = 64
akka.debug.receive = on

2.1

akka.default-dispatcher.fork-join-executor.pool-size-max =64
akka.actor.debug.receive = on

Akka 自己的文档core-pool-size-max类似 2.0 的设置,但pool-size-max不像 2.1。为什么在 2.0 和 2.1 之间会发生这种变化?在 Play 中配置 Akka 的正确方法是什么?这是其中一个版本中的文档错误吗?

(与此同时,我将尝试在我的 Play 2.1 配置中保留这两种配置样式,并希望取得最好的成绩)。

4

1 回答 1

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
  }

"thread-pool-executor"因此,总而言之,如果要使用 ThreadPoolExecutor,则需要设置默认调度程序以使用ThreadPoolExecutor,akka.default-dispatcher.executor = "thread-pool-executor"然后指定该线程池执行程序的配置。

这有帮助吗?

干杯,√</p>

于 2013-05-12T13:38:22.860 回答