fallocate plot files in background upon creation #46
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.
Once hdd is being filled up to 80%+ allocating 101.5GiB of data can take up to 30-60 extra seconds. That is usually done during plot writing stage (3, 4 and waiting for prev plot in stage 1) by filesystem itself while plot file is being written.
In this patch i'm using
fallocate
system call and run it in background thread after plot file creation. Linux optimizes this --fallocate
process take lowest IO prio in kernel -- so, it does not affect previous plot writing speeds at all.This can have different impact on various filesystems, I'm using
ext4
withdata=writeback
.Same can be archieved by separate
fallocate
process on zero sized *.plot.tmp files, e.g:while true; do find /mnt/plots_mountpoint -name '*.plot.tmp' -size 0 -print -exec fallocate -l 101G {} \;; sleep 60; done
Example bladebit output:
This is newly created filesystem on 18TB disk. On 80%+ filled disks
fallocate
syscall takes ~1min and happens in separate thread.