<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>IT Notes - kvm</title><link>https://it-notes.dragas.net/categories/kvm/</link><description>Articles in category kvm</description><atom:link href="https://it-notes.dragas.net/categories/kvm/feed.xml" rel="self"/><language>en</language><lastBuildDate>Mon, 10 Jun 2024 05:53:45 +0000</lastBuildDate><item><title>Proxmox vs FreeBSD: Which Virtualization Host Performs Better?</title><link>https://it-notes.dragas.net/2024/06/10/proxmox-vs-freebsd-which-virtualization-host-performs-better/</link><description>&lt;p&gt;&lt;img src="https://it-notes.dragas.net/featured/server_rack.webp" alt="Proxmox vs FreeBSD: Which Virtualization Host Performs Better?"&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;TL;DR&lt;/strong&gt;: Skip to the &lt;a href="/2024/06/10/proxmox-vs-freebsd-which-virtualization-host-performs-better/#heading-11"&gt;Conclusion&lt;/a&gt; for a summary. &lt;/p&gt;
&lt;h3&gt;Preamble&lt;/h3&gt;
&lt;p&gt;I have always been passionate about virtualization and have consistently used it. &lt;/p&gt;
&lt;p&gt;The first solution I installed on my infrastructures (and those of clients) was &lt;a href="https://it-notes.dragas.net/2023/08/27/that-old-netbsd-server-running-since-2010/"&gt;Xen on NetBSD&lt;/a&gt;, with great success. I then used Xen on Linux and, since 2012, OpenNebula, followed by Proxmox in 2013. &lt;a href="https://it-notes.dragas.net/categories/proxmox/"&gt;Proxmox&lt;/a&gt; has always given me great satisfaction, and even today I consider it a valuable platform that I install gladly. I have also used other hypervisors like &lt;a href="https://xcp-ng.org/"&gt;XCP-ng&lt;/a&gt; but less frequently, and in recent years, I have started to make extensive use of bhyve. &lt;/p&gt;
&lt;p&gt;About two and a half years ago, &lt;a href="https://it-notes.dragas.net/2022/01/24/why-were-migrating-many-of-our-servers-from-linux-to-freebsd/"&gt;we began a progressive process of migrating our servers (and those of our clients) from Linux to FreeBSD&lt;/a&gt;, &lt;a href="https://it-notes.dragas.net/2022/02/05/how-we-are-migrating-many-of-our-servers-from-linux-to-freebsd-part-1-system-and-jails-setup/"&gt;using jails&lt;/a&gt; (when possible) or VMs on bhyve. In some cases, &lt;a href="https://it-notes.dragas.net/2023/03/14/how-we-are-migrating-many-of-our-servers-from-linux-to-freebsd-part-3/"&gt;migrating setups from Proxmox to FreeBSD&lt;/a&gt; resulted in performance improvements, even with the same hardware. In some instances, 
I migrated VMs without notifying clients, and they contacted me a few days later to inquire if we had new hardware because they noticed better performance. &lt;/p&gt;
&lt;p&gt;After years, I decided to conduct a test to determine if this was just a perception or if there was a technical basis behind it. Of course, &lt;em&gt;this test has no scientific validity&lt;/em&gt;, and the results were obtained on specific hardware and at a specific time, so on different hardware, workload, and situations, the results could be entirely opposite. 
However, I tried to have as scientific and objective an approach as possible since I am comparing two solutions that I care about and use daily. &lt;/p&gt;
&lt;h3&gt;Hardware and Test Conditions&lt;/h3&gt;
&lt;p&gt;I often see comparative tests done on VMs from various providers. In my opinion, this comparison makes no sense because a VM from any provider shares its hardware with many other VMs, so the results will vary depending on the load of the "neighbors" and will never be reliable. &lt;/p&gt;
&lt;p&gt;For this test, I decided to take a physical server with the following characteristics: &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Intel Core i7-6700 &lt;/li&gt;
&lt;li&gt;2x SSD M.2 NVMe 512 GB &lt;/li&gt;
&lt;li&gt;4x RAM 16384 MB DDR4 &lt;/li&gt;
&lt;li&gt;NIC 1 Gbit Intel I219-LM &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The hardware is not recent, but still very widespread. On more recent hardware, the results might differ, but the test will be based on this configuration. &lt;/p&gt;
&lt;p&gt;I installed &lt;a href="https://www.proxmox.com/en/"&gt;Proxmox 8.2.2&lt;/a&gt; starting from the Debian template of the provider and &lt;a href="https://pve.proxmox.com/wiki/Install_Proxmox_VE_on_Debian_12_Bookworm"&gt;manually installed it following the instructions&lt;/a&gt;. I created a partition for Proxmox and left one partition free on each of the two NVME drives to create (at different times) the ZFS pool (in mirror) and the LVM on top of the Linux software raid. &lt;/p&gt;
&lt;p&gt;After all the tests, I installed &lt;a href="https://www.freebsd.org/"&gt;FreeBSD&lt;/a&gt; 14.1-RELEASE on ZFS on the same host, using &lt;em&gt;bsdinstall&lt;/em&gt; from an &lt;a href="https://mfsbsd.vx.sk/"&gt;mfsbsd image&lt;/a&gt; since the provider does not directly support installing FreeBSD from its panel or rescue mode. &lt;/p&gt;
&lt;p&gt;In both installations, I always trimmed the NVME drives before starting the tests, and in the case of ZFS, I set (both on Proxmox and FreeBSD) compression to zstd and atime to off. 
No other changes were made compared to the standard installation. &lt;/p&gt;
&lt;p&gt;On FreeBSD, the VM was created and managed with &lt;a href="https://github.com/churchers/vm-bhyve"&gt;vm-bhyve (devel)&lt;/a&gt;. &lt;/p&gt;
&lt;p&gt;On Proxmox, I tested the physical host on ZFS and ext4 and the VM on ZFS and LVM as LVM is the standard and most common setup in Proxmox. &lt;/p&gt;
&lt;p&gt;On FreeBSD, I tested the host on ZFS and the VM with both virtio and nvme drivers, on zvol, and as an image file within a ZFS dataset. &lt;/p&gt;
&lt;p&gt;I used &lt;a href="https://github.com/akopytov/sysbench"&gt;sysbench&lt;/a&gt; installed from the official Debian repository (on Proxmox and VM) and from the FreeBSD package on the respective host. &lt;/p&gt;
&lt;p&gt;The VMs, both on Proxmox and FreeBSD, have nearly identical characteristics and default configuration (apart from the nvme drivers set on bhyve, and for that reason, I also tested virtio).&lt;/p&gt;
&lt;p&gt;For those who want to reproduce my tests, here are the detailed configurations of the VMs used in bhyve:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;FreeBSD bhyve VM Configuration with NVMe Driver&lt;/strong&gt;:&lt;/p&gt;
&lt;pre class="highlight"&gt;&lt;code&gt;loader=&amp;quot;uefi&amp;quot;
cpu=4
memory=4096M
network0_type=&amp;quot;virtio-net&amp;quot;
network0_switch=&amp;quot;public&amp;quot;
disk0_type=&amp;quot;nvme&amp;quot;
disk0_name=&amp;quot;disk0.img&amp;quot;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;strong&gt;FreeBSD bhyve VM Configuration with virtio Driver&lt;/strong&gt;:&lt;/p&gt;
&lt;pre class="highlight"&gt;&lt;code&gt;loader=&amp;quot;uefi&amp;quot;
cpu=4
memory=4096M
network0_type=&amp;quot;virtio-net&amp;quot;
network0_switch=&amp;quot;public&amp;quot;
disk0_type=&amp;quot;virtio-blk&amp;quot;
disk0_name=&amp;quot;disk0.img&amp;quot;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;strong&gt;Proxmox VM Configuration&lt;/strong&gt;:&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;strong&gt;Component&lt;/strong&gt;&lt;/th&gt;
&lt;th&gt;&lt;strong&gt;Details&lt;/strong&gt;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Memory&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;4.00 GiB [balloon=0]&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Processors&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;4 (1 sockets, 4 cores) [x86-64-v2-AES]&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;BIOS&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Default (SeaBIOS)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Display&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Default&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Machine&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Default (i440fx)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;SCSI Controller&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;VirtIO SCSI single&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;CD/DVD Drive (ide2)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;local:iso/debian-12.5.0-amd64-netinst.iso,media=cdrom,size=629M&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Hard Disk (scsi0)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;zfspool:vm-100-disk-0,cache=writeback,discard=on,iothread=1,size=50G,ssd=1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Network Device (net0)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;virtio=BC:24:11:22:3D:F0,bridge=vmbr0&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;In all the configurations, I used Debian 12 as the VM operating system, with the file system on ext4.&lt;/p&gt;
&lt;p&gt;I chose Debian 12 as it is a stable, widespread, and modern Linux distribution. I did not test a FreeBSD VM because, in my setups, &lt;a href="https://it-notes.dragas.net/2023/11/27/migrating-from-vm-to-hierarchical-jails-freebsd/"&gt;I tend not to virtualize FreeBSD on FreeBSD but to use nested jails&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;All tests were performed multiple times, and I took the median results. CPU and RAM were tested only on the first VM (on Proxmox (ZFS) and FreeBSD (ZFS and nvme)) as they are not dependent on the underlying storage. Storage performance, on the other hand, was tested on all configurations.&lt;/p&gt;
&lt;h3&gt;CPU and RAM Tests on VMs&lt;/h3&gt;
&lt;p&gt;On both VMs:&lt;/p&gt;
&lt;pre class="highlight"&gt;&lt;code class="language-shell"&gt;sysbench --test=cpu --cpu-max-prime=20000 run
sysbench --test=memory run
&lt;/code&gt;&lt;/pre&gt;

