【问题标题】:How to increase Tcp Chunk size in Akka IO using Tcp如何使用 Tcp 增加 Akka IO 中的 Tcp Chunk 大小
【发布时间】:2015-05-27 20:48:08
【问题描述】:

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

【问题讨论】:

    标签: akka akka-cluster akka-io


    【解决方案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 默认为无限制,因此您的问题可能是由缓冲区大小引起的。

    【讨论】:

      猜你喜欢
      • 2014-09-29
      • 2013-01-01
      • 1970-01-01
      • 2014-05-23
      • 1970-01-01
      • 1970-01-01
      • 2020-06-23
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多