You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2021/12/03 09:46:42 UTC

[GitHub] [spark] LuciferYang commented on a change in pull request #34792: [SPARK-37530][Core] Spark reads many paths very slow though newAPIHadoopFile

LuciferYang commented on a change in pull request #34792:
URL: https://github.com/apache/spark/pull/34792#discussion_r761787184



##########
File path: core/src/main/scala/org/apache/spark/rdd/NewHadoopRDD.scala
##########
@@ -123,6 +123,10 @@ class NewHadoopRDD[K, V](
 
   override def getPartitions: Array[Partition] = {
     val inputFormat = inputFormatClass.getConstructor().newInstance()
+    // setMinPartitions below will call FileInputFormat.listStatus(), which can be quite slow when
+    // traversing a large number of directories and files. Parallelize it.
+    _conf.setIfUnset(FileInputFormat.LIST_STATUS_NUM_THREADS,
+      Runtime.getRuntime.availableProcessors().toString)

Review comment:
       Will this `availableProcessors` get the actual number of available CPU cores in container instances, VM instances and physical machine instances?




-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org