use posix_fadvise to avoid spoiling the OS cache#279
Closed
ThomasWaldmann wants to merge 6 commits intojborg:masterfrom
ThomasWaldmann:fadvise
Closed
use posix_fadvise to avoid spoiling the OS cache#279ThomasWaldmann wants to merge 6 commits intojborg:masterfrom ThomasWaldmann:fadvise
ThomasWaldmann wants to merge 6 commits intojborg:masterfrom
ThomasWaldmann:fadvise
Conversation
added "nonlocal euid" - without this, euid just gets redefined in inner scope instead of assigned to outer scope
added check for euid 0 - if we run as root, we always have permissions (not just if we are file owner)
note: due to caching and OS behaviour on linux, the bug was a bit tricky to reproduce
and also the fix was a bit tricky to test.
one needs strictatime mount option to enfore traditional atime updating.
for repeated tests, always change file contents (e.g. from /dev/urandom) or attic's caching
will prevent that the file gets read ("accessed") again.
check atimes with ls -lu
i could reproduce code was broken and is fixed with this changeset. and root now doesn't touch any atimes.
this safes some back-and-forth between C and Python code and also some memory management overhead as we can always reuse the same read_buf instead of letting Python allocate and free a up to 10MB big buffer for each buffer filling read. we can't use os-level file descriptors all the time though, as chunkify gets also invoked on objects like BytesIO that are not backed by a os-level file. Note: this changeset is also a preparation for O_DIRECT support which can be implemented a lot easier on C level.
note: - we call this frequently AFTER re-filling the chunker buffer, so even big input files have little cache impact. - there is still some cache impact due to output files caching, if the repository is on a locally mounted filesystem.
less calls to posix_fadvise (which seem to force a write-cache sync-to-disk and wait for that to complete) - if we call it after we synced anyway, we don't lose time. also: fixed a bug in the os.fsync call, it needs the fileno.
Contributor
Author
|
closing this pull request, seems unwanted. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
this is on-top of / includes PR #244.
for "attic create", neither the backup input file reads nor the repo file writes will spoil the cache any more.