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

Multiple reshuffles are ignored in some cases on Flink batch runner.

Details

    • Bug
    • Status: Resolved
    • P2
    • Resolution: Fixed
    • 2.19.0, 2.20.0
    • 2.22.0
    • runner-flink
    • None

    Description

      Multiple reshuffles are ignored in some cases on Flink batch runner. This may lead to huge performace penalty in IO connectors (when reshuffling splits).

      In flink optimizer, when we `.rebalance()` dataset, is output channel is marked as `FORCED_REBALANCED`. When we chain this with another `.rebalance()`, the latter is ignored because it's source is already `FORCED_REBALANCED`, thus requested property is met. This is correct beaviour because rebalance is idempotent.

      When we include `flatMap` in between rebalances -> `.rebalance().flatMap(...).rebalance()`, we need to reshuffle again, because dataset distribution may have changed (eg. you can possibli emit unbouded stream from a single element). Unfortunatelly `flatMap` output is still incorrectly marked as `FORCED_REBALANCED` and the second reshuffle gets ignored.

      This especially affects IO connectors -> `FileIO.match()` returns reshuffled list of matched files -> we split each file into ranges -> *reshuffle* -> read. Ignoring the second reshuffle leads to huge perf. degradation (5m -> 2h in one of our production pipelines)

      Attachments

        Issue Links

          Activity

            People

              dmvk David Morávek
              dmvk David Morávek
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

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