You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "Gargi-jais11 (via GitHub)" <gi...@apache.org> on 2025/03/04 04:24:50 UTC
[PR] Hdds-12436. [DiskBalancer] Add metrics for time spent by container move [ozone]
Gargi-jais11 opened a new pull request, #8001:
URL: https://github.com/apache/ozone/pull/8001
## What changes were proposed in this pull request?
Add metrics in DiskBalancerServiceMetrics to record the time spent on container move, for both success and failure case.
## What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-12436
## How was this patch tested?
The patch was tested manually by running docker cluster and seeing the results at JMX endpoint and prometheus. At prometheus endpoint by querying for `disk_balancer_service_metrics_move_success_time_avg_time` and `disk_balancer_service_metrics_move_failure_time_avg_time` it shows the change in graph curves and the average time taken for the successful and failure moves respectively.
```
"name" : "Hadoop:service=HddsDatanode,name=DiskBalancerServiceMetrics",
"modelerType" : "DiskBalancerServiceMetrics",
"tag.Context" : "dfs",
"tag.Hostname" : "2757e35f9c78",
"FailureCount" : 6,
"IdleLoopExceedsBandwidthCount" : 0,
"IdleLoopNoAvailableVolumePairCount" : 0,
"MoveFailureTimeNumOps" : 6,
"MoveFailureTimeAvgTime" : 0.0,
"MoveSuccessTimeNumOps" : 7,
"MoveSuccessTimeAvgTime" : 0.0,
"RunningLoopCount" : 10,
"SuccessBytes" : 10412359680,
"SuccessCount" : 7
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-12436. [DiskBalancer] Add metrics for time spent by container move [ozone]
Posted by "ivandika3 (via GitHub)" <gi...@apache.org>.
ivandika3 commented on PR #8001:
URL: https://github.com/apache/ozone/pull/8001#issuecomment-2708221778
@Gargi-jais11 Thanks for the patch.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-12436. [DiskBalancer] Add metrics for time spent by container move [ozone]
Posted by "ivandika3 (via GitHub)" <gi...@apache.org>.
ivandika3 commented on code in PR #8001:
URL: https://github.com/apache/ozone/pull/8001#discussion_r1985942360
##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/diskbalancer/DiskBalancerService.java:
##########
@@ -470,8 +474,16 @@ public BackgroundTaskResult call() {
if (destVolumeIncreased) {
destVolume.decrementUsedSpace(containerSize);
}
+ // Stop timing for failure move
+ long endTime = Time.monotonicNow();
+ metrics.getMoveFailureTime().add(endTime - startTime);
metrics.incrFailureCount();
} finally {
+ // Stop timing for successful move
+ if (moveSucceeded) {
+ long endTime = Time.monotonicNow();
+ metrics.getMoveSuccessTime().add(endTime - startTime);
+ }
Review Comment:
```suggestion
long endTime = Time.monotonicNow();
if (moveSucceeded) {
metrics.getMoveSuccessTime().add(endTime - startTime);
} else {
metrics.getMoveFailureTime().add(endTime - startTime);
}
```
##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/diskbalancer/DiskBalancerService.java:
##########
@@ -470,8 +474,16 @@ public BackgroundTaskResult call() {
if (destVolumeIncreased) {
destVolume.decrementUsedSpace(containerSize);
}
+ // Stop timing for failure move
+ long endTime = Time.monotonicNow();
+ metrics.getMoveFailureTime().add(endTime - startTime);
Review Comment:
This can be pushed further to the `finally` block.
##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/diskbalancer/DiskBalancerService.java:
##########
@@ -392,6 +392,9 @@ private class DiskBalancerTask implements BackgroundTask {
@Override
public BackgroundTaskResult call() {
+ //start time
Review Comment:
Unnecessary comment.
##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/diskbalancer/DiskBalancerService.java:
##########
@@ -392,6 +392,9 @@ private class DiskBalancerTask implements BackgroundTask {
@Override
public BackgroundTaskResult call() {
+ //start time
+ long startTime = Time.monotonicNow();
+ boolean moveSucceeded = false;
Review Comment:
Nit: I prefer to have `moveSucceeded` to be `true` and only set to false in `exception` so that the main body is try catch body is cleaner.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-12436. [DiskBalancer] Add metrics for time spent by container move [ozone]
Posted by "ivandika3 (via GitHub)" <gi...@apache.org>.
ivandika3 commented on code in PR #8001:
URL: https://github.com/apache/ozone/pull/8001#discussion_r1982442688
##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/diskbalancer/DiskBalancerService.java:
##########
@@ -392,6 +392,8 @@ private class DiskBalancerTask implements BackgroundTask {
@Override
public BackgroundTaskResult call() {
+ //start time
+ long startTime = System.currentTimeMillis();
Review Comment:
As mentioned in https://issues.apache.org/jira/browse/HDDS-12060, it's better to use `Time.monotonicNow` for duration calculation.
##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/diskbalancer/DiskBalancerService.java:
##########
@@ -446,6 +448,10 @@ public BackgroundTaskResult call() {
}
oldContainer.getContainerData().getVolume()
.decrementUsedSpace(containerSize);
+
+ // Stop timing
+ long endTime = System.currentTimeMillis();
+ metrics.getMoveSuccessTime().add(endTime - startTime);
Review Comment:
Better to put these `endTime` and duration calculation in the `finally` block to prevent duplication.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-12436. [DiskBalancer] Add metrics for time spent by container move [ozone]
Posted by "ivandika3 (via GitHub)" <gi...@apache.org>.
ivandika3 commented on code in PR #8001:
URL: https://github.com/apache/ozone/pull/8001#discussion_r1982443469
##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/diskbalancer/DiskBalancerService.java:
##########
@@ -446,6 +448,10 @@ public BackgroundTaskResult call() {
}
oldContainer.getContainerData().getVolume()
.decrementUsedSpace(containerSize);
+
+ // Stop timing
+ long endTime = System.currentTimeMillis();
+ metrics.getMoveSuccessTime().add(endTime - startTime);
Review Comment:
Better to put these `endTime` and duration calculations (this and the subsequent ones) in the `finally` block to prevent duplication.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-12436. [DiskBalancer] Add metrics for time spent by container move [ozone]
Posted by "ivandika3 (via GitHub)" <gi...@apache.org>.
ivandika3 merged PR #8001:
URL: https://github.com/apache/ozone/pull/8001
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-12436. [DiskBalancer] Add metrics for time spent by container move [ozone]
Posted by "Gargi-jais11 (via GitHub)" <gi...@apache.org>.
Gargi-jais11 commented on code in PR #8001:
URL: https://github.com/apache/ozone/pull/8001#discussion_r1982685501
##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/diskbalancer/DiskBalancerService.java:
##########
@@ -392,6 +392,8 @@ private class DiskBalancerTask implements BackgroundTask {
@Override
public BackgroundTaskResult call() {
+ //start time
+ long startTime = System.currentTimeMillis();
Review Comment:
ok will do the changes
##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/diskbalancer/DiskBalancerService.java:
##########
@@ -446,6 +448,10 @@ public BackgroundTaskResult call() {
}
oldContainer.getContainerData().getVolume()
.decrementUsedSpace(containerSize);
+
+ // Stop timing
+ long endTime = System.currentTimeMillis();
+ metrics.getMoveSuccessTime().add(endTime - startTime);
Review Comment:
sure
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org