Question about Windows '--vm-process-priority' option

Discussions related to using VirtualBox on Windows hosts.
Post Reply
MKANET
Posts: 14
Joined: 8. Jul 2020, 03:17

Question about Windows '--vm-process-priority' option

Post by MKANET »

Per the documentation below, there's an option called, --vm-process-priority for Windows hosts; with the following respective settings: default|flat|low|normal|high
https://www.virtualbox.org/manual/ch08.html

Usage syntax example:
VBoxManage modifyvm "VMNAME" --vm-process-priority high

I am able to successfully change this setting for my VM. I confirmed this via:
VBoxManage showvminfo VMNAME --details
---
Autostart Enabled: disabled
Autostart Delay: 0
Default Frontend:
VM process priority: high
Storage Controller Name (0): SATA
Storage Controller Type (0): IntelAhci
Storage Controller Instance Number (0): 0
Storage Controller Max Port Count (0): 30
Storage Controller Port Count (0): 2
Storage Controller Bootable (0): on
SATA (0, 0): C:\Users\Michael\VirtualBox VMs\HASSIO\HASSOS.vdi (UUID: 1aaa4e3b-62f5-4619-8727-aa10c833b32d)

---

My VM starts up in "headless mode" normally without any errors. However, the actual Windows process base priority on the Host for VboxHeadless.exe (and it's respective child processes) shows as "Normal" in Windows 10 Task Manager. VBoxSDS,exe and VboxSVC.exe are also running with normal priority.

Maybe misunderstood what this option does?

Thank you in advance.
fth0
Volunteer
Posts: 5690
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: Question about Windows '--vm-process-priority' option

Post by fth0 »

MKANET wrote:Maybe misunderstood what this option does?
Yes, but it's not your fault. ;)

First of all, the reality is a bit more complex. The process named VBoxHeadless (or VirtualBoxVM) consists of several threads (e.g. 42), and each of those threads has its own priorities. To see this for yourself on a Windows host, you'll need a better alternative to the Windows Task Manager, for example Sysinternals Process Explorer. In Process Explorer, you'll see three nested processes named VBoxHeadless (or VirtualBoxVM). Right click on the innermost process, choose Properties, and then the Threads tab, where you can explore the priorities of the threads.

If you then use the VBoxManage controlvm "VM name" vm-process-priority command while the VM is running, you can observe subtle changes in the base priority. These priority changes are smaller than the typical process priority changes that you can also view in the right click menu that I mentioned earlier.

Note that you cannot change the priority of the innermost process due to the VirtualBox hardening. In consequence, the VBoxManage commands (modifyvm, controlvm) are probably the only way to influence the priorities.
MKANET
Posts: 14
Joined: 8. Jul 2020, 03:17

Re: Question about Windows '--vm-process-priority' option

Post by MKANET »

Thanks for the quick reply. I would like to take a step back and explain my original goal.

My VM pulls information from a remote API at regular 10-second intervals (several concurrent threads). If there is heavy enough disk activity on a disk on my Host OS (like a very large zip/rar file is extracted). This app causes my VM's API polling to timeout. (NOTE: The VM is NOT on the same disk as the VM).

I wanted to increase the priority of my VM (over that highly active process on the host OS) so that time-sensitive network polling doesn't timeout in the VM.

Would --VM-process-priority be the most effective way to prevent these timeouts; or maybe you could suggest another approach?

EDIT: This may sound like a dumb question, but what's the default setting for --VM-process-priority for Windows VMs? I stupidly changed mine to "high" before checking that the default setting was. Would the default setting be "default", "flat", or "normal"? My guess is it would be "default"; but, I'd like to know for sure.
fth0
Volunteer
Posts: 5690
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: Question about Windows '--vm-process-priority' option

Post by fth0 »

MKANET wrote:I would like to take a step back and explain my original goal.
That's a good strategy, especially to avoid XY problems. ;)
MKANET wrote:My VM pulls information from a remote API at regular 10-second intervals (several concurrent threads). If there is heavy enough disk activity on a disk on my Host OS (like a very large zip/rar file is extracted). This app causes my VM's API polling to timeout. (NOTE: The VM is NOT on the same disk as the VM).
Maybe it's too late for me tonight, but I don't really understand what you've tried to describe. Can you please try again?
MKANET wrote:My guess is it would be "default"; but, I'd like to know for sure.
This is as obvious as it is correct indeed. Compare the .vbox and .vbox-prev files to convince yourself. ;)
MKANET
Posts: 14
Joined: 8. Jul 2020, 03:17

Re: Question about Windows '--vm-process-priority' option

Post by MKANET »

Maybe it's too late for me tonight, but I don't really understand what you've tried to describe. Can you please try again?
Sure. Thank you.

My Windows Host has two physical disks:

1. 2TB Mechanical disk. I use this disk to extract very large >5GB ZIP/RAR files.
2. 256GB SSD. I used this disk for the Host OS, VirtualBox app, and also VM.

My VM has several time-critical tasks that poll a webserver's API every 10 seconds. I have several of these time-critical tasks running concurrently. These tasks will time-out if no information is returned within 12 seconds.

