You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by li...@apache.org on 2016/04/22 11:02:56 UTC
[2/2] kylin git commit: KYLIN-1614 Add linux transparent hugepage and
vm swappiness into diagnosis tool for performance tunning
KYLIN-1614 Add linux transparent hugepage and vm swappiness into diagnosis tool for performance tunning
Project: http://git-wip-us.apache.org/repos/asf/kylin/repo
Commit: http://git-wip-us.apache.org/repos/asf/kylin/commit/8045e7d8
Tree: http://git-wip-us.apache.org/repos/asf/kylin/tree/8045e7d8
Diff: http://git-wip-us.apache.org/repos/asf/kylin/diff/8045e7d8
Branch: refs/heads/master
Commit: 8045e7d8112ae2479497cc13b1c28882bc24a786
Parents: f4fc179
Author: lidongsjtu <li...@apache.org>
Authored: Fri Apr 22 17:01:44 2016 +0800
Committer: lidongsjtu <li...@apache.org>
Committed: Fri Apr 22 17:01:44 2016 +0800
----------------------------------------------------------------------
.../org/apache/kylin/tool/DiagnosisInfoCLI.java | 28 ++++++++++++++++++++
1 file changed, 28 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/kylin/blob/8045e7d8/tool/src/main/java/org/apache/kylin/tool/DiagnosisInfoCLI.java
----------------------------------------------------------------------
diff --git a/tool/src/main/java/org/apache/kylin/tool/DiagnosisInfoCLI.java b/tool/src/main/java/org/apache/kylin/tool/DiagnosisInfoCLI.java
index d4257c5..f41a728 100644
--- a/tool/src/main/java/org/apache/kylin/tool/DiagnosisInfoCLI.java
+++ b/tool/src/main/java/org/apache/kylin/tool/DiagnosisInfoCLI.java
@@ -37,6 +37,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.common.collect.Lists;
+import com.google.common.io.Files;
public class DiagnosisInfoCLI extends AbstractApplication {
private static final Logger logger = LoggerFactory.getLogger(DiagnosisInfoCLI.class);
@@ -61,6 +62,9 @@ public class DiagnosisInfoCLI extends AbstractApplication {
@SuppressWarnings("static-access")
private static final Option OPTION_INCLUDE_HBASE = OptionBuilder.withArgName("includeHBase").hasArg().isRequired(false).withDescription("Specify whether to include hbase files to extract. Default true.").create("includeHBase");
+ @SuppressWarnings("static-access")
+ private static final Option OPTION_INCLUDE_LINUX = OptionBuilder.withArgName("includeLinux").hasArg().isRequired(false).withDescription("Specify whether to include os and linux kernel info to extract. Default true.").create("includeLinux");
+
private CubeMetaExtractor cubeMetaExtractor;
private HBaseUsageExtractor hBaseUsageExtractor;
private Options options;
@@ -115,6 +119,7 @@ public class DiagnosisInfoCLI extends AbstractApplication {
boolean compress = optionsHelper.hasOption(OPTION_COMPRESS) ? Boolean.valueOf(optionsHelper.getOptionValue(OPTION_COMPRESS)) : true;
boolean includeConf = optionsHelper.hasOption(OPTION_INCLUDE_CONF) ? Boolean.valueOf(optionsHelper.getOptionValue(OPTION_INCLUDE_CONF)) : true;
boolean includeHBase = optionsHelper.hasOption(OPTION_INCLUDE_HBASE) ? Boolean.valueOf(optionsHelper.getOptionValue(OPTION_INCLUDE_HBASE)) : true;
+ boolean includeLinux = optionsHelper.hasOption(OPTION_INCLUDE_LINUX) ? Boolean.valueOf(optionsHelper.getOptionValue(OPTION_INCLUDE_LINUX)) : true;
// export HBase
if (includeHBase) {
@@ -160,6 +165,29 @@ public class DiagnosisInfoCLI extends AbstractApplication {
}
}
+ // export os conf - linux
+ if (includeLinux) {
+ File linuxDir = new File(exportDir, "linux");
+ FileUtils.forceMkdir(linuxDir);
+ File transparentHugepageCompactionDir = new File(linuxDir, "transparent_hugepage");
+ FileUtils.forceMkdir(transparentHugepageCompactionDir);
+ File vmSwappinessDir = new File(linuxDir, "vm.swappiness");
+ FileUtils.forceMkdir(vmSwappinessDir);
+ try {
+ String transparentHugepageCompactionPath = "/sys/kernel/mm/transparent_hugepage/defrag";
+ Files.copy(new File(transparentHugepageCompactionPath), new File(transparentHugepageCompactionDir, "defrag"));
+ } catch (Exception e) {
+ logger.warn("Error in export transparent hugepage compaction status.", e);
+ }
+
+ try {
+ String vmSwapinessPath = "/proc/sys/vm/swappiness";
+ Files.copy(new File(vmSwapinessPath), new File(vmSwappinessDir, "swappiness"));
+ } catch (Exception e) {
+ logger.warn("Error in export vm swapiness.", e);
+ }
+ }
+
// export commit id
try {
FileUtils.copyFileToDirectory(new File(KylinConfig.getKylinHome(), "commit_SHA1"), exportDir);