szetszwo commented on pull request #296:
URL: https://github.com/apache/incubator-ratis/pull/296#issuecomment-732988191


   > ... , otherwise if we use client -> primary -> peer, primary must wait 
finish write 128MB block, and then transfer the whole block file to follower ...
   
   No.  The transferTo method calls WritableByteChannel.write(..) multiple 
times.  For example, transferToArbitraryChannel(..) create a 8KB buffer and 
call WritableByteChannel.write(..) every 8KB.  We must send small packets in 
Streaming.
   ```
   //sun.nio.ch.FileChannelImpl
     private long transferToArbitraryChannel(long var1, int var3, 
WritableByteChannel var4) throws IOException {
       int var5 = Math.min(var3, 8192);
       ByteBuffer var6 = Util.getTemporaryDirectBuffer(var5);
   ```
   var6 above is the 8KB buffer.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to