Best cache option

adambenk

Renowned Member
Apr 14, 2015
16
0
66
Hello,
A storage is formatted with ZFS and attached to the system.
What is the recomended choice for a VM in: HARD DISK - CACHE option?
(first safety, then speed)
Thank You
 
I don't know if its "best", but I always use "write-back" [not write back (unsafe)]. I have never had a problem with it.
 
ZFS has its own read cache (ARC), which is not relevant here. But it also always has its own thing called ZIL (ZFS Intent Log) which buffers (async) writes for up to 5 seconds. For this reason I usually use "No cache" on a virtual disk. Every enabled additional cache will increase the risk of data loss or inconsistencies in case of any hardware failure.

The above is my main reason. There are two more, possibly not so important: it possibly slows down more than expected as data has to be moved/copied (very quick, in RAM) more times than necessary and -or course- it needs more RAM for this double storage scenario. My RAM is to precious for this!

Of course there are exemptions, depending on the actual behavior of some services I run in VMs. So one valid answer regarding a recommendation is: "it depends" ;-)

---
Edit: possibly I am mixing up TXG (Transaction Groups) and ZIL. In any case the 5 second buffer for normal writes does exist. Unfortunately I cannot find a good document explaining this...
Edit2: https://www.45drives.com/community/articles/zfs-caching/ + https://www.delphix.com/blog/zfs-fundamentals-transaction-groups
 
Last edited:
Thank you guys for your help. I have 2VMS (1 is Zimbra CS,2nd is a Windows server with sql), and I want to be sure if someting happening with the electricity, the "stop" of the vms would be somehow gracefull without corrupting the filesystem.