maheshk114 commented on code in PR #45228:
URL: https://github.com/apache/spark/pull/45228#discussion_r1535382480


##########
core/src/main/scala/org/apache/spark/internal/config/package.scala:
##########
@@ -551,6 +551,22 @@ package object config {
       .checkValue(_.endsWith(java.io.File.separator), "Path should end with 
separator.")
       .createOptional
 
+  private[spark] val STORAGE_FALLBACK_STORAGE_NUM_THREADS_FOR_SHUFFLE_READ =
+    ConfigBuilder("spark.storage.fallbackStorage.num.threads.for.shuffle.read")

Review Comment:
   done



##########
core/src/main/scala/org/apache/spark/storage/FallbackStorage.scala:
##########
@@ -147,6 +222,14 @@ private[spark] object FallbackStorage extends Logging {
     }
   }
 
+  def stopThreadPool(conf: SparkConf): Unit = {
+    logInfo(s" Stopping thread pool")
+    if (getFallbackStorage(conf).isDefined &&
+      getFallbackStorage(conf).get.fetchThreadPool.isDefined) {

Review Comment:
   done



##########
core/src/main/scala/org/apache/spark/storage/FallbackStorage.scala:
##########
@@ -92,6 +95,57 @@ private[storage] class FallbackStorage(conf: SparkConf) 
extends Logging {
     val hash = JavaUtils.nonNegativeHash(filename)
     fallbackFileSystem.exists(new Path(fallbackPath, 
s"$appId/$shuffleId/$hash/$filename"))
   }
+
+  private val fetchThreadPool: Option[ThreadPoolExecutor] = {
+    val numShuffleThreads = FallbackStorage.getNumReadThreads(conf)
+    if (numShuffleThreads > 0) {
+      logInfo(s"FallbackStorage created thread pool using  
${numShuffleThreads} thread(s)")
+      Some(ThreadUtils.newDaemonCachedThreadPool(
+        "FetchFromFallbackStorage-threadPool", numShuffleThreads))
+    } else {
+      logInfo("FallbackStorage thread pool not created")
+      None
+    }
+  }
+
+  def fetchBlocks(
+      blockManager: BlockManager,
+      blocks: collection.Seq[FetchBlockInfo],
+      address: BlockManagerId,
+      listener: BlockFetchingListener): Unit = {
+    fetchThreadPool match {
+      case Some(p) if !p.isShutdown =>
+        blocks.foreach(block =>
+          p.submit(new Runnable {
+            override def run(): Unit = {
+              fetchShuffleBlocks(block, blockManager, listener)
+            }
+          })
+        )
+      case _ =>
+        logInfo(s" fetchThreadPool does not exists for $address or shutdown")
+        blocks.foreach(block => fetchShuffleBlocks(block, blockManager, 
listener))
+    }
+  }
+
+  private def fetchShuffleBlocks(
+              block: FetchBlockInfo,

Review Comment:
   done



##########
core/src/test/scala/org/apache/spark/storage/FallbackStorageSuite.scala:
##########
@@ -172,61 +172,64 @@ class FallbackStorageSuite extends SparkFunSuite with 
LocalSparkContext {
   }
 
   test("migrate shuffle data to fallback storage") {
-    val conf = new SparkConf(false)

Review Comment:
   The test is not removed. I have just added a new conf to avoid duplicating 
the same test case.



##########
core/src/main/scala/org/apache/spark/executor/CoarseGrainedExecutorBackend.scala:
##########
@@ -354,7 +355,8 @@ private[spark] class CoarseGrainedExecutorBackend(
                 // We can only trust allBlocksMigrated boolean value if there 
were no tasks running
                 // since the start of computing it.
                 if (allBlocksMigrated && (migrationTime > 
lastTaskFinishTime.get())) {
-                  logInfo("No running tasks, all blocks migrated, stopping.")
+                  val timeTakenMs = (System.nanoTime() - startTime) / (1000 * 
1000)
+                  logInfo(s"No running tasks, all blocks migrated in 
$timeTakenMs ms, stopping.")

Review Comment:
   This log line can be used to compare the time taken to migrate to external 
storage and remote node. This may be helpful to user to check the increase in 
migration time.



##########
core/src/main/scala/org/apache/spark/storage/ShuffleBlockFetcherIterator.scala:
##########
@@ -1558,6 +1587,7 @@ object ShuffleBlockFetcherIterator {
       mapIndex: Int,
       address: BlockManagerId,
       size: Long,
+      timeTaken: Long,

Review Comment:
   This is not just for logging but to capture the time taken by read 
operations. This was helpful in comparing the time diff between read from 
external storage and remote node.



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