Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-25318 Improvement of scheduler and execution for Flink OLAP
  3. FLINK-25328

Improvement of reuse segments for join/agg/sort operators in TaskManager for flink olap queries

    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.14.0, 1.12.5, 1.13.3
    • None
    • Runtime / Coordination
    • None

    Description

      We submit batch jobs to flink session cluster as olap queries, and these jobs' subtasks in TaskManager are frequently created and destroyed because they finish their work quickly. Each slot in taskmanager manages `MemoryManager` for multiple tasks in one job, and the `MemoryManager` is closed when all the subtasks are finished. Join/Aggregate/Sort and etc. operators in the subtasks allocate `MemorySegment` via `MemoryManager` and these `MemorySegment` will be free when they are finished.

      It causes too much memory allocation and free of `MemorySegment` in taskmanager. For example, a TaskManager contains 50 slots, one job has 3 join/agg operatos run in the slot, each operator will allocate 2000 segments and initialize them. If the subtasks of a job take 100ms to execute, then the taskmanager will execute 10 jobs' subtasks one second and it will allocate and free 2000 * 3 * 50 * 10 = 300w segments for them. Allocate and free too many segments from memory will cause two issues:

      1) Increases the CPU usage of taskmanager
      2) Increase the cost of subtasks in taskmanager, which will increase the latency of job and decrease the qps.

      To improve the usage of memory segment between jobs in the same slot, we propose not drop memory manager when all the subtasks in the slot are finished. The slot will hold the `MemoryManager` and not free the allocated `MemorySegment` in it immediately. When some subtasks of another job are assigned to the slot, they don't need to allocate segments from memory and can reuse the `MemoryManager` and `MemorySegment` in it. WDYT? xtsong THX

      Attachments

        Activity

          People

            Unassigned Unassigned
            zjureel Fang Yong
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated: