Skip to content

Commit

Permalink
HDFS-15814. Make some parameters configurable for DataNodeDiskMetrics (
Browse files Browse the repository at this point in the history
  • Loading branch information
tomscut authored Feb 14, 2021
1 parent f9a073c commit c3134ab
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,14 @@ public class DFSConfigKeys extends CommonConfigurationKeys {
"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 =
5L;
public static final String DFS_DATANODE_SLOWDISK_LOW_THRESHOLD_MS_KEY =
"dfs.datanode.slowdisk.low.threshold.ms";
public static final long DFS_DATANODE_SLOWDISK_LOW_THRESHOLD_MS_DEFAULT =
20L;
public static final String DFS_DATANODE_HOST_NAME_KEY =
HdfsClientConfigKeys.DeprecatedKeys.DFS_DATANODE_HOST_NAME_KEY;
public static final String DFS_NAMENODE_CHECKPOINT_DIR_KEY =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1489,7 +1489,7 @@ void startDataNode(List<StorageLocation> dataDirectories,

if (dnConf.diskStatsEnabled) {
diskMetrics = new DataNodeDiskMetrics(this,
dnConf.outliersReportIntervalMs);
dnConf.outliersReportIntervalMs, getConf());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
*/
package org.apache.hadoop.hdfs.server.datanode.metrics;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hdfs.DFSConfigKeys;
import org.apache.hadoop.thirdparty.com.google.common.annotations.VisibleForTesting;
import org.apache.hadoop.thirdparty.com.google.common.collect.ImmutableMap;
import org.apache.hadoop.thirdparty.com.google.common.collect.Maps;
Expand Down Expand Up @@ -48,8 +50,6 @@ public class DataNodeDiskMetrics {
DataNodeDiskMetrics.class);

private DataNode dn;
private final long MIN_OUTLIER_DETECTION_DISKS = 5;
private final long SLOW_DISK_LOW_THRESHOLD_MS = 20;
private final long detectionInterval;
private volatile boolean shouldRun;
private OutlierDetector slowDiskDetector;
Expand All @@ -61,11 +61,27 @@ public class DataNodeDiskMetrics {
// code, status should not be overridden by daemon thread.
private boolean overrideStatus = true;

public DataNodeDiskMetrics(DataNode dn, long diskOutlierDetectionIntervalMs) {
/**
* Minimum number of disks to run outlier detection.
*/
private final long minOutlierDetectionDisks;
/**
* Threshold in milliseconds below which a disk is definitely not slow.
*/
private final long lowThresholdMs;

public DataNodeDiskMetrics(DataNode dn, long diskOutlierDetectionIntervalMs,
Configuration conf) {
this.dn = dn;
this.detectionInterval = diskOutlierDetectionIntervalMs;
slowDiskDetector = new OutlierDetector(MIN_OUTLIER_DETECTION_DISKS,
SLOW_DISK_LOW_THRESHOLD_MS);
minOutlierDetectionDisks =
conf.getLong(DFSConfigKeys.DFS_DATANODE_MIN_OUTLIER_DETECTION_DISKS_KEY,
DFSConfigKeys.DFS_DATANODE_MIN_OUTLIER_DETECTION_DISKS_DEFAULT);
lowThresholdMs =
conf.getLong(DFSConfigKeys.DFS_DATANODE_SLOWDISK_LOW_THRESHOLD_MS_KEY,
DFSConfigKeys.DFS_DATANODE_SLOWDISK_LOW_THRESHOLD_MS_DEFAULT);
slowDiskDetector =
new OutlierDetector(minOutlierDetectionDisks, lowThresholdMs);
shouldRun = true;
startDiskOutlierDetectionThread();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2370,6 +2370,22 @@
</description>
</property>

<property>
<name>dfs.datanode.min.outlier.detection.disks</name>
<value>5</value>
<description>
Minimum number of disks to run outlier detection.
</description>
</property>

<property>
<name>dfs.datanode.slowdisk.low.threshold.ms</name>
<value>20</value>
<description>
Threshold in milliseconds below which a disk is definitely not slow.
</description>
</property>

<property>
<name>hadoop.user.group.metrics.percentiles.intervals</name>
<value></value>
Expand Down

0 comments on commit c3134ab

Please sign in to comment.