&lt;h4&gt;Comparative Results&lt;/h4&gt;
&lt;h5&gt;CPU Test&lt;/h5&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Configuration&lt;/th&gt;
&lt;th&gt;Events per Second&lt;/th&gt;
&lt;th&gt;Total Time (s)&lt;/th&gt;
&lt;th&gt;Latency (avg) (ms)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Proxmox&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;498.08&lt;/td&gt;
&lt;td&gt;10.0010&lt;/td&gt;
&lt;td&gt;2.01&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;FreeBSD&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;473.65&lt;/td&gt;
&lt;td&gt;10.0019&lt;/td&gt;
&lt;td&gt;2.11&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h5&gt;CPU Percentage Analysis&lt;/h5&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Difference in Events per Second&lt;/strong&gt;: ((498.08 - 473.65) / 498.08 approx -4.91\%)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Difference in Total Time&lt;/strong&gt;: ((10.0019 - 10.0010) / 10.0010 approx +0.009\%)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Difference in Latency (avg)&lt;/strong&gt;: ((2.11 - 2.01) / 2.01 approx +4.98\%)&lt;/li&gt;
&lt;/ul&gt;
&lt;h5&gt;RAM Test&lt;/h5&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Configuration&lt;/th&gt;
&lt;th&gt;Total Operations&lt;/th&gt;
&lt;th&gt;Operations per Second&lt;/th&gt;
&lt;th&gt;Total MiB Transferred&lt;/th&gt;
&lt;th&gt;MiB/sec&lt;/th&gt;
&lt;th&gt;Latency (avg) (ms)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Proxmox&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;64777227&lt;/td&gt;
&lt;td&gt;6476757.59&lt;/td&gt;
&lt;td&gt;63259.01&lt;/td&gt;
&lt;td&gt;6324.96&lt;/td&gt;
&lt;td&gt;0.00&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;FreeBSD&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;68621063&lt;/td&gt;
&lt;td&gt;6861139.06&lt;/td&gt;
&lt;td&gt;67012.76&lt;/td&gt;
&lt;td&gt;6700.33&lt;/td&gt;
&lt;td&gt;0.00&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h5&gt;RAM Percentage Analysis&lt;/h5&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Difference in Total Operations&lt;/strong&gt;: ((68621063 - 64777227) / 64777227 approx +5.94\%)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Difference in Operations per Second&lt;/strong&gt;: ((6861139.06 - 6476757.59) / 6476757.59 approx +5.94\%)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Difference in Total MiB Transferred&lt;/strong&gt;: ((67012.76 - 63259.01) / 63259.01 approx +5.93\%)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Difference in MiB/sec&lt;/strong&gt;: ((6700.33 - 6324.96) / 6324.96 approx +5.93\%)&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;CPU and RAM Comparative Results Table&lt;/h4&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Test&lt;/th&gt;
&lt;th&gt;Metric&lt;/th&gt;
&lt;th&gt;Proxmox (KVM)&lt;/th&gt;
&lt;th&gt;FreeBSD (bhyve)&lt;/th&gt;
&lt;th&gt;Difference (%)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;CPU&lt;/td&gt;
&lt;td&gt;Events/s&lt;/td&gt;
&lt;td&gt;498.08&lt;/td&gt;
&lt;td&gt;473.65&lt;/td&gt;
&lt;td&gt;-4.91&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;Time (s)&lt;/td&gt;
&lt;td&gt;10.0010&lt;/td&gt;
&lt;td&gt;10.0019&lt;/td&gt;
&lt;td&gt;+0.009&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;Latency&lt;/td&gt;
&lt;td&gt;2.01&lt;/td&gt;
&lt;td&gt;2.11&lt;/td&gt;
&lt;td&gt;+4.98&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;RAM&lt;/td&gt;
&lt;td&gt;Ops&lt;/td&gt;
&lt;td&gt;64777227&lt;/td&gt;
&lt;td&gt;68621063&lt;/td&gt;
&lt;td&gt;+5.94&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;Ops/s&lt;/td&gt;
&lt;td&gt;6476757.59&lt;/td&gt;
&lt;td&gt;6861139.06&lt;/td&gt;
&lt;td&gt;+5.94&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;MiB&lt;/td&gt;
&lt;td&gt;63259.01&lt;/td&gt;
&lt;td&gt;67012.76&lt;/td&gt;
&lt;td&gt;+5.93&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;MiB/s&lt;/td&gt;
&lt;td&gt;6324.96&lt;/td&gt;
&lt;td&gt;6700.33&lt;/td&gt;
&lt;td&gt;+5.93&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;Latency&lt;/td&gt;
&lt;td&gt;0.00&lt;/td&gt;
&lt;td&gt;0.00&lt;/td&gt;
&lt;td&gt;0.00&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h3&gt;Interpretation of CPU and RAM Results&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;CPU Performance&lt;/strong&gt;:&lt;/li&gt;
&lt;li&gt;The VM on FreeBSD has slightly lower CPU performance compared to Proxmox (-4.91% in events per second).&lt;/li&gt;
&lt;li&gt;The total execution time is nearly identical, with a negligible difference.&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The average latency is slightly higher on FreeBSD (+4.98%).&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;RAM Performance&lt;/strong&gt;:&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;The VM on FreeBSD has better RAM performance compared to Proxmox (+5.94% in operations and MiB/sec).&lt;/li&gt;
&lt;li&gt;The average latency is identical in both configurations.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;In summary, while Proxmox provides more consistent CPU performance, FreeBSD demonstrates superior memory performance. The choice between Proxmox and FreeBSD may depend on the specific workload requirements and the importance of consistent performance versus higher throughput.&lt;/p&gt;
&lt;h3&gt;I/O Performance Tests&lt;/h3&gt;
&lt;p&gt;The test has been conducted using sysbench, with this command line:&lt;/p&gt;
&lt;pre class="highlight"&gt;&lt;code class="language-sh"&gt;sysbench --test=fileio --file-total-size=30G prepare
sysbench --test=fileio --file-total-size=30G --file-test-mode=rndrw  --max-time=300 --max-requests=0 run
&lt;/code&gt;&lt;/pre&gt;

