HDFS-12163. Ozone: Reduce MiniOzoneCluster handler thread count. Contributed by Weiwei Yang.

This commit is contained in:
Xiaoyu Yao 2017-08-04 11:33:10 -07:00 committed by Owen O'Malley
parent 89d8d20c73
commit 6f83e9c51e
1 changed files with 17 additions and 0 deletions

View File

@ -293,6 +293,9 @@ public final class MiniOzoneCluster extends MiniDFSCluster
private Boolean ozoneEnabled = true; private Boolean ozoneEnabled = true;
private Boolean waitForChillModeFinish = true; private Boolean waitForChillModeFinish = true;
private Boolean randomContainerPort = true; private Boolean randomContainerPort = true;
// Use relative smaller number of handlers for testing
private int numOfKsmHandlers = 20;
private int numOfScmHandlers = 20;
/** /**
* Creates a new Builder. * Creates a new Builder.
@ -361,6 +364,16 @@ public final class MiniOzoneCluster extends MiniDFSCluster
return this; return this;
} }
public Builder setNumOfKSMHandlers(int numOfHandlers) {
numOfKsmHandlers = numOfHandlers;
return this;
}
public Builder setNumOfSCMHandlers(int numOfHandlers) {
numOfScmHandlers = numOfHandlers;
return this;
}
public String getPath() { public String getPath() {
return path; return path;
} }
@ -385,6 +398,10 @@ public final class MiniOzoneCluster extends MiniDFSCluster
conf.set(KSMConfigKeys.OZONE_KSM_ADDRESS_KEY, "127.0.0.1:0"); conf.set(KSMConfigKeys.OZONE_KSM_ADDRESS_KEY, "127.0.0.1:0");
conf.set(KSMConfigKeys.OZONE_KSM_HTTP_ADDRESS_KEY, "127.0.0.1:0"); conf.set(KSMConfigKeys.OZONE_KSM_HTTP_ADDRESS_KEY, "127.0.0.1:0");
// Configure KSM and SCM handlers
conf.setInt(ScmConfigKeys.OZONE_SCM_HANDLER_COUNT_KEY, numOfScmHandlers);
conf.setInt(KSMConfigKeys.OZONE_KSM_HANDLER_COUNT_KEY, numOfKsmHandlers);
// Use random ports for ozone containers in mini cluster, // Use random ports for ozone containers in mini cluster,
// in order to launch multiple container servers per node. // in order to launch multiple container servers per node.
conf.setBoolean(OzoneConfigKeys.DFS_CONTAINER_IPC_RANDOM_PORT, conf.setBoolean(OzoneConfigKeys.DFS_CONTAINER_IPC_RANDOM_PORT,