HDFS-14535. The default 8KB buffer in requestFileDescriptors#BufferedOutputStream is causing lots of heap allocation in HBase when using short-circut read

This commit is contained in:
huzheng 2019-06-04 10:54:46 +08:00 committed by Todd Lipcon
parent 827a84778a
commit ea3b0a1844
1 changed files with 2 additions and 1 deletions

View File

@ -86,6 +86,7 @@ import org.slf4j.LoggerFactory;
@InterfaceAudience.Private @InterfaceAudience.Private
public class BlockReaderFactory implements ShortCircuitReplicaCreator { public class BlockReaderFactory implements ShortCircuitReplicaCreator {
static final Logger LOG = LoggerFactory.getLogger(BlockReaderFactory.class); static final Logger LOG = LoggerFactory.getLogger(BlockReaderFactory.class);
private static final int SMALL_BUFFER_SIZE = 512;
public static class FailureInjector { public static class FailureInjector {
public void injectRequestFileDescriptorsFailure() throws IOException { public void injectRequestFileDescriptorsFailure() throws IOException {
@ -582,7 +583,7 @@ public class BlockReaderFactory implements ShortCircuitReplicaCreator {
Slot slot) throws IOException { Slot slot) throws IOException {
ShortCircuitCache cache = clientContext.getShortCircuitCache(); ShortCircuitCache cache = clientContext.getShortCircuitCache();
final DataOutputStream out = final DataOutputStream out =
new DataOutputStream(new BufferedOutputStream(peer.getOutputStream())); new DataOutputStream(new BufferedOutputStream(peer.getOutputStream(), SMALL_BUFFER_SIZE));
SlotId slotId = slot == null ? null : slot.getSlotId(); SlotId slotId = slot == null ? null : slot.getSlotId();
new Sender(out).requestShortCircuitFds(block, token, slotId, 1, new Sender(out).requestShortCircuitFds(block, token, slotId, 1,
failureInjector.getSupportsReceiptVerification()); failureInjector.getSupportsReceiptVerification());