Akka中如何为不同的调度器指定不同的吞吐量值?
How to specify different throughput values for different dispatchers in Akka?
我的 Akka Actor 系统有许多不同的调度程序。在我的 application.conf
文件中,示例类似于以下内容...
market-dispatcher {
executor = "thread-pool-executor"
type = PinnedDispatcher
thread-pool-executor.allow-core-timeout=off
}
现在我想通过指定吞吐量值来进一步配置我的调度程序。我已经尝试了明显的解决方案...
market-dispatcher {
executor = "thread-pool-executor"
type = PinnedDispatcher
thread-pool-executor.allow-core-timeout=off
throughput = 1000
}
...但我没有注意到系统性能有任何明显差异。是否可以为各个调度程序单独配置吞吐量?
是的,您可以配置每个调度程序的吞吐量。但是对于您的示例,对于 PinnedDispatcher,吞吐量设置将被忽略。来自文档:
Throughput defines the maximum number of messages to be processed per
actor before the thread jumps to the next actor.
但是,PinnedDispatcher
dedicates a unique thread for each actor
所以线程永远不会跳转到另一个演员。
由于很难理解 PinnedDispatcher 和设置吞吐量的组合,因此在这种情况下忽略了吞吐量设置。
关于您的评论:
This means at most 8 < 10 threads can make progress at any point in
time and thus, at any point in time, 2 of the actors using the
PinnedDispatcher will have idle threads.
我想我不明白你的例子。在我的理解中,线程空闲意味着 actor 没有消息要处理,而不是 运行 上没有 CPU 核心。所有 10 个都可以 运行 启用或空闲,与内核数量无关。
I am trying to understand how to control the point at which an actor
using a PinnedDispatcher stops making progress and is forced to idle
in this case.
你的意思是被迫放弃核心?通过使用 PinnedDispatcher,您是说您将此决定留给了 OS 调度程序。似乎您想 "yield" 在处理大量消息后显式线程。我认为这是相当不常见的,而不是 Akka 内置的东西。 "natural" 屈服点将在处理 吞吐量 数量的消息之后,这将适用于其他类型的调度程序。
为什么首先使用 PinnedDispatcher?
我的 Akka Actor 系统有许多不同的调度程序。在我的 application.conf
文件中,示例类似于以下内容...
market-dispatcher {
executor = "thread-pool-executor"
type = PinnedDispatcher
thread-pool-executor.allow-core-timeout=off
}
现在我想通过指定吞吐量值来进一步配置我的调度程序。我已经尝试了明显的解决方案...
market-dispatcher {
executor = "thread-pool-executor"
type = PinnedDispatcher
thread-pool-executor.allow-core-timeout=off
throughput = 1000
}
...但我没有注意到系统性能有任何明显差异。是否可以为各个调度程序单独配置吞吐量?
是的,您可以配置每个调度程序的吞吐量。但是对于您的示例,对于 PinnedDispatcher,吞吐量设置将被忽略。来自文档:
Throughput defines the maximum number of messages to be processed per actor before the thread jumps to the next actor.
但是,PinnedDispatcher
dedicates a unique thread for each actor
所以线程永远不会跳转到另一个演员。
由于很难理解 PinnedDispatcher 和设置吞吐量的组合,因此在这种情况下忽略了吞吐量设置。
关于您的评论:
This means at most 8 < 10 threads can make progress at any point in time and thus, at any point in time, 2 of the actors using the PinnedDispatcher will have idle threads.
我想我不明白你的例子。在我的理解中,线程空闲意味着 actor 没有消息要处理,而不是 运行 上没有 CPU 核心。所有 10 个都可以 运行 启用或空闲,与内核数量无关。
I am trying to understand how to control the point at which an actor using a PinnedDispatcher stops making progress and is forced to idle in this case.
你的意思是被迫放弃核心?通过使用 PinnedDispatcher,您是说您将此决定留给了 OS 调度程序。似乎您想 "yield" 在处理大量消息后显式线程。我认为这是相当不常见的,而不是 Akka 内置的东西。 "natural" 屈服点将在处理 吞吐量 数量的消息之后,这将适用于其他类型的调度程序。 为什么首先使用 PinnedDispatcher?