[英]Understanding dispatchers in akka
我在官方網站上閱讀了有關調度員的文檔。 但尚不清楚哪個調度員是野獸。 例如,可以將其配置如下:
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
}
問題:
這是否意味着每個actor系統僅由一個實例表示的任何已配置的調度程序?
調度程序的一個實例可以管理多個執行程序(線程池,派生聯接池)嗎?
如果每個已配置的調度程序只有一個實例,那么不同的參與者(也許在不同的節點上)如何與之交互?
最簡單的方法是將調度程序視為用於運行角色的線程池(實際上是線程池)。 根據角色的性質,您可以在fork-join線程池(最常見)或CachedThreadPool(如果您是IO專家)等上運行它們。我強烈建議您這篇文章,它很好地解釋了線程池。
要回答具體問題:
您可以使用上面的配置創建多個相同種類的分派器。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.