Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-2048

Optimizations to CPU usage of external spilling code

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 1.1.0
    • Spark Core
    • None

    Description

      In the external spilling code in ExternalAppendOnlyMap and CoGroupedRDD, there are a few opportunities for optimization:

      • There are lots of uses of pattern-matching on Tuple2 (e.g. val (k, v) = pair), which we found to be much slower than accessing fields directly
      • Hash codes for each element are computed many times in StreamBuffer.minKeyHash, which will be expensive for some data types
      • Uses of buffer.remove() may be expensive if there are lots of hash collisions (better to swap in the last element into that position)
      • More objects are allocated than is probably necessary, e.g. ArrayBuffers and pairs
      • Because ExternalAppendOnlyMap is only given one key-value pair at a time, it allocates a new update function on each one, unlike the way we pass a single update function to AppendOnlyMap in Aggregator

      These should help because situations where we're spilling are also ones where there is presumably a lot of GC pressure in the new generation.

      Attachments

        Activity

          People

            matei Matei Alexandru Zaharia
            matei Matei Alexandru Zaharia
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: