在 akka 集群节点之间流式传输数据
Streaming data between akka cluster nodes
我需要在 akka 集群节点之间传输几百 KB 到许多 MB 之间的数据。最简单的方法是将其拆分为分块消息,但这似乎是可取的,因为它可能会干扰集群的内务处理。
或者,我可以使用消息来传达一次性 url 并使用 http。
但是,我更喜欢持久连接方法,所以我在考虑使用 zeromq 和分块消息。
但我不想采用自己的方法,而是想使用现有的方法来完成此操作,但我还没有找到。
还有一个要求:大多数时候该流的消耗是通过 Play 直接进行的,因此创建可用于将流代理到 http 的迭代器的方法将是更可取的。
Iteratees 无法跨机器边界进行通信,因此单独的 iterates 可能不是您正在寻找的工具。
我会采用以下方法之一:
使用远程 rpc akka Actor 通过网络发送数据块。 Actors 可用于在连线的任一侧(Enumerator.unicast
和 Iteratee.foreach
)创建迭代器和枚举器,这样您使用 Actors 的事实只是一个实现细节,在您的接口中不可见溪流。
将 Akka Streams. This library has support for TCP connections, and while this is a different streaming library from iteratees, I have found that it is more robust in the stream operations it supports. It looks like Play is looking to move towards a tighter integration 与 Akka Streams 一起使用,因为他们正在考虑用 Akka Http Streams 替换他们的 netty HTTP 后端
Akka Streams 2.5.12 有 StreamRefs 我认为是您的用例。
我需要在 akka 集群节点之间传输几百 KB 到许多 MB 之间的数据。最简单的方法是将其拆分为分块消息,但这似乎是可取的,因为它可能会干扰集群的内务处理。
或者,我可以使用消息来传达一次性 url 并使用 http。
但是,我更喜欢持久连接方法,所以我在考虑使用 zeromq 和分块消息。
但我不想采用自己的方法,而是想使用现有的方法来完成此操作,但我还没有找到。
还有一个要求:大多数时候该流的消耗是通过 Play 直接进行的,因此创建可用于将流代理到 http 的迭代器的方法将是更可取的。
Iteratees 无法跨机器边界进行通信,因此单独的 iterates 可能不是您正在寻找的工具。
我会采用以下方法之一:
使用远程 rpc akka Actor 通过网络发送数据块。 Actors 可用于在连线的任一侧(
Enumerator.unicast
和Iteratee.foreach
)创建迭代器和枚举器,这样您使用 Actors 的事实只是一个实现细节,在您的接口中不可见溪流。将 Akka Streams. This library has support for TCP connections, and while this is a different streaming library from iteratees, I have found that it is more robust in the stream operations it supports. It looks like Play is looking to move towards a tighter integration 与 Akka Streams 一起使用,因为他们正在考虑用 Akka Http Streams 替换他们的 netty HTTP 后端
Akka Streams 2.5.12 有 StreamRefs 我认为是您的用例。