Issue:
If there is very heavy disk activity on my mechanical disk, my VM's time-critical tasks will time-out. This especially happens when there is no cache available to assist with writing/reading to HDD (I can hear the HDD it is VERY active). However, the Guest OS and Host OS do NOT lock/freeze at all.

Things I've tried to avoid this issue:
1. Enable "Host IO cache" on VM
2. Set '--vm-process-priority' to "high"
3. Reduced Windows process priority for app extracting RAR/ZIP files to "below normal".
3. Enable/disable write disk caching option for mechanical HDD in Windows device driver
4. Increased CPU cores dedicated for VM from 1 to 4 (there are a total of 8 cores on the host). I have not tried increasing the cores beyond 4.

PS: Are there any conditions where "--vm-process-priority" = high is useful? It doesn't appear anyone has ever tried this setting before (at least I couldn't find anything when searching on Google.com). Maybe, this is used to increase/decrease the VM priority over other VMs in Virtualbox?
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows, Linux

Re: Question about Windows '--vm-process-priority' option

Post by scottgus1 »

MKANET wrote:2TB Mechanical disk. I use this disk to extract very large >5GB ZIP/RAR files.
Do you download these files? If so, do the timeouts happen while the files are downloading, or while they are being extracted?

I have almost never tried to set priority on any process either in Task Manager, Process Explorer or though the questioned vboxmanage command. But doing so would probably help if the bottleneck was in the CPU. If the CPU has extra processing capability available, setting priority probably won't help. It would be important to pinpoint the bottleneck before finding the solution.

Accessing a website's API implies internet and therefore network access, as well as CPU.

Extracting Zips implies not only disk and CPU access but possibly internet and network access as well.
MKANET wrote:256GB SSD. I used this disk for the Host OS, VirtualBox app, and also VM.
This implies that all the files for the VM, including the VM's disk file, are on the SSD. Is this true? If so, heavy disk usage would seem to not be the problem interfering with accessing a website's API.

Though I am theorizing without data, I lean towards suspecting the network getting swamped, but more data will tell.

When the API access is timing out, determine total and individual CPU core usage, disk usage, and network usage. Host Task Manager's Performance graphs should show a quick overview. Report back what you see.

Also, please start the guest from full power off, not save-state. Run until you see the API timeout happen, then shut down the guest from within the guest OS if possible. If not possible, close the Virtualbox window for the guest with the Power Off option set. Then right-click the guest in the main Virtualbox window's guest list, choose Show Log. Save the far left tab's log, zip the log file, and post the zip file, using the forum's Upload Attachment tab.
MKANET
Posts: 14
Joined: 8. Jul 2020, 03:17

Re: Question about Windows '--vm-process-priority' option

Post by MKANET »

Thank you. I originally noticed this issue when using my news reader app, which can download large compressed archive files and extract them automatically. It's important to note that I can trigger this issue by running a disk speed test (when it's stressing the HDD)... For example, https://crystalmark.info/en/software/crystaldiskmark/. CPU and Network utilization can be relatively low when this issue happens.

Per your request, I will trigger the time-out errors, shutdown the Guest OS.. then submit the log (zipped) today.
fth0
Volunteer
Posts: 5690
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: Question about Windows '--vm-process-priority' option

Post by fth0 »

Thank your for your detailed explanation, I've got a better picture now. Like scottgus1, I'd suggest to take measurements first and think about solutions later. Some random thoughts:

12 seconds is a very long time for a computer capable of preemptive multitasking. There probably exists a locking situation somewhere.

Regarding the network traffic, it's often useful to compare the good case and the bad case, and more often than not, the good case already shows unexpected problems. I'd suggest to make Wireshark traces on the host's network interface to analyze the network timing.

Providing 2 vCPUs to a VirtualBox VM is usually best, so I'd suggest to start with 2 vCPUs while experimenting. The VBox.log file will tell us if your CPU really has 8 cores or rather 4 cores + hyperthreading; we are doubting Thomas regarding CPU core statements. ;)
MKANET wrote:Are there any conditions where "--vm-process-priority" = high is useful?
Probably yes, but I don't really know what those conditions are. Assessing relationships between 42ish threads having different priorities is a bit over my head. ;) Implementing such a thread priority system is easy, but mastering it is quite complex.
MKANET
Posts: 14
Joined: 8. Jul 2020, 03:17

Re: Question about Windows '--vm-process-priority' option

Post by MKANET »

I was able to prevent the timeout errors doing a couple of different things.
  • I increased the time-out to 20 seconds (which is a lot, I know).

    Reseated the external HDD related to these symptoms. The disk's enclosure had a RED LED (that's not supposed to be there).
I'm going to revert the time out back to 10 seconds (default) to see if the issue comes back or not. I'm crossing my fingers this issue is resolved.

I REALLY appreciate you guys going out of your way to assist me in this thread; and, sharing your expertise. At least I now have a better understanding of "--vm-process-priority"; and, hopefully this issue is behind me. Thank you.
Post Reply