HDFS-13493. Reduce the HttpServer2 thread count on DataNodes. Contributed by Erik Krogen.
(cherry picked from commit cddbbe5f69
)
This commit is contained in:
parent
a138496379
commit
f57e91a348
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue