HDFS-10326. Disable setting tcp socket send/receive buffers for write pipelines. Contributed by Daryn Sharp.
This commit is contained in:
parent
e0c24145d2
commit
71b8dda4f6
@ -48,8 +48,8 @@ public final class HdfsConstants {
|
|||||||
public static final byte COLD_STORAGE_POLICY_ID = 2;
|
public static final byte COLD_STORAGE_POLICY_ID = 2;
|
||||||
public static final String COLD_STORAGE_POLICY_NAME = "COLD";
|
public static final String COLD_STORAGE_POLICY_NAME = "COLD";
|
||||||
|
|
||||||
// TODO should be conf injected?
|
public static final int DEFAULT_DATA_SOCKET_SIZE = 0;
|
||||||
public static final int DEFAULT_DATA_SOCKET_SIZE = 128 * 1024;
|
|
||||||
/**
|
/**
|
||||||
* A special path component contained in the path for a snapshot file/dir
|
* A special path component contained in the path for a snapshot file/dir
|
||||||
*/
|
*/
|
||||||
|
@ -2545,13 +2545,14 @@
|
|||||||
|
|
||||||
<property>
|
<property>
|
||||||
<name>dfs.client.socket.send.buffer.size</name>
|
<name>dfs.client.socket.send.buffer.size</name>
|
||||||
<value>131072</value>
|
<value>0</value>
|
||||||
<description>
|
<description>
|
||||||
Socket send buffer size for a write pipeline in DFSClient side.
|
Socket send buffer size for a write pipeline in DFSClient side.
|
||||||
This may affect TCP connection throughput.
|
This may affect TCP connection throughput.
|
||||||
If it is set to zero or negative value,
|
If it is set to zero or negative value,
|
||||||
no buffer size will be set explicitly,
|
no buffer size will be set explicitly,
|
||||||
thus enable tcp auto-tuning on some system.
|
thus enable tcp auto-tuning on some system.
|
||||||
|
The default value is 0.
|
||||||
</description>
|
</description>
|
||||||
</property>
|
</property>
|
||||||
|
|
||||||
@ -3025,23 +3026,25 @@
|
|||||||
|
|
||||||
<property>
|
<property>
|
||||||
<name>dfs.datanode.transfer.socket.send.buffer.size</name>
|
<name>dfs.datanode.transfer.socket.send.buffer.size</name>
|
||||||
<value>131072</value>
|
<value>0</value>
|
||||||
<description>
|
<description>
|
||||||
Socket send buffer size for DataXceiver (mirroring packets to downstream
|
Socket send buffer size for DataXceiver (mirroring packets to downstream
|
||||||
in pipeline). This may affect TCP connection throughput.
|
in pipeline). This may affect TCP connection throughput.
|
||||||
If it is set to zero or negative value, no buffer size will be set
|
If it is set to zero or negative value, no buffer size will be set
|
||||||
explicitly, thus enable tcp auto-tuning on some system.
|
explicitly, thus enable tcp auto-tuning on some system.
|
||||||
|
The default value is 0.
|
||||||
</description>
|
</description>
|
||||||
</property>
|
</property>
|
||||||
|
|
||||||
<property>
|
<property>
|
||||||
<name>dfs.datanode.transfer.socket.recv.buffer.size</name>
|
<name>dfs.datanode.transfer.socket.recv.buffer.size</name>
|
||||||
<value>131072</value>
|
<value>0</value>
|
||||||
<description>
|
<description>
|
||||||
Socket receive buffer size for DataXceiver (receiving packets from client
|
Socket receive buffer size for DataXceiver (receiving packets from client
|
||||||
during block writing). This may affect TCP connection throughput.
|
during block writing). This may affect TCP connection throughput.
|
||||||
If it is set to zero or negative value, no buffer size will be set
|
If it is set to zero or negative value, no buffer size will be set
|
||||||
explicitly, thus enable tcp auto-tuning on some system.
|
explicitly, thus enable tcp auto-tuning on some system.
|
||||||
|
The default value is 0.
|
||||||
</description>
|
</description>
|
||||||
</property>
|
</property>
|
||||||
|
|
||||||
|
@ -30,7 +30,6 @@
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.Socket;
|
import java.net.Socket;
|
||||||
|
|
||||||
import static org.apache.hadoop.hdfs.client.HdfsClientConfigKeys.DFS_CLIENT_SOCKET_SEND_BUFFER_SIZE_DEFAULT;
|
|
||||||
import static org.apache.hadoop.hdfs.client.HdfsClientConfigKeys.DFS_CLIENT_SOCKET_SEND_BUFFER_SIZE_KEY;
|
import static org.apache.hadoop.hdfs.client.HdfsClientConfigKeys.DFS_CLIENT_SOCKET_SEND_BUFFER_SIZE_KEY;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
@ -42,15 +41,16 @@ public class TestDFSClientSocketSize {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The setting of socket send buffer size in
|
* Test that the send buffer size default value is 0, in which case the socket
|
||||||
* {@link java.net.Socket#setSendBufferSize(int)} is only a hint. Actual
|
* will use a TCP auto-tuned value.
|
||||||
* value may differ. We just sanity check that it is somewhere close.
|
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testDefaultSendBufferSize() throws IOException {
|
public void testDefaultSendBufferSize() throws IOException {
|
||||||
assertTrue("Send buffer size should be somewhere near default.",
|
final int sendBufferSize = getSendBufferSize(new Configuration());
|
||||||
getSendBufferSize(new Configuration()) >=
|
LOG.info("If not specified, the auto tuned send buffer size is: {}",
|
||||||
DFS_CLIENT_SOCKET_SEND_BUFFER_SIZE_DEFAULT / 2);
|
sendBufferSize);
|
||||||
|
assertTrue("Send buffer size should be non-negative value which is " +
|
||||||
|
"determined by system (kernel).", sendBufferSize > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -73,6 +73,10 @@ public void testSpecifiedSendBufferSize() throws IOException {
|
|||||||
sendBufferSize1 > sendBufferSize2);
|
sendBufferSize1 > sendBufferSize2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test that if the send buffer size is 0, the socket will use a TCP
|
||||||
|
* auto-tuned value.
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testAutoTuningSendBufferSize() throws IOException {
|
public void testAutoTuningSendBufferSize() throws IOException {
|
||||||
final Configuration conf = new Configuration();
|
final Configuration conf = new Configuration();
|
||||||
|
Loading…
Reference in New Issue
Block a user