Setting sync=always, adding slog

Status
Not open for further replies.

SwisherSweet

Contributor
Joined
May 13, 2017
Messages
139
Hi,

Besides storing archived data, my FreeNAS server is primarily used for iSCSI.

I have read though dozens of posts that a SLOG may impove write performance of my iSCSI zvols.

1. How do I go about setting sync=always for my zvols? Can this be done after they are created? Is this a zvol specific setting or an overall server setting?

2. I would like to use a 240gb Kingston Hyper-X Predator PCIe flash card for my SLOG. I know it's more space than I need but it's a spare I already own and writes at 1,000MB/s. Will this card work as a SLOG? Do I need to "under-provision" it and what does that mean/how does that work? :)

3. Based on my reading, adding a zil (slog) is just extending the pool and selecting zil via the UI. Is this correct?

Thank you.
 

Spearfoot

He of the long foot
Moderator
Joined
May 13, 2015
Messages
2,478
Hi,

Besides storing archived data, my FreeNAS server is primarily used for iSCSI.

I have read though dozens of posts that a SLOG may impove write performance of my iSCSI zvols.
You'll get the best write performance by simply turning synchronous writes off for your iSCSI zvols... which is okay for a home lab, but is definitely a bad idea for any kind of production system!
1. How do I go about setting sync=always for my zvols? Can this be done after they are created? Is this a zvol specific setting or an overall server setting?
The zfs command is used to change the sync setting; you can change the sync setting at any time; and you can change it for a volume, dataset, or zvol. In practice, you only want to set it to 'always' for individual datasets or zvols on pools equipped with a ZIL SLOG device, leaving all of your other volumes and datasets at the default value.

Example: I have an NFS VM datastore configured as a dataset named vm on a volume named voom. I ran this zfs command to change the sync setting to 'always' after I created the dataset:
Code:
zfs set sync=always voom/vm
2. I would like to use a 240gb Kingston Hyper-X Predator PCIe flash card for my SLOG. I know it's more space than I need but it's a spare I already own and writes at 1,000MB/s. Will this card work as a SLOG? Do I need to "under-provision" it and what does that mean/how does that work? :)
I don't know much about the Kingston HyperX Predator and there's only one thread here on the forum that mentions it.

In general, a ZIL SLOG device needs power protection, low latency, fast writes, and high durability. I suspect the Kingston may lack power protection.

The good, better, and best Intel selections for SLOG devices run like this:
3. Based on my reading, adding a zil (slog) is just extending the pool and selecting zil via the UI. Is this correct?
Yes, sir. The GUI dropdown shows it as 'Log (ZIL)' -- be certain you select this, as adding a Stripe to your pool is usually a disaster!
vol-manager-adding-log-zil.jpg


Hope this helps!
 

SwisherSweet

Contributor
Joined
May 13, 2017
Messages
139
You'll get the best write performance by simply turning synchronous writes off for your iSCSI zvols... which is okay for a home lab, but is definitely a bad idea for any kind of production system!

Interesting idea. According to this post, there actually is very little risk with running async writes with ZFS:

https://pthree.org/2013/04/19/zfs-administration-appendix-a-visualizing-the-zfs-intent-log/

See section "Asynchronous Writes", paragraph beginning with, "I know what you're thinking...". This page makes it sound like unless something catastrophic happened (hardware or power failure), there is little or no risk. If there was a hardware or power failure, the only data loss was the last transaction that didn't get committed to the pool, but the pool would still be in a clean state.

As a developer, I wonder how async writes might work in a situation when the system or program tries to read data FreeNAS said it wrote, but really didn't. Does it read it from RAM until it is committed to the pool?
 

SwisherSweet

Contributor
Joined
May 13, 2017
Messages
139
Since you are extending the pool via ZIL, if you lost the SLOG, would the entire pool be lost as well? I read that if you extend a pool via vdev, if you loose a vdev, the entire pool is lost.
 

Spearfoot

He of the long foot
Moderator
Joined
May 13, 2015
Messages
2,478
Since you are extending the pool via ZIL, if you lost the SLOG, would the entire pool be lost as well? I read that if you extend a pool via vdev, if you loose a vdev, the entire pool is lost.
No, sir, because the SLOG is not a vdev; you can remove and add a SLOG device to your heart's content without harming the pool.

It is true that if you lose any vdev making up a pool, you lose the pool.
 

Robert Trevellyan

Pony Wrangler
Joined
May 16, 2014
Messages
3,778
the pool would still be in a clean state.
The pool might be in a clean state, but the data on the ZVOL might not be. Effectively, you'd be telling ZFS to lie to the client filesystem about writes being committed to non-volatile storage.
 
Status
Not open for further replies.
Top