&lt;h4&gt;I/O Comparative Performance Data with Percentage Differences&lt;/h4&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Metric&lt;/th&gt;
&lt;th&gt;VM on Proxmox (ZFS)&lt;/th&gt;
&lt;th&gt;VM on Proxmox (LVM)&lt;/th&gt;
&lt;th&gt;VM on FreeBSD (ZFS, NVMe)&lt;/th&gt;
&lt;th&gt;VM on FreeBSD (ZFS, Virtio)&lt;/th&gt;
&lt;th&gt;VM on FreeBSD (zvol)&lt;/th&gt;
&lt;th&gt;Host FreeBSD (ZFS)&lt;/th&gt;
&lt;th&gt;Host Proxmox (ZFS)&lt;/th&gt;
&lt;th&gt;Host Proxmox (ext4)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;File creation speed (MiB/s)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;407.82&lt;/td&gt;
&lt;td&gt;461.52&lt;/td&gt;
&lt;td&gt;1467.83&lt;/td&gt;
&lt;td&gt;1398.81&lt;/td&gt;
&lt;td&gt;1333.64&lt;/td&gt;
&lt;td&gt;1625.67&lt;/td&gt;
&lt;td&gt;968.64&lt;/td&gt;
&lt;td&gt;633.13&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Reads per second&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;650.09&lt;/td&gt;
&lt;td&gt;504.80&lt;/td&gt;
&lt;td&gt;11183.44&lt;/td&gt;
&lt;td&gt;806.93&lt;/td&gt;
&lt;td&gt;11834.53&lt;/td&gt;
&lt;td&gt;1234.62&lt;/td&gt;
&lt;td&gt;920.95&lt;/td&gt;
&lt;td&gt;498.37&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Writes per second&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;433.40&lt;/td&gt;
&lt;td&gt;336.54&lt;/td&gt;
&lt;td&gt;7455.62&lt;/td&gt;
&lt;td&gt;537.95&lt;/td&gt;
&lt;td&gt;7889.69&lt;/td&gt;
&lt;td&gt;823.08&lt;/td&gt;
&lt;td&gt;613.96&lt;/td&gt;
&lt;td&gt;332.25&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;fsyncs per second&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;1387.08&lt;/td&gt;
&lt;td&gt;1076.97&lt;/td&gt;
&lt;td&gt;23858.08&lt;/td&gt;
&lt;td&gt;1721.79&lt;/td&gt;
&lt;td&gt;25247.36&lt;/td&gt;
&lt;td&gt;2634.01&lt;/td&gt;
&lt;td&gt;1964.96&lt;/td&gt;
&lt;td&gt;1063.19&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Read throughput (MiB/s)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;10.16&lt;/td&gt;
&lt;td&gt;7.89&lt;/td&gt;
&lt;td&gt;174.74&lt;/td&gt;
&lt;td&gt;12.61&lt;/td&gt;
&lt;td&gt;184.91&lt;/td&gt;
&lt;td&gt;19.29&lt;/td&gt;
&lt;td&gt;14.39&lt;/td&gt;
&lt;td&gt;7.79&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Write throughput (MiB/s)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;6.77&lt;/td&gt;
&lt;td&gt;5.26&lt;/td&gt;
&lt;td&gt;116.49&lt;/td&gt;
&lt;td&gt;8.41&lt;/td&gt;
&lt;td&gt;123.28&lt;/td&gt;
&lt;td&gt;12.86&lt;/td&gt;
&lt;td&gt;9.59&lt;/td&gt;
&lt;td&gt;5.19&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Total events&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;741163&lt;/td&gt;
&lt;td&gt;575588&lt;/td&gt;
&lt;td&gt;12749157&lt;/td&gt;
&lt;td&gt;919952&lt;/td&gt;
&lt;td&gt;13491459&lt;/td&gt;
&lt;td&gt;1407592&lt;/td&gt;
&lt;td&gt;1049894&lt;/td&gt;
&lt;td&gt;568277&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Average latency (ms)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;0.40&lt;/td&gt;
&lt;td&gt;0.52&lt;/td&gt;
&lt;td&gt;0.02&lt;/td&gt;
&lt;td&gt;0.33&lt;/td&gt;
&lt;td&gt;0.02&lt;/td&gt;
&lt;td&gt;0.21&lt;/td&gt;
&lt;td&gt;0.29&lt;/td&gt;
&lt;td&gt;0.53&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;95th percentile latency (ms)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;2.30&lt;/td&gt;
&lt;td&gt;3.25&lt;/td&gt;
&lt;td&gt;0.06&lt;/td&gt;
&lt;td&gt;1.58&lt;/td&gt;
&lt;td&gt;0.05&lt;/td&gt;
&lt;td&gt;1.32&lt;/td&gt;
&lt;td&gt;1.79&lt;/td&gt;
&lt;td&gt;2.71&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Max latency (ms)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;22.65&lt;/td&gt;
&lt;td&gt;32.30&lt;/td&gt;
&lt;td&gt;35.49&lt;/td&gt;
&lt;td&gt;13.60&lt;/td&gt;
&lt;td&gt;77.53&lt;/td&gt;
&lt;td&gt;9.03&lt;/td&gt;
&lt;td&gt;9.47&lt;/td&gt;
&lt;td&gt;17.39&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Total test time (s)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;300.0475&lt;/td&gt;
&lt;td&gt;300.1147&lt;/td&gt;
&lt;td&gt;300.0020&lt;/td&gt;
&lt;td&gt;300.0226&lt;/td&gt;
&lt;td&gt;300.0012&lt;/td&gt;
&lt;td&gt;300.0416&lt;/td&gt;
&lt;td&gt;300.0159&lt;/td&gt;
&lt;td&gt;300.1381&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h4&gt;Percentage Differences Compared to VM on Proxmox (ZFS)&lt;/h4&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Metric&lt;/th&gt;
&lt;th&gt;VM on Proxmox (LVM)&lt;/th&gt;
&lt;th&gt;VM on FreeBSD (ZFS, NVMe)&lt;/th&gt;
&lt;th&gt;VM on FreeBSD (ZFS, Virtio)&lt;/th&gt;
&lt;th&gt;VM on FreeBSD (zvol)&lt;/th&gt;
&lt;th&gt;Host FreeBSD (ZFS)&lt;/th&gt;
&lt;th&gt;Host Proxmox (ZFS)&lt;/th&gt;
&lt;th&gt;Host Proxmox (ext4)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;File creation speed (MiB/s)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;+13.18%&lt;/td&gt;
&lt;td&gt;+259.77%&lt;/td&gt;
&lt;td&gt;+242.99%&lt;/td&gt;
&lt;td&gt;+227.02%&lt;/td&gt;
&lt;td&gt;+298.62%&lt;/td&gt;
&lt;td&gt;+137.52%&lt;/td&gt;
&lt;td&gt;+55.25%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Reads per second&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;-22.34%&lt;/td&gt;
&lt;td&gt;+1619.98%&lt;/td&gt;
&lt;td&gt;+24.13%&lt;/td&gt;
&lt;td&gt;+1720.45%&lt;/td&gt;
&lt;td&gt;+89.92%&lt;/td&gt;
&lt;td&gt;+41.67%&lt;/td&gt;
&lt;td&gt;-23.34%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Writes per second&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;-22.35%&lt;/td&gt;
&lt;td&gt;+1620.26%&lt;/td&gt;
&lt;td&gt;+24.12%&lt;/td&gt;
&lt;td&gt;+1720.42%&lt;/td&gt;
&lt;td&gt;+89.91%&lt;/td&gt;
&lt;td&gt;+41.66%&lt;/td&gt;
&lt;td&gt;-23.34%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;fsyncs per second&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;-22.36%&lt;/td&gt;
&lt;td&gt;+1620.02%&lt;/td&gt;
&lt;td&gt;+24.13%&lt;/td&gt;
&lt;td&gt;+1720.18%&lt;/td&gt;
&lt;td&gt;+89.90%&lt;/td&gt;
&lt;td&gt;+41.66%&lt;/td&gt;
&lt;td&gt;-23.35%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Read throughput (MiB/s)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;-22.34%&lt;/td&gt;
&lt;td&gt;+1619.88%&lt;/td&gt;
&lt;td&gt;+24.11%&lt;/td&gt;
&lt;td&gt;+1719.98%&lt;/td&gt;
&lt;td&gt;+89.86%&lt;/td&gt;
&lt;td&gt;+41.63%&lt;/td&gt;
&lt;td&gt;-23.33%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Write throughput (MiB/s)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;-22.30%&lt;/td&gt;
&lt;td&gt;+1620.68%&lt;/td&gt;
&lt;td&gt;+24.22%&lt;/td&gt;
&lt;td&gt;+1720.97%&lt;/td&gt;
&lt;td&gt;+89.96%&lt;/td&gt;
&lt;td&gt;+41.65%&lt;/td&gt;
&lt;td&gt;-23.33%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Total events&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;-22.34%&lt;/td&gt;
&lt;td&gt;+1620.16%&lt;/td&gt;
&lt;td&gt;+24.12%&lt;/td&gt;
&lt;td&gt;+1720.31%&lt;/td&gt;
&lt;td&gt;+89.92%&lt;/td&gt;
&lt;td&gt;+41.65%&lt;/td&gt;
&lt;td&gt;-23.31%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Average latency (ms)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;+30.00%&lt;/td&gt;
&lt;td&gt;-95.00%&lt;/td&gt;
&lt;td&gt;-17.50%&lt;/td&gt;
&lt;td&gt;-95.00%&lt;/td&gt;
&lt;td&gt;-47.50%&lt;/td&gt;
&lt;td&gt;-27.50%&lt;/td&gt;
&lt;td&gt;+32.50%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;95th percentile latency (ms)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;+41.30%&lt;/td&gt;
&lt;td&gt;-97.39%&lt;/td&gt;
&lt;td&gt;-31.30%&lt;/td&gt;
&lt;td&gt;-97.83%&lt;/td&gt;
&lt;td&gt;-42.61%&lt;/td&gt;
&lt;td&gt;-22.17%&lt;/td&gt;
&lt;td&gt;+17.83%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Max latency (ms)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;+42.60%&lt;/td&gt;
&lt;td&gt;+56.69%&lt;/td&gt;
&lt;td&gt;-39.96%&lt;/td&gt;
&lt;td&gt;+242.30%&lt;/td&gt;
&lt;td&gt;-60.13%&lt;/td&gt;
&lt;td&gt;-58.19%&lt;/td&gt;
&lt;td&gt;-23.22%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Total test time (s)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;+0.02%&lt;/td&gt;
&lt;td&gt;-0.02%&lt;/td&gt;
&lt;td&gt;-0.01%&lt;/td&gt;
&lt;td&gt;-0.02%&lt;/td&gt;
&lt;td&gt;-0.02%&lt;/td&gt;
&lt;td&gt;-0.01%&lt;/td&gt;
&lt;td&gt;+0.01%&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h4&gt;Percentage Differences Compared to VM on Proxmox (LVM) as this is the standard Proxmox setup&lt;/h4&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Metric&lt;/th&gt;
&lt;th&gt;VM on Proxmox (ZFS)&lt;/th&gt;
&lt;th&gt;VM on FreeBSD (ZFS, NVMe)&lt;/th&gt;
&lt;th&gt;VM on FreeBSD (ZFS, Virtio)&lt;/th&gt;
&lt;th&gt;VM on FreeBSD (zvol)&lt;/th&gt;
&lt;th&gt;Host FreeBSD (ZFS)&lt;/th&gt;
&lt;th&gt;Host Proxmox (ZFS)&lt;/th&gt;
&lt;th&gt;Host Proxmox (ext4)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;File creation speed (MiB/s)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;-11.64%&lt;/td&gt;
&lt;td&gt;+218.04%&lt;/td&gt;
&lt;td&gt;+203.09%&lt;/td&gt;
&lt;td&gt;+188.97%&lt;/td&gt;
&lt;td&gt;+252.24%&lt;/td&gt;
&lt;td&gt;+109.88%&lt;/td&gt;
&lt;td&gt;+37.18%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Reads per second&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;+28.78%&lt;/td&gt;
&lt;td&gt;+2115.42%&lt;/td&gt;
&lt;td&gt;+59.85%&lt;/td&gt;
&lt;td&gt;+2244.40%&lt;/td&gt;
&lt;td&gt;+144.58%&lt;/td&gt;
&lt;td&gt;+82.44%&lt;/td&gt;
&lt;td&gt;-1.27%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Writes per second&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;+28.78%&lt;/td&gt;
&lt;td&gt;+2115.37%&lt;/td&gt;
&lt;td&gt;+59.85%&lt;/td&gt;
&lt;td&gt;+2244.35%&lt;/td&gt;
&lt;td&gt;+144.57%&lt;/td&gt;
&lt;td&gt;+82.43%&lt;/td&gt;
&lt;td&gt;-1.27%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;fsyncs per second&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;+28.79%&lt;/td&gt;
&lt;td&gt;+2115.30%&lt;/td&gt;
&lt;td&gt;+59.87%&lt;/td&gt;
&lt;td&gt;+2244.30%&lt;/td&gt;
&lt;td&gt;+144.58%&lt;/td&gt;
&lt;td&gt;+82.45%&lt;/td&gt;
&lt;td&gt;-1.28%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Read throughput (MiB/s)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;+28.77%&lt;/td&gt;
&lt;td&gt;+2114.70%&lt;/td&gt;
&lt;td&gt;+59.82%&lt;/td&gt;
&lt;td&gt;+2243.60%&lt;/td&gt;
&lt;td&gt;+144.49%&lt;/td&gt;
&lt;td&gt;+82.38%&lt;/td&gt;
&lt;td&gt;-1.27%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Write throughput (MiB/s)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;+28.71%&lt;/td&gt;
&lt;td&gt;+2114.64%&lt;/td&gt;
&lt;td&gt;+59.89%&lt;/td&gt;
&lt;td&gt;+2243.73%&lt;/td&gt;
&lt;td&gt;+144.49%&lt;/td&gt;
&lt;td&gt;+82.32%&lt;/td&gt;
&lt;td&gt;-1.33%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Total events&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;+28.77%&lt;/td&gt;
&lt;td&gt;+2114.98%&lt;/td&gt;
&lt;td&gt;+59.83%&lt;/td&gt;
&lt;td&gt;+2243.94%&lt;/td&gt;
&lt;td&gt;+144.55%&lt;/td&gt;
&lt;td&gt;+82.40%&lt;/td&gt;
&lt;td&gt;-1.27%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Average latency (ms)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;-23.08%&lt;/td&gt;
&lt;td&gt;-96.15%&lt;/td&gt;
&lt;td&gt;-36.54%&lt;/td&gt;
&lt;td&gt;-96.15%&lt;/td&gt;
&lt;td&gt;-59.62%&lt;/td&gt;
&lt;td&gt;-44.23%&lt;/td&gt;
&lt;td&gt;+1.92%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;95th percentile latency (ms)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;-29.23%&lt;/td&gt;
&lt;td&gt;-98.15%&lt;/td&gt;
&lt;td&gt;-51.38%&lt;/td&gt;
&lt;td&gt;-98.46%&lt;/td&gt;
&lt;td&gt;-59.38%&lt;/td&gt;
&lt;td&gt;-44.92%&lt;/td&gt;
&lt;td&gt;-16.62%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Max latency (ms)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;-29.88%&lt;/td&gt;
&lt;td&gt;+9.88%&lt;/td&gt;
&lt;td&gt;-57.89%&lt;/td&gt;
&lt;td&gt;+140.03%&lt;/td&gt;
&lt;td&gt;-72.04%&lt;/td&gt;
&lt;td&gt;-70.68%&lt;/td&gt;
&lt;td&gt;-46.16%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Total test time (s)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;-0.02%&lt;/td&gt;
&lt;td&gt;-0.04%&lt;/td&gt;
&lt;td&gt;-0.03%&lt;/td&gt;
&lt;td&gt;-0.04%&lt;/td&gt;
&lt;td&gt;-0.02%&lt;/td&gt;
&lt;td&gt;-0.03%&lt;/td&gt;
&lt;td&gt;+0.01%&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h4&gt;Analysis of Performance Data&lt;/h4&gt;
&lt;p&gt;The performance data collected from various configurations of Proxmox and FreeBSD provides a comprehensive view of the I/O capabilities and highlights some significant differences. Here is an analysis of the key findings:&lt;/p&gt;
&lt;h5&gt;Comparative Analysis&lt;/h5&gt;
&lt;h6&gt;Hypothesis on NVMe Performance and fsync&lt;/h6&gt;
&lt;p&gt;An important observation from my tests is that VMs with the bhyve NVMe driver show significantly higher performance compared to the same VMs with the virtio driver or compared to the physical host system. This difference initially led me to hypothesize that the bhyve NVMe driver might not correctly respect fsync operations, returning a positive result before the underlying file system has confirmed the final write. However, this was just a theory based on benchmark results and is not supported by concrete data. Furthermore, some developers have reviewed the code and found no evidence to suggest this behavior, and I personally have never encountered any potential issues that would indicate such a problem.&lt;/p&gt;
&lt;p&gt;Specifically, I observed that:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The VM with the virtio driver has performance comparable to Proxmox.&lt;/li&gt;
&lt;li&gt;The VM with the NVMe driver, whether on a ZFS dataset or zvol, shows performance superior to the physical FreeBSD host.&lt;/li&gt;
&lt;/ul&gt;
&lt;h5&gt;Host Physical Systems and Filesystems&lt;/h5&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;File Creation Speed&lt;/strong&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Host FreeBSD (ZFS)&lt;/strong&gt; shows the highest file creation speed at 1625.67 MiB/s, which is +68.03% compared to Host Proxmox (ZFS) and +156.72% compared to Host Proxmox (ext4).&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Host Proxmox (ext4)&lt;/strong&gt; has a file creation speed of 633.13 MiB/s, which is -34.62% compared to Host Proxmox (ZFS).&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Read and Write Operations per Second&lt;/strong&gt;:&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Host FreeBSD (ZFS)&lt;/strong&gt; demonstrates the highest read and write operations per second with 1234.62 reads/s and 823.08 writes/s.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Reads per second: +34.06% compared to Host Proxmox (ZFS) and +147.80% compared to Host Proxmox (ext4).&lt;/li&gt;
&lt;li&gt;Writes per second: +34.04% compared to Host Proxmox (ZFS) and +147.61% compared to Host Proxmox (ext4).&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Host Proxmox (ext4)&lt;/strong&gt; shows a lower performance with 498.37 reads/s and 332.25 writes/s.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Host Proxmox (ZFS)&lt;/strong&gt; has 920.95 reads/s and 613.96 writes/s.&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;fsync Operations per Second&lt;/strong&gt;:&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Host FreeBSD (ZFS)&lt;/strong&gt; achieves the highest fsync operations per second at 2634.01 fsyncs/s, which is +34.02% compared to Host Proxmox (ZFS) and +147.73% compared to Host Proxmox (ext4).&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Host Proxmox (ext4)&lt;/strong&gt; has a lower performance with 1063.19 fsyncs/s.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Host Proxmox (ZFS)&lt;/strong&gt; achieves 1964.96 fsyncs/s.&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Throughput&lt;/strong&gt;:&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Host FreeBSD (ZFS)&lt;/strong&gt; again leads in throughput with 19.29 MiB/s read and 12.86 MiB/s write.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Read throughput: +34.03% compared to Host Proxmox (ZFS) and +147.53% compared to Host Proxmox (ext4).&lt;/li&gt;
&lt;li&gt;Write throughput: +34.08% compared to Host Proxmox (ZFS) and +147.79% compared to Host Proxmox (ext4).&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Host Proxmox (ext4)&lt;/strong&gt; has the lowest throughput with 7.79 MiB/s read and 5.19 MiB/s write.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Host Proxmox (ZFS)&lt;/strong&gt; has 14.39 MiB/s read and 9.59 MiB/s write.&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Latency&lt;/strong&gt;:&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Host FreeBSD (ZFS)&lt;/strong&gt; shows the lowest average latency at 0.21 ms and 95th percentile latency at 1.32 ms.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Average latency: -27.59% compared to Host Proxmox (ZFS) and -60.38% compared to Host Proxmox (ext4).&lt;/li&gt;
&lt;li&gt;95th percentile latency: -26.27% compared to Host Proxmox (ZFS) and -51.29% compared to Host Proxmox (ext4).&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Host Proxmox (ext4)&lt;/strong&gt; has the highest average latency at 0.53 ms and 95th percentile latency at 2.71 ms.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Host Proxmox (ZFS)&lt;/strong&gt; has an average latency of 0.29 ms and 95th percentile latency of 1.79 ms.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h5&gt;VMs vs Physical Hosts&lt;/h5&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;File Creation Speed&lt;/strong&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;VM on FreeBSD (ZFS, NVMe)&lt;/strong&gt; demonstrates an outstanding file creation speed at 1467.83 MiB/s (+218.04% compared to VM on Proxmox (LVM) and +259.77% compared to VM on Proxmox (ZFS)).&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;VM on FreeBSD (zvol)&lt;/strong&gt; achieves 1333.64 MiB/s, which is also significantly higher than VM on Proxmox (LVM) and VM on Proxmox (ZFS).&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Read and Write Operations per Second&lt;/strong&gt;:&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;VM on FreeBSD (ZFS, NVMe)&lt;/strong&gt; shows exceptional performance with 11183.44 reads/s and 7455.62 writes/s.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;VM on FreeBSD (zvol)&lt;/strong&gt; also performs excellently with 11834.53 reads/s and 7889.69 writes/s.&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;fsync Operations per Second&lt;/strong&gt;:&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;VM on FreeBSD (ZFS, NVMe)&lt;/strong&gt; achieves 23858.08 fsyncs/s, and &lt;strong&gt;VM on FreeBSD (zvol)&lt;/strong&gt; achieves 25247.36 fsyncs/s, both significantly higher than any other configuration.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Throughput&lt;/strong&gt;:&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;VM on FreeBSD (ZFS, NVMe)&lt;/strong&gt; achieves the highest throughput with 174.74 MiB/s read and 116.49 MiB/s write.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;VM on FreeBSD (zvol)&lt;/strong&gt; also has high throughput at 184.91 MiB/s read and 123.28 MiB/s write.&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Latency&lt;/strong&gt;:&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;VM on FreeBSD (ZFS, NVMe)&lt;/strong&gt; shows very low average latency at 0.02 ms and 95th percentile latency at 0.06 ms.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;VM on FreeBSD (zvol)&lt;/strong&gt; has similarly low latencies, indicating fast response times for I/O operations.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h5&gt;VM Configurations Comparison&lt;/h5&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;File Creation Speed&lt;/strong&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Among VMs, &lt;strong&gt;VM on FreeBSD (ZFS, NVMe)&lt;/strong&gt; leads, followed by &lt;strong&gt;VM on FreeBSD (zvol)&lt;/strong&gt;, and then &lt;strong&gt;VM on FreeBSD (ZFS, Virtio)&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Read and Write Operations per Second&lt;/strong&gt;:&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;VM on FreeBSD (ZFS, NVMe)&lt;/strong&gt; and &lt;strong&gt;VM on FreeBSD (zvol)&lt;/strong&gt; both outperform &lt;strong&gt;VM on Proxmox (ZFS)&lt;/strong&gt; and &lt;strong&gt;VM on Proxmox (LVM)&lt;/strong&gt; configurations significantly.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;VM on Proxmox (ZFS)&lt;/strong&gt; outperforms &lt;strong&gt;VM on Proxmox (LVM)&lt;/strong&gt; in read and write operations.&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;fsync Operations per Second&lt;/strong&gt;:&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;VM on FreeBSD (ZFS, NVMe)&lt;/strong&gt; and &lt;strong&gt;VM on FreeBSD (zvol)&lt;/strong&gt; have significantly higher fsync operations compared to &lt;strong&gt;VM on Proxmox (ZFS)&lt;/strong&gt; and &lt;strong&gt;VM on Proxmox (LVM)&lt;/strong&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Throughput&lt;/strong&gt;:&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;VM on FreeBSD (ZFS, NVMe)&lt;/strong&gt; and &lt;strong&gt;VM on FreeBSD (zvol)&lt;/strong&gt; have the highest throughput, followed by &lt;strong&gt;VM on Proxmox (ZFS)&lt;/strong&gt; and then &lt;strong&gt;VM on Proxmox (LVM)&lt;/strong&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Latency&lt;/strong&gt;:&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;VM on FreeBSD (ZFS, NVMe)&lt;/strong&gt; and &lt;strong&gt;VM on FreeBSD (zvol)&lt;/strong&gt; show the lowest latencies among the VMs, indicating faster response times.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;VM on Proxmox (ZFS)&lt;/strong&gt; shows lower latencies compared to &lt;strong&gt;VM on Proxmox (LVM)&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Cache Settings and Performance Influence&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Cache settings can significantly influence the performance of virtualization systems. In my setup, I did not modify the cache settings for the NVMe and virtio drivers, keeping the default settings. It is possible that the observed performance differences are also due to how different operating systems manage the caches of NVMe devices. I encourage other system administrators to explore the cache settings of their systems to see if changes in this area can influence benchmark results.&lt;/p&gt;
&lt;h3&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;Regarding RAM and CPU, the performance of the VMs is comparable. There are slight differences in favor of Proxmox for CPU and FreeBSD for RAM, but in my opinion, these differences are so negligible that they wouldn't sway the decision towards one solution or the other.&lt;/p&gt;
&lt;p&gt;The I/O performance data clearly indicates that VM on FreeBSD with NVMe and ZFS outperforms all other configurations by a significant margin. This is evident in the file creation speed, read/write operations per second, fsync operations per second, throughput, and latency metrics. &lt;/p&gt;
&lt;p&gt;When comparing physical hosts, Host FreeBSD (ZFS) demonstrates excellent performance, particularly in comparison to Host Proxmox (ZFS) and Host Proxmox (ext4). &lt;/p&gt;
&lt;p&gt;When comparing VMs, VM on FreeBSD (ZFS, NVMe) and VM on FreeBSD (zvol) configurations stand out as the top performers. &lt;/p&gt;
&lt;p&gt;The VM using virtio on FreeBSD also shows strong performance, albeit not as high as the NVMe configuration. It significantly outperforms Proxmox configurations in terms of file creation speed, read/write operations per second, and throughput, while maintaining competitive latencies.&lt;/p&gt;
&lt;p&gt;The virtio driver provides a stable and reliable option, making it a suitable choice for environments where the NVMe driver cannot be used. This makes FreeBSD with virtio a balanced option for virtualization, offering both high performance and reliability.&lt;/p&gt;
&lt;p&gt;By examining these performance metrics, users can make informed decisions about their virtualization and storage configurations to optimize their systems for specific workloads and performance requirements.&lt;/p&gt;
&lt;p&gt;In light of these tests and experiments, I can therefore affirm that my sensations (and those of many users) of greater "snappiness" of the VMs on FreeBSD can be confirmed. Certainly, Proxmox is a stable solution, rich in features, battle-tested, and has many other valid points, but FreeBSD, especially with the nvme driver, demonstrates very high performance and a very low overhead in installation and operation.&lt;/p&gt;
&lt;p&gt;I will continue to use both solutions with great satisfaction, but I will be even more encouraged to implement virtualization servers based on FreeBSD and bhyve.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Stefano Marinelli</dc:creator><pubDate>Mon, 10 Jun 2024 05:53:45 +0000</pubDate><guid isPermaLink="true">https://it-notes.dragas.net/2024/06/10/proxmox-vs-freebsd-which-virtualization-host-performs-better/</guid><category>freebsd</category><category>linux</category><category>proxmox</category><category>kvm</category><category>bhyve</category><category>hosting</category><category>filesystems</category><category>virtualization</category><category>zfs</category><category>debian</category><category>server</category></item><item><title>Boosting Network Performance in FreeBSD's VNET Jails</title><link>https://it-notes.dragas.net/2023/08/14/boosting-network-performance-in-freebsds-vnet-jails/</link><description>&lt;p&gt;&lt;img src="https://images.unsplash.com/photo-1604869515882-4d10fa4b0492?crop=entropy&amp;cs=tinysrgb&amp;fit=max&amp;fm=jpg&amp;ixid=M3wxMTc3M3wwfDF8c2VhcmNofDIwfHxuZXR3b3JrfGVufDB8fHx8MTY5MjAzNTI4N3ww&amp;ixlib=rb-4.0.3&amp;q=80&amp;w=2000" alt="Boosting Network Performance in FreeBSD&amp;#x27;s VNET Jails"&gt;&lt;/p&gt;&lt;p&gt;In the world of FreeBSD, jails are a renowned feature that allows for system-level virtualization. As I was setting up the jails for BSDCafe, I stumbled upon an interesting discovery: the network performance of VNET jails was noticeably lower compared to that of VPS or standard jails. Rather than diving into this immediately, I decided to take a mental note and proceed.&lt;/p&gt;
&lt;p&gt;As I delved deeper with various tests, a pattern began to emerge. Anytime there was a NAT (Network Address Translation) acting between the internal bridge of the VNET jails - irrespective of whether it was local or bridged via a VPN - the outgoing performance took a nosedive.&lt;/p&gt;
&lt;p&gt;From using &lt;code&gt;tcpdump&lt;/code&gt; to carrying out MTU (Maximum Transmission Unit) tests, my endeavors seemed fruitless. However, a memory from the past struck me. I recalled setting up a FreeBSD VM on Proxmox (effectively pointing towards an issue with KVM) where I had to make specific tweaks.&lt;/p&gt;
&lt;p&gt;To remedy the situation, I made the following modifications:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Added the following to &lt;code&gt;/boot/loader.conf&lt;/code&gt;:&lt;/li&gt;
&lt;/ol&gt;
&lt;pre class="highlight"&gt;&lt;code&gt;hw.vtnet.X.csum_disable=1
hw.vtnet.lro_disable=1
&lt;/code&gt;&lt;/pre&gt;

