Skip to content

Force niofs for fdt tmp file read access when flushing stored fields #129538

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

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

martijnvg
Copy link
Member

@martijnvg martijnvg commented Jun 17, 2025

Due to the way how stored fields get flushed when index sorting is active, it is possible that we encounter significant page cache faults when memory is scarce. In order to mitigate some of the slowness around this, we're planning to no longer mmap the fdt temp file. Initially behind a feature flag, to check for unforeseen side effects.

Typically using always mmap directory is better compared to noifs directory given there is a sufficient memory available to the OS for filesystem caching. However when that isn't the case, then indexing performance can vary a lot (often very slow). This is more true for files tmp files that stored fields create during flushing. These files exist for only a brief moment to sort stored fields in the order of the configured index sorting and are then removed. If these tmp files are mmapped there is risk to trash file system cache.

This change only avoids using mmap for the fdt tmp file. This the file that actually contains the data and can large compared to other files that get flushed. The fdm (metadata) and fdi (stored field index) remain being mmapped.

(labelling as non-issue, until feature flag has been removed)

…fields and

force direct io for checksuming fdt tmp file.
@martijnvg martijnvg changed the title Force normal read advice for stored field temp fdt files Force normal niofs for fdt tmp file read access when flushing stored fields Jun 17, 2025
@martijnvg martijnvg changed the title Force normal niofs for fdt tmp file read access when flushing stored fields Force niofs for fdt tmp file read access when flushing stored fields Jun 18, 2025
@elasticsearchmachine
Copy link
Collaborator

Hi @martijnvg, I've created a changelog YAML for you.

@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-storage-engine (Team:StorageEngine)

Copy link
Contributor

@ChrisHegarty ChrisHegarty left a comment

Choose a reason for hiding this comment

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

Makes sense to me @martijnvg. LGTM

Longer term we should consider how to migrate to using the new IOContext Hints in 10.3, so as to avoid the fragile dependency on the file name.

@martijnvg
Copy link
Member Author

Longer term we should consider how to migrate to using the new IOContext Hints in 10.3, so as to avoid the fragile dependency on the file name.

I will add a item on the roadmap for this.

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