我挖掘了akka的消息来源,并发现它使用了所谓的BusLogging
类,它将消息发布到EventStream
。 EventStream::publish(event: Event)
轮流只将事件发布到cache: Map.empty[Classifier, Set[Subscriber]]
中的接收者。
我发现/system/log1-Slf4jLogger
演员正在执行日志记录。 documentation说:
事件处理程序角色 没有有界的收件箱, 在上运行 默认调度程序 。这意味着记录极端数量 数据可能会严重影响您的应用程序。它可以在某种程度上得到缓解 确保使用异步日志记录后端。
有没有办法将它移动到我配置我想要的方式的另一个调度程序?
答案 0 :(得分:2)
您可以通过将这些参数添加到application.conf
文件中来配置它:
akka.loggers-dispatcher = "my-blocking-dispatcher"
my-blocking-dispatcher {
type = Dispatcher
executor = "thread-pool-executor"
thread-pool-executor {
fixed-pool-size = 4
}
throughput = 1
}
Akka配置参考: http://doc.akka.io/docs/akka/2.5/scala/dispatchers.html http://doc.akka.io/docs/akka/2.5.4/scala/general/configuration.html#config-akka-remote