anmolanmol1234 commented on code in PR #7832:
URL: https://github.com/apache/hadoop/pull/7832#discussion_r2459698158


##########
hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/services/ReadBufferManagerV2.java:
##########
@@ -17,67 +17,91 @@
  */
 package org.apache.hadoop.fs.azurebfs.services;
 
+import org.apache.hadoop.fs.azurebfs.AbfsConfiguration;
+import org.apache.hadoop.fs.azurebfs.contracts.services.ReadBufferStatus;
+
+import com.sun.management.OperatingSystemMXBean;
+
 import java.io.IOException;
+import java.lang.management.ManagementFactory;
+import java.lang.management.MemoryMXBean;
+import java.lang.management.MemoryUsage;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Stack;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
 import java.util.concurrent.SynchronousQueue;
 import java.util.concurrent.ThreadFactory;
 import java.util.concurrent.ThreadPoolExecutor;
 import java.util.concurrent.TimeUnit;
+import java.util.concurrent.locks.ReentrantLock;
 
-import org.apache.hadoop.classification.VisibleForTesting;
-import org.apache.hadoop.fs.azurebfs.AbfsConfiguration;
-import org.apache.hadoop.fs.azurebfs.contracts.services.ReadBufferStatus;
 import org.apache.hadoop.fs.azurebfs.utils.TracingContext;
+import org.apache.hadoop.classification.VisibleForTesting;
 
-final class ReadBufferManagerV2 extends ReadBufferManager {
+import static 
org.apache.hadoop.fs.azurebfs.constants.FileSystemConfigurations.ONE_HUNDRED;
+
+/**
+ * The Improved Read Buffer Manager for Rest AbfsClient.
+ */
+public class ReadBufferManagerV2 extends ReadBufferManager {
+  // Internal constants
+  private static final ReentrantLock LOCK = new ReentrantLock();
 
   // Thread Pool Configurations
   private static int minThreadPoolSize;
   private static int maxThreadPoolSize;
+  private static int cpuMonitoringIntervalInMilliSec;
+  private static double cpuThreshold;
+  private static int threadPoolUpscalePercentage;
+  private static int threadPoolDownscalePercentage;
   private static int executorServiceKeepAliveTimeInMilliSec;
+  private static final double THREAD_POOL_REQUIREMENT_BUFFER = 1.2; // 20% 
more threads than the queue size
+  private static boolean isDynamicScalingEnabled;
+
+  private ScheduledExecutorService cpuMonitorThread;
   private ThreadPoolExecutor workerPool;
+  private final List<ReadBufferWorker> workerRefs = new ArrayList<>();

Review Comment:
   Shouldn't this be synchronized as there can be concurrent modifications to 
the list ?



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to