0

我正在用 Scala 中的 Akka 演员构建一个库,以进行一些大规模的数据处理。

我正在使用 StarCluster 在 Amazon EC2 现货实例上运行我的代码。该程序不稳定,因为远程执行的演员有时会掉线:

在代码运行时,节点会在几分钟内一个接一个断开连接。节点说类似:

[ERROR] [07/16/2014 17:40:06.837] [slave-akka.actor.default-dispatcher-4] [akka://slave/system/endpointManager/reliableEndpointWriter-akka.tcp%3A%2F%2Fslave%40master%3A2552-0/endpointWriter] AssociationError [akka.tcp://slave@node005:2552] -> [akka.tcp://slave@master:2552]: Error [Association failed with [akka.tcp://slave@master:2552]] [
akka.remote.EndpointAssociationException: Association failed with [akka.tcp://slave@master:2552]
Caused by: akka.remote.transport.netty.NettyTransport$$anonfun$associate$1$$anon$2: Connection refused: master

[WARN] [07/16/2014 17:30:05.548] [slave-akka.actor.default-dispatcher-12] [Remoting] Tried to associate with unreachable remote address [akka.tcp://slave@master:2552]. Address is now quarantined, all messages to this address will be delivered to dead letters.

即使我可以在节点之间 ping 也很好。

我一直在努力解决这个问题;我认为这是一些配置设置。Akka 远程处理文档甚至说,

但是,在 Amazon EC2 等云环境中,该值可能会增加到 12,以解决此类平台上有时会出现的网络问题。

但是,我已经设置了这一点,但仍然没有解决问题的运气。这是我当前的远程配置:

akka {
  actor {
    provider = "akka.remote.RemoteActorRefProvider"
  }
  remote {
    enabled-transports = ["akka.remote.netty.tcp"]
    netty.tcp {
      port = 2552
      # for modelling
      #send-buffer-size = 50000000b
      #receive-buffer-size = 50000000b
      #maximum-frame-size = 25000000b
      send-buffer-size = 5000000b
      receive-buffer-size = 5000000b
      maximum-frame-size = 2500000b
    }
    watch-failure-detector.threshold = 100
    acceptable-heartbeat-pause = 20s
    transport-failure-detector {
      heartbeat-interval = 4 s
      acceptable-heartbeat-pause = 20 s
    }
  }
  log-dead-letters = off
}

我从主节点部署我的演员:

val o2m = system.actorOf(Props(classOf[IntOneToMany], p), name = "o2m")
val remote = Deploy(scope = RemoteScope(Address("akka.tcp", "slave", args(i), 2552)))
val b = system.actorOf(Props(classOf[IntBoss], o2m).withDeploy(remote), name = "boss_" + i)
etc.

谁能指出我正在犯的错误/如何解决此问题并阻止节点断开连接?或者,如果演员断开连接,重新启动演员的一些解决方案也有效;我不太关心丢失的消息。事实上,我认为这应该是一种易于配置的行为,但我发现很难找到合适的位置来寻找它。

谢谢

4

1 回答 1

2

至少属性语法是错误的:acceptable-heartbeat-pause 应该在 watch-failure-detector 下,(你的处于同一级别)。它们应该如下所示:

watch-failure-detector {
  threshold = 100
  acceptable-heartbeat-pause = 20 s
}
transport-failure-detector {
  heartbeat-interval = 4 s
  acceptable-heartbeat-pause = 20 s
}
于 2015-05-10T05:41:37.247 回答