High base load on FreeBSD in a virtual machine

What to do if your FreeBSD machine experiences a high base load

I’ve recently upgraded my virtual server to FreeBSD and stumbled across an issue with high base load. Even with basically no services running and web and database shut down, the base load of the system was around 0,50. Here’s a workaround to the issue.

First, I assumed it’s a ghost load from the virtualization host. To verify that, I booted in both the Linux as well as the FreeBSD rescue system. It turned out that the Linux load was nearly 0,00 when idling, whereas FreeBSD had the same high load I experienced before, so I could rule out both ghost load from the VM host as well as a misconfiguration on my end.

Next, a search on the internet pointed to several bug reports with some workarounds. What worked for me is tuning the kern.eventtimer.timer setting. First, find out the available choices with

sysctl kern.eventtimer.choice

The output will be something like kern.eventtimer.choice: LAPIC(600) i8254(100) RTC(0), listing three different options with the reliability of the choice in brackets – LAPIC, i8254 and RTC. Then, show the currently used choice with

sysctl kern.eventtimer.timer

resulting in an output like kern.eventtimer.choice: LAPIC. As a workaround to the base load problem, try each of the available choices in the respective order, wait a few minutes on an otherwise idle system and see how the load develops. For me, the RTC event timer worked, which I chose with:

sysctl -w kern.eventtimer.timer=RTC

To make the above change persistent between reboots, you need to add it to /etc/sysctl.conf with:

echo "kern.eventtimer.timer=RTC" >> /etc/sysctl.conf

IMPORTANT NOTE: I did not dig deeper into this issue and I do not know if there are any unwanted side-effects, so use the setting with care! This is a quick workaround – you should know what you’re doing. I still think something is not properly set, as the load spikes are quite major during normal operations, but I will investigate further.

Florian Effenberger

Autor: Florian Effenberger

Florian engagiert sich seit über 16 Jahren für freie Software und ist einer der Gründer der The Document Foundation, der Stiftung hinter LibreOffice

Schreibe einen Kommentar