neutrinolabs / xrdp

xrdp: an open source RDP server
http://www.xrdp.org/
Apache License 2.0
5.47k stars 1.73k forks source link

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

Open pcgeek86 opened 1 year ago

pcgeek86 commented 1 year ago

Repro Steps

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.

matt335672 commented 1 year ago

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 commented 1 year ago

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

pcgeek86 commented 1 year ago

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?

matt335672 commented 1 year ago

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.
pcgeek86 commented 1 year ago

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.

matt335672 commented 1 year ago

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.