&lt;ol&gt;
&lt;li&gt;Integrated these lines into &lt;code&gt;/etc/sysctl.conf&lt;/code&gt;:&lt;/li&gt;
&lt;/ol&gt;
&lt;pre class="highlight"&gt;&lt;code&gt;net.link.bridge.pfil_member=0
net.link.bridge.pfil_bridge=0
net.link.bridge.pfil_onlyip=0
&lt;/code&gt;&lt;/pre&gt;

&lt;ol&gt;
&lt;li&gt;And appended to &lt;code&gt;/etc/rc.local&lt;/code&gt; (which I already use for initialization):&lt;/li&gt;
&lt;/ol&gt;
&lt;pre class="highlight"&gt;&lt;code&gt;ifconfig vtnet0 -rxcsum
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The end result was exhilarating: not only did the VNET jails now perform at full bandwidth, but even those interconnected via VPN showcased commendable performance.&lt;/p&gt;
&lt;p&gt;Interestingly, this seems to be linked to a long-standing bug from 2012, &lt;a href="https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=165059"&gt;FreeBSD Bug 165059&lt;/a&gt;. This issue is even highlighted in the official PFSense documentation.&lt;/p&gt;
&lt;p&gt;In the vast landscape of tech, sometimes revisiting the past provides solutions for the present. All's well that ends well, and I'm pleased to share this resolution with my readers. For those dabbling in FreeBSD, I hope this piece offers some guidance in optimizing your VNET jail setups.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Stefano Marinelli</dc:creator><pubDate>Mon, 14 Aug 2023 15:50:14 +0000</pubDate><guid isPermaLink="true">https://it-notes.dragas.net/2023/08/14/boosting-network-performance-in-freebsds-vnet-jails/</guid><category>freebsd</category><category>jail</category><category>kvm</category><category>linux</category><category>networking</category><category>proxmox</category><category>hosting</category><category>vpn</category><category>virtualization</category><category>server</category><category>container</category></item><item><title>Creating a Mikrotik CHR - RouterOS 7 - bhyve VM in FreeBSD</title><link>https://it-notes.dragas.net/2023/03/21/creating-a-mikrotik-chr-routeros-7-bhyve-vm-in-freebsd-2/</link><description>&lt;p&gt;&lt;img src="https://it-notes.dragas.net/content/images/2023/03/mikrotik-1.jpeg" alt="Creating a Mikrotik CHR - RouterOS 7 - bhyve VM in FreeBSD"&gt;&lt;/p&gt;&lt;p&gt;While I love &lt;a href="https://it-notes.dragas.net/2022/01/24/why-were-migrating-many-of-our-servers-from-linux-to-freebsd/"&gt;FreeBSD&lt;/a&gt;-based router solutions (OPNsense, PFsense, etc.), I also appreciate and use &lt;a href="https://mikrotik.com"&gt;MikroTik&lt;/a&gt; devices and software. They produce and sell reasonably-priced, efficient hardware, and have implemented some interesting proprietary solutions (EoIP, etc.). Additionally, they're a European company. From the smallest Wi-Fi router to the largest enterprise routing platform, they employ the same software with (almost) the same features.&lt;/p&gt;
&lt;p&gt;That's why I'm also implementing virtualized MikroTik CHR solutions - they're lightweight, efficient, and can handle a significant amount of traffic with minimal resource overhead.&lt;/p&gt;
&lt;p&gt;Our FreeBSD hypervisors run &lt;a href="https://it-notes.dragas.net/2023/03/14/how-we-are-migrating-many-of-our-servers-from-linux-to-freebsd-part-3/"&gt;vm-bhyve&lt;/a&gt; as a lightweight, efficient, and intelligent management tool for VMs.&lt;/p&gt;
&lt;p&gt;Even though MikroTik states that bhyve is not supported (as they believe it's merely a paravirtualization software), CHR based on RouterOS 6 works flawlessly, &lt;a href="https://github.com/churchers/vm-bhyve/wiki/Supported-Guest-Examples"&gt;following the hints provided by the vm-bhyve documentation&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Unfortunately, things change when dealing with RouterOS 7. It doesn't boot at all, and if you upgrade from RoS 6 to RoS 7, it ceases to function entirely.&lt;/p&gt;
&lt;p&gt;It seems that the MikroTik CHR image based on RouterOS 7 has an unusual partition table, somewhere between MBR and GPT. For this reason, Proxmox (KVM) doesn't experience any issues, while bhyve seems unable to properly boot the VM. I conducted several tests, but the best solution was suggested by user &lt;a href="https://forum.mikrotik.com/viewtopic.php?t=184254"&gt;kriszos on the MikroTik forum&lt;/a&gt; (even if kriszos was dealing with Hyper-V).&lt;/p&gt;
&lt;p&gt;The script should be used on a machine with the following tools installed: gdisk, wget, unzip, qemu-img, qemu-nbd, and rsync:&lt;/p&gt;
&lt;pre class="highlight"&gt;&lt;code class="language-bash"&gt;#!/bin/bash
wget --no-check-certificate https://download.mikrotik.com/routeros/7.8/chr-7.8.img.zip -O /tmp/chr.img.zip
unzip -p /tmp/chr.img.zip &amp;gt; /tmp/chr.img
rm -rf  chr.qcow2
qemu-img convert -f raw -O qcow2 /tmp/chr.img chr.qcow2
rm -rf /tmp/chr.im*
modprobe nbd
qemu-nbd -c /dev/nbd0 chr.qcow2
rm -rf /tmp/tmp*
mkdir /tmp/tmpmount/
mkdir /tmp/tmpefipart/
mount /dev/nbd0p1 /tmp/tmpmount/
rsync -a /tmp/tmpmount/ /tmp/tmpefipart/
umount /dev/nbd0p1
mkfs -t fat /dev/nbd0p1
mount /dev/nbd0p1 /tmp/tmpmount/
rsync -a /tmp/tmpefipart/ /tmp/tmpmount/
umount /dev/nbd0p1
rm -rf /tmp/tmp*
(
echo 2 # use GPT
echo t # change partition code
echo 1 # select first partition
echo 8300 # change code to Linux filesystem 8300
echo r # Recovery/transformation
echo h # Hybrid MBR
echo 1 2 # partitions added to the hybrid MBR
echo n # Place EFI GPT (0xEE) partition first in MBR (good for GRUB)? (Y/N)
echo   # Enter an MBR hex code (default 83)
echo y # Set the bootable flag? (Y/N)
echo   # Enter an MBR hex code (default 83)
echo n # Set the bootable flag? (Y/N)
echo n # Unused partition space(s) found. Use one to protect more partitions? (Y/N)
echo w # write changes to disk
echo y # confirm
) | gdisk /dev/nbd0
qemu-nbd -d /dev/nbd0
echo &amp;quot;script finished, created file chr.qcow2&amp;quot;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;I used the script on a machine with Proxmox installed, and it worked correctly. Once the relevant image was obtained, it was converted to raw format to be fed to bhyve:&lt;/p&gt;
&lt;pre class="highlight"&gt;&lt;code class="language-bash"&gt;qemu-img convert -f qcow2 -O raw chr.qcow2 chr.img
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Now that we have the correct image available, here's an example of a VM configuration managed by vm-bhyve:&lt;/p&gt;
&lt;pre class="highlight"&gt;&lt;code&gt;loader=&amp;quot;uefi&amp;quot;
graphics=&amp;quot;no&amp;quot;
cpu=&amp;quot;2&amp;quot;
memory=“128M&amp;quot;
network0_type=&amp;quot;virtio-net&amp;quot;
network0_switch=&amp;quot;public&amp;quot;
disk0_type=&amp;quot;virtio-blk&amp;quot;
disk0_name=“chr.img”
uuid=“cafecafe-cafe-cafe-cafe-cafecafecafe”
network0_mac=“ca:fe:ca:fe:ca:fe”
&lt;/code&gt;&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Stefano Marinelli</dc:creator><pubDate>Tue, 21 Mar 2023 12:27:34 +0000</pubDate><guid isPermaLink="true">https://it-notes.dragas.net/2023/03/21/creating-a-mikrotik-chr-routeros-7-bhyve-vm-in-freebsd-2/</guid><category>freebsd</category><category>proxmox</category><category>virtualization</category><category>hosting</category><category>linux</category><category>server</category><category>tutorial</category><category>kvm</category><category>mikrotik</category><category>bhyve</category></item></channel></rss>