[
https://issues.apache.org/jira/browse/HADOOP-17998?focusedWorklogId=683281&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-683281
]
ASF GitHub Bot logged work on HADOOP-17998:
-------------------------------------------
Author: ASF GitHub Bot
Created on: 18/Nov/21 13:04
Start Date: 18/Nov/21 13:04
Worklog Time Spent: 10m
Work Description: sodonnel commented on a change in pull request #3645:
URL: https://github.com/apache/hadoop/pull/3645#discussion_r752220174
##########
File path:
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/CopyCommandWithMultiThread.java
##########
@@ -0,0 +1,157 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.fs.shell;
+
+import java.io.IOException;
+import java.util.LinkedList;
+import java.util.concurrent.ArrayBlockingQueue;
+import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.hadoop.classification.VisibleForTesting;
+
+/**
+ * Abstract command to enable sub copy commands run with multi-thread.
+ */
+public abstract class CopyCommandWithMultiThread
+ extends CommandWithDestination {
+
+ private int threadCount = 1;
+ private ThreadPoolExecutor executor = null;
+ private int threadPoolQueueSize = DEFAULT_QUEUE_SIZE;
+
+ public static final int DEFAULT_QUEUE_SIZE = 1024;
+ public static final int MAX_THREAD_COUNT =
+ Runtime.getRuntime().availableProcessors() * 2;
Review comment:
I wonder if we should limit the number of threads like this. Its hard to
say if the copy will be CPU bound, or disk / IO bound overall. I guess it is
best to avoid having no limit, but I wonder if having 2 * cores would be enough
for a small VM trying to put a large dir into the cluster. What do you think?
Maybe setting the limit to 4 or 8 * cores would be more flexible for users and
they can experiment with their own hardware to find the best setting?
--
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]
Issue Time Tracking
-------------------
Worklog Id: (was: 683281)
Time Spent: 1.5h (was: 1h 20m)
> Enable get command run with multi-thread
> ----------------------------------------
>
> Key: HADOOP-17998
> URL: https://issues.apache.org/jira/browse/HADOOP-17998
> Project: Hadoop Common
> Issue Type: Improvement
> Components: fs
> Affects Versions: 3.3.1
> Reporter: Chengwei Wang
> Priority: Major
> Labels: pull-request-available
> Attachments: HADOOP-17998.001.patch, HADOOP-17998.002.patch
>
> Time Spent: 1.5h
> Remaining Estimate: 0h
>
> CopyFromLocal/Put is enabled to run with multi-thread with HDFS-11786 and
> HADOOP-14698, and make put dirs or multiple files faster.
> So, It's necessary to enable get and copyToLocal command run with
> multi-thread.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]