diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSConfigKeys.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSConfigKeys.java
index 7196def422..dc2bcbe2ff 100755
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSConfigKeys.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSConfigKeys.java
@@ -650,6 +650,14 @@ public class DFSConfigKeys extends CommonConfigurationKeys {
public static final long
DFS_DATANODE_PEER_METRICS_MIN_OUTLIER_DETECTION_SAMPLES_DEFAULT =
1000;
+ public static final String DFS_DATANODE_MIN_OUTLIER_DETECTION_NODES_KEY =
+ "dfs.datanode.min.outlier.detection.nodes";
+ public static final long DFS_DATANODE_MIN_OUTLIER_DETECTION_NODES_DEFAULT =
+ 10L;
+ public static final String DFS_DATANODE_SLOWPEER_LOW_THRESHOLD_MS_KEY =
+ "dfs.datanode.slowpeer.low.threshold.ms";
+ public static final long DFS_DATANODE_SLOWPEER_LOW_THRESHOLD_MS_DEFAULT =
+ 5L;
public static final String DFS_DATANODE_MIN_OUTLIER_DETECTION_DISKS_KEY =
"dfs.datanode.min.outlier.detection.disks";
public static final long DFS_DATANODE_MIN_OUTLIER_DETECTION_DISKS_DEFAULT =
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/metrics/DataNodePeerMetrics.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/metrics/DataNodePeerMetrics.java
index 3c70a23ac5..750e53db13 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/metrics/DataNodePeerMetrics.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/metrics/DataNodePeerMetrics.java
@@ -22,6 +22,7 @@
import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.classification.InterfaceStability;
import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hdfs.DFSConfigKeys;
import org.apache.hadoop.metrics2.MetricsJsonBuilder;
import org.apache.hadoop.metrics2.lib.MutableRollingAverages;
import org.slf4j.Logger;
@@ -48,11 +49,6 @@ public class DataNodePeerMetrics {
private final String name;
- /**
- * Threshold in milliseconds below which a DataNode is definitely not slow.
- */
- private static final long LOW_THRESHOLD_MS = 5;
- private static final long MIN_OUTLIER_DETECTION_NODES = 10;
private final OutlierDetector slowNodeDetector;
@@ -62,14 +58,28 @@ public class DataNodePeerMetrics {
* outlier detection is skipped.
*/
private final long minOutlierDetectionSamples;
+ /**
+ * Threshold in milliseconds below which a DataNode is definitely not slow.
+ */
+ private final long lowThresholdMs;
+ /**
+ * Minimum number of nodes to run outlier detection.
+ */
+ private final long minOutlierDetectionNodes;
public DataNodePeerMetrics(final String name, Configuration conf) {
this.name = name;
minOutlierDetectionSamples = conf.getLong(
DFS_DATANODE_PEER_METRICS_MIN_OUTLIER_DETECTION_SAMPLES_KEY,
DFS_DATANODE_PEER_METRICS_MIN_OUTLIER_DETECTION_SAMPLES_DEFAULT);
- this.slowNodeDetector = new OutlierDetector(MIN_OUTLIER_DETECTION_NODES,
- LOW_THRESHOLD_MS);
+ lowThresholdMs =
+ conf.getLong(DFSConfigKeys.DFS_DATANODE_SLOWPEER_LOW_THRESHOLD_MS_KEY,
+ DFSConfigKeys.DFS_DATANODE_SLOWPEER_LOW_THRESHOLD_MS_DEFAULT);
+ minOutlierDetectionNodes =
+ conf.getLong(DFSConfigKeys.DFS_DATANODE_MIN_OUTLIER_DETECTION_NODES_KEY,
+ DFSConfigKeys.DFS_DATANODE_MIN_OUTLIER_DETECTION_NODES_DEFAULT);
+ this.slowNodeDetector =
+ new OutlierDetector(minOutlierDetectionNodes, lowThresholdMs);
sendPacketDownstreamRollingAverages = new MutableRollingAverages("Time");
}
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/resources/hdfs-default.xml b/hadoop-hdfs-project/hadoop-hdfs/src/main/resources/hdfs-default.xml
index af547fdd5b..eee5f931b0 100755
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/resources/hdfs-default.xml
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/resources/hdfs-default.xml
@@ -2330,6 +2330,22 @@
+
+ dfs.datanode.min.outlier.detection.nodes
+ 10
+
+ Minimum number of nodes to run outlier detection.
+
+
+
+
+ dfs.datanode.slowpeer.low.threshold.ms
+ 5
+
+ Threshold in milliseconds below which a DataNode is definitely not slow.
+
+
+
dfs.datanode.outliers.report.interval
30m