TrueNAS ZFS IOPS Issue

Hello,

I’m working on getting a system set up using TrueNAS and ZFS for storage and some virtualization tasks.

My ZFS configuration consists of:

  • 6x 16TB WD Gold HDDs in RAID-Z2 for storage
  • 1x 1TB WD Black SN850X for L2ARC
  • 1x 1TB WD Black SN850X for SLOG

ZFS settings:

  • Compression: lz4
  • Deduplication: off
  • Sync: see below

Note 1: I know that it’s not optimal to have a single SLOG drive, and that it should be mirrored, but I want to get a proof of concept that this system will work at all before I deal with fixing that.

Note 2: I know that a SLOG is not a write cache, but I’m going to use that terminology anyway.

The problem I’m having is storage performance.
Running fio in a VM, I get around 100~200 write IOPS.
Changing the sync settings for the dataset makes no difference, I’ve tried standard, always, and disabled, and it doesn’t appear to have any impact.

I previously had the storage pool configured with no SLOG and got ~10,000 IOPS average with sync=disabled, because the writes were being cached in memory, but then the memory cache has to be committed to storage every ~5 seconds (if I understand correctly). The user experience of storage grinding to a halt every 5 seconds is pretty bad, so I decided to reconfigure some drives and add a dedicated SLOG device.

I thought that adding a SLOG device would let me write near the write performance of the SLOG device, but instead adding a SLOG made everything slower.
Looking at the TrueNAS disk usage report, the SLOG device doesn’t look like it’s being used at all. Writes appear to be being sent directly to the HDDs, without being cached at all, in memory or on the SLOG. The noise coming from those drives during a fio run is awful.

My understanding is that there should be a way for ZFS to be configured such that write operations are written to the ZIL on the SLOG, and then reported to the application as being finished, which should effectively give me the write performance of SLOG device. What I really don’t understand is that I get worse performance with a SLOG while at the same time I get no utilization on the SLOG.

The goal is to have performance that’s acceptable for a modern graphical desktop user. It doesn’t have to be for the entire pool, just for a few select VMs that won’t be storing super critical data.

If anyone has any suggestions, I’d be happy to try them as I’m running out of ideas here.

In general the slog should be a percentage the size of main memory, ie allocate 16GB of your l2arc to your slog.

You have 2 SSDs, partition them to make a 16GB slog partition on each, mirror that and make it your slog. In general only certain databases need an SLOG, the rest are fine without.

You can do something similar for a metadata vdev if you want.

You will get much better performance with truenas at 32GB than 8GB of RAM regardless of whatever you are doing with persistent disks. Often times I see people give truenas 6GB of ram, and $2000 in SSDs and complain about the performance. Give it 16GB to 32GB of ram instead.

Most OS tasks don’t run sync after every transaction. zfs can handle a huge amount of transactions per second, but they don’t complete as quickly as a different operating system. If you want to see higher IOPS increase the number of threads you are running on your benchmark. Each transactions probably takes the same amount of time to complete if it comes from 1 thread of 1000 threads, but from 1000 threads it would show a benchmarked result 1000 times faster.

Oh yeah, don’t put virtual memory partitions on zfs.

1 Like

Hello Mike,

Thank you for your response.

I forgot to mention that my system has 128 GB of memory total, of which ~40 are allocated to VMs. So I have plenty of memory available for ZFS to use.

I was hoping to keep my storage configuration to things that can be configured in the TrueNAS Scale UI, but mirroring two partitions that are more appropriately sized is probably better than having a single, massively over sized drive.

Thanks for the tip on benchmarking. Now that I think about it, it’s possible that the workloads I was running that lead me down this path may have been more of the problem than my ZFS configuration.

they always are no matter if you have a LOG or not. LOG just provides a second optional line of defense in the form of stable storage (for integrity reasons) until ARC writes everything to disk.

Which doesn’t change with a LOG. The TXG timeout parameter is the same 5 seconds. You can simply change it to whatever value you like. But having periodic TXG flushes to disk is an integral part of ZFS, which is a good thing in general and why ZFS “feels” so fast on random IO especially on HDDs.

The storage doesn’t grind to a halt, it’s just writing stuff to disks that accumulated since last TXG sync (5 second is default).
If your CPU goes crazy on each flush and latency spikes because the server stalls, adjust tunables, compression and stuff or get a beefier system.

I’m writing up to ~50GB of data during a txg sync and while CPU usage is very high (well, ZSTD compression job on 50GB isn’t trivial), disks keep on writing at max speed and ARC gets filled by incoming data and I don’t see any slowdown outside of HDDs not being able to keep up. Latency is obviously bad on high throughput and if system load > amount of cores, things just run slower.

Because a LOG is always slower than ARC. And sync writes are always slower than async writes. And storage is generally slower than DRAM.

this is only the case for sync writes. If the writes are async (most stuff), LOG is obviously showing no utilization. LOG is only ever used for sync writes. If you have no sync writes, LOG is pointless.
If you assign a LOG to a pool, ZIL will be written to that device for sync writes instead of writing it to HDDs, which is much faster because SSD (unless the SSD is throttling down to HDD levels, which can happen with consumer drives).

“acceptable” is a very vague term. If the clients run across the network, network and software stack will eat most IOPS. Network latency + SMB share + cqow2 VM disk + record/blocksize mismatch + software and filesystem running on the VM itself…accumulates to a fraction of what the server actually is capable of (and it can get a lot more complicated and worse depending on your setup).
And which is why a local fio on the server can look great (by ZFS NVMe standards) but client IOPS are much worse.

100-200 write IOPS can be entirely normal. And with sync=disabled, that’s the fastest sync writes you can get on any storage because you don’t need to write to slow NVMe storage. It’s quite the luxury to have it, most other storage doesn’t.

If a local fio on the server shows 200 write IOPS, we’ll talk. Because that’s what HDD performance looks like.

edit: Found a link from @diizzy in another Thread that might be applicable here. If crappy NVMe drives can’t sustain loads, that would explain sucky LOG performance. Because LOG workload is torture only the best can handle.

1 Like