Akka配置异常:无法加载指定的记录器

时间:2015-03-31 10:55:19

标签: scala akka actor spray apachebench

我正在尝试使用apache bench工具基于actor模型加载测试我的喷雾http客户端。表现不是很好。更重要的是,当我将并发级别增加到200-300左右时,我看到了几个与记录器相关的错误。

代码段

   val result = for {
      response <- GlobalObject.io.ask(HttpRequest(GET,URL)).mapTo[spray.http.HttpResponse]
    } yield response
   result Oncomplete{
    case Success(response) => doSomething
   }

完整堆栈跟踪:

[info] [WARN] [03/31/2015 14:31:52.580] [squbs-akka.actor.default-dispatcher-26] [EventStream(akka://hcp-client)] Logger log1-Logging$DefaultLogger did not respond within Timeout(5000 milliseconds) to InitializeLogger(bus)
[error] error while starting up loggers
[error] akka.ConfigurationException: Logger specified in config can't be loaded [akka.event.Logging$DefaultLogger] due to [akka.event.Logging$LoggerInitializationException: Logger log1-Logging$DefaultLogger did not respond with LoggerInitialized, sent instead [TIMEOUT]]
[error]         at akka.event.LoggingBus$$anonfun$4$$anonfun$apply$1.applyOrElse(Logging.scala:116)
[error]         at akka.event.LoggingBus$$anonfun$4$$anonfun$apply$1.applyOrElse(Logging.scala:115)
[error]         at scala.runtime.AbstractPartialFunction.apply(AbstractPartialFunction.scala:36)
[error]         at scala.util.Failure$$anonfun$recover$1.apply(Try.scala:215)
[error]         at scala.util.Try$.apply(Try.scala:191)
[error]         at scala.util.Failure.recover(Try.scala:215)
[error]         at akka.event.LoggingBus$$anonfun$4.apply(Logging.scala:115)
[error]         at akka.event.LoggingBus$$anonfun$4.apply(Logging.scala:110)
[error]         at scala.collection.TraversableLike$WithFilter$$anonfun$map$2.apply(TraversableLike.scala:728)
[error]         at scala.collection.Iterator$class.foreach(Iterator.scala:750)
[error]         at scala.collection.AbstractIterator.foreach(Iterator.scala:1202)
[error]         at scala.collection.IterableLike$class.foreach(IterableLike.scala:72)
[error]         at scala.collection.AbstractIterable.foreach(Iterable.scala:54)
[error]         at scala.collection.TraversableLike$WithFilter.map(TraversableLike.scala:727)
[error]         at akka.event.LoggingBus$class.startDefaultLoggers(Logging.scala:110)
[error]         at akka.event.EventStream.startDefaultLoggers(EventStream.scala:26)
[error]         at akka.actor.LocalActorRefProvider.init(ActorRefProvider.scala:622)
[error]         at akka.actor.ActorSystemImpl.liftedTree2$1(ActorSystem.scala:619)
[error]         at akka.actor.ActorSystemImpl._start$lzycompute(ActorSystem.scala:616)
[error]         at akka.actor.ActorSystemImpl._start(ActorSystem.scala:616)
[error]         at akka.actor.ActorSystemImpl.start(ActorSystem.scala:633)
[error]         at akka.actor.ActorSystem$.apply(ActorSystem.scala:142)
[error]         at akka.actor.ActorSystem$.apply(ActorSystem.scala:109)
[error]         at com.paypal.vyasa.persistors.KafkaStorage.<init>(KafkaStorage.scala:40)
[error]         at sun.reflect.GeneratedConstructorAccessor22.newInstance(Unknown Source)
[error]         at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
[error]         at java.lang.reflect.Constructor.newInstance(Constructor.java:408)
[error]         at akka.util.Reflect$.instantiate(Reflect.scala:66)
[error]         at akka.actor.ArgsReflectConstructor.produce(Props.scala:352)
[error]         at akka.actor.Props.newActor(Props.scala:252)
[error]         at akka.actor.ActorCell.newActor(ActorCell.scala:552)
[error]         at akka.actor.ActorCell.create(ActorCell.scala:578)
[error]         at akka.actor.ActorCell.invokeAll$1(ActorCell.scala:456)
[error]         at akka.actor.ActorCell.systemInvoke(ActorCell.scala:478)
[error]         at akka.dispatch.Mailbox.processAllSystemMessages(Mailbox.scala:279)
[error]         at akka.dispatch.Mailbox.run(Mailbox.scala:220)
[error]         at akka.dispatch.Mailbox.exec(Mailbox.scala:231)
[error]         at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
[error]         at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
[error]         at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
[error]         at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
[error] Caused by: akka.event.Logging$LoggerInitializationException: Logger log1-Logging$DefaultLogger did not respond with LoggerInitialized, sent instead [TIMEOUT]
[error]         at akka.event.LoggingBus$class.akka$event$LoggingBus$$addLogger(Logging.scala:185)
[error]         at akka.event.LoggingBus$$anonfun$4$$anonfun$apply$4.apply(Logging.scala:114)
[error]         at akka.event.LoggingBus$$anonfun$4$$anonfun$apply$4.apply(Logging.scala:113)

我在网上搜索,但似乎错误是唯一的。有人带领任何人?还有关于如何提高性能的任何线索?请求总数似乎每秒约15次。

2 个答案:

答案 0 :(得分:8)

网络上已经提到过这个错误:

https://groups.google.com/forum/#!topic/akka-user/nng-bb2IZFA

这意味着其中一个参与者(log1-Logging)没有及时响应。您可以使用logger-startup-timeout设置增加超时时间:

 # Loggers are created and registered synchronously during ActorSystem
 # start-up, and since they are actors, this timeout is used to bound the
 # waiting time
 logger-startup-timeout = 5s

可能发生的原因是执行服务(池)配置:

  • 也许您选择的游泳池容量太低(或太高)
  • 也许你正在使用可能受线程饥饿问题影响的池 - 任何不支持托管阻塞的池(包括常规的内置固定和动态池)。这可以通过使用fork-join-pool(默认情况下在akka中使用)
  • 来解决

答案 1 :(得分:0)

这可能是由LOGBACK-1221引起的,这已在Logback 1.1.10中修复。如果您使用的是早期版本的Logback,则解决方案只是更新为1.1.10或更高版本。