gpt4 book ai didi

java - 为 akka 日志配置 Dispatcher

转载 作者:行者123 更新时间:2023-11-30 08:31:39 24 4
gpt4 key购买 nike

我深入研究了 akka 的源代码,发现它使用了所谓的 BusLogging 类,该类将消息发布到 EventStreamEventStream::publish(event: Event) 依次将事件发布到 cache: Map.empty[Classifier, Set[Subscriber]] 中的接收器。

我发现日志记录是由 /system/log1-Slf4jLogger actor 执行的。 documentation说:

The event handler actor does not have a bounded inbox and is run on the default dispatcher. This means that logging extreme amounts of data may affect your application badly. It can be somewhat mitigated by making sure to use an async logging backend though.

有没有办法将它移动到另一个我按照我想要的方式配置的调度程序?

最佳答案

您可以通过将这些参数添加到您的 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

关于java - 为 akka 日志配置 Dispatcher,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40531679/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com