Date: Fri, 11 Jul 2014 12:12:10 +0000 From: Matt Churchyard <matt.churchyard@userve.net> To: "freebsd-fs@freebsd.org" <freebsd-fs@freebsd.org> Subject: Re: ZFS: always use ZIL instead of memory? Message-ID: <3cb5c826a61b43f588dda48537076584@SERVER.ad.usd-group.com>
next in thread | raw e-mail | index | archive | help
> Hello. > Is it possible always use ZIL instead of memory for log write transaction= s > for any write operation (sync and async)? > I see that ZIL using only for sync operations, but I need for all write > operation. > Thanks a lot ZFS never uses the ZIL *instead* of memory. All writes, whether they are sync or async are tracked in memory, as part o= f the current transaction. After a certain amount of time, all those write = operations in memory are committed to disk and a new transaction is started= . Because it's possible for the machine to crash while writes are still sitti= ng in memory, ZFS also puts a copy of all sync writes in the ZIL (which sho= uld be on non-volatile storage somewhere). It does this because when the ap= plication requested that sync write, ZFS had to guarantee that the data mad= e it to disk. There is no such promise with async writes. In normal operati= on ZFS still uses the in-memory copy for everything, and only reads the ZIL= after a crash (in order to replay and sync writes that were lost in RAM). If you want all writes to be written to the ZIL, regardless of whether they= are sync or async, set the sync option to always on your dataset: zfs set sync=3Dalways my/dataset Although understand that, as explained above, all writes will still be hand= led in memory as normal, it's just that a copy of all writes will be also w= ritten to ZIL. The benefit of sync=3Dalways is that if the machine crashes,= all writes can be recovered, not just those that were written in sync mode= . Downside is that it may affect performance, especially if you don't have = a fast ZIL device. As far as I am aware, there is no way to stop ZFS using memory for the curr= ent write transaction, it's just part of how ZFS works. Matt
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3cb5c826a61b43f588dda48537076584>