diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/web/DatanodeHttpServer.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/web/DatanodeHttpServer.java index 0ce327a69e1..4349c26b053 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/web/DatanodeHttpServer.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/web/DatanodeHttpServer.java @@ -89,6 +89,13 @@ public class DatanodeHttpServer implements Closeable { private InetSocketAddress httpsAddress; static final Log LOG = LogFactory.getLog(DatanodeHttpServer.class); + // HttpServer threads are only used for the web UI and basic servlets, so + // set them to the minimum possible + private static final int HTTP_SELECTOR_THREADS = 1; + private static final int HTTP_ACCEPTOR_THREADS = 1; + private static final int HTTP_MAX_THREADS = + HTTP_SELECTOR_THREADS + HTTP_ACCEPTOR_THREADS + 1; + public DatanodeHttpServer(final Configuration conf, final DataNode datanode, final ServerSocketChannel externalHttpChannel) @@ -97,7 +104,12 @@ public class DatanodeHttpServer implements Closeable { this.conf = conf; Configuration confForInfoServer = new Configuration(conf); - confForInfoServer.setInt(HttpServer2.HTTP_MAX_THREADS_KEY, 10); + confForInfoServer.setInt(HttpServer2.HTTP_MAX_THREADS_KEY, + HTTP_MAX_THREADS); + confForInfoServer.setInt(HttpServer2.HTTP_SELECTOR_COUNT_KEY, + HTTP_SELECTOR_THREADS); + confForInfoServer.setInt(HttpServer2.HTTP_ACCEPTOR_COUNT_KEY, + HTTP_ACCEPTOR_THREADS); int proxyPort = confForInfoServer.getInt(DFS_DATANODE_HTTP_INTERNAL_PROXY_PORT, 0); HttpServer2.Builder builder = new HttpServer2.Builder()