Skip to content

Commit ea3b0a1

Browse files
openinxtoddlipcon
authored andcommitted
HDFS-14535. The default 8KB buffer in requestFileDescriptors#BufferedOutputStream is causing lots of heap allocation in HBase when using short-circut read
1 parent 827a847 commit ea3b0a1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/client/impl/BlockReaderFactory.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@
8686
@InterfaceAudience.Private
8787
public class BlockReaderFactory implements ShortCircuitReplicaCreator {
8888
static final Logger LOG = LoggerFactory.getLogger(BlockReaderFactory.class);
89+
private static final int SMALL_BUFFER_SIZE = 512;
8990

9091
public static class FailureInjector {
9192
public void injectRequestFileDescriptorsFailure() throws IOException {
@@ -582,7 +583,7 @@ private ShortCircuitReplicaInfo requestFileDescriptors(DomainPeer peer,
582583
Slot slot) throws IOException {
583584
ShortCircuitCache cache = clientContext.getShortCircuitCache();
584585
final DataOutputStream out =
585-
new DataOutputStream(new BufferedOutputStream(peer.getOutputStream()));
586+
new DataOutputStream(new BufferedOutputStream(peer.getOutputStream(), SMALL_BUFFER_SIZE));
586587
SlotId slotId = slot == null ? null : slot.getSlotId();
587588
new Sender(out).requestShortCircuitFds(block, token, slotId, 1,
588589
failureInjector.getSupportsReceiptVerification());

0 commit comments

Comments
 (0)