Uploaded image for project: 'Beam'
  1. Beam
  2. BEAM-8191

Multiple Flatten.pCollections() transforms generate an overwhelming number of tasks

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 2.12.0, 2.14.0, 2.15.0
    • Fix Version/s: None
    • Component/s: runner-spark
    • Labels:
      None

      Description

      The Flatten.pCollections() is translated into a Spark union operation. The resulting RDD will have the sum of the partitions in the originating RDDs.

      If you flatten 2 PCollections with each 10 partitions, the result will have 20 partitions.

      This is ok in small pipelins, but in our main pipeline, this means the number of tasks grows out of hand quite easily (over 500k tasks in one stage). This overloads the driver and crashes the process.

      I have created a small repro case:

      https://github.com/pbackx/beam-flatmap-test

       

      A possible solution is to add a coalesce call after the union. We have been testing this and it seems to do exactly what we want, but I'm not sure if this fix is applicable for all cases. 

      I will open a PR for this so that you can review my proposed change and discuss whether or not it's a good idea.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                pbackx Peter Backx
                Reporter:
                pbackx Peter Backx
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 2h
                  2h