3

For a data-mining algorithm I am currently developing using Akka, I was wondering if Akka implements performance optimizations of the messages that are sent.

For instance, if I have an Actor that emits a very large number of messages to the same other Actor, is it good to encapsulate a set of messages into another large message? Or does Akka have some sort of buffer itself so that not one message but many messages are transfered over the network at once?

I am asking this question because the algorithm is supposed to be executed remotely on a cluster where transfer performance is important and I currently have no option to just do benchmarks myself.

4

1 回答 1

2

对于在同一台机器上通过 Akka 传递的消息,我认为无论您使用小消息还是消息聚合作为单个消息,这并不重要。我认为许多调用与在处理聚合时必须循环相比的额外开销是最小的。我更喜欢使用小消息,因为它使系统更简单。

但是,当通过网络发送消息时,Akka 使用 HTTP,因此建立连接等会产生额外的 HTTP 开销。因此,您可以选择在这里将一些消息聚合成一条消息。但是,这也取决于您的用例。缓冲意味着等待更多,直到有足够的(或发生超时)。如果您不能等待,例如因为您需要快速响应,那么您仍然需要单独发送每条消息。

我不认为有一个标准的 Akka 演员可以做一些消息聚合。也许可以应用一种特殊的路由来进行缓冲。

或者你可以看看 Akka Streams。这确实支持消息的缓冲。

于 2015-04-17T12:14:21.160 回答