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

Set ReadAdvice#NORMAL on files that have a forward-only access pattern. #13450

Merged
merged 5 commits into from
Jun 5, 2024

Conversation

jpountz
Copy link
Contributor

@jpountz jpountz commented Jun 4, 2024

This applies to files where performing readahead could help:

  • Doc values data (.dvd)
  • Norms data (.nvd)
  • Docs and freqs in postings lists (.doc)
  • Points data (.kdd)

Other files (KNN vectors, stored fields, term vectors) keep using a RANDOM
advice.

…ess pattern.

This introduces a new API that allows directories to optimize access to
`IndexInput`s that have a forward-only access pattern by reading ahead of the
current position. It would be applicable to:
 - Postings lists,
 - Doc values,
 - Norms,
 - Points.

Relates apache#13179
@jpountz jpountz mentioned this pull request Jun 4, 2024
9 tasks
}
// TODO: Is there a hint we can give to the OS to let it optimize for our forward-only access
// pattern in the given range?
}
Copy link
Member

Choose a reason for hiding this comment

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

MADV_SEQUENTIAL

Copy link
Member

Choose a reason for hiding this comment

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

or even better, MADV_NORMAL for the range, which is less aggressive.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought you had concerns about MADV_NORMAL but I like it better too, I updated the PR to use ReadAdvice.NORMAL instead.

This reverts commit 8375caf.
…ern.

This applies to files where performing readahead could help:
 - Doc values data (`.dvd`)
 - Norms data (`.nvd`)
 - Docs and freqs in postings lists (`.doc`)
 - Points data (`.kdd`)

Other files (KNN vectors, stored fields, term vectors) keep using a `RANDOM`
advice.
@jpountz jpountz changed the title Give a hint to IndexInput about slices that have a forward-only access pattern. Set ReadAdvice#NORMAL on files that have a forward-only access pattern. Jun 5, 2024
@jpountz jpountz marked this pull request as ready for review June 5, 2024 08:20
@jpountz jpountz merged commit 846aa2f into apache:main Jun 5, 2024
3 checks passed
@jpountz jpountz deleted the readahead_hint branch June 5, 2024 11: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