Desktop renders slowly despite high resource spec

Hi all,
I’m using whonix via kvm. I encountered issues with the desktop rendering slowly (jumps when scrolling and trying to play video in fullscreen results in freezes) I tried giving the VM more CPU’s and RAM (6 VCPU cores and 6GB of RAM) but the issue is still there and CPU usage is nowhere near maxed out (only ~20%) does anyone know what might be causing this? Thanks,

btw I run stuff where anonymity is a lower priority (or not possible as I need to sign in) though my regular desktop and vpn using privacy friendly browsers, what other measures can I take to minimize data collection when anonymity is not an option?

Which OS you use KVM on?

You must remove the cpu placement = static and cpuset = 1 settings in the vcpu line for all the extra horsepower to be effective.

2 Likes

Thanks. Anything else I can do to improve rendering performance? I’ve got a decently high-spec machine so it’s easy enough to throw a few cores and a chunk of ram at it but if there’s a better way to do things I’d love to know.

Adding vCPUs

(Whonix is based on Kicksecure.)

You can enable 3D acceleration (which we disable for hardening) and remove the blkiotune tag in the settings.

1 Like

What is the rationale for blkio and how does that change performance?

It’s an attempt to protect against host resource exhaustion by a rogue guest. If the performance hit is too much, we can either bump it up or remove it completely.

1 Like

The performance on Workstation is very poor, and I’m not sure if there’s a way to improve it. It becomes a problem when trying to play a video with VLC. If I try to maximize or fullscreen pretty much any video, the screen tearing is severe, and then the entire virt-manager GUI disappears with the VM still running in the background. I have to re-open virt-manager from my host’s application menu then re-open the VM and attempt to quickly pause the video before it happens again. This is far worse than Virtualbox, where I was easily able to play videos in fullscreen without crashing. I thought KVM was supposed to have better performance, so this doesn’t make sense.

I’ve tried editing the CPU topology to match my host cpu configuration (1 socket, 4 cores, 2 threads), but the performance was the same, if not worse. I’ve tried multiple different combinations of sockets, cores and threads, and nothing helps.

This should be easily reproducible if you just download or drop in any video from YouTube to a Whonix guest via shared folder. I think my CPU should be powerful enough, otherwise why would the performance in Virtualbox be better?

I’ve checked and followed the instructions in the wiki for adding vcpus:

I’ve switched from the virtio to the QXL driver, and performance seems to have improved, but it’s still not ideal. I had to add vgamem and add an entry for xrandr to get 4K resolution[1], but when displaying at 4K the display freezes often, especially when moving a window around too fast. 1080p performs much better, but I wanted 4K. Even on Virtualbox the display would just resize to whatever the current VM’s window’s dimensions were, which I would usually just leave maximized with a 4K host resolution, and I didn’t get nearly as many freezes as I am now using KVM.

ref. 1: High screen resolution on a KVM virtual machine with QXL - stafwag Blog

I’m having the same problem as OP, didn’t know about removing this line. Maybe that should be added to the wiki as well

Edit: Nevermind, it makes no difference. Simply watching a video with VLC still causes the virt-manager GUI to crash

Try Generic Bug Reproduction.

  1. Learn more about KVM.
  2. Set this up with KVM using Debian stable.
  3. Contact upstream KVM / libvirt support in case of issues.
  4. Please let us know about any any progress.

Duplicate of Desktop renders slowly despite high resource spec?

In any case, the following methodology could be applied to make progress with this:

I’ve done some more testing on a generic Linux Mint install, and I hate to admit I think this issue may be unspecific to Whonix. I’m getting the same crashes/video playback issues there. I am just in disbelief that so many people say that qemu-kvm is better than Virtualbox, when the performance I’m experiencing on kvm is significantly worse, making me think I still might be doing something wrong…

The QXL driver is unusable, the freezes are rampant. The virtio driver is slightly better but the Virt Manager GUI will abruptly close if it gets overloaded.

Although the CPU usage reported by Virt Manager for the VM does not go very high, my host’s CPU usage reports much higher levels. Simply playing a 1080p YouTube video at full screen with guest 4K resolution raises it up to nearly 80%, and the screen tearing is significant. After a short while Virt Manager will disappear.

My CPU is not very powerful but it’s not old. virsh nodeinfo reports a frequency of 4241 MHz. I would have thought that’d be enough to simply play back video, but maybe not. Supposedly Virtualbox has a form of 3D acceleration enabled by default[1], so maybe that’s why the performance seems so much better

I attempted following the instructions in the below link for CPU pinning, adjusting the commands to match my hardware, and it didn’t do anything. Maybe I’ll continue researching this, because I really wanted to start using kvm, not just for Whonix but in general

1: virtual machine - Performance issues with KVM versus Virtualbox - Super User

1 Like

I’ve enabled 3D acceleration and the performance has improved. It’s not great but the crashes are no longer happening when playing video, and screen tearing is significantly reduced. I had to install libvirglrenderer1 and qemu-system-gui on the Debian 12 host, otherwise it wouldn’t boot.

Edit: I forgot to mention that I had to change the ‘Display Spice’ setting ‘Listen Type’ to None, then check OpenGL and choose my GPU

I’m going to try this next, but I haven’t found it in the GUI settings yet. I found documentation here, but it just gives virsh commands to change it, doesn’t say anything about completely removing it:

Yes, this should probably be merged with my other post

1 Like

I found it, it’s toward the top of the XML data in the Overview section

I haven’t noticed much of a difference removing the blkiotune tag, but now with 3D acceleration the performance matches what I’ve come to expect from Virtualbox. It may even be a bit better. I just wish it wasn’t a security risk.

1 Like

For those following along at home, I remove the CPU pinning settings and bump up their number for the VM and it plays video sufficiently without having to resort to 3D acceleration.

QXL should never be used it is obsolete.

2 Likes

Added to documentation just now:
KVM Videos