I/O limits for ZFS

Hello,

I have Ubuntu 20.04.3 with ZFS 2.1.0 (6 SSD in RAID-Z1):
I set limits.max to 10MB:

lxc config device set testcontainer root limits.max 10MB
root@tsthost:/sys/fs/cgroup/blkio/lxc.monitor.testcontainer# ls -la
total 0
drwxr-xr-x  2 root root 0 Nov  1 13:02 .
dr-xr-xr-x 56 root root 0 Sep  7 00:45 ..
--w-------  1 root root 0 Nov  1 13:26 blkio.reset_stats
-r--r--r--  1 root root 0 Nov  1 13:15 blkio.throttle.io_service_bytes
-r--r--r--  1 root root 0 Nov  1 13:26 blkio.throttle.io_service_bytes_recursive
-r--r--r--  1 root root 0 Nov  1 13:26 blkio.throttle.io_serviced
-r--r--r--  1 root root 0 Nov  1 13:26 blkio.throttle.io_serviced_recursive
-rw-r--r--  1 root root 0 Nov  1 13:15 blkio.throttle.read_bps_device
-rw-r--r--  1 root root 0 Nov  1 13:26 blkio.throttle.read_iops_device
-rw-r--r--  1 root root 0 Nov  1 13:15 blkio.throttle.write_bps_device
-rw-r--r--  1 root root 0 Nov  1 13:26 blkio.throttle.write_iops_device
-rw-r--r--  1 root root 0 Nov  1 13:26 cgroup.clone_children
-rw-r--r--  1 root root 0 Nov  1 13:26 cgroup.procs
-rw-r--r--  1 root root 0 Nov  1 13:26 notify_on_release
-rw-r--r--  1 root root 0 Nov  1 13:26 tasks

It looks like limits have not been applied. I verified container’s configuration and I see these limit in configuration. If I run dd (iflag/oflag), write speed was without any limits.

Have you any idea how to solve this issue?

I’m not aware of any way to make this work. Those limits (blkio) rely on the fact that the filesystem uses the normal block code path in Linux which isn’t the case for ZFS.

Ah, it’s also worth noting that even on non-ZFS, blkio is starting to become less and less useful as things like NVME drives use scsi-mq in noop mode, effectively letting the physical drive handle the request queuing. For such backing drives, blkio limits will not work regardless of filesystem.