xrdp icon indicating copy to clipboard operation
xrdp copied to clipboard

Extremely high CPU utilization access Ubuntu Studio under Hyper-V VM

Open pcgeek86 opened this issue 1 year ago • 6 comments

Repro Steps

  • Run Windows 11 and install Hyper-V
  • Create Hyper-V virtual machine w/ 4x CPU cores, 8 GB RAM, with disk on high-performance NVMe SSD
  • Install Ubuntu Studio 22.04 LTS in VM
  • Install XRDP in Ubuntu Studio VM
  • RDP into VM from Windows 11 locally

Actual Result

CPU consistently sits around 70-100% utilization.

Processes consuming the most CPU cycles:

xrdp
kwin_x11
Xorg

Here's a screenshot from btop:

image

Expected Result

CPU sits mostly idle, unless intense work being done on VM.

Question

Are there any methods of improving performance in this scenario? I have a high-end system, but with all the system resources being consumed by the Linux desktop environment and xrdp, the VM feels really sluggish.

pcgeek86 avatar May 05 '23 14:05 pcgeek86

What happens to the CPU if you:-

  1. Disconnect from the xrdp session, but leave it running?
  2. kill kwin_x11 (allowing for the desktop becoming unusable)?

matt335672 avatar May 05 '23 15:05 matt335672

@pcgeek86 - do you need any more input into this?

matt335672 avatar May 16 '23 09:05 matt335672

Yeah I do, thanks.

What are you hoping to find out by disconnecting from xrdp? Do you want me to SSH into the VM and use something like btop to inspect CPU utilization, in this scenario?

What are you hoping to accomplish by killing the kwin_x11 process?

pcgeek86 avatar May 24 '23 13:05 pcgeek86

It's fairly likely the high CPU is being driven by the kwin_x11 compositor:-

  1. The disconnect should remove the xrdp process from the system so we can see what else is happening. Yes - use ssh/btop (or whatever) to look at the CPU performance.
  2. Removes the compositor itself.

matt335672 avatar May 24 '23 13:05 matt335672

I've since set up a new environment. Brand new Windows 11 system. Brand new Ubuntu Studio 22.04 LTS Hyper-V virtual machine. Same exact hardware as original post. Display scaling set to 200%.

I installed xrdp with apt-get install xrdp --yes. I also tweaked the port= setting to a value of vsock://-1:3389 tcp://:3389. I have no idea what that actually does, but I read it somewhere. My CPU utilization doesn't seem to be as high as in my OP.

image

On the Hyper-V host, I also ran this PowerShell command:

get-vm -Name ub* | set-vm -EnhancedSessionTransportType HvSocket 

I don't know if that did anything.

pcgeek86 avatar Jun 03 '23 03:06 pcgeek86

The vsock setting allows VMs on the same Hyper-V host to communicate directly rather than going via the TCP stack on the host. If your Windows 11 system is a separate machine, this will have no effect.

There's also some info in #2698 that may be of interest to you, namely:-

  1. Don't use less than 24-bit colour.
  2. Enable the LAN connection type in mstsc.exe if you haven't already.

matt335672 avatar Jun 05 '23 09:06 matt335672