Linux file write patterns: So you want to write to a file fast
1–10 of 53 posts
Re: Linux file write patterns: So you want to write to a file fast
#2Re: Linux file write patterns: So you want to write to a file fast
#3Re: Linux file write patterns: So you want to write to a file fast
#4Re: Linux file write patterns: So you want to write to a file fast
#5I would never do XFS benchmarks because in my experience if XFS is writing during powerdown, it trashses the FS (maybe this was fixed in the past 6 years, but after it happened 3 times I haven't touched the OS again).
Re: Linux file write patterns: So you want to write to a file fast
#6He does say:
> in a real program you’d have to do real error handling instead of assertions, of course
But somebody somewhere is reading this and thinking this is a "semantically correct pattern" (as it is introduced) and may just copy-paste it into their program. Especially when contrasting it with a "wrong way" I think it wouldn't hurt to include real error handling. And that means something that doesn't fall into an infinite loop when the disk fills up.
Re: Linux file write patterns: So you want to write to a file fast
#7Am I correct in noting that none of his benchmarks actually timed how long it took for the data to be durably committed to disk, to the limit that the OS can report that? I would never do XFS benchmarks because in my experience if XFS is writing during powerdown, it trashses the FS (maybe this was fixed in the past 6 years, but after it happened 3 times I haven't touched the OS again).
[0] https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux....
Re: Linux file write patterns: So you want to write to a file fast
#8I would assume the encryption is such a big overhead that most optimizations in the upper levels will be useless.
Re: Linux file write patterns: So you want to write to a file fast
#9of course that depends on the amount of RAM the system has, and how the kernel VM parameters are tuned (sysctl vm.dirty_*)
just add a fdatasync() call and you will take into account the time it takes to flush all dirty pages into the disk.
Re: Linux file write patterns: So you want to write to a file fast
#10A bit surprising (considering he started off talking about coredumps) that he doesn't mention sparse files. Core dumps can be very sparse, and you might save time and definitely will save space by not writing out the all-zeroes parts.