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

Implement cache eviction #610

Merged
merged 3 commits into from
Nov 16, 2023
Merged

Implement cache eviction #610

merged 3 commits into from
Nov 16, 2023

Conversation

passaro
Copy link
Contributor

@passaro passaro commented Nov 16, 2023

Description of change

Introduce a CacheLimit argument for the DiskDataCache to configure the eviction policy. If a limit is set, the cache will track usage of the stored blocks. On put, it will check if the limit has been exceeded and start removing the least recently used blocks if required.

Relevant issues: #255

Does this change impact existing behavior?

No.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and I agree to the terms of the Developer Certificate of Origin (DCO).

Introduce a `CacheLimit` argument for the `DiskDataCache` to configure the eviction policy. If a limit is set, the cache will track usage of the stored blocks. On put, it will check if the limit has been exceeded and start removing the least recently used blocks if required.

Signed-off-by: Alessandro Passaro <alexpax@amazon.co.uk>
@passaro passaro temporarily deployed to PR integration tests November 16, 2023 11:42 — with GitHub Actions Inactive
@passaro passaro temporarily deployed to PR integration tests November 16, 2023 11:42 — with GitHub Actions Inactive
@passaro passaro temporarily deployed to PR integration tests November 16, 2023 11:42 — with GitHub Actions Inactive
@passaro passaro temporarily deployed to PR integration tests November 16, 2023 11:42 — with GitHub Actions Inactive
Copy link
Contributor

@dannycjones dannycjones left a comment

Choose a reason for hiding this comment

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

Nice! just a few minor comments

mountpoint-s3/src/main.rs Show resolved Hide resolved
mountpoint-s3/src/data_cache/disk_data_cache.rs Outdated Show resolved Hide resolved
mountpoint-s3/src/data_cache/disk_data_cache.rs Outdated Show resolved Hide resolved
mountpoint-s3/src/data_cache/disk_data_cache.rs Outdated Show resolved Hide resolved
@passaro passaro had a problem deploying to PR integration tests November 16, 2023 15:03 — with GitHub Actions Failure
@passaro passaro had a problem deploying to PR integration tests November 16, 2023 15:03 — with GitHub Actions Failure
@passaro passaro had a problem deploying to PR integration tests November 16, 2023 15:03 — with GitHub Actions Failure
@passaro passaro had a problem deploying to PR integration tests November 16, 2023 15:03 — with GitHub Actions Failure
Signed-off-by: Alessandro Passaro <alexpax@amazon.co.uk>
@passaro passaro temporarily deployed to PR integration tests November 16, 2023 15:05 — with GitHub Actions Inactive
@passaro passaro temporarily deployed to PR integration tests November 16, 2023 15:05 — with GitHub Actions Inactive
@passaro passaro temporarily deployed to PR integration tests November 16, 2023 15:05 — with GitHub Actions Inactive
@passaro passaro temporarily deployed to PR integration tests November 16, 2023 15:05 — with GitHub Actions Inactive
dannycjones
dannycjones previously approved these changes Nov 16, 2023
Copy link
Contributor

@dannycjones dannycjones left a comment

Choose a reason for hiding this comment

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

There's two comments but I don't want to block on them. LGTM.

Comment on lines +247 to +250
Ok(stats) if stats.total_space() == 0 => {
warn!("unable to determine available space");
return false;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Thinking about this a little more, maybe we should switch the cache limit to Unbounded when we encounter this... otherwise this is a lot of WARN logging 😄

Though that requires us to switch to &mut self or something. Maybe let's switch to unbounded if we notice that we can't determine total space?

(I'm happy for this to be follow-up, we're not targeting filesystems that lie about fsstat.)

mountpoint-s3/src/data_cache/disk_data_cache.rs Outdated Show resolved Hide resolved
@passaro passaro marked this pull request as ready for review November 16, 2023 16:40
Signed-off-by: Alessandro Passaro <alexpax@amazon.co.uk>
Copy link
Contributor

@dannycjones dannycjones left a comment

Choose a reason for hiding this comment

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

nice, thanks for handling the not enough space case here

@passaro passaro enabled auto-merge November 16, 2023 16:59
@passaro passaro added this pull request to the merge queue Nov 16, 2023
Merged via the queue into awslabs:main with commit 65cb1a7 Nov 16, 2023
18 checks passed
@passaro passaro deleted the cache-eviction branch November 16, 2023 17:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants