我想开始使用带有重率信息的演员。演员的最后一个状态非常重要 我正在关注此处显示的持久性示例http://doc.akka.io/docs/akka/2.3.9/scala/persistence.html#event-sourcing 我试图发送大量的消息
for (i <-0 to 100000){
persistentActor ! Cmd("foo"+i)
}
并使用像此一样的persistAsync
val receiveCommand: Receive = {
case Cmd(data) =>
persistAsync(Evt(s"${data}-${numEvents}"))(updateState)
case "snap" => saveSnapshot(state)
case "print" => println(state)
}
在关机之前我添加了Thread.sleep(150000)以确保所有这些都持续存在。起初所有似乎都没问题,但重新运行应用程序显示有些人会死信
> [INFO] [02/03/2015 15:35:18.187]
> [example-akka.actor.default-dispatcher-3]
> [akka://example/user/persistentActor-4-scala] Message
> [java.lang.String] from Actor[akka://example/deadLetters] to
> Actor[akka://example/user/persistentActor-4-scala#1206460640] was not
> delivered. [1] dead letters encountered. This logging can be turned
> off or adjusted with configuration settings 'akka.log-dead-letters'
> and 'akka.log-dead-letters-during-shutdown'. [INFO] [02/03/2015
> 15:35:18.192] [example-akka.actor.default-dispatcher-3]
> [akka://example/user/persistentActor-4-scala] Message
> [akka.persistence.Recover] from
> Actor[akka://example/user/persistentActor-4-scala#1206460640] to
> Actor[akka://example/user/persistentActor-4-scala#1206460640] was not
> delivered. [2] dead letters encountered. This logging can be turned
> off or adjusted with configuration settings 'akka.log-dead-letters'
> and 'akka.log-dead-letters-during-shutdown'.
or getting something like :
----------
[INFO] [02/03/2015 15:54:32.732] [example-akka.actor.default-dispatcher-11] [akka://example/user/persistentActor-4-scala] Message [akka.persistence.JournalProtocol$ReplayedMessage] from Actor[akka://example/deadLetters] to Actor[akka://example/user/persistentActor-4-scala#-973984210] was not delivered. [1] dead letters encountered. This logging can be turned off or adjusted with configuration settings 'akka.log-dead-letters' and 'akka.log-dead-letters-during-shutdown'.
[INFO] [02/03/2015 15:54:32.735] [example-akka.actor.default-dispatcher-3] [akka://example/user/persistentActor-4-scala] Message [akka.persistence.JournalProtocol$ReplayedMessage] from Actor[akka://example/deadLetters] to Actor[akka://example/user/persistentActor-4-scala#-973984210] was not delivered. [10] dead letters encountered, no more dead letters will be logged. This logging can be turned off or adjusted with configuration settings 'akka.log-dead-letters' and 'akka.log-dead-letters-during-shutdown'.
A fatal error has been detected by the Java Runtime Environment:
SIGSEGV (0xb) at pc=0x00007fa2a3e06b6a, pid=18870, tid=140335801857792
JRE version: Java(TM) SE Runtime Environment (7.0_71-b14) (build 1.7.0_71-b14)
Java VM: Java HotSpot(TM) 64-Bit Server VM (24.71-b01 mixed mode linux-amd64 compressed oops)
Problematic frame:
V [libjvm.so+0x97bb6a] Unsafe_GetNativeByte+0xaa
Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
An error report file with more information is saved as:
/home/tadmin/projects/akka-sample-persistence-scala/hs_err_pid18870.log
If you would like to submit a bug report, please visit:
http://bugreport.sun.com/bugreport/crash.jsp
=============================================== =========================
如何坚持应该处理大量邮件的演员的状态?
答案 0 :(得分:0)
我怀疑默认数据库levelDB是问题所在,而且肯定是核心转储。您是否有机会同时向多个演员写入数据库?根据我的经验,我在那种情况下看到了它的核心转储。您可以在shared mode中尝试,但我只是插入了一个不同的数据库,问题就消失了。就我而言,我使用了Cassandra。
我会为akka-persistence尝试一个内存中的日志插件。交换非常容易。如果问题消失,那么你就知道levelDB是问题所在。如果是这样,请使用其他数据库。