[
https://issues.apache.org/jira/browse/HADOOP-19737?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18039097#comment-18039097
]
ASF GitHub Bot commented on HADOOP-19737:
-----------------------------------------
manika137 commented on code in PR #8056:
URL: https://github.com/apache/hadoop/pull/8056#discussion_r2537251184
##########
hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/WriteThreadPoolSizeManager.java:
##########
@@ -255,19 +289,43 @@ private double getCpuUtilization() {
OperatingSystemMXBean osBean = ManagementFactory.getPlatformMXBean(
OperatingSystemMXBean.class);
double cpuLoad = osBean.getSystemCpuLoad();
- if (cpuLoad < 0) {
+ if (cpuLoad < ZERO) {
LOG.warn("System CPU load value unavailable (returned -1.0). Defaulting
to 0.0.");
- return 0.0;
+ return ZERO_D;
}
return cpuLoad;
}
+ /**
+ * Returns the CPU utilization of the JVM process as a percentage (0–100).
+ */
+ public static double getJvmCpuUtilization() {
+ OperatingSystemMXBean osBean =
+ (OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean();
+ long cpuTime = osBean.getProcessCpuTime();
+ long now = System.nanoTime();
+ if (lastTime == ZERO) {
+ lastCpuTime = cpuTime;
+ lastTime = now;
+ return 0.0; // first call has no previous data
Review Comment:
nit: we can use ZERO_D here too
> ABFS: Add metrics to identify improvements with read and write aggressiveness
> -----------------------------------------------------------------------------
>
> Key: HADOOP-19737
> URL: https://issues.apache.org/jira/browse/HADOOP-19737
> Project: Hadoop Common
> Issue Type: Sub-task
> Components: fs/azure
> Affects Versions: 3.5.0, 3.4.2
> Reporter: Anmol Asrani
> Assignee: Anmol Asrani
> Priority: Major
> Labels: pull-request-available
>
> Introduces new performance metrics in the ABFS driver to monitor and evaluate
> the effectiveness of read and write aggressiveness tuning. These metrics help
> in understanding how thread pool behavior, CPU utilization, and heap
> availability impact overall I/O throughput and latency. By capturing detailed
> statistics such as active thread count, pool size, and system resource
> utilization, this enhancement enables data-driven analysis of optimizations
> made to improve ABFS read and write performance under varying workloads.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]