Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-35076

Watermark alignment will cause data flow to experience serious shake

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.16.1
    • None
    • Runtime / Coordination
    • None

    Description

      In our company, there is a requirement scenario for multi-stream join operations, we are making modifications based on Flink watermark alignment, then I found that the final join output would experience serious shake.

      and I analyzed the reasons: an upstream topic has more than 300 partitions. The number of partitions requested for this topic is too large, causing some partitions to frequently experience intermittent writes with QPS=0. This phenomenon is more serious between 2 am and 5 am.However, the overall topic writing is very smooth.

      The final join output will experience serious shake, as shown in the following diagram:

      Root cause:

      1. The SourceOperator#emitLatestWatermark reports the lastEmittedWatermark to the SourceCoordinator.
      2. If the partition write is zero during a certain period, the lastEmittedWatermark sent by the subtask corresponding to that partition remains unchanged.
      3. The SourceCoordinator aggregates the watermarks of all subtasks according to the watermark group and takes the smallest watermark. This means that the maxAllowedWatermark may remain unchanged for some time, even though the overall upstream data flow is moving forward. until that minimum value is updated, only then will everything change, which will manifest as serious shake in the output data stream.

      I think choosing the global minimum might not be a good option. Using min/max could more likely encounter some edge cases. Perhaps choosing a median value would be more appropriate? Or a more complex selection strategy?

      If replaced with a median value, it can ensure that the overall data flow is very smooth:

       

      Attachments

        1. image-2024-04-10-20-15-05-731.png
          308 kB
          elon_X
        2. image-2024-04-10-20-23-13-872.png
          85 kB
          elon_X
        3. image-2024-04-10-20-25-59-387.png
          202 kB
          elon_X
        4. image-2024-04-10-20-29-13-835.png
          105 kB
          elon_X

        Activity

          People

            Unassigned Unassigned
            elon elon_X
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: