Replies: 5 comments 12 replies
-
Hello! I suggest you to try zstd algorithm first, cause it's most effective we have starting from ZFS 2.0. If you really need to save every byte you can try zstd-19 but remember that every ratio step is less efficient than previous one. Depending on your data it may not worth to set high ratios. For example you will get +0.5% of space but it will take +50% of CPU time. By my opinion default rate of compression=zstd-3 (that equals to compression=zstd) is best option for generic workloads. If you wanna save more than use zstd-5, zstd-7. After this (zstd-9+) it will not worth it. Check this: Don't forget that any process scheduler (CFS in linux) works the worse the higher the load. In your case with 2c/4t and 100% load your scheduler spends much time to switch execution context. I suggest first to lower the overall load using better compression algorithm. |
Beta Was this translation helpful? Give feedback.
-
I had similar issues with sound in my qemu/kvm workload. I managed to fully mitigate it by using preemptive kernel ( My theory is system devices like sound or network device use cpu affinity mask to operate on a specific CPU thread, but ZFS will also schedule big chunk of work on those CPU thread which cannot be reallocated to another one. Also, compression in ZFS without preemptive kernel doesn't let higher priority tasks to be executed for a long time even if they are latency critical. I only had this issue with qemu and I run it with realtime scheduling priority using |
Beta Was this translation helpful? Give feedback.
-
I had a similar problem but with a much more capable setup and less performance dragging configuration: I only had a few audio stutters but my CPU (Ryzen 4 1600, 6 cores / 12 threads) was only about 50 % max due to ZFS compression. Normally, I could utilize my full CPU power (e.g. compiling Lineage OS with 12 threads) and I wouldn't hear any audio stutters due to working priorities and scheduling. ZFS compression seem to be excluded from that. I could mitigate them for me without rebooting while restarting mpv with But still I would wish to be able to deprioritize ZFS's compression thread properly, best with an option possible to alter while the system is running. |
Beta Was this translation helpful? Give feedback.
-
I had a similar problem. Also with a much more capable system: Ryzen 9 5900X 24-threads 94GB RAM. Using zstd-10 copying from from zfs (default compression algo) to a newer zfs (zstd-10). First problem I experimented was, slow copy speed. Checking I noticed a lot of swap activity. I manage to "control" this by changing a couple of zfs parameters concerning memory usage. The first was zfs_arc_max. I set it to much less than 1/2 of RAM. The other was zfs_arc_sys_free. First tried to set it to 10GB and it didn´t solve the problem, 40GB did it. My guess is that zstd in zfs using a separated RAM space which depends on the zstd chosen level, with higher requiring more RAM. Since zfs arc RAM usage has apparently nothing to do with zstd then zfs arc RAM was strangling zstd and sending it to swap. Once this problem was solved then during copy, with some files CPU usage went really somewhat high, using basically all CPU threads and causing the same type of mpv audio problems. I played with ionice and renice, giving the rsync (copy) processes the lowest possible priority and mpv the highest possible priority but it didn't improve the audio problem. Also I tried the PIPEWIRE_LATENCY=1024/48000 suggested above and it didn't improve audio glitching. spl.spl_taskq_thread_bind=0 was already to 0. There must be some zstd related kernel/module activity that has a really high priority that can't be changed. Computer is completely unusable while zfs compress copy. Not only mpv audio is affected, browsing and everything else is sluggish. A Ryzen 9 brought to its knees with just this. I think the best solution would be to have a more comprehensive memory control of zfs (not just arc) that includes memory control for all zfs activities, and also a priority setting for different zfs activities (hashing, encryption and compression). Edit: The latency problem was solved changing preempt from voluntary to full: echo "full" | sudo tee /sys/kernel/debug/sched/preempt I thought full was the default with Debian Kernels In short. To use zstd above 3 one needs to
Kernel 6.4.0-0-amd64 |
Beta Was this translation helpful? Give feedback.
-
I'm looking for a setting that would assist in resolution of the following issue:
Is there any way to operate with huge amounts of data stored in ZFS and play audio without interruptions simultaneously?
I tried chrt vlc & pulseaudio -- it does not help. Probably USB driver is missing CPU cycles, because ZFS with compression=gzip-9 loads 100% of all CPU cores with kernel threads for compression. ZFS kernel threads nice value is -19 with SCHED_OTHER. They are spawned frequently, thus I can't alter their priority consistently. Maybe there's a way to drop priority change for them or spawn them in SCHED_IDLE queue temporarily?
OS: Ubuntu 22.04.1, CPU: Intel Core i7, 2 cores
Beta Was this translation helpful? Give feedback.
All reactions