2015-05-27 67 views
0

我正在使用Akka-Cluster並通過網絡使用Akka IO通過Tcp發送大型對象。數據正在被分割成很小的塊。通過「收到」消息收到的數據ByteString的大小非常小(約7KB)。有沒有使用我可以一次發送和接收更大的ByteStrings的配置設置?如何使用Tcp增加Akka IO中的TCP塊大小

回答

0

接收的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默認爲無限制,所以您的問題可能是由緩衝區大小引起的。