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

add 2025-01-02_direct-io.md #45

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

machine424
Copy link
Member

@machine424 machine424 commented Feb 18, 2025


![container_memory_cache](../assets/2025-01-02_direct-io/container_memory_cache.png)

## Alternatives
Copy link
Member

@dgl dgl Feb 19, 2025

Choose a reason for hiding this comment

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

Using posix_fadvise with POSIX_FADV_DONTNEED could be an option if it doesn't make sense to totally avoid the cache (there's also Linux specific memory management options like MADV_COLD, which could help for some of the container concerns to optimise which memory is reclaimed, although it wouldn't likely have as much user visible impact on the page cache).

I suspect those don't make sense for the TSDB but could be worth mentioning here, there might be other places in the ecosystem where those make more sense than O_DIRECT.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thnaks, I'll mention that.


In addition to the issues mentioned above, sometimes the page cache generated during writes is not
used at all. For instance, once chunks are written during compaction, they are opened via
`mmap`, which renders the page cache produced during writing redundant and useless.
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure that's entirely true, Linux has a merged page + buffer cache: https://www.thomas-krenn.com/en/wiki/Linux_Page_Cache_Basics#Page_Cache_or_Buffer_Cache

(The exception being OpenBSD, see prometheus/prometheus#8799)

Copy link
Member Author

Choose a reason for hiding this comment

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

You're right, I'll make that clearer.

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