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/06/28 05:15:21 UTC

[GitHub] [spark] dongjoon-hyun commented on a change in pull request #33109: [SPARK-35910][CORE][SHUFFLE] Update remoteBlockBytes based on merged block info to reduce task time

dongjoon-hyun commented on a change in pull request #33109:
URL: https://github.com/apache/spark/pull/33109#discussion_r659483474



##########
File path: core/src/main/scala/org/apache/spark/storage/ShuffleBlockFetcherIterator.scala
##########
@@ -379,13 +378,13 @@ final class ShuffleBlockFetcherIterator(
         hostLocalBlocks ++= blocksForAddress.map(info => (info._1, info._3))
         hostLocalBlockBytes += mergedBlockInfos.map(_.size).sum
       } else {
-        remoteBlockBytes += blockInfos.map(_._2).sum
         val (_, timeCost) = Utils.timeTakenMs[Unit] {
           collectFetchRequests(address, blockInfos, collectedRemoteRequests)
         }
         logDebug(s"Collected remote fetch requests for $address in $timeCost ms")
       }
     }
+    val remoteBlockBytes = collectedRemoteRequests.map(_.size).sum
     val numRemoteBlocks = collectedRemoteRequests.map(_.blocks.size).sum

Review comment:
       Instead of two iterations, what about the single iteration? Something like the following?
   ```scala
   val (remoteBlockBytes, numRemoteBlocks) =
       collectedRemoteRequests.reduce((x, y) => (x.size + y.size, x.blocks.size + y.blocks.size))
   ```




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