You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@flink.apache.org by Sigalit Eliazov <e....@gmail.com> on 2024/05/23 10:20:43 UTC

Task Manager memory usage

Hi,

I am trying to understand the following behavior in our Flink application
cluster. Any assistance would be appreciated.

We are running a Flink application cluster with 5 task managers, each with
the following configuration:

   - jobManagerMemory: 12g
   - taskManagerMemory: 20g
   - taskManagerMemoryHeapSize: 12g
   - taskManagerMemoryNetworkMax: 4g
   - taskManagerMemoryNetworkMin: 1g
   - taskManagerMemoryManagedSize: 50m
   - taskManagerMemoryOffHeapSize: 2g
   - taskManagerMemoryNetworkFraction: 0.2
   - taskManagerNetworkMemorySegmentSize: 4mb
   - taskManagerMemoryFloatingBuffersPerGate: 64
   - taskmanager.memory.jvm-overhead.min: 256mb
   - taskmanager.memory.jvm-overhead.max: 2g
   - taskmanager.memory.jvm-overhead.fraction: 0.1

Our pipeline includes stateful transformations, and we are verifying that
we clear the state once it is no longer needed.

Through the Flink UI, we observe that the heap size increases and decreases
during the job lifecycle.

However, there is a noticeable delay between clearing the state and the
reduction in heap size usage, which I assume is related to the garbage
collector frequency.

What is puzzling is the task manager pod memory usage. It appears that the
memory usage increases intermittently and is not released. We verified the
different state metrics and confirmed they are changing according to the
logic.

Additionally, if we had a state that was never released, I would expect to
see the heap size increasing constantly as well.

Any insights or ideas?

Thanks,

Sigalit

Re: Task Manager memory usage

Posted by Sigalit Eliazov <e....@gmail.com>.
hi,
thanks for your reply,
we are storing the data in memory since it is a short term we thought that
adding rocksdb will add overhead.


On Thu, May 23, 2024 at 4:38 PM Sachin Mittal <sj...@gmail.com> wrote:

> Hi
> Where are you storing the state.
> Try rocksdb.
>
> Thanks
> Sachin
>
>
> On Thu, 23 May 2024 at 6:19 PM, Sigalit Eliazov <e....@gmail.com>
> wrote:
>
>> Hi,
>>
>> I am trying to understand the following behavior in our Flink application
>> cluster. Any assistance would be appreciated.
>>
>> We are running a Flink application cluster with 5 task managers, each
>> with the following configuration:
>>
>>    - jobManagerMemory: 12g
>>    - taskManagerMemory: 20g
>>    - taskManagerMemoryHeapSize: 12g
>>    - taskManagerMemoryNetworkMax: 4g
>>    - taskManagerMemoryNetworkMin: 1g
>>    - taskManagerMemoryManagedSize: 50m
>>    - taskManagerMemoryOffHeapSize: 2g
>>    - taskManagerMemoryNetworkFraction: 0.2
>>    - taskManagerNetworkMemorySegmentSize: 4mb
>>    - taskManagerMemoryFloatingBuffersPerGate: 64
>>    - taskmanager.memory.jvm-overhead.min: 256mb
>>    - taskmanager.memory.jvm-overhead.max: 2g
>>    - taskmanager.memory.jvm-overhead.fraction: 0.1
>>
>> Our pipeline includes stateful transformations, and we are verifying that
>> we clear the state once it is no longer needed.
>>
>> Through the Flink UI, we observe that the heap size increases and
>> decreases during the job lifecycle.
>>
>> However, there is a noticeable delay between clearing the state and the
>> reduction in heap size usage, which I assume is related to the garbage
>> collector frequency.
>>
>> What is puzzling is the task manager pod memory usage. It appears that
>> the memory usage increases intermittently and is not released. We verified
>> the different state metrics and confirmed they are changing according to
>> the logic.
>>
>> Additionally, if we had a state that was never released, I would expect
>> to see the heap size increasing constantly as well.
>>
>> Any insights or ideas?
>>
>> Thanks,
>>
>> Sigalit
>>
>

Re: Task Manager memory usage

Posted by Sachin Mittal <sj...@gmail.com>.
Hi
Where are you storing the state.
Try rocksdb.

Thanks
Sachin


On Thu, 23 May 2024 at 6:19 PM, Sigalit Eliazov <e....@gmail.com> wrote:

> Hi,
>
> I am trying to understand the following behavior in our Flink application
> cluster. Any assistance would be appreciated.
>
> We are running a Flink application cluster with 5 task managers, each with
> the following configuration:
>
>    - jobManagerMemory: 12g
>    - taskManagerMemory: 20g
>    - taskManagerMemoryHeapSize: 12g
>    - taskManagerMemoryNetworkMax: 4g
>    - taskManagerMemoryNetworkMin: 1g
>    - taskManagerMemoryManagedSize: 50m
>    - taskManagerMemoryOffHeapSize: 2g
>    - taskManagerMemoryNetworkFraction: 0.2
>    - taskManagerNetworkMemorySegmentSize: 4mb
>    - taskManagerMemoryFloatingBuffersPerGate: 64
>    - taskmanager.memory.jvm-overhead.min: 256mb
>    - taskmanager.memory.jvm-overhead.max: 2g
>    - taskmanager.memory.jvm-overhead.fraction: 0.1
>
> Our pipeline includes stateful transformations, and we are verifying that
> we clear the state once it is no longer needed.
>
> Through the Flink UI, we observe that the heap size increases and
> decreases during the job lifecycle.
>
> However, there is a noticeable delay between clearing the state and the
> reduction in heap size usage, which I assume is related to the garbage
> collector frequency.
>
> What is puzzling is the task manager pod memory usage. It appears that the
> memory usage increases intermittently and is not released. We verified the
> different state metrics and confirmed they are changing according to the
> logic.
>
> Additionally, if we had a state that was never released, I would expect to
> see the heap size increasing constantly as well.
>
> Any insights or ideas?
>
> Thanks,
>
> Sigalit
>

