There's already a built-in concept of WindowStagger that provides an
interface for accomplishing this.

It's not as well integrated (or documented) as it might be, but the
basic mechanism exists. To use it, I believe you would do something
like this:

assigner = new TumblingEventTimeWindows(Time.seconds(5), 0,
WindowStagger.RANDOM);

foo.keyBy(...)
  .window(assigner)
  ...

The different stagger strategies are documented in [1].

[1] 
https://nightlies.apache.org/flink/flink-docs-stable/api/java/index.html?org/apache/flink/streaming/api/windowing/assigners/WindowStagger.html

On Wed, Aug 2, 2023 at 7:13 PM xiangyu feng <xiangyu...@gmail.com> wrote:
>
> Hi Tucker,
>
> Can you describe more about your running job and how the trigger timer is 
> configured? Also it would be better if you can attach a FlameGraph to show 
> the CPU usage when the timer is triggered.
>
> Best,
> Xiangyu
>
> Tucker Harvey via user <user@flink.apache.org> 于2023年8月1日周二 05:51写道:
>>
>> Hello Flink community! My team is trying to optimize CPU usage on a running 
>> job, and we're exploring the option of offsetting the trigger time for 
>> smoother CPU patterns. Since adjusting the window will compromise job 
>> correctness, we plan to pursue a custom trigger implementation. We were 
>> curious if the community had any thoughts or insights on this issue.
>>
>>

Reply via email to