HDFS-13493. Reduce the HttpServer2 thread count on DataNodes. Contributed by Erik Krogen.

(cherry picked from commit cddbbe5f69)
This commit is contained in:
Inigo Goiri 2018-05-23 12:12:08 -07:00
parent c5f29d62eb
commit 506f61e186
1 changed files with 13 additions and 1 deletions

View File

@ -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()