jak@trace:~$ packet-trace

· 7 sections · boots in 4m 28s

From 71 fsyncs to 2,260: fixing a slow Proxmox ZFS pool on a budget

A Proxmox box at work felt sluggish, and pveperf said 71 fsyncs a second. One untrimmable pair of SSDs, a manual trim and a second-hand Intel S3700 later, it's doing 2,260.

We’ve got a Dell R730xd at work running Proxmox, and the VMs never felt as quick as they should on all-flash storage. The pool was the textbook setup: an HBA passing disks straight to ZFS, six SSDs in three mirrored pairs. The catch is that the SSDs were consumer drives, four Lexar NS100 1TBs and two Crucial BX500 2TBs, with a third BX500 sitting in as a hot spare. There’s no money for new enterprise kit, so this is about squeezing what I could out of what was already in the box.

The symptom

First job was putting a number on “feels slow”. pveperf has an FSYNCS/SECOND line that measures how fast the storage can confirm sync writes, which is what databases, filesystem journals and Windows updates all lean on.

root@pve:~# pveperf /vmpool
...
FSYNCS/SECOND:     71.45
  1. That’s hard-disk territory, on a pool of SSDs. Every sync write from every VM was queueing behind it, and some of those VMs run databases.

Ruling things out

A few things can produce a number like that without the drives being at fault, so I checked them before blaming the hardware.

  • One sick disk dragging a mirror down. zpool iostat -vl vmpool 1 showed all six disks with similar wait times, so no obvious bad drive.
  • Write cache switched off. PERC cards sometimes disable the disks’ own write cache for pass-through drives, which wrecks fsync numbers. smartctl -g wcache on each disk said Enabled across the board.
  • A RAID card. I did consider swapping to hardware RAID with a battery-backed cache to hide the problem. Then I checked the invoice: the controller is an H330, which has no cache at all, so that route meant buying a new card and rebuilding everything. Not worth it.

So no misconfiguration. Budget DRAM-less SSDs without power-loss protection are just bad at sync writes, because every one has to be physically flushed to flash before the drive will say “done”.

The TRIM that wasn’t

Next step was a manual trim, since DRAM-less drives slow down badly without one. That’s where it got interesting:

root@pve:~# zpool trim vmpool
cannot trim '/dev/disk/by-id/ata-CT2000BX500SSD1_...-part1': trim operations are not supported by this device
cannot trim '/dev/disk/by-id/ata-CT2000BX500SSD1_...-part1': trim operations are not supported by this device

The BX500s support TRIM fine on a normal SATA port. The problem is the H330: LSI-based SAS controllers only pass TRIM through to SATA drives that advertise deterministic read-zero after TRIM. hdparm -I confirmed the BX500 reports TRIM but not that feature, so the controller silently blocks it.

That meant those two drives had never been trimmed in this server, and never would be. On top of that, ZFS sends more new writes to the emptiest mirror, and the BX500 pair was the emptiest by a mile. So the slowest drives in the pool were getting the most work.

Autotrim was also off on the pool, which explained why the Lexars were behind too.

Evicting the BX500s

ZFS can remove a whole mirror from a pool and migrate the data off live, so this was painless:

zpool remove vmpool mirror-2

It copied 3.87GB onto the Lexars in under a minute, with the VMs running the whole time. I also pulled the BX500 hot spare out, otherwise a Lexar failure would have dragged an untrimmable drive straight back into the pool.

Then autotrim on, and a full trim on the four Lexars:

zpool set autotrim=on vmpool
zpool trim vmpool

The trim took a lot longer than I expected, which says something about how much stale space those drives were sitting on. With it finished:

FSYNCS/SECOND:     1003

From 71 to about 1,000 without spending anything. The pool is now 1.8TB of Lexars, which is still about twenty times what the VMs actually use.

A second-hand SLOG

To go further I added a SLOG: a separate log device that takes ZFS’s intent log off the pool drives. Sync writes land there first, and the Lexars only get the big batched writes every few seconds, which they handle fine. The whole point is that the SLOG drive has power-loss protection, so it can confirm a write almost instantly because its capacitors guarantee it’ll reach flash even if the power dies.

Optane used to be the obvious choice, but it’s discontinued and the prices have gone silly. Instead I got a used Intel DC S3700 100GB, which turned up HP-branded as an MK0100GCTYU. SMART said 42,601 power-on hours, no reallocated sectors, no errors, and the endurance indicator (hidden behind smartctl -x on the HP firmware) read 0% used. Five years powered on and barely written to.

zpool add vmpool log /dev/disk/by-id/ata-MK0100GCTYU_...

Double-check the word log is in there before pressing Enter. Without it you’ve just added a 100GB data disk to your pool.

FSYNCS/SECOND:     2260

That’s below the 3,000+ I’d hoped for from the drive’s spec sheet; the trip through ZFS, the H330 and SATA adds latency. But pveperf only sends one write at a time, and the S3700 is rated for far more parallel writes than that, so with several VMs and databases committing at once it should hold up much better than the number suggests.

Where it ended up

  • 71 → 2,260 fsyncs a second, roughly 32 times faster, for the price of one used SSD.
  • The biggest single win was free: getting the untrimmable BX500s out of the pool and trimming the rest.
  • ARC was already hitting 99.6%, so reads were never the problem. This was all about sync writes.

Things I’d tell my past self: check whether your controller actually passes TRIM through before putting consumer SSDs behind it, and check autotrim is on. The SLOG is still a single drive, so the one upgrade left on the list is a second S3700 to mirror it.

$ systemd-analyze Startup finished in 4m 28s (reading, 984 words) $ echo $? 0

XP installed