Checkpoint size growing Hi! We're running Flink 1...
# troubleshooting
k
Checkpoint size growing Hi! We're running Flink 1.15.2 in Amazon Managed Service for Flink. Recently our checkpoints have been behaving a little bad. We're taking both manually-triggered savepoints every 30 minutes and Flink-managed checkpoints every 30 minutes. The offset is a little different, which I think explains why the maximum and minimum sizes of checkpoints over one hour oscillate: checkpoints seem to be consistently larger than savepoints. Would anyone have an idea why our checkpoint sizes are growing fast but savepoint sizes are relatively stable? We have double-checked that every
ValueState
and
MapState
in our application has TTL set. Our Flink cluster is under quite heavy load, both CPU usage and I/O to sink occasionally create backpressure. Could that explain why checkpoints are increasing in size? Thanks so much for any insights 🙏
Note: We started triggering manual savepoints using AWS Lambda on Dec 1st. I think that should explain why there are three graphs instead of one, because we only created Flink-managed checkpoints before that.
y
Hi Kimmo. Can you elaborate why you are triggering savepoints every 30 minutes? Savepoints are usually meant to be taken when you want to gracefully upgrade your Flink application, otherwise you could be using checkpoints. In order to better understand the behavior, we need to understand the logic and behavior: 1. Which state backend are you using a. If you’re using RocksDB, do you have StateTtl set? If you do, are you running compaction in the background or relying on savepoints to be compacted during savepoints? 2. Could it be that over time, your application is accumulating more state? (this is also probably related to eviction, but trying to understand if the logic itself should see spikes in data as well)
k
Hi Yuval! Thanks for the response and good questions. We're triggering savepoints every 30 minutes to ensure we always have a relatively recent savepoint where to restart processing. We have seen multiple times our Flink application getting so stuck that it cannot create savepoint on shutdown, so we want to create those on schedule. This is also the AWS recommended setup I think:
We recommend that your application create a snapshot several times a day to restart properly with correct state data. The correct frequency for your snapshots depends on your application's business logic. Taking frequent snapshots allows you to recover more recent data, but increases cost and requires more system resources.
1. AWS Managed Flink uses RocksDB. We have state TTL set on all
MapState
and
ValueState
that we have. We're not explicitly running compaction, I believe all that should be handled by the managed Flink service 2. It is possible, but we have double-checked all state has TTL set. Also, the savepoint size seems to be relatively stable. It's only the checkpoints that are increasing in size.
y
I am not in the details of the checkpoint and savepoint structure, but as far as my understanding they should be mostly identical, indeed very weird that checkpoints are ending up larger. Are you using unaligned checkpoints, incremental checkpoints, etc?
k
Here's the full checkpointing configuration. The only things that we can control are Interval, Timeout and Minimum Pause Between Checkpoints. All else is controlled by AWS:
y
Are you setting up cleanupInRocksdbCompactFilter or cleanupFullSnapshot in your StateTtlConfig?
k
Hmm no, we only have this
Copy code
val ttlConfig =
      StateTtlConfig
        .newBuilder(Time.hours(24))
        .setUpdateType(StateTtlConfig.UpdateType.OnCreateAndWrite)
        .build()
Should we add those? I have seen the documentation for those but I'm a little hesitant to add such in Managed Flink, especially since we don't control the state backend 🤔
y
I would give it a try, the first option to cleanup during compaction should be more lightweight.
k
OK, I think we'll have to speak with AWS about that. I would like to understand better how they think it would affect performance. Thanks for the suggestion! Found also some more information here: > Managed Service for Apache Flink is using incremental checkpoints and thus state ttl is based on RocksDB compaction. You can only observe an actual reduction in state size (indicated by checkpoint size) after a compaction operation occurs. In particular for checkpoint sizes below 200 MB, it's unlikely that you observe any checkpoint size reduction as a result of state expiring. However, savepoints are based on a clean copy of the state that does not contain old data, so you can trigger a snapshot in Managed Service for Apache Flink to force the removal of outdated state. We're triggering snapshots periodically so that should at least for the removal of outdated state 🤔
👍 1