You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pr@cassandra.apache.org by GitBox <gi...@apache.org> on 2020/06/25 08:06:35 UTC

[GitHub] [cassandra] jasonstack commented on a change in pull request #651: Fix entire sstable streaming leak and reduce buffer allocation

jasonstack commented on a change in pull request #651:
URL: https://github.com/apache/cassandra/pull/651#discussion_r445380479



##########
File path: src/java/org/apache/cassandra/net/AsyncStreamingOutputPlus.java
##########
@@ -170,36 +170,50 @@ public int writeToChannel(Write write, StreamRateLimiter limiter) throws IOExcep
      */
     public long writeFileToChannel(FileChannel file, StreamRateLimiter limiter) throws IOException
     {
-        // write files in 1MiB chunks, since there may be blocking work performed to fetch it from disk,
-        // the data is never brought in process and is gated by the wire anyway
         if (channel.pipeline().get(SslHandler.class) != null)
-            return writeFileToChannel(file, limiter, 1 << 20, 1 << 20, 2 << 20);
+            // each batch is loaded into ByteBuffer, 64kb is more BufferPool friendly.
+            return writeFileToChannel(file, limiter, 1 << 16);

Review comment:
       Using 128kb (NORMAL_CHUNK_SIZE) won't cause out-of-pool allocation.
   
   But current default low/high water mark is 32kb/64kb, I think a lower batch size will allow the write thread to wake up earlier and perform the blocking disk read earlier, assuming netty worker thread is flushing at a constant rate..
   
   > The thing I don't know is what the optimal buffer size actually is.
   
   My gut feeling is somewhere between low water mark and high water mark.. Legacy stream writer uses 64kb size. Zero-copy has higher batch-size and low/high water mark because buffer won't be copied to user space..




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org