adoroszlai commented on code in PR #5791:
URL: https://github.com/apache/ozone/pull/5791#discussion_r1471098799


##########
hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/OzoneClientConfig.java:
##########
@@ -201,6 +201,21 @@ public enum ChecksumCombineMode {
   // 3 concurrent stripe read should be enough.
   private int ecReconstructStripeReadPoolLimit = 10 * 3;
 
+  @Config(key = "ec.reconstruct.stripe.write.pool.limit",
+      defaultValue = "30",
+      description = "Thread pool max size for parallelly write" +
+          " available ec chunks to reconstruct the whole stripe.",
+      tags = ConfigTag.CLIENT)
+  private int ecReconstructStripeWritePoolLimit = 10 * 3;
+
+  @Config(key = "ec.client.write.pool.limit",
+      defaultValue = "200",
+      description = "Maximum number of threads in the pool for handling 
client-side" +
+          " write operations in erasure coding. This setting controls the 
concurrency " +
+          "level for writing data blocks, ensuring efficient data processing 
and" +
+          " throughput while managing resource utilization.",
+      tags = ConfigTag.CLIENT)
+  private int ecClientWritePoolLimit = 200;

Review Comment:
   Since this applies to all writes, not just EC, let's rename it.



##########
hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/rpc/RpcClient.java:
##########
@@ -2480,26 +2488,45 @@ public void setTimes(OzoneObj obj, String keyName, long 
mtime, long atime)
     ozoneManagerClient.setTimes(builder.build(), mtime, atime);
   }
 
+  private ExecutorService createThreadPoolExecutor(
+      int corePoolSize, int maximumPoolSize, String threadNameFormat) {
+    return new ThreadPoolExecutor(corePoolSize, maximumPoolSize,
+        60, TimeUnit.SECONDS, new SynchronousQueue<>(),
+        new ThreadFactoryBuilder()
+            .setNameFormat(threadNameFormat)
+            .build(),
+        new ThreadPoolExecutor.CallerRunsPolicy());
+  }
+
   public ExecutorService getECReconstructExecutor() {
-    // local ref to a volatile to ensure access
-    // to a completed initialized object
-    ExecutorService executor = ecReconstructExecutor;
-    if (executor == null) {
+    ExecutorService localRef = ecReconstructExecutor;
+    if (localRef == null) {
       synchronized (this) {
-        executor = ecReconstructExecutor;
-        if (executor == null) {
-          ecReconstructExecutor = new ThreadPoolExecutor(
-              EC_RECONSTRUCT_STRIPE_READ_POOL_MIN_SIZE,
+        localRef = ecReconstructExecutor;
+        if (localRef == null) {
+          localRef = 
createThreadPoolExecutor(EC_RECONSTRUCT_STRIPE_READ_POOL_MIN_SIZE,
               clientConfig.getEcReconstructStripeReadPoolLimit(),
-              60, TimeUnit.SECONDS, new SynchronousQueue<>(),
-              new ThreadFactoryBuilder()
-                  .setNameFormat("ec-reconstruct-reader-TID-%d")
-                  .build(),
-              new ThreadPoolExecutor.CallerRunsPolicy());
-          executor = ecReconstructExecutor;
+              "ec-reconstruct-reader-TID-%d");
+          ecReconstructExecutor = localRef;
+        }
+      }
+    }
+    return localRef;
+  }
+
+  public ExecutorService getECWriteThreadPool() {
+    ExecutorService localRef = ecWriteExecutor;
+    if (localRef == null) {
+      synchronized (this) {
+        localRef = ecWriteExecutor;
+        if (localRef == null) {
+          localRef = createThreadPoolExecutor(EC_WRITE_POOL_MIN_SIZE,
+              clientConfig.getEcClientWritePoolLimit(),

Review Comment:
   One question: should we make this an unbounded cached thread pool?  This 
would help resource re-use (as opposed to current single thread per output 
stream), but also allow scaling further without config change.



-- 
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