When extracting archives and using ZFS on FreeBSD, the mouse and sound stutter, but there are no problems when using UFS

Hello, I have the following hardware:

  • HP Probook 4540S Laptop
  • Intel Core i5-3230M Ivy Bridge @ 2.6GHz
  • Intel HD 4000 Graphics
  • Intel 335 SSD Drive, 240GB, MLC Chips.
  • 8GB (2x4GB Kingston RAM)

I’m using FreeBSD 14.1-RELEASE with the Xfce desktop environment. During FreeBSD installation, I selected ZFS (Auto) and left the options as is. There is just one drive in the laptop.

If I listen to a song, whether it’s in the browser or a music player application such as VLC or MPV, and I install a package in the terminal using “pkg install packagename”, the sound and mouse stutter during the extraction stage of the package.

If I disable the prefetch option in ZFS, the stuttering happens less frequently, although it still occurs sometimes. So, disabling prefetch almost fixes it.

If I install FreeBSD on the UFS filesystem, I never have this stuttering issue. Whether I install packages as mentioned earlier or extract large archives manually using commands like unzip or tar, the stuttering never happens.

On the FreeBSD forums, some suggested I check the video card driver, and I did, but I don’t think it has anything to do with the video driver because this stuttering happens even outside Xorg. If I open a song file in MPV in one console and then switch to a different console using CTRL+ALT+F2 and install a package, the stuttering still occurs, even without any graphical environment.

Here’s a video I recorded:

I removed the SSD drive and tried a different one, a brand-new Crucial MX 500 with 3D NAND chips. I did a secure erase, then freshly installed FreeBSD on it with ZFS. The stuttering issue remains.

The laptop has the latest BIOS version. I also updated the microcode of the CPU. I tried everything I could think of but couldn’t fix this problem. The stuttering only happens on FreeBSD with ZFS, not on FreeBSD with UFS or Linux Debian with EXT4 or XFS. I asked for help on FreeBSD Forums and FreeBSD Facebook group, but no one could give a clear solution. One of the users suggested me to try asking here.

I’d appreciate any suggestions. Thank you!

Zoltan

1 Like

You’re looking for lower latency, and you already disabled prefetch, so the next step is tuning recordsize. Generally, you want smaller recordsize where the media you’re playing isn’t, and larger recordsize where the media files you’re playing are–so you might, for example, set recordsize=64K on your /, but recordsize=1M on your /home/yourname/media (or wherever you keep the stuff you’re playing).

Some of this is an artifact of your hardware being ancient, combined with your OS choice, though. FreeBSD isn’t very efficient with graphical stuff (although I realize this isn’t only a problem on the desktop), and that CPU and GPU are extremely old. I understand that you aren’t seeing the problem on UFS2, don’t get me wrong–I’m just warning you that most likely you are right on the edge of seeing the same problem with UFS2, because that system is very, very underperformant compared to what devs have expected to see for quite some time now.

In particular, your i5-3230M is only a dual-core part–and even Celerons from two generations ago offer four full cores, not just two cores with hyperthreading. Worse yet, its SATA controler is SATA II, not SATA III–meaning it can’t even begin to unlock the performance potential of your SSDs; it bottlenecks at 300MiB/s throughput instead of 600MiB/s. The throughput itself likely isn’t a problem, but that also means latency of any given operation will be increased as well, and that’s where you’re having your biggest problems.

Anyway, you’ll probably be okay after tuning recordsize, for now. I’m just warning you that the writing is very much on the wall for your laptop at this point, unfortunately. :slight_smile:

3 Likes

A member of the FreeBSD group shared a photo of his machine (photo below), which appears to have lower specs than mine, claiming he doesn’t encounter the same issue. I attempted adjusting the record size, but the stuttering persists. You’re right about my computer’s age and thank you for your time. I appreciate it. There may be a bug in FreeBSD or something and ZFS just makes it more apparent.

1 Like

You know, this is one hell of a time to buy laptops with pre-8th-gen-Intel CPUs, thanks to Windows 11. Used to be, the $300 or less laptop market was all stuff about the age of your lappy, but these days you can frequently get SEVENTH gen laptops with 16GiB RAM and new SSDs for $200 or less.

Also: just changing the recordsize won’t immediately change anything; the recordsize of all the data that’s already been written isn’t changed when you change the property. In order to get the already-existing data rewritten with the new recordsize, you need to do brute-force copying–eg:

root@bsd:~# rsync -ha /path/to/dir /path/to/dir.tmp
root@bsd:~# mv /path/to/dir /path/to/dir.old
root@bsd:~# mv /path/to/dir.tmp /path/to/dir
root@bsd:~# rm -r /path/to/dir.old

Hope some of this helps. :slight_smile: