[ https://issues.apache.org/jira/browse/SPARK-11583?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14996147#comment-14996147 ]
Kent Yao commented on SPARK-11583: ---------------------------------- [~srowen] MapStatus stores BlockManagerId where it locates and Array[Long] which are the sizes of shuffle results, One of its implementation HighlyCompressedMapStatus compresses the Array[long] to a *long* ---avgSize and a BitSet[Array.size] marking empty blocks. For large tasks such as 200k, the size of bitset[200k] is 128KB, when 200k mapstatuses be passed to the diver, it will be 200k * 128KB ≈ 4.66GB, each executor will fetch them later. What if only few blocks contain result , or only few blocks are empty (maybe only 10), we use a container stores the _reduceId: Int_ , size of such a mapstatus may be 10*32bit, which means the diver may only receive 61MB data. Am I right? > Make MapStatus use less memory uage > ----------------------------------- > > Key: SPARK-11583 > URL: https://issues.apache.org/jira/browse/SPARK-11583 > Project: Spark > Issue Type: Improvement > Reporter: Kent Yao > > In the resolved issue https://issues.apache.org/jira/browse/SPARK-11271, as I > said, using BitSet can save ≈20% memory usage compared to RoaringBitMap. > For a spark job contains quite a lot of tasks, 20% seems a drop in the ocean. > Essentially, BitSet uses long[]. For example a BitSet[200k] = long[3125]. > So if we use a HashSet[Int] to store reduceId (when non-empty blocks are > dense,use reduceId of empty blocks; when sparse, use non-empty ones). > For dense cases: if HashSet[Int](numNonEmptyBlocks).size < > BitSet[totalBlockNum], I use MapStatusTrackingNoEmptyBlocks > For sparse cases: if HashSet[Int](numEmptyBlocks).size < > BitSet[totalBlockNum], I use MapStatusTrackingEmptyBlocks > sparse case, 299/300 are empty > sc.makeRDD(1 to 30000, 3000).groupBy(x=>x).top(5) > dense case, no block is empty > sc.makeRDD(1 to 9000000, 3000).groupBy(x=>x).top(5) -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org