Score:5

BTRFS checksum cost

th flag

BTRFS (or ZFS, which I have no experience of) has checksum functionality "built-in", which seems like a very good feature. My Synology NAS gives me the option of enabling it for any given folder, so it begs the question of: should I enable it for data that I don't really care that much about?

Which leads to the actual question: What is the cost of enabling BTRFS checksum's? Does it take up more space? If so how much? Does it take up more CPU time for reading or writing?

Score:3
ca flag

Short version: leave checksum enabled, disabling it will not give you any real advantage.

Long version: Checksum calculation on modern CPU is very fast, and easily in the "absolutely don't worry" territory. For comparison, my ancient Ryzen 7 1700X does ZFS fletcher4 computation at >9GB/s. CRC32C on recent processors should be even faster, due to dedicated instructions.

The real cost of checksummed filesystem or block devices (ie: dm-integrity) is not in the checksum calculation itself, rather in the CoW or read/modify/write machinery and layout needed to correlate data with checksum. Disabling checksum will not change that, and will only provide an extremely small speedup (if any).

Johan Sonesson avatar
th flag
thanks, it was the no checksum but still CoW = no difference I was struggling to find the answer to. Re the CPU load though, my old Syno NAS has a dual Atom from 2013 which I think does not have a CRC32 instruction (that NAS line was not rolled out with btrfs support either, it was added later). And before I was even half through that sentence I realized I should probably run a quick performance test haha
mx flag
Bulk checksum bandwidth is arguably not as useful in this case as extra time spent per block, because the blocks being checksummed are small enough that the setup is a nontrivial percentage of the time spent. From my own testing though, CRC32c on most modern x86 chips that have native instructions for it works out to needing roughly 1500-2000 cycles for a 4 kiB block (the default block size for BTRFS on x86), so having checksums on translates to a few microseconds of additional time spent on each read or write (which is probably not enough to matter for most users).
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.