4 ms·
Not sure about SSD but filesystem COW doesn't only entail writing and freeing whole blocks, it entails "dont make an actual copy until write" COW filesystem me
by strainer 5y ago
Not sure about SSD but filesystem COW doesn't only entail writing and freeing whole blocks, it entails "dont make an actual copy until write"
COW filesystem means you can make (virtual) copies of files /blocks without writing (duplicating) them on the media. They only write metadata for bare copies and delay duplicating data until a virtual duplicate is altered.
Actual writes are written into a free block, then the old block is marked clear. The old block is not copied and then written over. In my understanding that's not what COW characterizes - its refering to how copying data is almost free (only costs metadata changes in COW filesystems) until copies are altered (written to)
- londons_explore 5y agoThese semantics are true at all three layers. In Postgres, Transactions work on a "snapshot" of the data that existed at one point in time. That snapshot is logically a copy of the data, but in reality uses copy-on-write of records to avoid having to make a copy of the entire database at the start of any transaction. In ZFS, it works as described. In SSD's, operating system 'write' commands are treated as transactions - ie. certain ordering semantics must be preserved in case of a power failure. Since performance is improved by having extra parallelism and not doing the actual operations in the order they are presented by the OS, a copy-on-write model is used to ensure that an incomplete transaction can be rolled back. This isn't supposed to be user-visible, but occasionally in a badly broken SSD, you hear users complaining of 'it works fine, but then when I reboot my computer everything I did is undone'! Well that's because no transactions are committing...
- strainer 5y agoWhat puzzled me is how you feel layers of particularly COW operations combine to make a dramatic increase in write load. I expect the whole block writing requirement of the SSD would be the major and finally unavoidable multiplier of its write load. Unless its blocks are small. There seems to be only a dramatic increase involved if one of the layers has dramatically larger blocks. There would be a middling chance of doubling writes between layers due to block misalignments and overlap, but that will not occur constantly and doubling is the worst case from misalignment. The most significant write multiplication throughout the layers should be the biggest block size as I imagine it.