Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FLINK-37379][state/forst] Double list LRU in ForSt state and cache reload #26237

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Zakelly
Copy link
Contributor

@Zakelly Zakelly commented Feb 28, 2025

What is the purpose of the change

Currently, the file-based LRU cache lacks of loading files from the disaggregated DFS. Meaning that after the job recovery, there will be no cache available, hence the performance is low over a period of time. It is critical for production availability of disaggregated state.

This PR introduces a new implementation that allows ForSt to manage file-based cache in a double list (hot/cold) and support cache reload after eviction.

Brief change log

  • Introduce DoubleListLru and rewrite the FileBasedCache based on that.

Verifying this change

This change is already covered by existing IT tests. The new introduced classes are covered by new introduced UTs.

Does this pull request potentially affect one of the following parts:

  • Dependencies (does it add or upgrade a dependency): no
  • The public API, i.e., is any changed class annotated with @Public(Evolving): no
  • The serializers: no
  • The runtime per-record code paths (performance sensitive): yes
  • Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn, ZooKeeper: no
  • The S3 file system connector: no

Documentation

  • Does this pull request introduce a new feature? yes
  • If yes, how is the feature documented? docs

@Zakelly Zakelly changed the title [FLINK-37379] Double list LRU in ForSt state and cache reload [FLINK-37379][state/forst] Double list LRU in ForSt state and cache reload Feb 28, 2025
@flinkbot
Copy link
Collaborator

flinkbot commented Feb 28, 2025

CI report:

Bot commands The @flinkbot bot supports the following commands:
  • @flinkbot run azure re-run the last Azure build

Copy link
Contributor

@fredia fredia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR, overall design LGTM, left two comments regarding the implementation.

void movedToSecond(FileCacheEntry value) {
// trigger the evicting
LOG.trace("Cache entry {} moved to second link.", value.cachePath);
cacheLimitPolicy.release(value.entrySize);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the FileCacheEntry#cachePath deleted from cacheFs?
Do we need to wait for delete before releasing cacheLimitPolicy?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cache will be deleted in value.invalidate(), if the reference count reached 0.

We'd better not wait for that, since we are on the task thread and it's better not block here.

@Zakelly
Copy link
Contributor Author

Zakelly commented Mar 3, 2025

Also, additional two commits to enhance the user experience are attached.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants