Skip to content

Conversation

vladem
Copy link
Contributor

@vladem vladem commented Oct 3, 2025

Currently we reserve memory for backwards seek only when an actual seek occurs. The memory is used even if there is no such seek. Also we reserve too few memory, up to 1MiB, while the whole extra buffer of size part_size may be kept in RAM.

With this change MP makes a memory reservation upon the creation of PrefetchGetObject and releases memory once it is dropped. This replaces the existing mechanism which reserves memory in PartQueue::push_front.

Does this change impact existing behavior?

In a memory constrained environment, this may result in smaller read window sizes and less memory consumption.

Does this change need a changelog entry? Does it require a version change?

Patch version change and a change log to mountpoint-s3-fs, will add later.


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).

Signed-off-by: Vlad Volodkin <vlaad@amazon.com>
@vladem vladem had a problem deploying to PR integration tests October 3, 2025 13:08 — with GitHub Actions Failure
@vladem vladem had a problem deploying to PR integration tests October 3, 2025 13:08 — with GitHub Actions Failure
@vladem vladem temporarily deployed to PR integration tests October 3, 2025 13:08 — with GitHub Actions Inactive
@vladem vladem temporarily deployed to PR integration tests October 3, 2025 13:08 — with GitHub Actions Inactive
@vladem vladem temporarily deployed to PR integration tests October 3, 2025 13:08 — with GitHub Actions Inactive
@vladem vladem had a problem deploying to PR integration tests October 3, 2025 13:08 — with GitHub Actions Failure
@vladem vladem had a problem deploying to PR integration tests October 3, 2025 13:08 — with GitHub Actions Failure
@vladem vladem had a problem deploying to PR integration tests October 3, 2025 13:08 — with GitHub Actions Failure
@vladem vladem temporarily deployed to PR integration tests October 3, 2025 13:08 — with GitHub Actions Inactive
@vladem vladem had a problem deploying to PR integration tests October 3, 2025 13:08 — with GitHub Actions Failure
@vladem vladem temporarily deployed to PR integration tests October 3, 2025 13:08 — with GitHub Actions Inactive
@vladem vladem temporarily deployed to PR integration tests October 3, 2025 13:08 — with GitHub Actions Inactive
@vladem vladem temporarily deployed to PR integration tests October 3, 2025 13:08 — with GitHub Actions Inactive
@vladem vladem temporarily deployed to PR integration tests October 3, 2025 13:08 — with GitHub Actions Inactive
@vladem vladem temporarily deployed to PR integration tests October 3, 2025 13:08 — with GitHub Actions Inactive
@vladem vladem temporarily deployed to PR integration tests October 3, 2025 13:08 — with GitHub Actions Inactive
@vladem vladem had a problem deploying to PR integration tests October 3, 2025 13:08 — with GitHub Actions Failure
@vladem vladem temporarily deployed to PR integration tests October 3, 2025 13:08 — with GitHub Actions Inactive
@vladem vladem temporarily deployed to PR integration tests October 3, 2025 13:08 — with GitHub Actions Inactive
@vladem vladem temporarily deployed to PR integration tests October 3, 2025 13:08 — with GitHub Actions Inactive
@vladem vladem temporarily deployed to PR integration tests October 3, 2025 13:08 — with GitHub Actions Inactive
@vladem vladem changed the title Keep a constant memory reservation for backwards seek for each file handle Keep a constant memory reservation for backwards seek for each fh Oct 3, 2025
Signed-off-by: Vlad Volodkin <vlaad@amazon.com>
@vladem vladem temporarily deployed to PR integration tests October 3, 2025 14:07 — with GitHub Actions Inactive
@vladem vladem temporarily deployed to PR integration tests October 3, 2025 14:07 — with GitHub Actions Inactive
@vladem vladem had a problem deploying to PR integration tests October 3, 2025 14:07 — with GitHub Actions Failure
@vladem vladem temporarily deployed to PR integration tests October 3, 2025 14:07 — with GitHub Actions Inactive
@vladem vladem temporarily deployed to PR integration tests October 3, 2025 14:07 — with GitHub Actions Inactive
@vladem vladem temporarily deployed to PR integration tests October 3, 2025 14:07 — with GitHub Actions Inactive
@vladem vladem temporarily deployed to PR integration tests October 3, 2025 14:07 — with GitHub Actions Inactive
@vladem vladem temporarily deployed to PR integration tests October 3, 2025 14:07 — with GitHub Actions Inactive
@vladem vladem temporarily deployed to PR integration tests October 3, 2025 14:07 — with GitHub Actions Inactive
@vladem vladem temporarily deployed to PR integration tests October 3, 2025 14:07 — with GitHub Actions Inactive
@vladem vladem temporarily deployed to PR integration tests October 3, 2025 14:07 — with GitHub Actions Inactive
@vladem vladem temporarily deployed to PR integration tests October 3, 2025 14:07 — with GitHub Actions Inactive
@vladem vladem temporarily deployed to PR integration tests October 3, 2025 14:07 — with GitHub Actions Inactive
@vladem vladem temporarily deployed to PR integration tests October 3, 2025 14:07 — with GitHub Actions Inactive
@vladem vladem temporarily deployed to PR integration tests October 3, 2025 14:07 — with GitHub Actions Inactive
@vladem vladem temporarily deployed to PR integration tests October 3, 2025 14:07 — with GitHub Actions Inactive
@vladem vladem temporarily deployed to PR integration tests October 3, 2025 14:07 — with GitHub Actions Inactive
@vladem vladem temporarily deployed to PR integration tests October 3, 2025 14:07 — with GitHub Actions Inactive
@vladem vladem temporarily deployed to PR integration tests October 3, 2025 14:07 — with GitHub Actions Inactive
@vladem vladem temporarily deployed to PR integration tests October 3, 2025 14:07 — with GitHub Actions Inactive
@vladem vladem temporarily deployed to PR integration tests October 3, 2025 14:07 — with GitHub Actions Inactive
@vladem vladem temporarily deployed to PR integration tests October 3, 2025 14:26 — with GitHub Actions Inactive
@vladem vladem added the performance PRs to run benchmarks on label Oct 3, 2025
@vladem vladem marked this pull request as ready for review October 6, 2025 09:34
/// The amount of memory reserved for a backwards seek window.
///
/// The seek window size is rounded up to the nearest multiple of part_size.
fn seek_window_reservation(part_size: usize, seek_window_size: usize) -> u64 {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: backwards_seek_reservation?

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

Labels

performance PRs to run benchmarks on

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants