spark-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mridulm <...@git.apache.org>
Subject [GitHub] spark pull request: SPARK-1145: Memory mapping with many small blo...
Date Sat, 01 Mar 2014 05:31:13 GMT
Github user mridulm commented on a diff in the pull request:

    https://github.com/apache/spark/pull/43#discussion_r10189405
  
    --- Diff: core/src/main/scala/org/apache/spark/storage/DiskStore.scala ---
    @@ -84,12 +84,27 @@ private class DiskStore(blockManager: BlockManager, diskManager: DiskBlockManage
       override def getBytes(blockId: BlockId): Option[ByteBuffer] = {
         val segment = diskManager.getBlockLocation(blockId)
         val channel = new RandomAccessFile(segment.file, "r").getChannel()
    -    val buffer = try {
    -      channel.map(MapMode.READ_ONLY, segment.offset, segment.length)
    -    } finally {
    -      channel.close()
    +
    +    val buffer =
    +      // For small files, directly read rather than memory map
    +      if (segment.length < 2 * 4096) {
    --- End diff --
    
    I would rather have a hidden config param which can be tuned if required (however rarely),
as opposed to have magic values which actually have no experimental basis.
    The impact of this PR is not just in memory usage, but also in the IO characteristics
of spark.
    
    In particular, this is going to have significant performance impact if there are a large
number of small files : which are fairly common - and in a lot of times, like in our experiments,
aggressively aimed towards for the performance characterstics we are shooting for.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message