Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -975,6 +975,9 @@ public class DFSConfigKeys extends CommonConfigurationKeys {
public static final String DFS_DATANODE_HTTP_ADDRESS_DEFAULT = "0.0.0.0:" + DFS_DATANODE_HTTP_DEFAULT_PORT;
public static final String DFS_DATANODE_HTTP_INTERNAL_PROXY_PORT =
"dfs.datanode.http.internal-proxy.port";
public static final String DFS_DATANODE_NETTY_WORKER_NUM_THREADS_KEY =
"dfs.datanode.netty.worker.threads";
public static final int DFS_DATANODE_NETTY_WORKER_NUM_THREADS_DEFAULT = 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution, but is it reasonable to default to 0 for the number of threads?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@slfan1989 Thank you for your review, the default value should not continue to be 0, and I plan to change the default value to 10. What do you think, sir?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@slfan1989 I have changed the default value to 10, and it works normally in our HDFS cluster.

public static final String DFS_DATANODE_MAX_RECEIVER_THREADS_KEY =
HdfsClientConfigKeys.DeprecatedKeys.DFS_DATANODE_MAX_RECEIVER_THREADS_KEY;
public static final int DFS_DATANODE_MAX_RECEIVER_THREADS_DEFAULT = 4096;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,15 @@
import java.security.GeneralSecurityException;
import java.util.Enumeration;
import java.util.Map;
import java.util.concurrent.Executors;

import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_ADMIN;
import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_DATANODE_HTTPS_ADDRESS_DEFAULT;
import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_DATANODE_HTTPS_ADDRESS_KEY;
import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_DATANODE_HTTP_ADDRESS_KEY;
import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_DATANODE_HTTP_INTERNAL_PROXY_PORT;
import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_DATANODE_NETTY_WORKER_NUM_THREADS_KEY;
import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_DATANODE_NETTY_WORKER_NUM_THREADS_DEFAULT;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add this configuration into hdfs-default.xml. Thanks.


/**
* Data node HTTP Server Class.
Expand Down Expand Up @@ -144,7 +147,15 @@ public DatanodeHttpServer(final Configuration conf,
confForCreate.set(FsPermission.UMASK_LABEL, "000");

this.bossGroup = new NioEventLoopGroup();
this.workerGroup = new NioEventLoopGroup();
int workerCount = conf.getInt(DFS_DATANODE_NETTY_WORKER_NUM_THREADS_KEY,
DFS_DATANODE_NETTY_WORKER_NUM_THREADS_DEFAULT);
if (workerCount < 0) {
LOG.warn("The value of {} is less than 0, will use default value: {}",
DFS_DATANODE_NETTY_WORKER_NUM_THREADS_KEY, DFS_DATANODE_NETTY_WORKER_NUM_THREADS_DEFAULT);
workerCount = DFS_DATANODE_NETTY_WORKER_NUM_THREADS_DEFAULT;
}
this.workerGroup = new NioEventLoopGroup(workerCount, Executors.newCachedThreadPool());

this.externalHttpChannel = externalHttpChannel;
HttpConfig.Policy policy = DFSUtil.getHttpPolicy(conf);
final ChannelHandler[] handlers = getFilterHandlers(conf);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,14 @@
</description>
</property>

<property>
<name>dfs.datanode.netty.worker.threads</name>
<value>0</value>
<description>
The number of Datanode http server worker threads.
</description>
</property>

<property>
<name>dfs.datanode.handler.count</name>
<value>10</value>
Expand Down