0

我正在使用 Akka-Cluster 并通过 Tcp 使用 Akka IO 通过网络发送大型对象。数据被切割成非常小的块。通过 'Received' 消息接收到的数据 ByteString 的大小非常小(大约 7KB)。是否有任何配置设置可以让我一次发送和接收更大的字节字符串?

4

1 回答 1

1

接收到的 ByteString 的大小可在 application.conf 文件中配置。这是默认配置:

akka.io.tcp {
      # The number of bytes per direct buffer in the pool used to read or write
      # network data from the kernel.
      direct-buffer-size = 128 KiB

      # The maximal number of direct buffers kept in the direct buffer pool for
      # reuse.
      direct-buffer-pool-limit = 1000

      # The maximum number of bytes delivered by a `Received` message. Before
      # more data is read from the network the connection actor will try to
      # do other work.
      # The purpose of this setting is to impose a smaller limit than the 
      # configured receive buffer size. When using value 'unlimited' it will
      # try to read all from the receive buffer.
      max-received-message-size = unlimited
}

尝试更改这些设置。由于 max-received-message-size 默认为无限制,因此您的问题可能是由缓冲区大小引起的。

于 2015-05-29T10:15:14.947 回答