Solved virtualbox-ose extremely slow performance

FreeBSD 12.1-RELEASE-p7
With virtualbox-ose installed as a package (pkg install virtualbox-ose), I am getting terrible performance from the guest operating system and inability to use the system with specific settings.

The premise is that the guest operating system is a 64-bit Linux (Fedora 32) using raw full-disk access (VBoxManage internalcommands createrawvmdk -filename /root/VMs/fedora.vmdk -rawdisk /dev/mfid0) to a logical RAID1 drive (in fact, three of them, but, for the sake of simplicity, I'll only refer to one for now) that is provided by an LSI 3108 controller. Said RAID1 "drive" is visible as /dev/mfid0 to FreeBSD.

  1. If the VirtualBox storage controller option Use host IO cache is not checked, the guest system will fail to find anything to boot. If the option is set, the system will boot, but...
  2. ...very slowly. It may take up to 10 minutes for the system to boot, and its usability is zero. This is independent of whether I set the storage controller to IDE, SATA, or SAS. The physical controller is a SAS controller and all physical disks attached to it are SAS disks.
dmesg will reveal (VirtualBox) is attempting to use unsafe AIO requests - not logging anymore, which suggests PR 212128, but I see no fix for this. Given the age of the bug, I have either lost the rest of my eyesight or the bug is simply being ignored. Any suggestions as to why the guest will not find anything to boot if host IO caching is not enabled and why it is so hideously slow when it is set?

EDIT 1: It appears that if I set the controller to IDE, unset Use Host I/O Cache and set the chipset to ICH6, then the guest will boot. Still equally slow as before.

EDIT 2: Slowness is not related to disk access only. After pressing Host+Q, it will take several seconds for the window to appear where I am asked whether I want to save the machine state or power it down. If I choose to power it down, it will take another 10 seconds or so to actually power down.
 
I think I have found the cause. The mfi(4) driver on FreeBSD is giving absurdly poor performance.
Code:
root@stuffed:~ # cat /dev/mfid0 | pv -br > /dev/null
^C37MiB [ 111KiB/s]

Checking what a change to mrsas(4) will do.

Result: it will vastly improve the speed:
Code:
root@stuffed:~ # dd bs=1M status=progress if=/dev/da0 of=fedoramain.ddimg
^C2486173696 bytes (2486 MB, 2371 MiB) transferred 3.001s, 828 MB/s
3212+0 records in
3212+0 records out
3368026112 bytes transferred in 3.949572 secs (852757136 bytes/sec)
root@stuffed:~ # cat /dev/da0 | pv -br > /dev/null
^C21MiB [ 106MiB/s]

Now, check the performance of the virtual computer...

...and it is beautiful, beautiful performance. The best performance in the world!

SOLVED.
 
Back
Top