Scala 在Play 2.x中配置演员的正确方法是什么?

Scala 在Play 2.x中配置演员的正确方法是什么?,scala,playframework,playframework-2.0,akka,playframework-2.1,Scala,Playframework,Playframework 2.0,Akka,Playframework 2.1,我注意到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.default-dispatcher.core-pool-size-max = 64 akka.debug.r

我注意到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.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
具有类似2.0的
核心池最大大小设置,但没有类似2.1的
池最大大小设置。为什么会在2.0和2.1之间发生变化?在游戏中配置Akka的正确方法是什么?这是其中一个版本中的文档错误吗


(同时,我将尝试在我的Play 2.1配置中使用这两种配置样式,并希望是最好的)。

首先,始终使用您所使用版本的文档,在您的情况下,您将链接到快照文档,该文档用于未发布的Akka版本(即快照)

下面是2.1.2文档:(也可以从doc.akka.io访问)

当我们查看该页面时,我们会看到fork join executor和thread pool executor的示例配置下显示:“有关更多选项,请参阅配置的默认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
  }
#如果您设置了“executor=”线程池executor“
线程池执行器{
#保持线程的活动时间
保持活动时间=60秒
#最小线程数以cap因子为基础的核心数
核心池大小最小值=8
#核心池大小因子用于确定线程池核心大小
#使用以下公式:ceil(可用处理器*系数)。
#然后,结果大小由核心池大小min和
#核心池大小最大值。
核心池大小系数=3.0
#要限制的最大线程数基于要限制的线程数的系数
核心池最大大小=64
#最小线程数到cap因子基于最大线程数到
#(如果使用有界任务队列)
最大池大小最小值=8
#最大线程数(如果使用有界任务队列)由
#计算:ceil(可用处理器*系数)
最大池大小系数=3.0
#最大线程数到cap基于系数的最大线程数到
#(如果使用有界任务队列)
最大池大小max=64
#指定任务队列的有界容量(<1==无界)
任务队列大小=-1
#指定将使用哪种类型的任务队列,可以是“数组”或
#“链接”(默认)
任务队列类型=“已链接”
#允许核心线程超时
允许核心超时=开启
}
因此,总而言之,如果要使用ThreadPoolExecutor,需要通过
akka.default-dispatcher.executor=“thread pool executor”
将默认调度程序设置为使用
“thread pool executor”
,然后指定该线程池执行器的配置

这有用吗

干杯,

首先,始终使用您正在使用的版本的文档,在您的情况下,您将链接到快照文档,该文档用于未发布的Akka版本(即快照)

下面是2.1.2文档:(也可以从doc.akka.io访问)

当我们查看该页面时,我们会看到fork join executor和thread pool executor的示例配置下显示:“有关更多选项,请参阅配置的默认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
  }
#如果您设置了“executor=”线程池executor“
线程池执行器{
#保持线程的活动时间
保持活动时间=60秒
#最小线程数以cap因子为基础的核心数
核心池大小最小值=8
#核心池大小因子用于确定线程池核心大小
#使用以下公式:ceil(可用处理器*系数)。
#然后,结果大小由核心池大小min和
#核心池大小最大值。
核心池大小系数=3.0
#要限制的最大线程数基于要限制的线程数的系数
核心池最大大小=64
#最小线程数到cap因子基于最大线程数到
#(如果使用有界任务队列)
最大池大小最小值=8
#最大线程数(如果使用有界任务队列)由
#计算:ceil(可用处理器*系数)
最大池大小系数=3.0
#最大线程数到cap基于系数的最大线程数到
#(如果使用有界任务队列)
最大池大小max=64
#指定任务队列的有界容量(<1==无界)
任务队列大小=-1
#指定将使用哪种类型的任务队列,可以是“数组”或
#“链接”(默认)
任务队列类型=“已链接”
#允许核心线程超时
允许核心超时=开启
}
因此,总而言之,如果要使用ThreadPoolExecutor,需要通过
akka.default-dispatcher.executor=“thread pool executor”
将默认调度程序设置为使用
“thread pool executor”
,然后指定该线程池执行器的配置

这有用吗

干杯,

嗯,我不想改变执行器,只是调整默认的一个,就像Play的配置中的示例一样-我只是想知道为什么Play 2.1的文档不同于Play 2.0-这是一个真正的API更改,还是一个文档错误。不管怎样,我只想设置
核心池大小最大值
池大小最大值
。但您需要更改设置以实现正确的实现。默认的调度程序使用fork-join-executor,因此除非您更改executor,否则您必须更改其设置。请参阅文档。嗯,我不想更改执行器,只需调整默认的执行器,如Play的配置中的示例所示-我只是想知道为什么Play 2.1的文档与Play 2.0不同-这是一个真正的API更改,还是一个docs错误。不管怎样,我只想设置
核心池大小最大值
池大小最大值
。但您需要更改设置以实现正确的实现。默认dispatcher使用fork-join-executor,因此您必须更改其设置,除非您使用c