Re: Task Manager memory usage

Posted by Zhanghao Chen <zh...@outlook.com>.
Hi Sigalit,

Yes. Here, most of your memory is consumed by JVM heap and Flink network memory, both are somewhat like a pre-allocated memory pool managed by JVM/Flink Memory Manager, which typically do not return memory to the OS even if there's some free space internally.

Best,
Zhanghao Chen
________________________________
From: Sigalit Eliazov <e....@gmail.com>
Sent: Tuesday, June 4, 2024 15:46
To: Zhanghao Chen <zh...@outlook.com>
Subject: Re: Task Manager memory usage

hi, thanks for your reply
as you suggested the memory did stop increasing at some point
but even after the pipeline was idle for a long time i still see the TM pod memory is not changed.
I assume flink 'saves' this memory just in case data will arrive
but is there any point where flink does release the memory at all?


thanks
Sigalit

On Thu, May 23, 2024 at 6:49 PM Zhanghao Chen <zh...@outlook.com>> wrote:
Hi Sigalit,

For states stored in memory, they would most probably keep alive for several rounds of GC and ended up in the old gen of heap, and won't get recycled until a Full GC.

As for the TM pod memory usage, most probabliy it will stop increasing at some point. You could try setting a larger taskmanager.memory.jvm-overhead memory, and monitor it for a long time. If that's not the case, then there might be native memory leakage somewhere, but that may not be related to the state.

Best,
Zhanghao Chen
________________________________
From: Sigalit Eliazov <e....@gmail.com>>
Sent: Thursday, May 23, 2024 18:20
To: user <us...@flink.apache.org>>
Subject: Task Manager memory usage


Hi,

I am trying to understand the following behavior in our Flink application cluster. Any assistance would be appreciated.

We are running a Flink application cluster with 5 task managers, each with the following configuration:

  *   jobManagerMemory: 12g
  *   taskManagerMemory: 20g
  *   taskManagerMemoryHeapSize: 12g
  *   taskManagerMemoryNetworkMax: 4g
  *   taskManagerMemoryNetworkMin: 1g
  *   taskManagerMemoryManagedSize: 50m
  *   taskManagerMemoryOffHeapSize: 2g
  *   taskManagerMemoryNetworkFraction: 0.2
  *   taskManagerNetworkMemorySegmentSize: 4mb
  *   taskManagerMemoryFloatingBuffersPerGate: 64
  *   taskmanager.memory.jvm-overhead.min: 256mb
  *   taskmanager.memory.jvm-overhead.max: 2g
  *   taskmanager.memory.jvm-overhead.fraction: 0.1

Our pipeline includes stateful transformations, and we are verifying that we clear the state once it is no longer needed.

Through the Flink UI, we observe that the heap size increases and decreases during the job lifecycle.

However, there is a noticeable delay between clearing the state and the reduction in heap size usage, which I assume is related to the garbage collector frequency.

What is puzzling is the task manager pod memory usage. It appears that the memory usage increases intermittently and is not released. We verified the different state metrics and confirmed they are changing according to the logic.

Additionally, if we had a state that was never released, I would expect to see the heap size increasing constantly as well.

Any insights or ideas?

Thanks,

Sigalit

Re: Task Manager memory usage

Posted by Zhanghao Chen <zh...@outlook.com>.
Hi Sigalit,

For states stored in memory, they would most probably keep alive for several rounds of GC and ended up in the old gen of heap, and won't get recycled until a Full GC.

As for the TM pod memory usage, most probabliy it will stop increasing at some point. You could try setting a larger taskmanager.memory.jvm-overhead memory, and monitor it for a long time. If that's not the case, then there might be native memory leakage somewhere, but that may not be related to the state.

Best,
Zhanghao Chen
________________________________
From: Sigalit Eliazov <e....@gmail.com>
Sent: Thursday, May 23, 2024 18:20
To: user <us...@flink.apache.org>
Subject: Task Manager memory usage


Hi,

I am trying to understand the following behavior in our Flink application cluster. Any assistance would be appreciated.

We are running a Flink application cluster with 5 task managers, each with the following configuration:

  *   jobManagerMemory: 12g
  *   taskManagerMemory: 20g
  *   taskManagerMemoryHeapSize: 12g
  *   taskManagerMemoryNetworkMax: 4g
  *   taskManagerMemoryNetworkMin: 1g
  *   taskManagerMemoryManagedSize: 50m
  *   taskManagerMemoryOffHeapSize: 2g
  *   taskManagerMemoryNetworkFraction: 0.2
  *   taskManagerNetworkMemorySegmentSize: 4mb
  *   taskManagerMemoryFloatingBuffersPerGate: 64
  *   taskmanager.memory.jvm-overhead.min: 256mb
  *   taskmanager.memory.jvm-overhead.max: 2g
  *   taskmanager.memory.jvm-overhead.fraction: 0.1

Our pipeline includes stateful transformations, and we are verifying that we clear the state once it is no longer needed.

Through the Flink UI, we observe that the heap size increases and decreases during the job lifecycle.

However, there is a noticeable delay between clearing the state and the reduction in heap size usage, which I assume is related to the garbage collector frequency.

What is puzzling is the task manager pod memory usage. It appears that the memory usage increases intermittently and is not released. We verified the different state metrics and confirmed they are changing according to the logic.

Additionally, if we had a state that was never released, I would expect to see the heap size increasing constantly as well.

Any insights or ideas?

Thanks,

Sigalit