Error of txg_sync blocked for more than 120 seconds
Following error was appearing in my dmesg monitoring screen.
txg_sync blocked for more than 120 seconds --> excessive load
If I'm not wrong, it could be caused by slow harddisk speed, because the TrueNAS zfs cache is about 61GB, can take longer time to flush back to hard disk.
Same as other filesystem, zfs has writeback caching (aka write-behind caching), which will flush data back to hard disk in specific interval. zfs has synchronous and asynchronous mode, they are a bit different that readonly, writethrough and writeback mode.
Except above, zfs has different behaviors on copy on write (COW) as below.
- Always write to new block due to copy on write
- Big file for random writing, such as VM disk file, can be fragmented
- Can not reduce the write operation even if keep writing same block
Therefore, copy on write should be disabled for VM images. But if so, snapshot function could be lost.
Read-Through, Write-Through, Write-Behind Caching and Refresh-Ahead